[med-svn] [aghermann] 40/60: fix corner cases when displaying Experiment->Global ops->Detect Artifacts

andrei zavada hmmr-guest at alioth.debian.org
Mon Nov 4 23:49:58 UTC 2013


This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch WIP
in repository aghermann.

commit 4996af44c87009d33efca4b61268e7bd123077e8
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sun Oct 20 01:10:52 2013 +0300

    fix corner cases when displaying Experiment->Global ops->Detect Artifacts
---
 upstream/src/aghermann/ui/mw/mainmenu_cb.cc |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
index 2b0a51f..4515dab 100644
--- a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
+++ b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
@@ -261,17 +261,20 @@ iExpGloballyDetectArtifacts_activate_cb(
                                 CComprehensiveArtifactDetector::common_subdir,
                                 A, *ED.ED, agh::SExpDirLevelId {"", "", ""}));
 
-        if ( profiles.size() < 1 ) {
-                pop_ok_message( ED.wMainWindow,
-                                "Create some profiles first",
-                                "You can do it by opening a recording in Scoring Facility and"
-                                " tweaking default parameters in Artifact Detect dialog."
-                                " After saving them as an experiment-wide profile, the latter will appear here.");
-                return;
+        bool must_select_first = false;
+        if ( profiles.empty() ) {
+                profiles.emplace_back( *ED.ED, agh::SExpDirLevelId {"", "", ""}), must_select_first = true;
+        } else {
+                int previously_selected = gtk_combo_box_get_active( ED.eGlobalADProfiles);
+                if ( (int)profiles.size() < previously_selected ||  // user has deleted some since we last displayed
+                     previously_selected == -1 )
+                must_select_first = true;
         }
 
         populate_combo( profiles, ED.mGlobalADProfiles);
         gtk_combo_box_set_model( ED.eGlobalADProfiles, (GtkTreeModel*)ED.mGlobalADProfiles);
+        if ( must_select_first )
+                gtk_combo_box_set_active( ED.eGlobalADProfiles, 0);
 
         gtk_label_set_markup(
                 ED.lGlobalADHint,

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git



More information about the debian-med-commit mailing list