[libslab] Use gtk_show_uri() instead of gnome_url_show() in libslab-util.c



commit 3802682a5b337ccda08ee3d545d29b45768c9faa
Author: Federico Mena Quintero <federico novell com>
Date:   Mon Jun 29 12:28:44 2009 -0500

    Use gtk_show_uri() instead of gnome_url_show() in libslab-util.c
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 libslab/libslab-utils.c |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/libslab/libslab-utils.c b/libslab/libslab-utils.c
index 417eb40..5fe4314 100644
--- a/libslab/libslab-utils.c
+++ b/libslab/libslab-utils.c
@@ -12,7 +12,7 @@
 #include <sys/resource.h>
 #include <sys/time.h>
 #include <gconf/gconf-value.h>
-#include <libgnome/gnome-url.h>
+#include <gtk/gtk.h>
 
 #define DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG "TerminalEmulator"
 #define ALTERNATE_DOCPATH_KEY               "DocPath"
@@ -180,6 +180,29 @@ libslab_gnome_desktop_item_get_docpath (GnomeDesktopItem *item)
 	return path;
 }
 
+/* Ugh, here we don't have knowledge of the screen that is being used.  So, do
+ * what we can to find it.
+ */
+static GdkScreen *
+get_screen (void)
+{
+	GdkEvent *event;
+	GdkScreen *screen = NULL;
+
+	event = gtk_get_current_event ();
+	if (event) {
+		if (event->any.window)
+			screen = gdk_drawable_get_screen (GDK_DRAWABLE (event->any.window));
+
+		gdk_event_free (event);
+	}
+
+	if (!screen)
+		screen = gdk_screen_get_default ();
+
+	return screen;
+}
+
 gboolean
 libslab_gnome_desktop_item_open_help (GnomeDesktopItem *item)
 {
@@ -199,9 +222,7 @@ libslab_gnome_desktop_item_open_help (GnomeDesktopItem *item)
 	if (doc_path) {
 		help_uri = g_strdup_printf ("ghelp:%s", doc_path);
 
-		gnome_url_show (help_uri, & error);
-
-		if (error) {
+		if (!gtk_show_uri (get_screen (), help_uri, gtk_get_current_event_time (), &error)) {
 			g_warning ("error opening %s [%s]\n", help_uri, error->message);
 
 			g_error_free (error);



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