[dia] Bug # - Replace gnome_help_display() with gtk_show_uri()



commit 41ec6eafc42ce0302f6ed83d87af678ad476c24d
Author: Hans Breuer <hans breuer org>
Date:   Fri Oct 23 13:48:19 2009 +0200

    Bug # - Replace gnome_help_display() with gtk_show_uri()
    
    From: Heikki Paajanen <hepaajan iki fi>
    Date: Tue, 9 Jun 2009 13:58:52 +0300
    Subject: [PATCH] Replace use of gnome_help_display and launching
    browser/xdg-open with gtk_show_uri

 app/commands.c |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/app/commands.c b/app/commands.c
index 93a88d7..19614e5 100644
--- a/app/commands.c
+++ b/app/commands.c
@@ -26,12 +26,6 @@
 #include <sys/types.h>
 #include <math.h>
 #include <glib.h>
-
-#ifdef HAVE_GNOME
-#undef GTK_DISABLE_DEPRECATED
-#  include <gnome.h> 	 
-#endif 	 
-
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gtk/gtk.h>
 
@@ -630,14 +624,20 @@ edit_redo_callback (GtkAction *action)
 void
 help_manual_callback (GtkAction *action)
 {
-#ifdef HAVE_GNOME
-  gnome_help_display("dia", NULL, NULL);
-#else
   char *helpdir, *helpindex = NULL, *command;
   guint bestscore = G_MAXINT;
   GDir *dp;
   const char *dentry;
   GError *error = NULL;
+#if GTK_CHECK_VERSION(2,14,0)
+  GdkScreen *screen;
+  DDisplay *ddisp;
+  ddisp = ddisplay_active();
+  screen = gtk_widget_get_screen (GTK_WIDGET(ddisp->menu_bar));
+  if (gtk_show_uri(screen, "ghelp:dia", gtk_get_current_event_time (), NULL)) {
+    return;
+  }
+#endif
 
   helpdir = dia_get_data_directory("help");
   if (!helpdir) {
@@ -687,14 +687,18 @@ help_manual_callback (GtkAction *action)
 # define SW_SHOWNORMAL 1
   ShellExecuteA (0, "open", helpindex, NULL, helpdir, SW_SHOWNORMAL);
 #else
+# if GTK_CHECK_VERSION(2,14,0)
+  command = g_strdup_printf("file://%s", helpindex);
+  gtk_show_uri(screen, command, gtk_get_current_event_time (), NULL);
+# else
   command = getenv("BROWSER");
   command = g_strdup_printf("%s 'file://%s' &", command ? command : "xdg-open", helpindex);
+# endif
   system(command);
   g_free(command);
 #endif
 
   g_free(helpindex);
-#endif
 }
 
 static void 
@@ -705,10 +709,16 @@ activate_url (GtkAboutDialog *about,
 #ifdef G_OS_WIN32
   ShellExecuteA (0, "open", link, NULL, NULL, SW_SHOWNORMAL);
 #else
+# if GTK_CHECK_VERSION(2,14,0)
+  GdkScreen *screen;
+  screen = gtk_widget_get_screen (GTK_WIDGET(about));
+  gtk_show_uri(screen, link, gtk_get_current_event_time (), NULL);
+# else
   gchar *command = getenv("BROWSER");
   command = g_strdup_printf("%s '%s' &", command ? command : "xdg-open", link);
   system(command);
   g_free(command);
+# endif
 #endif
 }
 



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