gnome-games r8205 - in trunk: blackjack/src glines gnect/src gnibbles gnobots2 gnometris gnomine gnotravex gnotski gtali iagno libgames-support mahjongg same-gnome



Author: thomashpa
Date: Mon Oct 27 00:16:13 2008
New Revision: 8205
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8205&view=rev

Log:
move common help functionality to libgames-support/games-help.[ch]

Added:
   trunk/libgames-support/games-help.c
   trunk/libgames-support/games-help.h
Modified:
   trunk/blackjack/src/menu.cpp
   trunk/glines/glines.c
   trunk/gnect/src/main.c
   trunk/gnibbles/main.c
   trunk/gnobots2/menu.c
   trunk/gnometris/tetris.cpp
   trunk/gnomine/gnomine.c
   trunk/gnotravex/gnotravex.c
   trunk/gnotski/gnotski.c
   trunk/gtali/gyahtzee.c
   trunk/iagno/gnothello.c
   trunk/libgames-support/Makefile.am
   trunk/mahjongg/mahjongg.c
   trunk/same-gnome/ui.c

Modified: trunk/blackjack/src/menu.cpp
==============================================================================
--- trunk/blackjack/src/menu.cpp	(original)
+++ trunk/blackjack/src/menu.cpp	Mon Oct 27 00:16:13 2008
@@ -29,7 +29,8 @@
 
 using namespace std;
 
-#include <games-stock.h>
+#include <libgames-support/games-help.h>
+#include <libgames-support/games-stock.h>
 
 #include "blackjack.h"
 #include "menu.h"
@@ -126,27 +127,7 @@
 on_help_contents_activate (GtkAction *action,
                            gpointer   data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (toplevel_window));
