[Goodies-commits] r2196 - in xfce4-dict-plugin/trunk: . panel-plugin

Enrico Troeger enrico at xfce.org
Mon Dec 4 20:10:48 CET 2006


Author: enrico
Date: 2006-12-04 19:10:47 +0000 (Mon, 04 Dec 2006)
New Revision: 2196

Modified:
   xfce4-dict-plugin/trunk/ChangeLog
   xfce4-dict-plugin/trunk/configure.in.in
   xfce4-dict-plugin/trunk/panel-plugin/dict.c
Log:
Removed dependency on libexo, use exo-open(and some other fallbacks) instead.


Modified: xfce4-dict-plugin/trunk/ChangeLog
===================================================================
--- xfce4-dict-plugin/trunk/ChangeLog	2006-12-04 18:52:13 UTC (rev 2195)
+++ xfce4-dict-plugin/trunk/ChangeLog	2006-12-04 19:10:47 UTC (rev 2196)
@@ -2,6 +2,7 @@
 
 	* Fixed wrong display of panel text entry when panel orientation changed.
 	* Panel text entry grows and shrinks now according to the given size.
+	* Removed dependency on libexo, use exo-open(and some other fallbacks) instead.
 
 
 2006-11-25 enrico
@@ -18,7 +19,7 @@
 	* Added alternative search mode via a web site dictionary and provide three
 	  dictionary entries of dict.leo.org for convenience.
 	  The web site will be opened with the help of libexo.
-	* Added UTF8_STRING as drop targt. Might be it helps.
+	* Added UTF8_STRING as drop target. Might be it helps.
 
 
 2006-11-07 enrico

Modified: xfce4-dict-plugin/trunk/configure.in.in
===================================================================
--- xfce4-dict-plugin/trunk/configure.in.in	2006-12-04 18:52:13 UTC (rev 2195)
+++ xfce4-dict-plugin/trunk/configure.in.in	2006-12-04 19:10:47 UTC (rev 2196)
@@ -37,7 +37,6 @@
 XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.3.90.2])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.90.2])
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.99.1])
-XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.0])
 
 dnl check for debugging support
 XDT_FEATURE_DEBUG()

Modified: xfce4-dict-plugin/trunk/panel-plugin/dict.c
===================================================================
--- xfce4-dict-plugin/trunk/panel-plugin/dict.c	2006-12-04 18:52:13 UTC (rev 2195)
+++ xfce4-dict-plugin/trunk/panel-plugin/dict.c	2006-12-04 19:10:47 UTC (rev 2196)
@@ -27,9 +27,6 @@
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4panel/xfce-panel-convenience.h>
 
-#define EXO_API_SUBJECT_TO_CHANGE
-#include <exo/exo.h>
-
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
@@ -549,6 +546,44 @@
 }
 
 
+/* taken from xarchiver, thanks Giuseppe */
+static gboolean dict_open_browser(DictData *dd, const gchar *uri)
+{
+	gchar *argv[3];
+	gchar *browser_path;
+	gboolean result = FALSE;
+
+	browser_path = g_find_program_in_path("exo-open");
+	if (browser_path == NULL)
+		browser_path = g_find_program_in_path("htmlview");
+	if (browser_path == NULL)
+		browser_path = g_find_program_in_path("firefox");
+	if (browser_path == NULL)
+		browser_path = g_find_program_in_path("mozilla");
+	if (browser_path == NULL)
+		browser_path = g_find_program_in_path("opera");
+	if (browser_path == NULL)
+		browser_path = g_find_program_in_path("epiphany");
+	if (browser_path == NULL)
+		browser_path = g_find_program_in_path("konqueror");
+	if (browser_path == NULL)
+		browser_path = g_find_program_in_path("seamonkey");
+
+	if (browser_path == NULL) return FALSE;
+
+	argv[0] = browser_path;
+	argv[1] = (gchar*) uri;
+	argv[2] = NULL;
+
+	result = gdk_spawn_on_screen(gtk_widget_get_screen(GTK_WIDGET(dd->plugin)), NULL, argv, NULL,
+				G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
+
+	g_free (browser_path);
+
+	return result;
+}
+
+
 static void dict_search_word(DictData *dd, const gchar *word)
 {
 	gboolean show = TRUE;
@@ -586,7 +621,6 @@
 	}
 	else if (dd->mode == DICTMODE_WEB)
 	{
-		gboolean success;
 		gboolean use_leo = FALSE;
 		gchar *uri, *base;
 
@@ -626,8 +660,7 @@
 		}
 
 		uri = dict_str_replace(g_strdup(base), "{word}", dd->searched_word);
-		success = exo_url_show(uri, NULL, NULL);
-		if (! success)
+		if (! dict_open_browser(dd, uri))
 		{
 			xfce_err(_("Browser could not be opened. Please check your preferences."));
 		}




More information about the Goodies-commits mailing list