[gnome-games] libgames-support: Remove cruft



commit bc243fd53eed55b279ee4c6d3fb227b7f82bd0ba
Author: Christian Persch <chpe gnome org>
Date:   Mon Apr 11 16:09:06 2011 +0200

    libgames-support: Remove cruft

 libgames-support/games-conf.c     |    8 -----
 libgames-support/games-frame.c    |    5 ---
 libgames-support/games-runtime.c  |   55 --------------------------------
 libgames-support/games-runtime.h  |    9 -----
 libgames-support/games-settings.c |    4 +-
 libgames-support/games-show.c     |   25 ---------------
 libgames-support/games-stock.c    |   62 +++---------------------------------
 7 files changed, 8 insertions(+), 160 deletions(-)
---
diff --git a/libgames-support/games-conf.c b/libgames-support/games-conf.c
index d6df4cb..717ef71 100644
--- a/libgames-support/games-conf.c
+++ b/libgames-support/games-conf.c
@@ -197,8 +197,6 @@ window_state_event_cb (GtkWidget *widget,
   return FALSE;
 }
 
-#ifndef HAVE_HILDON
-
 static char *
 games_conf_get_accel_map_path (GamesConf *conf,
                                gboolean ensure_dir_exists)
@@ -278,8 +276,6 @@ games_conf_save_accel_map (GamesConf *conf)
   g_free (conf_file);
 }
 
-#endif /* !HAVE_HILDON */
-
 #ifdef HAVE_GNOME
 
 static void
