[med-svn] [SCM] aghermann branch, master, updated. 4f7a3b774136ffffbaf9b05d90bd568347bc5461

andrei zavada johnhommer at gmail.com
Fri Nov 16 00:50:38 UTC 2012


The following commit has been merged in the master branch:
commit c309c0c3171a39bf93acd1840cc606b6115ccfac
Author: andrei zavada <johnhommer at gmail.com>
Date:   Sun Oct 28 03:05:45 2012 +0300

    preserve group expander state across populate_1 events

diff --git a/src/ui/mw/mw-measurements_cb.cc b/src/ui/mw/mw-measurements_cb.cc
index a9bf970..8c08f45 100644
--- a/src/ui/mw/mw-measurements_cb.cc
+++ b/src/ui/mw/mw-measurements_cb.cc
@@ -18,6 +18,13 @@ using namespace aghui;
 
 extern "C" {
 
+void
+cGroupExpander_activate_cb( GtkExpander *w, gpointer userdata)
+{
+	auto& G = *(SExpDesignUI::SGroupPresentation*)userdata;
+	G._p.group_unvisibility[G.name()] = gtk_expander_get_expanded(w);
+}
+
 // individual channel callbacks
 
 gboolean
diff --git a/src/ui/mw/mw-populate.cc b/src/ui/mw/mw-populate.cc
index 30951a2..eace913 100644
--- a/src/ui/mw/mw-populate.cc
+++ b/src/ui/mw/mw-populate.cc
@@ -351,8 +351,6 @@ populate_1()
 	if ( ED->groups.empty() )
 		return;
 
-	gtk_flush();
-
       // touch toolbar controls
 	suppress_redraw = true;
 	gtk_spin_button_set_value( eMsmtOpFreqFrom, operating_range_from);
@@ -410,7 +408,7 @@ populate_1()
 	      // convert avg episode times
 		g_string_assign( __ss__, "");
 		for ( auto &E : AghEE ) {
-			pair<float, float>& avge = G.group().avg_episode_times[*_AghDi][E];
+			pair<float, float>& avge = G.cjgroup().avg_episode_times[*_AghDi][E];
 			unsigned seconds, h0, m0, s0, h9, m9, s9;
 			seconds = avge.first * 24 * 60 * 60;
 			h0 = seconds / 60 / 60;
@@ -432,24 +430,28 @@ populate_1()
 		snprintf_buf( "<b>%s</b> (%zu) %s", g_escaped, G.size(), __ss__->str);
 		g_free( g_escaped);
 
-		G.expander = (GtkExpander*)gtk_expander_new( __buf__);
-		gtk_expander_set_use_markup( G.expander, TRUE);
-		g_object_set( (GObject*)G.expander,
+		GtkExpander *expander = (GtkExpander*)gtk_expander_new( __buf__);
+		gtk_expander_set_use_markup( expander, TRUE);
+		g_object_set( (GObject*)expander,
 			      "visible", TRUE,
-			      "expanded", TRUE,
+			      "expanded", not group_unvisibility[G.name()],
 			      "height-request", -1,
 			      NULL);
+		g_signal_connect( expander, "activate",
+				  (GCallback)cGroupExpander_activate_cb,
+				  &G);
 		gtk_box_pack_start( (GtkBox*)cMeasurements,
-				    (GtkWidget*)G.expander, FALSE, TRUE, 3);
-		gtk_container_add( (GtkContainer*)G.expander,
-				   (GtkWidget*) (G.vbox = (GtkExpander*)gtk_box_new( GTK_ORIENTATION_VERTICAL, 1)));
-		g_object_set( (GObject*)G.vbox,
+				    (GtkWidget*)expander, FALSE, TRUE, 3);
+		GtkWidget *vbox;
+		gtk_container_add( (GtkContainer*)expander,
+				   vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 1));
+		g_object_set( (GObject*)vbox,
 			      "height-request", -1,
 			      NULL);
 
 		for ( auto &J : G ) {
 			J.da = gtk_drawing_area_new();
-			gtk_box_pack_start( (GtkBox*)G.vbox,
+			gtk_box_pack_start( (GtkBox*)vbox,
 					    J.da, TRUE, TRUE, 2);
 
 			// determine tl_left_margin
diff --git a/src/ui/mw/mw.hh b/src/ui/mw/mw.hh
index fc9918f..e49081f 100644
--- a/src/ui/mw/mw.hh
+++ b/src/ui/mw/mw.hh
@@ -111,32 +111,30 @@ class SExpDesignUI
 
 		const char* name() const
 			{
-				return cjgroup->first.c_str();
+				return gi->first.c_str();
 			}
-		agh::CJGroup& group()
+		agh::CJGroup& cjgroup()
 			{
-				return cjgroup->second;
+				return gi->second;
 			}
-		SGroupPresentation (agh::CExpDesign::TJGroups::iterator& _g,
+		SGroupPresentation (agh::CExpDesign::TJGroups::iterator& gi_,
 				    SExpDesignUI& parent)
 		      : _p (parent),
-			visible (true),
-			cjgroup (_g)
+			gi (gi_)
 			{}
 
 		SExpDesignUI&
 			_p;
 
-		bool	visible;
-		GtkExpander
-			*expander,
-			*vbox;
-
 	    private:
-		agh::CExpDesign::TJGroups::iterator cjgroup;
+		agh::CExpDesign::TJGroups::iterator gi;
 	};
 	list<SGroupPresentation>
 		groups;
+	// because groups are flushed clean routinely,
+	// here's this:
+	map<string, bool>
+		group_unvisibility;
 	SSubjectPresentation
 		*using_subject;
 	SSubjectPresentation*
diff --git a/src/ui/mw/mw_cb.hh b/src/ui/mw/mw_cb.hh
index 0ea9398..6f63bf7 100644
--- a/src/ui/mw/mw_cb.hh
+++ b/src/ui/mw/mw_cb.hh
@@ -53,6 +53,7 @@ void eMsmtMCF0_value_changed_cb( GtkSpinButton*, gpointer);
 
 void tvGlobalAnnotations_row_activated_cb( GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*, gpointer);
 
+void cGroupExpander_activate_cb( GtkExpander*, gpointer);
 void iiSubjectTimeline_show_cb( GtkWidget*, gpointer);
 void iSubjectTimelineScore_activate_cb( GtkMenuItem*, gpointer);
 void iSubjectTimelineDetectUltradianCycle_activate_cb( GtkMenuItem*, gpointer);

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list