-  gtk_show_uri (screen, "ghelp:blackjack", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-
-    d = gtk_message_dialog_new (GTK_WINDOW (toplevel_window), 
-                              (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display(toplevel_window, "blackjack", NULL);
 }
 
 void

Modified: trunk/glines/glines.c
==============================================================================
--- trunk/glines/glines.c	(original)
+++ trunk/glines/glines.c	Mon Oct 27 00:16:13 2008
@@ -39,6 +39,7 @@
 #include <libgames-support/games-files.h>
 #include <libgames-support/games-frame.h>
 #include <libgames-support/games-gridframe.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-preimage.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-scores.h>
@@ -1565,26 +1566,7 @@
 static void
 game_help_callback (GtkAction * action, gpointer data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (app));
-  gtk_show_uri (screen, "ghelp:glines", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (app), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (app, "glines", NULL);
 }
 
 static int

Modified: trunk/gnect/src/main.c
==============================================================================
--- trunk/gnect/src/main.c	(original)
+++ trunk/gnect/src/main.c	Mon Oct 27 00:16:13 2008
@@ -30,6 +30,7 @@
 
 #include <libgames-support/games-conf.h>
 #include <libgames-support/games-gridframe.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-sound.h>
 #include <libgames-support/games-stock.h>
@@ -932,26 +933,7 @@
 static void
 on_help_contents (GtkAction * action, gpointer data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (app));
-  gtk_show_uri (screen, "ghelp:gnect", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (app), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (app, "gnect", NULL);
 }
 
 

Modified: trunk/gnibbles/main.c
==============================================================================
--- trunk/gnibbles/main.c	(original)
+++ trunk/gnibbles/main.c	Mon Oct 27 00:16:13 2008
@@ -30,6 +30,7 @@
 
 #include <libgames-support/games-conf.h>
 #include <libgames-support/games-gridframe.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-scores.h>
 #include <libgames-support/games-sound.h>
@@ -771,26 +772,7 @@
 static void
 help_cb (GtkAction * action, gpointer data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (window));
-  gtk_show_uri (screen, "ghelp:gnibbles", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (window), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (window, "gnibbles", NULL);
 }
 
 static const GtkActionEntry action_entry[] = {

Modified: trunk/gnobots2/menu.c
==============================================================================
--- trunk/gnobots2/menu.c	(original)
+++ trunk/gnobots2/menu.c	Mon Oct 27 00:16:13 2008
@@ -26,6 +26,7 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-stock.h>
 #include <libgames-support/games-scores.h>
 #include <libgames-support/games-scores-dialog.h>
@@ -237,26 +238,7 @@
 static void
 help_cb (GtkAction * action, gpointer data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (app));
-  gtk_show_uri (screen, "ghelp:gnobots2", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (app), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (app, "gnobots2", NULL);
 }
 
 

Modified: trunk/gnometris/tetris.cpp
==============================================================================
--- trunk/gnometris/tetris.cpp	(original)
+++ trunk/gnometris/tetris.cpp	Mon Oct 27 00:16:13 2008
@@ -34,6 +34,7 @@
 
 #include <libgames-support/games-controls.h>
 #include <libgames-support/games-frame.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-sound.h>
 #include <libgames-support/games-stock.h>
@@ -1316,28 +1317,8 @@
 int
 Tetris::gameHelp(GtkAction *action, void *data)
 {
-	GdkScreen *screen;
-	GError *error = NULL;
 	Tetris *t = (Tetris*) data;
-
-	screen = gtk_widget_get_screen (GTK_WIDGET (t->getWidget()));
-	gtk_show_uri (screen, "ghelp:gnometris", gtk_get_current_event_time (), &error);
-
-	if (error != NULL)
-	{
-		GtkWidget *d;
-		d = gtk_message_dialog_new (GTK_WINDOW (t->getWidget()), 
-				(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
-				GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-				"%s", _("Unable to open help file"));
-		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-				"             %s", error->message);
-		g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-		gtk_window_present (GTK_WINDOW (d));
-
-		g_error_free (error);
-	}
-
+	games_help_display(t->getWidget(), "gnometris", NULL);
 	return TRUE;
 }
 

Modified: trunk/gnomine/gnomine.c
==============================================================================
--- trunk/gnomine/gnomine.c	(original)
+++ trunk/gnomine/gnomine.c	Mon Oct 27 00:16:13 2008
@@ -34,6 +34,7 @@
 #include <libgames-support/games-clock.h>
 #include <libgames-support/games-conf.h>
 #include <libgames-support/games-frame.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-scores.c>
 #include <libgames-support/games-scores-dialog.h>
@@ -806,26 +807,7 @@
 static void
 help_callback (void)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (window));
-  gtk_show_uri (screen, "ghelp:gnomine", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (window), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (window, "gnomine", NULL);
 }
 
 const GtkActionEntry actions[] = {

Modified: trunk/gnotravex/gnotravex.c
==============================================================================
--- trunk/gnotravex/gnotravex.c	(original)
+++ trunk/gnotravex/gnotravex.c	Mon Oct 27 00:16:13 2008
@@ -32,6 +32,7 @@
 
 #include <libgames-support/games-clock.h>
 #include <libgames-support/games-conf.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-scores.h>
 #include <libgames-support/games-scores-dialog.h>
 #include <libgames-support/games-runtime.h>
@@ -1884,26 +1885,7 @@
 void
 help_cb (GtkAction * action, gpointer data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (window));
-  gtk_show_uri (screen, "ghelp:gnotravex", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (window), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (window, "gnotravex", NULL);
 }
 
 void

Modified: trunk/gnotski/gnotski.c
==============================================================================
--- trunk/gnotski/gnotski.c	(original)
+++ trunk/gnotski/gnotski.c	Mon Oct 27 00:16:13 2008
@@ -30,6 +30,7 @@
 
 #include <libgames-support/games-conf.h>
 #include <libgames-support/games-gridframe.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-preimage.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-scores.h>
@@ -1537,26 +1538,7 @@
 void
 help_cb (GtkAction * action)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (window));
-  gtk_show_uri (screen, "ghelp:gnotski", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (window), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (window, "gnotski", NULL);
 }
 
 void

Modified: trunk/gtali/gyahtzee.c
==============================================================================
--- trunk/gtali/gyahtzee.c	(original)
+++ trunk/gtali/gyahtzee.c	Mon Oct 27 00:16:13 2008
@@ -44,6 +44,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
+#include <games-help.h>
 #include <games-stock.h>
 #include <games-scores.h>
 #include <games-scores-dialog.h>
@@ -698,26 +699,7 @@
 static void
 help_cb (GtkAction * action, gpointer data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (window));
-  gtk_show_uri (screen, "ghelp:gtali", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (window), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (window, "gtali", NULL);
 }
 
 

Modified: trunk/iagno/gnothello.c
==============================================================================
--- trunk/iagno/gnothello.c	(original)
+++ trunk/iagno/gnothello.c	Mon Oct 27 00:16:13 2008
@@ -32,6 +32,7 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 #include <libgames-support/games-conf.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-sound.h>
 #include <libgames-support/games-stock.h>
@@ -767,26 +768,7 @@
 static void
 help_cb (GtkAction * action, gpointer data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (window));
-  gtk_show_uri (screen, "ghelp:iagno", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (window), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (window, APP_NAME, NULL);
 }
 
 static const GtkActionEntry actions[] = {

Modified: trunk/libgames-support/Makefile.am
==============================================================================
--- trunk/libgames-support/Makefile.am	(original)
+++ trunk/libgames-support/Makefile.am	Mon Oct 27 00:16:13 2008
@@ -34,6 +34,8 @@
 	games-conf.h			\
 	games-files.c			\
 	games-files.h			\
+	games-help.c			\
+	games-help.h			\
 	games-pixbuf-utils.c		\
 	games-pixbuf-utils.h		\
 	games-runtime.c			\

Added: trunk/libgames-support/games-help.c
==============================================================================
--- (empty file)
+++ trunk/libgames-support/games-help.c	Mon Oct 27 00:16:13 2008
@@ -0,0 +1,68 @@
+/*
+ *  Copyright  2008 Thomas H.P. Andersen <phomes gmail com>
+ *
+ *  This runtime is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation; either version 2.1, or (at your option)
+ *  any later version.
+ *
+ *  This runtime is distributed in the hope runtime it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this runtime; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "games-help.h"
+
+/**
+ * games_help_display:
+ *
+ * Opens help or displays error dialog when unable to open help.
+ *
+ * @window: toplevel window
+ * @application: name used for the help file
+ * @section: section to open. NULL if not used.
+ *
+ */
+void
+games_help_display (GtkWidget *window,
+                    const char *app_name,
+                    const char *section)
+{
+
+  GdkScreen *screen;
+  GError *error = NULL;
+  char *help_string;
+
+  screen = gtk_widget_get_screen (GTK_WIDGET (window));
+
+  help_string = g_strconcat("ghelp:", app_name, "?", section, NULL);
+
+  gtk_show_uri (screen, help_string, gtk_get_current_event_time (), &error);
+
+  if (error != NULL)
+  {
+    GtkWidget *d;
+    d = gtk_message_dialog_new (GTK_WINDOW (window), 
+                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
+                              "%s", _("Unable to open help file"));
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
+                              "             %s", error->message);
+    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+    gtk_window_present (GTK_WINDOW (d));
+
+    g_error_free (error);
+  }
+  g_free(help_string);
+
+}

Added: trunk/libgames-support/games-help.h
==============================================================================
--- (empty file)
+++ trunk/libgames-support/games-help.h	Mon Oct 27 00:16:13 2008
@@ -0,0 +1,32 @@
+/*
+ *  Copyright  2008 Thomas H.P. Andersen <phomes gmail com>
+ *
+ *  This runtime is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation; either version 2.1, or (at your option)
+ *  any later version.
+ *
+ *  This runtime is distributed in the hope runtime it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this runtime; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GAMES_HELP_H
+#define GAMES_HELP_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+void games_help_display (GtkWidget *window,
+                         const char *app_name,
+                         const char *section);
+
+G_END_DECLS
+
+#endif /* !GAMES_HELP_H */

Modified: trunk/mahjongg/mahjongg.c
==============================================================================
--- trunk/mahjongg/mahjongg.c	(original)
+++ trunk/mahjongg/mahjongg.c	Mon Oct 27 00:16:13 2008
@@ -28,6 +28,7 @@
 #include <libgames-support/games-clock.h>
 #include <libgames-support/games-conf.h>
 #include <libgames-support/games-frame.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-stock.h>
 #include <libgames-support/games-scores.h>
 #include <libgames-support/games-scores-dialog.h>
@@ -1257,26 +1258,7 @@
 static void
 help_cb (GtkAction * action, gpointer data)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (window));
-  gtk_show_uri (screen, "ghelp:mahjongg", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (window), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (window, APPNAME, NULL);
 }
 
 static const GtkActionEntry actions[] = {

Modified: trunk/same-gnome/ui.c
==============================================================================
--- trunk/same-gnome/ui.c	(original)
+++ trunk/same-gnome/ui.c	Mon Oct 27 00:16:13 2008
@@ -14,6 +14,7 @@
 #include <libgames-support/games-conf.h>
 #include <libgames-support/games-files.h>
 #include <libgames-support/games-gridframe.h>
+#include <libgames-support/games-help.h>
 #include <libgames-support/games-scores-dialog.h>
 #include <libgames-support/games-stock.h>
 
@@ -439,26 +440,7 @@
 static void
 help_cb (void)
 {
-  GdkScreen *screen;
-  GError *error = NULL;
-
-  screen = gtk_widget_get_screen (GTK_WIDGET (application));
-  gtk_show_uri (screen, "ghelp:same-gnome", gtk_get_current_event_time (), &error);
-
-  if (error != NULL)
-  {
-    GtkWidget *d;
-    d = gtk_message_dialog_new (GTK_WINDOW (application), 
-                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                              GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, 
-                              "%s", _("Unable to open help file"));
-    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
-                              "             %s", error->message);
-    g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-    gtk_window_present (GTK_WINDOW (d));
-
-    g_error_free (error);
-  }
+  games_help_display (application, "same-gnome", NULL);
 }
 
 /* FIXME: Will we ever want this ? */



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