[aisleriot/wip/redesign: 17/17] all: Remove deprecated stock items



commit 73c0ec6bf6f26ee9f17e551d4f7afaed4a0e296f
Author: Christian Persch <chpe gnome org>
Date:   Wed Jul 3 19:52:21 2013 +0200

    all: Remove deprecated stock items

 src/ar-application.c |    2 -
 src/ar-stock.c       |  148 --------------------------------------------------
 src/ar-stock.h       |   17 ------
 src/stats-dialog.c   |    4 +-
 src/window.c         |   19 +++----
 5 files changed, 9 insertions(+), 181 deletions(-)
---
diff --git a/src/ar-application.c b/src/ar-application.c
index e930951..dc68c9d 100644
--- a/src/ar-application.c
+++ b/src/ar-application.c
@@ -42,7 +42,6 @@
 #endif
 
 #include "ar-debug.h"
-#include "ar-stock.h"
 #include "ar-sound.h"
 #include "ar-string-utils.h"
 
@@ -233,7 +232,6 @@ ar_application_startup (GApplication *application)
   G_APPLICATION_CLASS (ar_application_parent_class)->startup (application);
 
   ar_sound_enable (FALSE);
-  ar_stock_init ();
 
   path = g_build_filename (g_get_user_config_dir (), "aisleriot", NULL);
   if (g_mkdir_with_parents (path, 0700 /* as per XDG base dir spec */) < 0 && errno != EEXIST)
diff --git a/src/ar-stock.c b/src/ar-stock.c
index 816d576..e65f732 100644
--- a/src/ar-stock.c
+++ b/src/ar-stock.c
@@ -31,154 +31,6 @@
 
 #include "ar-stock.h"
 
