monkey-bubble r302 - in trunk: . src/ui



Author: herzi
Date: Fri Feb  8 13:15:32 2008
New Revision: 302
URL: http://svn.gnome.org/viewvc/monkey-bubble?rev=302&view=rev

Log:
2008-02-08  Sven Herzberg  <sven imendio com>

	* src/ui/ui-main.c: (ui_main_new), (ui_main_enabled_games_item),
	(ui_main_game_changed): merge the pause and resume handling code for
	GNOME and Maemo


Modified:
   trunk/ChangeLog
   trunk/src/ui/ui-main.c

Modified: trunk/src/ui/ui-main.c
==============================================================================
--- trunk/src/ui/ui-main.c	(original)
+++ trunk/src/ui/ui-main.c	Fri Feb  8 13:15:32 2008
@@ -88,10 +88,6 @@
 				    UiMain   * uimain);
 static void game_resume_cb         (GtkAction* action,
 				    UiMain   * uimain);
-#ifdef MAEMO
-static void pause_game             (GtkAction* action,
-				    UiMain   * uimain);
-#endif
 #ifdef GNOME
 static void stop_game              (GtkAction* action,
 				    UiMain   * uimain);
@@ -228,11 +224,13 @@
 		{"GameNetworkJoin", NULL, N_("Join _network game"),
 		 NULL, NULL,
 		 G_CALLBACK (new_network_game)},
-#ifdef MAEMO
-		{"GamePause", NULL, N_("Pause"),
+		{"GamePause", NULL, N_("Pause game"),
+		 NULL, NULL,
+		 G_CALLBACK (game_pause_cb)},
+		{"GameResume", NULL, N_("Resume game"),
 		 NULL, NULL,
-		 G_CALLBACK (pause_game)
-		},
+		 G_CALLBACK (game_resume_cb)},
+#ifdef MAEMO
 		{"ApplicationQuit", NULL, N_("Quit"),
 		 NULL, NULL,
 		 G_CALLBACK (quit_program)
@@ -250,12 +248,6 @@
 		{"GameScores", GTK_STOCK_INDEX, N_("_High Scores"),
 		 NULL, NULL,
 		 G_CALLBACK (show_high_scores)},
-		{"GamePause", NULL, N_("Pause game"),
-		 NULL, NULL,
-		 G_CALLBACK (game_pause_cb)},
-		{"GameResume", NULL, N_("Resume game"),
-		 NULL, NULL,
-		 G_CALLBACK (game_resume_cb)},
 		{"GameStop", NULL, N_("Stop game"),
 		 NULL, NULL,
 		 G_CALLBACK (stop_game)},
@@ -332,6 +324,7 @@
 					     "<menuitem action='GameNew1Player' />"
 					     "<menuitem action='GameNetworkJoin' />"
 					     "<menuitem action='GamePause' />"
+					     "<menuitem action='GameResume' />"
 					     "<menuitem action='ApplicationQuit' />"
 					   "</popup></ui>",
 					   -1,
@@ -549,13 +542,13 @@
 #ifdef GNOME
 	gtk_action_set_sensitive (gtk_action_group_get_action (PRIVATE (ui_main)->actions, "GameStop"),
 				  !enabled);
+#endif
 	gtk_action_set_sensitive (gtk_action_group_get_action (PRIVATE (ui_main)->actions, "GamePause"),
 				  !enabled);
 	gtk_action_set_visible   (gtk_action_group_get_action (PRIVATE (ui_main)->actions, "GamePause"),
 				  TRUE);
 	gtk_action_set_visible   (gtk_action_group_get_action (PRIVATE (ui_main)->actions, "GameResume"),
 				  FALSE);
-#endif
 }
 
 static void
@@ -600,21 +593,6 @@
 	game_pause (PRIVATE (ui_main)->game, FALSE);
 }
 
-#ifdef MAEMO
-static void
-pause_game (GtkAction* action,
-	    UiMain   * ui_main)
-{
-        if( PRIVATE(ui_main)->game != NULL) {
-                if( game_get_state( PRIVATE(ui_main)->game) == GAME_PAUSED) {
-			game_resume_cb (action, ui_main);
-                } else {
-			game_pause_cb (action, ui_main);
-                }
-        }
-}
-#endif
-
 static void ui_main_stop_game(UiMain * ui_main) {
       
         game_manager_stop(PRIVATE(ui_main)->manager);
@@ -672,19 +650,15 @@
                      UiMain* ui_main)
 {
         if( game_get_state(game) == GAME_PAUSED ) {
-#ifdef GNOME
 		gtk_action_set_visible (gtk_action_group_get_action (PRIVATE (ui_main)->actions, "GameResume"),
 					TRUE);
 		gtk_action_set_visible (gtk_action_group_get_action (PRIVATE (ui_main)->actions, "GamePause"),
 					FALSE);
-#endif
         } else if( game_get_state(game) == GAME_PLAYING ) {
-#ifdef GNOME
 		gtk_action_set_visible (gtk_action_group_get_action (PRIVATE (ui_main)->actions, "GameResume"),
 					FALSE);
 		gtk_action_set_visible (gtk_action_group_get_action (PRIVATE (ui_main)->actions, "GamePause"),
 					TRUE);
-#endif
         } else if( game_get_state(game) == GAME_STOPPED ) {
         }
 }



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