[dasher] Reduce toggle_game_mode spaghetti



commit 92d520836884416aa0e79d329a59808ec321e1a6
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Mon Aug 8 14:32:21 2011 +0100

    Reduce toggle_game_mode spaghetti
    
    Restrict visibility to dasher_main, there is no stock item for game
    mode, and a tooltip isn't useful for a menu item.

 Data/GUI/dasher.traditional.ui      |    6 ++----
 Src/Gtk2/dasher_editor_internal.cpp |    5 -----
 Src/Gtk2/dasher_main.cpp            |    4 +++-
 Src/Gtk2/dasher_main.h              |    2 --
 4 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/Data/GUI/dasher.traditional.ui b/Data/GUI/dasher.traditional.ui
index 4ebc02e..db07d0a 100644
--- a/Data/GUI/dasher.traditional.ui
+++ b/Data/GUI/dasher.traditional.ui
@@ -128,10 +128,8 @@
         </child>
         <child>
           <object class="GtkToggleAction" id="action_toggle_game_mode">
-            <property name="stock_id">action_toggle_game_mode</property>
-			<property name="tooltip" translatable="yes">_Game Mode</property>
-			<property name = "label" translatable="yes">_Game Mode</property>
-            <signal name="activate" handler="dasher_main_cb_editor"/>
+			<property name="label" translatable="yes">_Game Mode</property>
+            <signal name="activate" handler="dasher_main_cb_toggle_game_mode"/>
           </object>
         </child>
       </object>
diff --git a/Src/Gtk2/dasher_editor_internal.cpp b/Src/Gtk2/dasher_editor_internal.cpp
index d1a4a9a..39e34c6 100644
--- a/Src/Gtk2/dasher_editor_internal.cpp
+++ b/Src/Gtk2/dasher_editor_internal.cpp
@@ -945,11 +945,6 @@ dasher_editor_internal_command(DasherEditor *pSelf, const gchar *szCommand) {
     dasher_editor_internal_clipboard(pSelf, CLIPBOARD_SELECTALL);
     return TRUE;
   }
-
-  if(!strcmp(szCommand, "action_toggle_game_mode")) { //toggle game mode
-    dasher_main_toggle_game_mode(pPrivate->pDasherMain);
-    return TRUE;
-  }
  
   return FALSE;
 }
diff --git a/Src/Gtk2/dasher_main.cpp b/Src/Gtk2/dasher_main.cpp
index f801f4b..fce7d4a 100644
--- a/Src/Gtk2/dasher_main.cpp
+++ b/Src/Gtk2/dasher_main.cpp
@@ -97,6 +97,7 @@ static void dasher_main_command_preferences_alphabet(DasherMain *pSelf);
 static void dasher_main_command_tutorial(DasherMain *pSelf);
 static void dasher_main_command_help(DasherMain *pSelf);
 static void dasher_main_command_about(DasherMain *pSelf);
+static void dasher_main_command_toggle_game_mode(DasherMain*);
 
 /* c.f. WRAP_CPP_CB below */
 extern "C" void dasher_main_cb_import(GtkAction*, DasherMain*);
@@ -378,6 +379,7 @@ WRAP_CPP_CB(quit)
 WRAP_CPP_CB(preferences)
 WRAP_CPP_CB(help)
 WRAP_CPP_CB(about)
+WRAP_CPP_CB(toggle_game_mode)
 
 extern "C" void
 dasher_main_cb_editor(GtkAction *obj, DasherMain *pSelf)
@@ -640,7 +642,7 @@ void show_game_file_dialog(GtkWidget *pButton, GtkWidget *pWidget, gpointer pDat
  *
  * @param pSelf a reference to an instance of DasherMain
  */ 
-void dasher_main_toggle_game_mode(DasherMain *pSelf) {
+void dasher_main_command_toggle_game_mode(DasherMain *pSelf) {
 
   DasherMainPrivate *pPrivate = DASHER_MAIN_GET_PRIVATE(pSelf);
 
diff --git a/Src/Gtk2/dasher_main.h b/Src/Gtk2/dasher_main.h
index 190f26e..61d3de6 100644
--- a/Src/Gtk2/dasher_main.h
+++ b/Src/Gtk2/dasher_main.h
@@ -41,8 +41,6 @@ struct _SCommandLine {
 DasherMain *dasher_main_new(int *argc, char ***argv, SCommandLine *pCommandLine);
 GType dasher_main_get_type();
 void dasher_main_show(DasherMain *pSelf);
-
-void dasher_main_toggle_game_mode(DasherMain *pSelf); 
 G_END_DECLS
 
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]