-/* This will become GTK_CHECK_VERSION (2, 15, x) once the patch from gtk+ bug 511332 is committed */
-#undef HAVE_GTK_ICON_FACTORY_ADD_ALIAS
-
-#ifndef HAVE_GTK_ICON_FACTORY_ADD_ALIAS
-
-static void
-register_stock_icon (GtkIconFactory * icon_factory,
-                     const char * stock_id,
-                     const char * icon_name)
-{
-  GtkIconSource *source;
-  GtkIconSet *set;
-
-  set = gtk_icon_set_new ();
-
-  source = gtk_icon_source_new ();
-  gtk_icon_source_set_icon_name (source, icon_name);
-  gtk_icon_set_add_source (set, source);
-  gtk_icon_source_free (source);
-
-  gtk_icon_factory_add (icon_factory, stock_id, set);
-  gtk_icon_set_unref (set);
-}
-
-static void
-register_stock_icon_bidi (GtkIconFactory * icon_factory,
-                          const char * stock_id,
-                          const char * icon_name_ltr,
-                          const char * icon_name_rtl)
-{
-  GtkIconSource *source;
-  GtkIconSet *set;
-
-  set = gtk_icon_set_new ();
-
-  source = gtk_icon_source_new ();
-  gtk_icon_source_set_icon_name (source, icon_name_ltr);
-  gtk_icon_source_set_direction (source, GTK_TEXT_DIR_LTR);
-  gtk_icon_source_set_direction_wildcarded (source, FALSE);
-  gtk_icon_set_add_source (set, source);
-  gtk_icon_source_free (source);
-
-  source = gtk_icon_source_new ();
-  gtk_icon_source_set_icon_name (source, icon_name_rtl);
-  gtk_icon_source_set_direction (source, GTK_TEXT_DIR_RTL);
-  gtk_icon_source_set_direction_wildcarded (source, FALSE);
-  gtk_icon_set_add_source (set, source);
-  gtk_icon_source_free (source);
-
-  gtk_icon_factory_add (icon_factory, stock_id, set);
-  gtk_icon_set_unref (set);
-}
-
-#endif /* HAVE_GTK_ICON_FACTORY_ADD_ALIAS */
-
-void
-ar_stock_init (void)
-{
-  /* These stocks have a gtk stock icon */
-  const char *stock_icon_aliases[][2] = {
-    { AR_STOCK_CONTENTS,         "help-contents" },
-    { AR_STOCK_HINT,             "dialog-information" },
-    { AR_STOCK_NEW_GAME,         "document-new" },
-    { AR_STOCK_START_NEW_GAME,   "document-new" },
-    { AR_STOCK_RESET,            "edit-clear" },
-    { AR_STOCK_RESTART_GAME,     "view-refresh" },
-    { AR_STOCK_FULLSCREEN,       "view-fullscreen" },
-    { AR_STOCK_LEAVE_FULLSCREEN, "view-restore" },
-    { AR_STOCK_PAUSE_GAME,       "media-playback-pause" },
-  };
-
-#ifndef HAVE_GTK_ICON_FACTORY_ADD_ALIAS
-  const char *stock_icon_aliases_bidi[][3] = {
-    { AR_STOCK_REDO_MOVE, "edit-redo", "edit-undo" },
-    { AR_STOCK_UNDO_MOVE, "edit-undo", "edit-redo" },
-  };
-#endif
-
-  /* Private icon names */
-  const char *private_icon_names[][2] = {
-    { AR_STOCK_DEAL_CARDS, "cards-deal" }
-  };
-
-  static const GtkStockItem ar_stock_items[] = {
-    { AR_STOCK_CONTENTS,         N_("_Contents"),          0, GDK_KEY_F1, NULL },
-    { AR_STOCK_FULLSCREEN,       N_("_Fullscreen"),        0, GDK_KEY_F11, NULL },
-    { AR_STOCK_HINT,             N_("_Hint"),              GDK_CONTROL_MASK, 'h', NULL },
-    /* Translators: This "_New" is for the menu item 'Game->New', implies "New Game" */
-    { AR_STOCK_NEW_GAME,         N_("_New"),               GDK_CONTROL_MASK, 'n', NULL },
-    /* Translators: This "_New Game" is for the game-over dialogue */
-    { AR_STOCK_START_NEW_GAME,   N_("_New Game"),          0, 0, NULL },
-    { AR_STOCK_REDO_MOVE,        N_("_Redo Move"),         GDK_CONTROL_MASK | GDK_SHIFT_MASK, 'z', NULL },
-    /* Translators: this is the "Reset" scores button in a scores dialogue */
-    { AR_STOCK_RESET,            N_("_Reset"),             0, 0, NULL },
-    /* Translators: "_Restart" is the menu item 'Game->Restart', implies "Restart Game" */
-    { AR_STOCK_RESTART_GAME,     N_("_Restart"),           0, 0, NULL },
-    { AR_STOCK_UNDO_MOVE,        N_("_Undo Move"),         GDK_CONTROL_MASK, 'z', NULL },
-    { AR_STOCK_DEAL_CARDS,       N_("_Deal"),              GDK_CONTROL_MASK, 'd', NULL },
-    { AR_STOCK_LEAVE_FULLSCREEN, N_("_Leave Fullscreen"),  0, GDK_KEY_F11, NULL },
-    { AR_STOCK_PAUSE_GAME,       N_("_Pause"),             0, GDK_KEY_Pause, NULL },
-  };
-
-  guint i;
-  GtkIconFactory *icon_factory;
-
-  icon_factory = gtk_icon_factory_new ();
-
-#ifdef HAVE_GTK_ICON_FACTORY_ADD_ALIAS
-  for (i = 0; i < G_N_ELEMENTS (stock_icon_aliases); ++i) {
-    gtk_icon_factory_add_alias (stock_icon_aliases[i][0],
-                                stock_icon_aliases[i][1]);
-  }
-
-#else
-  for (i = 0; i < G_N_ELEMENTS (stock_icon_aliases); ++i) {
-    register_stock_icon (icon_factory,
-                         stock_icon_aliases[i][0],
-                         stock_icon_aliases[i][1]);
-  }
-
-  for (i = 0; i < G_N_ELEMENTS (stock_icon_aliases_bidi); ++i) {
-    register_stock_icon_bidi (icon_factory,
-                              stock_icon_aliases_bidi[i][0],
-                              stock_icon_aliases_bidi[i][1],
-                              stock_icon_aliases_bidi[i][2]);
-  }
-#endif /* HAVE_GTK_ICON_FACTORY_ADD_ALIAS */
-
-  /* Register our private themeable icons */
-  for (i = 0; i < G_N_ELEMENTS (private_icon_names); i++) {
-    register_stock_icon (icon_factory,
-                         private_icon_names[i][0],
-                         private_icon_names[i][1]);
-  }
-
-  gtk_icon_factory_add_default (icon_factory);
-  g_object_unref (icon_factory);
-
-  /* GtkIconTheme will then look in our custom hicolor dir
-   * for icons as well as the standard search paths.
-   */
-  /* FIXME: multi-head! */
-  gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
-                                     ar_runtime_get_directory (AR_RUNTIME_ICON_THEME_DIRECTORY));
- 
-  gtk_stock_add_static (ar_stock_items, G_N_ELEMENTS (ar_stock_items));
-}
-
 /**
  * ar_get_licence:
  *
diff --git a/src/ar-stock.h b/src/ar-stock.h
index 4a5aaf5..8270697 100644
--- a/src/ar-stock.h
+++ b/src/ar-stock.h
@@ -27,23 +27,6 @@
 
 G_BEGIN_DECLS
 
-/* These use stock gtk icons */
-#define AR_STOCK_FULLSCREEN       "aisleriot-fullscreen"
-#define AR_STOCK_LEAVE_FULLSCREEN "aisleriot-leave-fullscreen"
-#define AR_STOCK_NEW_GAME         "aisleriot-game-new"
-#define AR_STOCK_START_NEW_GAME   "aisleriot-game-new"
-#define AR_STOCK_PAUSE_GAME       "aisleriot-game-pause"
-#define AR_STOCK_RESET            "aisleriot-game-reset"
-#define AR_STOCK_RESTART_GAME     "aisleriot-game-restart"
-#define AR_STOCK_HINT             "aisleriot-game-hint"
-#define AR_STOCK_UNDO_MOVE        "aisleriot-move-undo"
-#define AR_STOCK_REDO_MOVE        "aisleriot-move-redo"
-#define AR_STOCK_CONTENTS         "aisleriot-help-contents"
-
-/* These belong to us */
-#define AR_STOCK_DEAL_CARDS       "aisleriot-game-deal"
-
-void   ar_stock_init (void);
 gchar *ar_get_licence (const gchar * game_name);
 
 G_END_DECLS
