[med-svn] [SCM] aghermann branch, master, updated. 4f7a3b774136ffffbaf9b05d90bd568347bc5461
Andrei Zavada
johnhommer at gmail.com
Fri Nov 16 00:50:02 UTC 2012
The following commit has been merged in the master branch:
commit 94eb904bdda1386e847ca29c6a5e6f0a5bd390e3
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Thu Oct 4 02:35:13 2012 +0300
use g_signal_emit to nicely close SF
diff --git a/data/main.glade b/data/main.glade
index 11700a7..01dadaf 100644
--- a/data/main.glade
+++ b/data/main.glade
@@ -1203,7 +1203,17 @@ rm */*/*/.*.{psd,mc}</property>
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkButton" id="bMainCloseThatSF">
+ <property name="label" translatable="yes">button</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
</child>
<child>
<placeholder/>
@@ -6636,6 +6646,12 @@ EEG microcontinuity algorithm. Read more <a href="http://johnhommer.com/acade
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
<child>
diff --git a/src/ui/expdesign-construct.cc b/src/ui/expdesign-construct.cc
index fe6a036..07adbc8 100644
--- a/src/ui/expdesign-construct.cc
+++ b/src/ui/expdesign-construct.cc
@@ -329,6 +329,13 @@ construct_widgets()
(GCallback)iSubjectTimelineResetMontage_activate_cb,
this);
+ // ------------ actions
+ if ( !(AGH_GBGETOBJ (GtkButton, bMainCloseThatSF)) )
+ return -1;
+
+ g_signal_connect( bMainCloseThatSF, "clicked",
+ (GCallback)bMainCloseThatSF_clicked_cb,
+ this);
// ================ 2. Simulations
// ------------- tvSimulations & controls
diff --git a/src/ui/expdesign.cc b/src/ui/expdesign.cc
index c7730d5..d8988c8 100644
--- a/src/ui/expdesign.cc
+++ b/src/ui/expdesign.cc
@@ -124,6 +124,7 @@ SExpDesignUI (aghui::SSessionChooser *parent,
display_profile_type (sigfile::TMetricType::Psd),
operating_range_from (2.),
operating_range_upto (3.),
+ close_this_SF_now (nullptr),
uc_accuracy_factor (1.),
pagesize_item (2),
binsize_item (1),
diff --git a/src/ui/expdesign.hh b/src/ui/expdesign.hh
index f6de102..2ef577d 100644
--- a/src/ui/expdesign.hh
+++ b/src/ui/expdesign.hh
@@ -208,6 +208,8 @@ class SExpDesignUI {
list<aghui::SScoringFacility*>
open_scoring_facilities;
+ aghui::SScoringFacility
+ *close_this_SF_now;
// own variables aka saved settings
sigfile::TMetricType
@@ -500,6 +502,9 @@ class SExpDesignUI {
GtkEntry
*eBrowseCommand;
+ GtkButton
+ *bMainCloseThatSF;
+
// 2. Simulations
GtkTreeView
*tvSimulations;
diff --git a/src/ui/expdesign_cb.cc b/src/ui/expdesign_cb.cc
index 1c2e868..7c40247 100644
--- a/src/ui/expdesign_cb.cc
+++ b/src/ui/expdesign_cb.cc
@@ -417,6 +417,21 @@ tvGlobalAnnotations_row_activated_cb( GtkTreeView* tree_view,
+void
+bMainCloseThatSF_clicked_cb( GtkButton*, gpointer userdata)
+{
+ auto& ED = *(SExpDesignUI*)userdata;
+
+ if ( ED.close_this_SF_now == nullptr ) {
+ fprintf( stderr, "Hey, keep your fingers off this button!\n");
+ return;
+ }
+
+ delete ED.close_this_SF_now;
+ ED.close_this_SF_now = nullptr;
+}
+
+
// -------- colours
diff --git a/src/ui/expdesign_cb.hh b/src/ui/expdesign_cb.hh
index 435d1f9..03ef61a 100644
--- a/src/ui/expdesign_cb.hh
+++ b/src/ui/expdesign_cb.hh
@@ -98,6 +98,8 @@ void eCtlParamDBAmendment2_toggled_cb( GtkToggleButton*, gpointer);
void eCtlParamAZAmendment1_toggled_cb( GtkToggleButton*, gpointer);
void eCtlParamAZAmendment2_toggled_cb( GtkToggleButton*, gpointer);
+void bMainCloseThatSF_clicked_cb( GtkButton*, gpointer);
+
} // extern "C"
diff --git a/src/ui/scoring-facility_cb.cc b/src/ui/scoring-facility_cb.cc
index 57b68fd..727976a 100644
--- a/src/ui/scoring-facility_cb.cc
+++ b/src/ui/scoring-facility_cb.cc
@@ -222,15 +222,10 @@ bSFShowPhaseDiffDialog_toggled_cb( GtkToggleButton *togglebutton, gpointer userd
void
bSFAccept_clicked_cb( GtkToolButton *button, gpointer userdata)
{
- auto SFp = (SScoringFacility*)userdata;
-
- SFp->_p.using_subject->create_cscourse();
- gtk_widget_queue_draw( (GtkWidget*)SFp->_p.using_subject->da);
+ auto& SF = *(SScoringFacility*)userdata;
- delete SFp;
- // the resulting destruction of all widgets owned by SF will cause
- // this warning: Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed
- // when I'm bored, perhaps I'll sit down and find a way to shut down scoring facility more cleanly
+ SF._p.close_this_SF_now = &SF;
+ g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
}
@@ -265,13 +260,10 @@ iSFAcceptAndTakeNext_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
gboolean
wScoringFacility_delete_event_cb( GtkWidget*, GdkEvent*, gpointer userdata)
{
- auto SFp = (SScoringFacility*)userdata;
-
- SFp->_p.using_subject->create_cscourse();
- gtk_widget_queue_draw( (GtkWidget*)SFp->_p.using_subject->da);
+ auto& SF = *(SScoringFacility*)userdata;
- // not sure resurrection will succeed, tho
- delete SFp;
+ SF._p.close_this_SF_now = &SF;
+ g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
return TRUE; // to stop other handlers from being invoked for the event
}
--
Sleep experiment manager
More information about the debian-med-commit
mailing list