@@ -438,9 +434,7 @@ games_conf_constructor (GType type,
 
 #endif /* HAVE_GNOME */
 
-#ifndef HAVE_HILDON
   games_conf_load_accel_map (conf);
-#endif /* !HAVE_HILDON */
 
   g_free (game_name);
 
@@ -453,10 +447,8 @@ games_conf_finalize (GObject *object)
   GamesConf *conf = GAMES_CONF (object);
   GamesConfPrivate *priv = conf->priv;
 
-#ifndef HAVE_HILDON
   /* Save the accel map */
   games_conf_save_accel_map (conf);
-#endif /* !HAVE_HILDON */
 
 #ifdef HAVE_GNOME
   gconf_client_remove_dir (priv->gconf_client, priv->base_path, NULL);
diff --git a/libgames-support/games-frame.c b/libgames-support/games-frame.c
index 7fe2123..cf0ebb8 100644
--- a/libgames-support/games-frame.c
+++ b/libgames-support/games-frame.c
@@ -22,10 +22,7 @@
 #include <gtk/gtk.h>
 
 #include "games-frame.h"
-
-#ifndef HAVE_HILDON
 #include "games-atk-utils.h"
-#endif
 
 enum {
   PROP_0,
@@ -81,10 +78,8 @@ games_frame_add (GtkContainer *container,
 
   gtk_container_add (GTK_CONTAINER (frame->priv->alignment), child);
 
-#ifndef HAVE_HILDON
   games_atk_util_add_atk_relation (frame->priv->label, child, ATK_RELATION_LABEL_FOR);
   games_atk_util_add_atk_relation (child, frame->priv->label, ATK_RELATION_LABELLED_BY);
-#endif
 }
 
 static void
diff --git a/libgames-support/games-runtime.c b/libgames-support/games-runtime.c
index f24ad4d..ce2f4c8 100644
--- a/libgames-support/games-runtime.c
+++ b/libgames-support/games-runtime.c
@@ -39,10 +39,6 @@
 
 #include "games-runtime.h"
 
-#ifdef HAVE_HILDON
-static osso_context_t *osso_context;
-#endif
-
 #if defined(G_OS_WIN32) && !defined(ENABLE_BINRELOC)
 #error binreloc must be enabled on win32
 #endif
@@ -348,50 +344,6 @@ games_runtime_init (const char *name)
   return retval;
 }
 
-#ifdef HAVE_HILDON
-
-/**
- * games_runtime_init_with_osso:
- *
- * Like games_runtime_init(), but also initialises the osso context.
- *
- * NOTE: This must be called before using ANY other glib/gtk/etc function!
- * 
- * Returns: %TRUE iff initialisation succeeded
- */
-gboolean
-games_runtime_init_with_osso (const char *name,
-                              const char *service_name)
-{
-  if (!games_runtime_init (name))
-    return FALSE;
-
-  osso_context = osso_initialize (service_name, VERSION, FALSE, NULL);
-  if (osso_context == NULL) {
-    g_printerr ("Failed to initialise osso\n");
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-/**
- * games_runtime_get_osso_context:
- *
- * Returns the osso context. May only be called after
- * games_runtime_init_with_osso().
- *
- * Returns: a #osso_context_t
- */
-osso_context_t*
-games_runtime_get_osso_context (void)
-{
-  g_assert (osso_context != NULL);
-  return osso_context;
-}
-
-#endif /* HAVE_HILDON */
-
 /**
  * games_runtime_shutdown:
  *
@@ -409,13 +361,6 @@ games_runtime_shutdown (void)
 
   g_free (app_name);
   app_name = NULL;
-
-#ifdef HAVE_HILDON
-  if (osso_context != NULL) {
-    osso_deinitialize (osso_context);
-    osso_context = NULL;
-  }
-#endif /* HAVE_HILDON */
 }
 
 /**
diff --git a/libgames-support/games-runtime.h b/libgames-support/games-runtime.h
index 9eebe67..6458225 100644
--- a/libgames-support/games-runtime.h
+++ b/libgames-support/games-runtime.h
@@ -21,10 +21,6 @@
 
 #include <glib.h>
 
-#ifdef HAVE_HILDON
-#include <libosso.h>
-#endif
-
 G_BEGIN_DECLS
 
 typedef enum {
@@ -62,11 +58,6 @@ typedef enum {
 } GamesRuntimeDirectory;
 
 gboolean        games_runtime_init             (const char *name);
-#ifdef HAVE_HILDON
-gboolean        games_runtime_init_with_osso   (const char *name,
-                                                const char *service_name);
-osso_context_t* games_runtime_get_osso_context (void);
-#endif /* HAVE_HILDON */
 void            games_runtime_shutdown         (void);
 const char     *games_runtime_get_directory    (GamesRuntimeDirectory directory);
 char           *games_runtime_get_file         (GamesRuntimeDirectory directory,
diff --git a/libgames-support/games-settings.c b/libgames-support/games-settings.c
index 09d220e..084bb23 100644
--- a/libgames-support/games-settings.c
+++ b/libgames-support/games-settings.c
@@ -107,7 +107,7 @@ window_state_event_cb (GtkWidget *widget,
   return FALSE;
 }
 
-#if 0 //#ifndef HAVE_HILDON
+#if 0
 
 #define ACCELMAP_EXT "accels"
 
@@ -190,7 +190,7 @@ games_conf_save_accel_map (GamesConf *conf)
   g_free (conf_file);
 }
 
-#endif /* !HAVE_HILDON */
+#endif /* 0 */
 
 typedef struct {
   guint keyval;
diff --git a/libgames-support/games-show.c b/libgames-support/games-show.c
index 0500b3e..5cf172b 100644
--- a/libgames-support/games-show.c
+++ b/libgames-support/games-show.c
@@ -22,14 +22,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#ifdef HAVE_MAEMO
-#ifdef HAVE_MAEMO_3
-#include <osso-browser-interface.h>
-#else
-#include <tablet-browser-interface.h>
-#endif /* HAVE_MAEMO_3 */
-#endif /* HAVE_MAEMO */
-
 #ifdef G_OS_WIN32
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
@@ -60,16 +52,6 @@ games_show_uri (GdkScreen *screen,
                 guint32 timestamp,
                 GError **error)
 {
-#ifdef HAVE_MAEMO
-  osso_rpc_run_with_defaults (games_runtime_get_osso_context (),
-                              "osso_browser",
-                              OSSO_BROWSER_OPEN_NEW_WINDOW_REQ,
-                              NULL,
-                              DBUS_TYPE_STRING, uri,
-                              DBUS_TYPE_INVALID);
-  return TRUE;
-#else
-
 #ifdef G_OS_WIN32
   ShellExecute (NULL, "open", uri, NULL, NULL, SW_SHOWNORMAL);
   return TRUE;
@@ -77,7 +59,6 @@ games_show_uri (GdkScreen *screen,
 
   return gtk_show_uri (screen, uri, timestamp, error);
 #endif /* G_OS_WIN32 */
-#endif /* HAVE_MAEMO */
 }
 
 /**
@@ -113,13 +94,7 @@ games_show_error (GtkWidget *window,
 
   gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                                             "%s", error->message);
-
-#ifdef HAVE_HILDON
-  /* Empty title shows up as "<unnamed>" on maemo */
-  gtk_window_set_title (GTK_WINDOW (dialog), _("Error"));
-#else
   gtk_window_set_title (GTK_WINDOW (dialog), "");
-#endif /* HAVE_HILDON */
 
   g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
 
diff --git a/libgames-support/games-stock.c b/libgames-support/games-stock.c
index 6b011d0..d932d91 100644
--- a/libgames-support/games-stock.c
+++ b/libgames-support/games-stock.c
@@ -31,8 +31,6 @@
 
 #include "games-stock.h"
 
-#ifndef HAVE_HILDON
-
 typedef struct {
   const char *stock_id;
   const char *tooltip;
@@ -164,13 +162,6 @@ games_stock_prepare_for_statusbar_tooltips (GtkUIManager * ui_manager,
                     G_CALLBACK (disconnect_proxy_cb), statusbar);
 }
 
-#endif /* !HAVE_HILDON */
-
-/* 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,
@@ -219,8 +210,6 @@ register_stock_icon_bidi (GtkIconFactory * icon_factory,
   gtk_icon_set_unref (set);
 }
 
-#endif /* HAVE_GTK_ICON_FACTORY_ADD_ALIAS */
-
 void
 games_stock_init (void)
 {
@@ -236,63 +225,44 @@ games_stock_init (void)
     { GAMES_STOCK_FULLSCREEN,       GTK_STOCK_FULLSCREEN },
     /* This is used on maemo 5 */
     { GAMES_STOCK_LEAVE_FULLSCREEN, GTK_STOCK_LEAVE_FULLSCREEN },
-#ifdef HAVE_GTK_ICON_FACTORY_ADD_ALIAS
-    { GAMES_STOCK_REDO_MOVE,        GTK_STOCK_REDO },
-    { GAMES_STOCK_UNDO_MOVE,        GTK_STOCK_UNDO },
-#ifndef HAVE_HILDON
-    { GAMES_STOCK_RESUME_GAME,      GTK_STOCK_MEDIA_PLAY },
-#endif /* HAVE_HILDON */
-#endif
-#ifndef HAVE_HILDON
     { GAMES_STOCK_NETWORK_GAME,     GTK_STOCK_NETWORK },
     { GAMES_STOCK_NETWORK_LEAVE,    GTK_STOCK_STOP },
     { GAMES_STOCK_PLAYER_LIST,      GTK_STOCK_INFO },
 
     { GAMES_STOCK_PAUSE_GAME,       GTK_STOCK_MEDIA_PAUSE },
-#endif /* !HAVE_HILDON */
   };
 
-#ifndef HAVE_GTK_ICON_FACTORY_ADD_ALIAS
   const char *stock_icon_aliases_bidi[][3] = {
     { GAMES_STOCK_REDO_MOVE, GTK_STOCK_REDO "-ltr", GTK_STOCK_REDO "-rtl" },
     { GAMES_STOCK_UNDO_MOVE, GTK_STOCK_UNDO "-ltr", GTK_STOCK_UNDO "-rtl" },
     { GAMES_STOCK_RESUME_GAME, GTK_STOCK_MEDIA_PLAY "-ltr", GTK_STOCK_MEDIA_PLAY "-rtl" },
   };
-#endif
 
   /* Private icon names */
   const char *private_icon_names[][2] = {
-#ifndef HAVE_HILDON
     { GAMES_STOCK_TELEPORT, "teleport" },
     { GAMES_STOCK_RTELEPORT, "teleport-random" },
     { GAMES_STOCK_SCORES, "scores" },
-#endif /* !HAVE_HILDON */
     { GAMES_STOCK_DEAL_CARDS, "cards-deal" }
   };
 
 /* Use different accels on GTK/GNOME and Maemo */
-#ifdef HAVE_HILDON
-#define STOCK_ACCEL(normal,hildon) (hildon)
-#else
-#define STOCK_ACCEL(normal,hildon) (normal)
-#endif
 
   static const GtkStockItem games_stock_items[] = {
-    { GAMES_STOCK_CONTENTS,         N_("_Contents"),          0, STOCK_ACCEL (GDK_KEY_F1, 0), NULL },
-    { GAMES_STOCK_FULLSCREEN,       N_("_Fullscreen"),        0, STOCK_ACCEL (GDK_KEY_F11, GDK_KEY_F6), NULL },
-    { GAMES_STOCK_HINT,             N_("_Hint"),              STOCK_ACCEL (GDK_CONTROL_MASK, 0), STOCK_ACCEL ('h', GDK_KEY_Return), NULL },
+    { GAMES_STOCK_CONTENTS,         N_("_Contents"),          0, GDK_KEY_F1, NULL },
+    { GAMES_STOCK_FULLSCREEN,       N_("_Fullscreen"),        0, GDK_KEY_F11, NULL },
+    { GAMES_STOCK_HINT,             N_("_Hint"),              GDK_CONTROL_MASK, 'h', NULL },
     /* Translators: This "_New" is for the menu item 'Game->New', implies "New Game" */
-    { GAMES_STOCK_NEW_GAME,         N_("_New"),               STOCK_ACCEL (GDK_CONTROL_MASK, 0), STOCK_ACCEL ('n', 0), NULL },
+    { GAMES_STOCK_NEW_GAME,         N_("_New"),               GDK_CONTROL_MASK, 'n', NULL },
     /* Translators: This "_New Game" is for the game-over dialogue */
     { GAMES_STOCK_START_NEW_GAME,   N_("_New Game"),          0, 0, NULL },
-    { GAMES_STOCK_REDO_MOVE,        N_("_Redo Move"),         STOCK_ACCEL (GDK_CONTROL_MASK | GDK_SHIFT_MASK, 0), STOCK_ACCEL ('z', GDK_KEY_F7), NULL },
+    { GAMES_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 */
     { GAMES_STOCK_RESET,            N_("_Reset"),             0, 0, NULL },
     /* Translators: "_Restart" is the menu item 'Game->Restart', implies "Restart Game" */
     { GAMES_STOCK_RESTART_GAME,     N_("_Restart"),           0, 0, NULL },
-    { GAMES_STOCK_UNDO_MOVE,        N_("_Undo Move"),         STOCK_ACCEL (GDK_CONTROL_MASK, 0), STOCK_ACCEL ('z', GDK_KEY_F8), NULL },
+    { GAMES_STOCK_UNDO_MOVE,        N_("_Undo Move"),         GDK_CONTROL_MASK, 'z', NULL },
     { GAMES_STOCK_DEAL_CARDS,       N_("_Deal"),              GDK_CONTROL_MASK, 'd', NULL },
-#ifndef HAVE_HILDON
     { GAMES_STOCK_LEAVE_FULLSCREEN, N_("_Leave Fullscreen"),  0, GDK_KEY_F11, NULL },
     { GAMES_STOCK_NETWORK_GAME,     N_("Network _Game"),      GDK_CONTROL_MASK, 'g', NULL },
     { GAMES_STOCK_NETWORK_LEAVE,    N_("L_eave Game"),        GDK_CONTROL_MASK, 'e', NULL },
@@ -301,32 +271,13 @@ games_stock_init (void)
     { GAMES_STOCK_RESUME_GAME,      N_("Res_ume"),            0, GDK_KEY_Pause, NULL },
     { GAMES_STOCK_SCORES,           N_("_Scores"),            0, 0, NULL },
     { GAMES_STOCK_END_GAME,         N_("_End Game"),          0, 0, NULL },
-#endif
-
-#ifdef HAVE_MAEMO_3
-    /* Work around maemo brokenness wrt. stock item translations.
-     * See https://bugs.maemo.org/show_bug.cgi?id=1449 . */
-    { GTK_STOCK_ABOUT,              N_("_About"),             0, 0, NULL },
-    { GTK_STOCK_CANCEL,             N_("_Cancel"),            0, 0, NULL },
-    { GTK_STOCK_CLOSE,              N_("_Close"),             0, 0, NULL },
-    { GTK_STOCK_OK,                 N_("_OK"),                0, 0, NULL },
-#endif /* HAVE_MAEMO_3 */
   };
 
-#undef STOCK_ACCEL
-
   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],
@@ -339,7 +290,6 @@ games_stock_init (void)
                               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++) {



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