[planner] Use gtk_show_uri instead of gnome_help_display and gnome_url_show



commit cae485d1d4dcc14544dd3cf664dbb29e63e91e40
Author: Javier Jardón <jjardon gnome org>
Date:   Sun Mar 21 20:51:29 2010 +0100

    Use gtk_show_uri instead of gnome_help_display and gnome_url_show
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=584009

 configure.in              |    2 +-
 src/Makefile.win32        |    1 -
 src/planner-html-plugin.c |    2 +-
 src/planner-util-win32.c  |   70 ---------------------------------------------
 src/planner-util.c        |   25 +++++++++------
 src/planner-util.h        |    6 ++--
 src/planner-window.c      |   19 +-----------
 7 files changed, 22 insertions(+), 103 deletions(-)
---
diff --git a/configure.in b/configure.in
index 1c5d2ea..7a33f67 100644
--- a/configure.in
+++ b/configure.in
@@ -67,7 +67,7 @@ dnl If you add a version number here, you *must* add an AC_SUBST line for
 dnl it too, or it will never make it into the spec file!
 
 GLIB_REQUIRED=2.6.0
-GTK_REQUIRED=2.10.0
+GTK_REQUIRED=2.14.0
 LIBGNOMECANVAS_REQUIRED=2.10.0
 LIBGNOMEUI_REQUIRED=2.10.0
 LIBGLADE_REQUIRED=2.3.0
diff --git a/src/Makefile.win32 b/src/Makefile.win32
index b2f0766..11b27e6 100644
--- a/src/Makefile.win32
+++ b/src/Makefile.win32
@@ -82,7 +82,6 @@ C_SRC = \
 	planner-task-date-widget.c	\
 	planner-task-dialog.c		\
 	planner-task-input-dialog.c	\
-	planner-util-win32.c		\
 	planner-view.c			\
 	planner-window.c		\
 	planner-working-time-dialog.c	\
diff --git a/src/planner-html-plugin.c b/src/planner-html-plugin.c
index 3ebd6d5..aa9c9b1 100644
--- a/src/planner-html-plugin.c
+++ b/src/planner-html-plugin.c
@@ -56,7 +56,7 @@ html_plugin_show_url (PlannerPlugin *plugin, const char *path)
 	gchar *url;
 
 	url = g_filename_to_uri (path, NULL, NULL);
-	planner_util_show_url (url, NULL);
+	planner_util_show_url (NULL, url);
 	g_free (url);
 }
 
diff --git a/src/planner-util.c b/src/planner-util.c
index dfae941..8a7588a 100644
--- a/src/planner-util.c
+++ b/src/planner-util.c
@@ -19,19 +19,24 @@
  */
 
 #include <config.h>
-#include <libgnome/gnome-url.h>
-#include <libgnome/gnome-help.h>
 
 #include "planner-util.h"
 
-gboolean
-planner_util_show_url (const gchar *url, GError **error)
+void
+planner_util_show_url (GtkWindow *parent, const gchar *url)
 {
-	return gnome_url_show (url, error);
-}
+	GtkWidget *dialog;
+	GError    *error = NULL;
 
-gboolean
-planner_util_show_help (GError **error)
-{
-	return gnome_help_display ("planner.xml", NULL, error);
+	gtk_show_uri (NULL, url, gtk_get_current_event_time (), &error);
+	if (error != NULL) {
+		dialog = gtk_message_dialog_new (parent,
+		                                 GTK_DIALOG_DESTROY_WITH_PARENT,
+		                                 GTK_MESSAGE_ERROR,
+		                                 GTK_BUTTONS_CLOSE,
+		                                 "%s", error->message);
+		gtk_dialog_run (GTK_DIALOG (dialog));
+		gtk_widget_destroy (dialog);
+		g_error_free (error);
+	}
 }
diff --git a/src/planner-util.h b/src/planner-util.h
index aa6a1f8..64f7ce9 100644
--- a/src/planner-util.h
+++ b/src/planner-util.h
@@ -21,11 +21,11 @@
 #ifndef __PLANNER_UTIL_H__
 #define __PLANNER_UTIL_H__
 
+#include <gtk/gtk.h>
 #include <glib.h>
 
-gboolean planner_util_show_url  (const gchar  *url,
-				 GError      **error);
-gboolean planner_util_show_help (GError      **error);
+void planner_util_show_url  (GtkWindow    *parent,
+                             const gchar  *url);
 
 #endif /* __PLANNER_UTIL_H__ */
 
diff --git a/src/planner-window.c b/src/planner-window.c
index d5f0a9f..8b81102 100644
--- a/src/planner-window.c
+++ b/src/planner-window.c
@@ -1158,22 +1158,7 @@ static void
 window_help_cb (GtkAction *action,
 		gpointer   data)
 {
-	GError    *error = NULL;
-	GtkWidget *dialog;
-
-	if (!planner_util_show_help (&error)) {
-		dialog = gtk_message_dialog_new (GTK_WINDOW (data),
-						 GTK_DIALOG_MODAL |
-						 GTK_DIALOG_DESTROY_WITH_PARENT,
-						 GTK_MESSAGE_ERROR,
-						 GTK_BUTTONS_OK,
-						 "%s", error->message);
-		gtk_widget_show (dialog);
-
-		gtk_dialog_run (GTK_DIALOG (dialog));
-		gtk_widget_destroy (dialog);
-		g_error_free (error);
-	}
+	planner_util_show_url (NULL, "ghelp:planner");
 }
 
 static  void
@@ -1194,7 +1179,7 @@ handle_links (GtkAboutDialog *about,
 		g_assert_not_reached ();
 	}
 
-	planner_util_show_url (newlink, NULL);
+	planner_util_show_url (NULL, newlink);
 	g_free (newlink);
 }
 



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