]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
merged the start/stop buttons into one
authorDaniel Carbonell Fraj <bocata@src.gnome.org>
Wed, 4 Jun 2003 17:13:53 +0000 (17:13 +0000)
committerDaniel Carbonell Fraj <bocata@src.gnome.org>
Wed, 4 Jun 2003 17:13:53 +0000 (17:13 +0000)
ChangeLog
src/commands.c
src/commands.h
src/tetrinet.c

index 1103cc9e09768d26d23b6b19a89535ea9682aa15..d4e3e88a849b28462f6ed899700830410fc5ab73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2003-06-04  Dani Carbonell  <bocata@panete.net>
+
+       * src/commands.h (show_stop_button, show_start_button): new functions.
+
+       * src/commands.c: changed the button order.
+       (make_menus): hide the stop button just after the toolbar has been created.
+       (show_stop_button): new function, it will hide the start button,
+       and show the stop one.
+       (show_start_button): new function, it will show the start button,
+       and hide the stop one.
+
+       * src/tetrinet.c (tetrinet_inmessage): show / hide the toolbar
+       buttons when required.
+
 2003-06-03  Jordi Mallach  <jordi@sindominio.net>
 
        * gtetrinet.desktop.in: change value of Terminal from 0 to false to
index 1f0c8d0d96f79322a65acbaf56f7764db227f994..8bb0471773768ae315c26db98a907e813480e1da 100644 (file)
@@ -83,8 +83,8 @@ GnomeUIInfo toolbar[] = {
     GNOMEUIINFO_ITEM_DATA(N_("Disconnect"), N_("Disconnect from the current server"), disconnect_command, NULL, disconnect_xpm),
     GNOMEUIINFO_SEPARATOR,
     GNOMEUIINFO_ITEM_DATA(N_("Start game"), N_("Start a new game"), start_command, NULL, play_xpm),
-    GNOMEUIINFO_ITEM_DATA(N_("Pause game"), N_("Pause the game"), pause_command, NULL, pause_xpm),
     GNOMEUIINFO_ITEM_DATA(N_("End game"), N_("End the current game"), end_command, NULL, stop_xpm),
+    GNOMEUIINFO_ITEM_DATA(N_("Pause game"), N_("Pause the game"), pause_command, NULL, pause_xpm),
     GNOMEUIINFO_SEPARATOR,
     GNOMEUIINFO_ITEM_DATA(N_("Change team"), N_("Change your current team name"), team_command, NULL, team24_xpm),
 #ifdef ENABLE_DETACH
@@ -99,6 +99,7 @@ void make_menus (GnomeApp *app)
   gnome_app_create_menus (app, menubar);
 
   gnome_app_create_toolbar (app, toolbar);
+  gtk_widget_hide (toolbar[4].widget);
 }
 
 /* callbacks */
@@ -127,23 +128,38 @@ void detach_command (void)
 
 void start_command (void)
 {
-    char buf[22];
-    g_snprintf (buf, sizeof(buf), "%i %i", 1, playernum);
-    client_outmessage (OUT_STARTGAME, buf);
+  char buf[22];
+  
+  g_snprintf (buf, sizeof(buf), "%i %i", 1, playernum);
+  client_outmessage (OUT_STARTGAME, buf);
+}
+
+void show_stop_button (void)
+{
+  gtk_widget_hide (toolbar[3].widget);
+  gtk_widget_show (toolbar[4].widget);
+}
+
+void show_start_button (void)
+{
+  gtk_widget_hide (toolbar[4].widget);
+  gtk_widget_show (toolbar[3].widget);
 }
 
 void end_command (void)
 {
-    char buf[22];
-    g_snprintf (buf, sizeof(buf), "%i %i", 0, playernum);
-    client_outmessage (OUT_STARTGAME, buf);
+  char buf[22];
+  
+  g_snprintf (buf, sizeof(buf), "%i %i", 0, playernum);
+  client_outmessage (OUT_STARTGAME, buf);
 }
 
 void pause_command (void)
 {
-    char buf[22];
-    g_snprintf (buf, sizeof(buf), "%i %i", paused?0:1, playernum);
-    client_outmessage (OUT_PAUSE, buf);
+  char buf[22];
+  
+  g_snprintf (buf, sizeof(buf), "%i %i", paused?0:1, playernum);
+  client_outmessage (OUT_PAUSE, buf);
 }
 
 void preferences_command (void)
index fcbf145c6f34380a750ac8fb28756d72d631d47b..b4f98df104907fa038ce8da946be669b0e9bb9a3 100644 (file)
@@ -14,5 +14,7 @@ void end_command (void);
 void pause_command (void);
 void preferences_command (void);
 void about_command (void);
+void show_start_button (void);
+void show_stop_button (void);
 
 void commands_checkstate (void);
index 877fed87361ef55ec291d9b67359d4ce6cc155dc..879fb51a2aff7866e140d31b06958044ece1b80c 100644 (file)
@@ -186,6 +186,7 @@ void tetrinet_inmessage (enum inmsg_type msgtype, char *data)
         list_issued = 0;
         up_chan_list_source = g_timeout_add (30000, (GSourceFunc) partyline_update_channel_list, NULL);
         partyline_joining_channel ("");
+        show_start_button ();
         break;
     case IN_DISCONNECT:
         if (!connected) {
@@ -600,6 +601,7 @@ void tetrinet_inmessage (enum inmsg_type msgtype, char *data)
             commands_checkstate ();
             partyline_fmt (_("%c*** The game has %cstarted"),
                            TETRI_TB_C_BRIGHT_RED, TETRI_TB_BOLD);
+            show_stop_button ();
             /* switch to playerfields when game starts */
             show_fields_page ();
         }
@@ -625,6 +627,7 @@ void tetrinet_inmessage (enum inmsg_type msgtype, char *data)
             commands_checkstate ();
             partyline_fmt(_("%c*** The game is %cin progress"),
                           TETRI_TB_C_BRIGHT_RED, TETRI_TB_BOLD);;
+            show_stop_button ();
         }
         break;
     case IN_PAUSE:
@@ -654,6 +657,7 @@ void tetrinet_inmessage (enum inmsg_type msgtype, char *data)
         commands_checkstate ();
         partyline_fmt (_("%c*** The game has %cended"),
                        TETRI_TB_C_BRIGHT_RED, TETRI_TB_BOLD);
+        show_start_button ();
         /* go back to partyline when game ends */
         show_partyline_page ();
         break;