diff --git a/src/stats-dialog.c b/src/stats-dialog.c
index 195eb8a..8921483 100644
--- a/src/stats-dialog.c
+++ b/src/stats-dialog.c
@@ -167,8 +167,8 @@ aisleriot_stats_dialog_init (AisleriotStatsDialog *stats_dialog)
   pack_in_frame (hbox, GTK_WIDGET (table), _("Time"));
 
   gtk_dialog_add_buttons (dialog,
-                          AR_STOCK_RESET, GTK_RESPONSE_REJECT,
-                          GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+                          _("_Reset"), GTK_RESPONSE_REJECT,
+                          _("_Close"), GTK_RESPONSE_CLOSE,
                           NULL);
   gtk_dialog_set_alternative_button_order (dialog,
                                            GTK_RESPONSE_CLOSE,
diff --git a/src/window.c b/src/window.c
index c586fe8..2027593 100644
--- a/src/window.c
+++ b/src/window.c
@@ -206,8 +206,8 @@ show_game_over_dialog (AisleriotWindow *window)
 
   if (game_won) {
     gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                            GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
-                            AR_STOCK_START_NEW_GAME, RESPONSE_NEW_GAME,
+                            _("_Close"), GTK_RESPONSE_CLOSE,
+                            _("_New Game"), RESPONSE_NEW_GAME,
                             NULL);
     gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                              RESPONSE_NEW_GAME,
@@ -215,10 +215,10 @@ show_game_over_dialog (AisleriotWindow *window)
                                              -1);
   } else {
     gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                           AR_STOCK_UNDO_MOVE, RESPONSE_UNDO,
-                            GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
-                            AR_STOCK_RESTART_GAME, RESPONSE_RESTART,
-                            AR_STOCK_START_NEW_GAME, RESPONSE_NEW_GAME,
+                            _("_Undo Move"), RESPONSE_UNDO,
+                            _("_Close"), GTK_RESPONSE_CLOSE,
+                            _("_Restart"), RESPONSE_RESTART,
+                            _("_New Game"), RESPONSE_NEW_GAME,
                             NULL);
     gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                              RESPONSE_NEW_GAME,
@@ -1634,12 +1634,7 @@ aisleriot_window_init (AisleriotWindow *window)
 
   statusbar = priv->statusbar;
   priv->game_message_id = gtk_statusbar_get_context_id (priv->statusbar, "game-message");
-#if 0 //fixme
-  ar_stock_prepare_for_statusbar_tooltips (priv->ui_manager,
-                                              GTK_WIDGET (priv->statusbar));
-#endif
-
-  priv->game_message_id = gtk_statusbar_get_context_id (priv->statusbar, "board-message");
+  priv->board_message_id = gtk_statusbar_get_context_id (priv->statusbar, "board-message");
 
 #ifdef HAVE_CLUTTER
   g_signal_connect (priv->board_actor, "status-message",


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