[med-svn] [aghermann] 77/85: rename some

andrei zavada hmmr-guest at alioth.debian.org
Thu Sep 26 23:46:36 UTC 2013


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

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

commit 017233654acd526f0fdb68ae54f625eff28d943e
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Tue Sep 24 23:56:32 2013 +0300

    rename some
---
 upstream/src/aghermann/ui/mf/Makefile.am           |    2 +-
 .../ui/mf/{mf-construct.cc => construct.cc}        |   50 +++++++++++---------
 2 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/upstream/src/aghermann/ui/mf/Makefile.am b/upstream/src/aghermann/ui/mf/Makefile.am
index 6a5fe89..6135a64 100644
--- a/upstream/src/aghermann/ui/mf/Makefile.am
+++ b/upstream/src/aghermann/ui/mf/Makefile.am
@@ -8,7 +8,7 @@ AM_CXXFLAGS := \
 noinst_LIBRARIES := liba.a
 
 liba_a_SOURCES := \
-	mf-construct.cc \
+	construct.cc \
 	mf.cc \
 	mf.hh \
 	mf_cb.cc \
diff --git a/upstream/src/aghermann/ui/mf/mf-construct.cc b/upstream/src/aghermann/ui/mf/construct.cc
similarity index 63%
rename from upstream/src/aghermann/ui/mf/mf-construct.cc
rename to upstream/src/aghermann/ui/mf/construct.cc
index e62580b..8a806c6 100644
--- a/upstream/src/aghermann/ui/mf/mf-construct.cc
+++ b/upstream/src/aghermann/ui/mf/construct.cc
@@ -53,30 +53,34 @@ construct_widgets()
         G_CONNECT_1 (eMFAZ1, toggled);
         G_CONNECT_1 (eMFAZ2, toggled);
 
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVrs" )] = agh::ach::TTunable::rs ;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVrc" )] = agh::ach::TTunable::rc ;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVfcR")] = agh::ach::TTunable::fcR;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVfcW")] = agh::ach::TTunable::fcW;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVS0" )] = agh::ach::TTunable::S0 ;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVSU" )] = agh::ach::TTunable::SU ;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVta" )] = agh::ach::TTunable::ta ;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVtp" )] = agh::ach::TTunable::tp ;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc1")] = agh::ach::TTunable::gc1;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc2")] = agh::ach::TTunable::gc2;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc3")] = agh::ach::TTunable::gc3;
-        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc4")] = agh::ach::TTunable::gc4;
-        for ( auto &tuple : eMFVx )
-                if ( tuple.first == nullptr )
-                        return -1;
+        for ( auto& T : forward_list<pair<const char*, agh::ach::TTunable>>
+                { {"eMFVrs",  agh::ach::TTunable::rs },
+                  {"eMFVrc",  agh::ach::TTunable::rc },
+                  {"eMFVfcR", agh::ach::TTunable::fcR},
+                  {"eMFVfcW", agh::ach::TTunable::fcW},
+                  {"eMFVS0",  agh::ach::TTunable::S0 },
+                  {"eMFVSU",  agh::ach::TTunable::SU },
+                  {"eMFVta",  agh::ach::TTunable::ta },
+                  {"eMFVtp",  agh::ach::TTunable::tp },
+                  {"eMFVgc1", agh::ach::TTunable::gc1},
+                  {"eMFVgc2", agh::ach::TTunable::gc2},
+                  {"eMFVgc3", agh::ach::TTunable::gc3},
+                  {"eMFVgc4", agh::ach::TTunable::gc4}} ) {
+                auto W = (GtkSpinButton*)gtk_builder_get_object( builder, T.first);
+                if ( W ) {
+                        eMFVx[W] = T.second;
+                        g_signal_connect(
+                                W, "value-changed",
+                                (GCallback)eMFVx_value_changed_cb,
+                                this);
+                } else
+                        throw runtime_error (string("Missing widget: ") + T.first);
+        }
+
         if ( not csimulation.ctl_params.AZAmendment1 ) // disable gcx unless AZAmendment is in effect
-                for ( auto &tuple : eMFVx )
-                        if ( tuple.second > agh::ach::TTunable::gc )
-                                gtk_widget_set_sensitive( (GtkWidget*)tuple.first, FALSE);
-
-        for ( auto &tuple : eMFVx )
-                g_signal_connect( tuple.first, "value-changed",
-                                  (GCallback)eMFVx_value_changed_cb,
-                                  this);
+                for ( auto &T : eMFVx )
+                        if ( T.second > agh::ach::TTunable::gc )
+                                gtk_widget_set_sensitive( (GtkWidget*)T.first, FALSE);
 
         g_object_set(
                 (GObject*)lMFLog,

-- 
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