From 181d3a19c6325770fd2aff8a5a47a33abdb146f3 Mon Sep 17 00:00:00 2001 From: Daniel Carbonell Fraj Date: Wed, 4 Jun 2003 17:13:53 +0000 Subject: [PATCH] merged the start/stop buttons into one --- ChangeLog | 14 ++++++++++++++ src/commands.c | 36 ++++++++++++++++++++++++++---------- src/commands.h | 2 ++ src/tetrinet.c | 4 ++++ 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1103cc9..d4e3e88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2003-06-04 Dani Carbonell + + * 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 * gtetrinet.desktop.in: change value of Terminal from 0 to false to diff --git a/src/commands.c b/src/commands.c index 1f0c8d0..8bb0471 100644 --- a/src/commands.c +++ b/src/commands.c @@ -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) diff --git a/src/commands.h b/src/commands.h index fcbf145..b4f98df 100644 --- a/src/commands.h +++ b/src/commands.h @@ -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); diff --git a/src/tetrinet.c b/src/tetrinet.c index 877fed8..879fb51 100644 --- a/src/tetrinet.c +++ b/src/tetrinet.c @@ -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; -- 2.50.1