[dasher] Remove gnome_help_display_desktop and use gtk_show_uri if it exists



commit ad877a9128a119e78fe7ec06c0d146a629280db9
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Wed May 13 12:36:36 2009 +0100

    Remove gnome_help_display_desktop and use gtk_show_uri if it exists
    (e.g. not in Ubuntu 8.04.2). Solves #575365 and part of #573964.
    So we move from a dependency on libgnome to a dependency on new
    gtk and gvfs.
---
 ChangeLog                |    6 ++++++
 Src/Gtk2/dasher_main.cpp |   29 +++++++++++++++++++++--------
 configure.ac             |    9 ++++++++-
 3 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 975429f..9516235 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-05-13  Patrick Welche  <prlw1 cam ac uk>
+
+	* dasher_main, configure.ac: Remove gnome_help_display_desktop and
+	use gtk_show_uri if it exists (e.g. not in Ubuntu 8.04.2).
+	(#575365 and part of #573964)
+
 2009-05-12  Patrick Welche  <prlw1 cam ac uk>
 
 	* configure.ac: We either need gnome a11y libraries such as cspi, or
diff --git a/Src/Gtk2/dasher_main.cpp b/Src/Gtk2/dasher_main.cpp
index dddb935..9a86270 100644
--- a/Src/Gtk2/dasher_main.cpp
+++ b/Src/Gtk2/dasher_main.cpp
@@ -12,9 +12,6 @@
 #ifdef WITH_MAEMOFULLSCREEN
 #include <hildon-widgets/hildon-program.h>
 #endif
-#ifdef GNOME_LIBS
-#include <libgnome/libgnome.h>
-#endif
 #include <unistd.h>
 
 #include "GtkDasherControl.h"
@@ -469,9 +466,9 @@ dasher_main_load_interface(DasherMain *pSelf) {
     pPrivate->pPrefXML = (GladeXML *) g_object_ref(pPrivate->pGladeXML);
   }
 
-  // XXX PRLW: Hide the Help Contents as there is no handler to display help.
-  // #575365
+#ifndef HAVE_GTK_SHOW_URI
   gtk_widget_hide(glade_xml_get_widget(pPrivate->pGladeXML, "menu_command_help"));
+#endif
 
   // Save the details of some of the widgets for later
   //  pPrivate->pActionPane = glade_xml_get_widget(pPrivate->pGladeXML, "vbox39");
@@ -1153,9 +1150,25 @@ dasher_main_command_tutorial(DasherMain *pSelf) {
 
 static void 
 dasher_main_command_help(DasherMain *pSelf) {
-  // TODO: Need to disable the menu if gnome libs aren't present (or get rid of without gnome option) 
-#ifdef GNOME_LIBS
-  gnome_help_display_desktop(NULL, "dasher", "dasher", NULL, NULL);
+#ifdef HAVE_GTK_SHOW_URI
+  DasherMainPrivate *pPrivate = DASHER_MAIN_GET_PRIVATE(pSelf);
+  GdkScreen *scr;
+  GError *err = NULL;
+
+  scr = gtk_widget_get_screen(pPrivate->pMainWindow);
+  if (!gtk_show_uri(scr, "ghelp:dasher", gtk_get_current_event_time(), &err)) {
+    GtkWidget *d;
+    d = gtk_message_dialog_new(GTK_WINDOW(pPrivate->pMainWindow),
+                               GTK_DIALOG_MODAL,
+                               GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+                               "%s", _("Unable to open help file"));
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(d),
+                               "%s", err->message);
+    g_signal_connect(d, "response", G_CALLBACK(gtk_widget_destroy), NULL);
+    gtk_window_present(GTK_WINDOW(d));
+
+    g_error_free (err);
+  }
 #endif
 }
 
diff --git a/configure.ac b/configure.ac
index 1d0bc29..54efaa1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -195,8 +195,15 @@ then
 	PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.6.0,[GTK2HERE=true],[GTK2HERE=false]) 
 	PKG_CHECK_MODULES(GCONF, gconf-2.0,[GCONF2HERE=true],[GCONF2HERE=false])
 	if test x$GCONF2HERE = xfalse; then
-	   AC_MSG_WARN("GConf was not detected - user preferences will not be stored.")
+		AC_MSG_WARN([GConf was not detected - user preferences will not be stored.])
 	fi
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	CFLAGS="$CFLAGS $GTK2_CFLAGS"
+	LIBS="$LIBS $GTK2_LIBS"
+	AC_CHECK_FUNCS([gtk_show_uri]) dnl which appeared in Gtk 2.13.1
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
 fi
 
 if test x"$GTK2HERE" = xtrue -a x"$WITHGTK2" = xtrue -a x"$WITHQTE" != xtrue



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