gnome-panel r11181 - in trunk: . gnome-panel gnome-panel/libpanel-util po



Author: vuntz
Date: Mon Aug  4 01:22:17 2008
New Revision: 11181
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11181&view=rev

Log:
2008-08-04  Vincent Untz  <vuntz gnome org>

	* configure.in: explicitly require gio-unix-2.0

2008-08-04  Vincent Untz  <vuntz gnome org>

	* POTFILES.in: updated

2008-08-04  Vincent Untz  <vuntz gnome org>

	* libpanel-util/Makefile.am: add new files
	* libpanel-util/panel-error.[ch]: new, moved from panel-util.c
	* libpanel-util/panel-glib.[ch]: moved some functions from panel-util.c
	here and rename them: panel_g_lookup_in_data_dirs(),
	panel_g_utf8_strstrcase()
	also add panel_g_lookup_in_applications_dirs
	* libpanel-util/panel-show.[ch]: new, to ease showing of URIs

	* panel-util.[ch]:
	(panel_error_dialog): moved to libpanel-util/panel-error.c
	(panel_ensure_dir): use g_mkdir()
	(panel_lookup_in_data_dirs): moved to libpanel-util/panel-error.c
	(panel_util_utf8_strstrcase): ditto
	(panel_util_gdk_pixbuf_load_from_stream): kill because we use GTK+ 2.13
	now
	(panel_util_get_pixbuf_from_g_loadable_icon): use
	gdk_pixbuf_new_from_stream()

	* launcher.c: (launch_url): simply call panel_show_uri()
	(create_launcher): use panel_g_lookup_in_applications_dirs()
	* panel-addto.c: (panel_addto_filter_func): small update
	(panel_compatibility_migrate_applications_scheme): use
	panel_g_lookup_in_applications_dirs()
	* panel-menu-items.c: (activate_uri_on_screen): simply use
	panel_show_uri()
	(activate_uri): fix parameter name
	(activate_path): new, to change a path into a uri before
	activate_uri_on_screen()
	(activate_home_uri): call activate_path()
	(activate_desktop_uri): ditto
	(volume_mount_cb): s/path/uri
	* panel-recent.c: (show_uri): simply use
	panel_show_uri_force_mime_type()
	(recent_documents_activate_cb): add a comment
	* panel-run-dialog.c: (panel_run_dialog_show_url): kill
	(panel_run_dialog_execute): use panel_show_uri()
	(panel_run_dialog_find_command_idle): updated

	* gnome-desktop-item-edit.c: #include update
	* panel-action-button.c: ditto
	* panel-compatibility.c: ditto
	* panel-context-menu.c: ditto
	* panel-menu-button.c: ditto
	* panel-menu-bar.c:  ditto
	* panel-properties-dialog.c: ditto
	* panel-shell.c: ditto


Added:
   trunk/gnome-panel/libpanel-util/panel-error.c
   trunk/gnome-panel/libpanel-util/panel-error.h
   trunk/gnome-panel/libpanel-util/panel-glib.c
   trunk/gnome-panel/libpanel-util/panel-show.c
   trunk/gnome-panel/libpanel-util/panel-show.h
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/gnome-panel/ChangeLog
   trunk/gnome-panel/gnome-desktop-item-edit.c
   trunk/gnome-panel/launcher.c
   trunk/gnome-panel/libpanel-util/Makefile.am
   trunk/gnome-panel/libpanel-util/panel-glib.h
   trunk/gnome-panel/panel-action-button.c
   trunk/gnome-panel/panel-addto.c
   trunk/gnome-panel/panel-compatibility.c
   trunk/gnome-panel/panel-context-menu.c
   trunk/gnome-panel/panel-menu-bar.c
   trunk/gnome-panel/panel-menu-button.c
   trunk/gnome-panel/panel-menu-items.c
   trunk/gnome-panel/panel-properties-dialog.c
   trunk/gnome-panel/panel-recent.c
   trunk/gnome-panel/panel-run-dialog.c
   trunk/gnome-panel/panel-shell.c
   trunk/gnome-panel/panel-util.c
   trunk/gnome-panel/panel-util.h
   trunk/po/ChangeLog
   trunk/po/POTFILES.in

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Aug  4 01:22:17 2008
@@ -70,7 +70,7 @@
 
 dnl pkg-config dependency checks
 
-PKG_CHECK_MODULES(PANEL, ORBit-2.0 >= $ORBIT_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
+PKG_CHECK_MODULES(PANEL, ORBit-2.0 >= $ORBIT_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
 AC_SUBST(PANEL_CFLAGS)
 AC_SUBST(PANEL_LIBS)
 

Modified: trunk/gnome-panel/gnome-desktop-item-edit.c
==============================================================================
--- trunk/gnome-panel/gnome-desktop-item-edit.c	(original)
+++ trunk/gnome-panel/gnome-desktop-item-edit.c	Mon Aug  4 01:22:17 2008
@@ -5,6 +5,7 @@
 #include <gtk/gtk.h>
 #include <libgnomeui/gnome-ui-init.h>
 
+#include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-keyfile.h>
 
 #include "panel-ditem-editor.h"

Modified: trunk/gnome-panel/launcher.c
==============================================================================
--- trunk/gnome-panel/launcher.c	(original)
+++ trunk/gnome-panel/launcher.c	Mon Aug  4 01:22:17 2008
@@ -21,11 +21,12 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 #include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-url.h>
 #include <gdk/gdkx.h>
 
+#include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-glib.h>
 #include <libpanel-util/panel-keyfile.h>
+#include <libpanel-util/panel-show.h>
 
 #include "launcher.h"
 
@@ -154,7 +155,6 @@
 launch_url (Launcher *launcher)
 {
 	char *url;
-	GError *error = NULL;
 	GdkScreen *screen;
 
 	g_return_if_fail (launcher != NULL);
@@ -177,21 +177,7 @@
 		return;
 	}
 
-	gnome_url_show_on_screen (url, screen, &error);
-
-	if (error) {
-		GtkWidget *error_dialog;
-		char      *primary;
-	
-		primary = g_strdup_printf (_("Could not show '%s'"), url);
-		error_dialog = panel_error_dialog (NULL, screen,
-						   "cannot_show_url_dialog",
-						   TRUE,
-						   primary, error->message);
-		g_free (primary);
-		launcher_register_error_dialog (launcher, error_dialog);
-		g_clear_error (&error);
-	}
+	panel_show_uri (screen, url, gtk_get_current_event_time (), NULL);
 
 	g_free (url);
 }
@@ -516,12 +502,8 @@
 		path = panel_make_full_path (NULL, location);
 
 		if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
-			char *buffer;
-
 			g_free (path);
-			buffer = g_strconcat ("applications/", location, NULL);
-			path = panel_lookup_in_data_dirs (buffer);
-			g_free (buffer);
+			path = panel_g_lookup_in_applications_dirs (location);
 			/* it's important to keep the full path if the desktop
 			 * file comes from a data dir: when the user will edit
 			 * it, we'll want to save it in PANEL_LAUNCHERS_PATH

Modified: trunk/gnome-panel/libpanel-util/Makefile.am
==============================================================================
--- trunk/gnome-panel/libpanel-util/Makefile.am	(original)
+++ trunk/gnome-panel/libpanel-util/Makefile.am	Mon Aug  4 01:22:17 2008
@@ -24,6 +24,9 @@
 	panel-cleanup.h			\
 	panel-dbus-service.c		\
 	panel-dbus-service.h		\
+	panel-error.c			\
+	panel-error.h			\
+	panel-glib.c			\
 	panel-glib.h			\
 	panel-keyfile.c			\
 	panel-keyfile.h			\
@@ -31,4 +34,6 @@
 	panel-power-manager.h		\
 	panel-session-manager.c		\
 	panel-session-manager.h		\
+	panel-show.c			\
+	panel-show.h			\
 	$(NULL)

Added: trunk/gnome-panel/libpanel-util/panel-error.c
==============================================================================
--- (empty file)
+++ trunk/gnome-panel/libpanel-util/panel-error.c	Mon Aug  4 01:22:17 2008
@@ -0,0 +1,96 @@
+/*
+ * panel-error.c: an easy-to-use error dialog
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Originally based on code from panel-util.c (there was no relevant copyright
+ * header at the time).
+ *
+ * Originally based on code from panel-util.c (there was no relevant copyright
+ * header at the time), but the code was:
+ * Copyright (C) Novell, Inc. (for the panel_g_utf8_strstrcase() code)
+ * Copyright (C) Dennis Cranston (for the panel_g_lookup_in_data_dirs() code)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *	Vincent Untz <vuntz gnome org>
+ */
+
+#include <glib/gi18n.h>
+
+#include <gtk/gtk.h>
+
+#include "panel-error.h"
+
+GtkWidget *
+panel_error_dialog (GtkWindow  *parent,
+		    GdkScreen  *screen,
+		    const char *dialog_class,
+		    gboolean    auto_destroy,
+		    const char *primary_text,
+		    const char *secondary_text)
+{
+	GtkWidget *dialog;
+	char      *freeme;
+
+	freeme = NULL;
+
+	if (primary_text == NULL) {
+		g_warning ("NULL dialog");
+		 /* No need to translate this, this should NEVER happen */
+		freeme = g_strdup_printf ("Error with displaying error "
+					  "for dialog of class %s",
+					  dialog_class);
+		primary_text = freeme;
+	}
+
+	dialog = gtk_message_dialog_new (parent, 0, GTK_MESSAGE_ERROR,
+					 GTK_BUTTONS_OK, "%s", primary_text);
+	if (secondary_text != NULL)
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+							  "%s", secondary_text);
+
+	/* FIXME: we're losing this feature
+	gtk_widget_add_events (dialog, GDK_KEY_PRESS_MASK);
+	g_signal_connect (dialog, "event",
+			  G_CALLBACK (panel_dialog_window_event), NULL);
+	*/
+
+	if (screen)
+		gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+
+	if (!parent) {
+		gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE);
+		/* FIXME: We need a title in this case, but we don't know what
+		 * the format should be. Let's put something simple until
+		 * the following bug gets fixed:
+		 * http://bugzilla.gnome.org/show_bug.cgi?id=165132 */
+		gtk_window_set_title (GTK_WINDOW (dialog), _("Error"));
+	}
+
+	gtk_widget_show_all (dialog);
+
+	if (auto_destroy)
+		g_signal_connect_swapped (G_OBJECT (dialog), "response",
+					  G_CALLBACK (gtk_widget_destroy),
+					  G_OBJECT (dialog));
+
+	if (freeme)
+		g_free (freeme);
+
+	return dialog;
+}

Added: trunk/gnome-panel/libpanel-util/panel-error.h
==============================================================================
--- (empty file)
+++ trunk/gnome-panel/libpanel-util/panel-error.h	Mon Aug  4 01:22:17 2008
@@ -0,0 +1,45 @@
+/*
+ * panel-error.h: an easy-to-use error dialog
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Originally based on code from panel-util.h (there was no relevant copyright
+ * header at the time).
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *	Vincent Untz <vuntz gnome org>
+ */
+
+#ifndef PANEL_ERROR_H
+#define PANEL_ERROR_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+GtkWidget *panel_error_dialog (GtkWindow  *parent,
+			       GdkScreen  *screen,
+			       const char *dialog_class,
+			       gboolean    auto_destroy,
+			       const char *primary_text,
+			       const char *secondary_text);
+
+G_END_DECLS
+
+#endif /* PANEL_ERROR_H */

Added: trunk/gnome-panel/libpanel-util/panel-glib.c
==============================================================================
--- (empty file)
+++ trunk/gnome-panel/libpanel-util/panel-glib.c	Mon Aug  4 01:22:17 2008
@@ -0,0 +1,164 @@
+/*
+ * panel-glib.c: various small extensions to glib
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Originally based on code from panel-util.c (there was no relevant copyright
+ * header at the time), but the code was:
+ * Copyright (C) Novell, Inc. (for the panel_g_utf8_strstrcase() code)
+ * Copyright (C) Dennis Cranston (for the panel_g_lookup_in_data_dirs() code)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *	Vincent Untz <vuntz gnome org>
+ */
+
+#include <string.h>
+
+#include <glib.h>
+
+#include "panel-glib.h"
+
+typedef char * (*LookupInDir) (const char *basename, const char *dir);
+
+static char *
+_lookup_in_dir (const char *basename,
+		const char *dir)
+{
+	char *path;
+
+	path = g_build_filename (dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+_lookup_in_applications_subdir (const char *basename,
+				const char *dir)
+{
+	char *path;
+
+	path = g_build_filename (dir, "applications", basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+_panel_g_lookup_in_data_dirs_internal (const char *basename,
+				       LookupInDir lookup)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup (basename, user_data_dir)))
+		return retval;
+
+	for (i = 0; system_data_dirs[i]; i++)
+		if ((retval = lookup (basename, system_data_dirs[i])))
+			return retval;
+
+	return NULL;
+}
+
+char *
+panel_g_lookup_in_data_dirs (const char *basename)
+{
+	return _panel_g_lookup_in_data_dirs_internal (basename,
+						      _lookup_in_dir);
+}
+
+char *
+panel_g_lookup_in_applications_dirs (const char *basename)
+{
+	return _panel_g_lookup_in_data_dirs_internal (basename,
+						      _lookup_in_applications_subdir);
+}
+
+/* Copied from evolution-data-server/libedataserver/e-util.c:
+ * e_util_unicode_get_utf8() */
+static char *
+_unicode_get_utf8 (const char *text, gunichar *out)
+{
+	*out = g_utf8_get_char (text);
+	return (*out == (gunichar)-1) ? NULL : g_utf8_next_char (text);
+}
+
+/* Copied from evolution-data-server/libedataserver/e-util.c:
+ * e_util_utf8_strstrcase() */
+const char *
+panel_g_utf8_strstrcase (const char *haystack, const char *needle)
+{
+	gunichar *nuni;
+	gunichar unival;
+	gint nlen;
+	const char *o, *p;
+
+	if (haystack == NULL) return NULL;
+	if (needle == NULL) return NULL;
+	if (strlen (needle) == 0) return haystack;
+	if (strlen (haystack) == 0) return NULL;
+
+	nuni = g_alloca (sizeof (gunichar) * strlen (needle));
+
+	nlen = 0;
+	for (p = _unicode_get_utf8 (needle, &unival);
+	     p && unival;
+	     p = _unicode_get_utf8 (p, &unival)) {
+		nuni[nlen++] = g_unichar_tolower (unival);
+	}
+	/* NULL means there was illegal utf-8 sequence */
+	if (!p) return NULL;
+
+	o = haystack;
+	for (p = _unicode_get_utf8 (o, &unival);
+	     p && unival;
+	     p = _unicode_get_utf8 (p, &unival)) {
+		gint sc;
+		sc = g_unichar_tolower (unival);
+		/* We have valid stripped char */
+		if (sc == nuni[0]) {
+			const char *q = p;
+			gint npos = 1;
+			while (npos < nlen) {
+				q = _unicode_get_utf8 (q, &unival);
+				if (!q || !unival) return NULL;
+				sc = g_unichar_tolower (unival);
+				if (sc != nuni[npos]) break;
+				npos++;
+			}
+			if (npos == nlen) {
+				return o;
+			}
+		}
+		o = p;
+	}
+
+	return NULL;
+}

Modified: trunk/gnome-panel/libpanel-util/panel-glib.h
==============================================================================
--- trunk/gnome-panel/libpanel-util/panel-glib.h	(original)
+++ trunk/gnome-panel/libpanel-util/panel-glib.h	Mon Aug  4 01:22:17 2008
@@ -22,13 +22,21 @@
  *	Vincent Untz <vuntz gnome org>
  */
 
-#ifndef PANEL_EXT_H
-#define PANEL_EXT_H
+#ifndef PANEL_GLIB_H
+#define PANEL_GLIB_H
+
+#include <glib.h>
 
 G_BEGIN_DECLS
 
 #define PANEL_GLIB_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
 
+char       *panel_g_lookup_in_data_dirs         (const char *basename);
+char       *panel_g_lookup_in_applications_dirs (const char *basename);
+
+const char *panel_g_utf8_strstrcase             (const char *haystack,
+						 const char *needle);
+
 G_END_DECLS
 
 #endif /* PANEL_GLIB_H */

Added: trunk/gnome-panel/libpanel-util/panel-show.c
==============================================================================
--- (empty file)
+++ trunk/gnome-panel/libpanel-util/panel-show.c	Mon Aug  4 01:22:17 2008
@@ -0,0 +1,193 @@
+/*
+ * panel-show.c: a helper around gtk_show_uri
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *	Vincent Untz <vuntz gnome org>
+ */
+
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
+
+#include <gtk/gtk.h>
+
+#include "panel-error.h"
+#include "panel-glib.h"
+
+#include "panel-show.h"
+
+static void
+_panel_show_error_dialog (const gchar *uri,
+			  GdkScreen   *screen,
+			  const gchar *message)
+{
+	char *escaped;
+	char *primary;
+
+	escaped = g_markup_escape_text (uri, -1);
+	primary = g_strdup_printf (_("Could not open location '%s'"),
+				   escaped);
+	g_free (escaped);
+
+	panel_error_dialog (NULL, screen, "cannot_show_url", TRUE,
+			    primary, message);
+	g_free (primary);
+}
+
+static void
+_panel_show_handle_error (const gchar  *uri,
+			  GdkScreen    *screen,
+			  GError       *local_error,
+			  GError      **error)
+{
+	g_return_if_fail (local_error != NULL);
+
+	if (error != NULL)
+		g_propagate_error (error, local_error);
+
+	else if (local_error != NULL) {
+		if (local_error->code != G_IO_ERROR_CANCELLED)
+			_panel_show_error_dialog (uri, screen,
+						  local_error->message);
+		g_error_free (local_error);
+	}
+}
+
+static gboolean
+_panel_app_info_launch_uri (GAppInfo     *appinfo,
+			    const gchar  *uri,
+			    GdkScreen    *screen,
+			    guint32       timestamp,
+			    GError      **error)
+{
+	GList               *uris;
+	GdkAppLaunchContext *context;
+	GError              *local_error;
+
+	uris = NULL;
+	uris = g_list_prepend (uris, (gpointer) uri);
+
+	context = gdk_app_launch_context_new ();
+	gdk_app_launch_context_set_screen (context, screen);
+	gdk_app_launch_context_set_timestamp (context, timestamp);
+
+	local_error = NULL;
+	g_app_info_launch_uris (appinfo, uris,
+				(GAppLaunchContext *) context,
+				&local_error);
+	g_list_free (uris);
+	g_object_unref (context);
+
+	if (local_error == NULL)
+		return TRUE;
+
+	_panel_show_handle_error (uri, screen, local_error, error);
+
+	return FALSE;
+}
+
+static gboolean
+panel_show_nautilus_search_uri (GdkScreen    *screen,
+				const gchar  *uri,
+				guint32       timestamp,
+				GError      **error)
+{
+	char            *desktopfile;
+	GDesktopAppInfo *appinfo;
+	gboolean         ret;
+
+	desktopfile = panel_g_lookup_in_applications_dirs ("nautilus-folder-handler.desktop");
+	if (desktopfile) {
+		appinfo = g_desktop_app_info_new_from_filename (desktopfile);
+		g_free (desktopfile);
+	}
+
+	if (!appinfo) {
+		_panel_show_error_dialog (uri, screen,
+					  _("No application to handle search folders is installed."));
+		return FALSE;
+	}
+
+	ret = _panel_app_info_launch_uri ((GAppInfo *) appinfo,
+					  uri, screen, timestamp, error);
+	g_object_unref (appinfo);
+
+	return ret;
+}
+
+gboolean
+panel_show_uri (GdkScreen    *screen,
+		const gchar  *uri,
+		guint32       timestamp,
+		GError      **error)
+{
+	GError *local_error = NULL;
+
+	g_return_val_if_fail (screen != NULL, FALSE);
+	g_return_val_if_fail (uri != NULL, FALSE);
+	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+	if (g_str_has_prefix (uri, "x-nautilus-search:")) {
+		return panel_show_nautilus_search_uri (screen, uri,
+						       timestamp, error);
+	}
+
+	gtk_show_uri (screen, uri, timestamp, &local_error);
+
+	if (local_error == NULL)
+		return TRUE;
+
+	_panel_show_handle_error (uri, screen, local_error, error);
+
+	return FALSE;
+}
+
+gboolean
+panel_show_uri_force_mime_type (GdkScreen    *screen,
+				const gchar  *uri,
+				const gchar  *mime_type,
+				guint32       timestamp,
+				GError      **error)
+{
+	GFile    *file;
+	GAppInfo *app;
+	gboolean  ret;
+
+	g_return_val_if_fail (screen != NULL, FALSE);
+	g_return_val_if_fail (uri != NULL, FALSE);
+	g_return_val_if_fail (mime_type != NULL, FALSE);
+	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+	file = g_file_new_for_uri (uri);
+	app = g_app_info_get_default_for_type (mime_type,
+					       !g_file_is_native (file));
+	g_object_unref (file);
+
+	if (app == NULL) {
+		/* no application for the mime type, so let's fallback on
+		 * automatic detection */
+		return panel_show_uri (screen, uri, timestamp, error);
+	}
+
+	ret = _panel_app_info_launch_uri (app, uri, screen, timestamp, error);
+	g_object_unref (app);
+
+	return ret;
+}

Added: trunk/gnome-panel/libpanel-util/panel-show.h
==============================================================================
--- (empty file)
+++ trunk/gnome-panel/libpanel-util/panel-show.h	Mon Aug  4 01:22:17 2008
@@ -0,0 +1,45 @@
+/*
+ * panel-show.h: a helper around gtk_show_uri
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *	Vincent Untz <vuntz gnome org>
+ */
+
+#ifndef PANEL_SHOW_H
+#define PANEL_SHOW_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+gboolean panel_show_uri (GdkScreen    *screen,
+			 const gchar  *uri,
+			 guint32       timestamp,
+			 GError      **error);
+
+gboolean panel_show_uri_force_mime_type (GdkScreen    *screen,
+					 const gchar  *uri,
+					 const gchar  *mime_type,
+					 guint32       timestamp,
+					 GError      **error);
+
+G_END_DECLS
+
+#endif /* PANEL_SHOW_H */

Modified: trunk/gnome-panel/panel-action-button.c
==============================================================================
--- trunk/gnome-panel/panel-action-button.c	(original)
+++ trunk/gnome-panel/panel-action-button.c	Mon Aug  4 01:22:17 2008
@@ -32,6 +32,7 @@
 
 #include <glib/gi18n.h>
 
+#include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-session-manager.h>
 
 #include "applet.h"

Modified: trunk/gnome-panel/panel-addto.c
==============================================================================
--- trunk/gnome-panel/panel-addto.c	(original)
+++ trunk/gnome-panel/panel-addto.c	Mon Aug  4 01:22:17 2008
@@ -1131,10 +1131,10 @@
 	    gtk_tree_store_iter_depth (GTK_TREE_STORE (model), iter) == 0)
 		return TRUE;
 
-	return (panel_util_utf8_strstrcase (data->name,
-					    dialog->search_text) != NULL ||
-	        panel_util_utf8_strstrcase (data->description,
-					    dialog->search_text) != NULL);
+	return (panel_g_utf8_strstrcase (data->name,
+					 dialog->search_text) != NULL ||
+	        panel_g_utf8_strstrcase (data->description,
+					 dialog->search_text) != NULL);
 }
 
 static void

Modified: trunk/gnome-panel/panel-compatibility.c
==============================================================================
--- trunk/gnome-panel/panel-compatibility.c	(original)
+++ trunk/gnome-panel/panel-compatibility.c	Mon Aug  4 01:22:17 2008
@@ -25,6 +25,8 @@
 
 #include "string.h"
 
+#include <libpanel-util/panel-glib.h>
+
 #include "panel-compatibility.h"
 
 #include "panel-profile.h"
@@ -1050,18 +1052,13 @@
 	    !strncmp (location, "all-preferences:", strlen ("all-preferences:")) ||
 	    !strncmp (location, "system-settings:", strlen ("system-settings:")) ||
 	    !strncmp (location, "server-settings:", strlen ("server-settings:"))) {
-		char *buffer;
 		char *basename;
 		char *new_location;
 
 		basename = g_path_get_basename (location);
-
-		buffer = g_strconcat ("applications/", basename, NULL);
+		new_location = panel_g_lookup_in_applications_dirs (basename);
 		g_free (basename);
 
-		new_location = panel_lookup_in_data_dirs (buffer);
-		g_free (buffer);
-
 		if (new_location != NULL) {
 			gconf_client_set_string (client, key,
 						 new_location, NULL);

Modified: trunk/gnome-panel/panel-context-menu.c
==============================================================================
--- trunk/gnome-panel/panel-context-menu.c	(original)
+++ trunk/gnome-panel/panel-context-menu.c	Mon Aug  4 01:22:17 2008
@@ -34,6 +34,8 @@
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 
+#include <libpanel-util/panel-error.h>
+
 #include "nothing.h"
 #include "panel-util.h"
 #include "panel.h"

Modified: trunk/gnome-panel/panel-menu-bar.c
==============================================================================
--- trunk/gnome-panel/panel-menu-bar.c	(original)
+++ trunk/gnome-panel/panel-menu-bar.c	Mon Aug  4 01:22:17 2008
@@ -31,6 +31,8 @@
 #include <string.h>
 #include <glib/gi18n.h>
 
+#include <libpanel-util/panel-error.h>
+
 #include "panel-util.h"
 #include "panel-background.h"
 #include "panel-action-button.h"

Modified: trunk/gnome-panel/panel-menu-button.c
==============================================================================
--- trunk/gnome-panel/panel-menu-button.c	(original)
+++ trunk/gnome-panel/panel-menu-button.c	Mon Aug  4 01:22:17 2008
@@ -31,6 +31,8 @@
 
 #include <gmenu-tree.h>
 
+#include <libpanel-util/panel-error.h>
+
 #include "applet.h"
 #include "panel-widget.h"
 #include "panel-util.h"

Modified: trunk/gnome-panel/panel-menu-items.c
==============================================================================
--- trunk/gnome-panel/panel-menu-items.c	(original)
+++ trunk/gnome-panel/panel-menu-items.c	Mon Aug  4 01:22:17 2008
@@ -39,11 +39,10 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 
-#include <libgnome/gnome-url.h>
-#include <libgnomeui/gnome-url.h>
-
+#include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-glib.h>
 #include <libpanel-util/panel-keyfile.h>
+#include <libpanel-util/panel-show.h>
 
 #include "menu.h"
 #include "panel-action-button.h"
@@ -99,71 +98,43 @@
 };
 
 static void
-activate_uri_on_screen (const char *path,
+activate_uri_on_screen (const char *uri,
 			GdkScreen  *screen)
 {
-	GError    *error = NULL;
-	GFile     *file;
-	char      *escaped;
-	char      *scheme;
-	char      *url;
-
-	scheme = g_uri_parse_scheme (path);
-	if (scheme) {
-		url = g_strdup (path);
-		g_free (scheme);
-	} else {
-		file = g_file_new_for_path (path);
-		url = g_file_get_uri (file);
-		g_object_unref (file);
-	}
-	
-	if (g_str_has_prefix (url, "x-nautilus-search:")) {
-		//FIXME: this is ugly...
-		char *command;
-
-		command = g_strdup_printf ("nautilus --no-desktop %s", url);
-		gdk_spawn_command_line_on_screen (screen, command, &error);
-	} else
-		gnome_url_show_on_screen (url, screen, &error);
-
-	if (error != NULL) {
-		if (error->code != GNOME_URL_ERROR_CANCELLED) {
-			char *primary;
-			escaped = g_markup_escape_text (url, -1);
-			primary = g_strdup_printf (_("Could not open location '%s'"),
-						   escaped);
-			g_free (escaped);
-			panel_error_dialog (NULL, screen,
-					    "cannot_show_url", TRUE,
-					    primary, error->message);
-			g_free (primary);
-		}
-		g_error_free (error);
-	}
-	g_free (url);
+	panel_show_uri (screen, uri, gtk_get_current_event_time (), NULL);
 }
 
 static void
 activate_uri (GtkWidget  *menuitem,
-	      const char *path)
+	      const char *uri)
 {
-	activate_uri_on_screen (path, menuitem_to_screen (menuitem));
+	activate_uri_on_screen (uri, menuitem_to_screen (menuitem));
+}
+
+static void
+activate_path (GtkWidget  *menuitem,
+	       const char *path)
+{
+	char *uri;
+
+	uri = g_filename_to_uri (path, NULL, NULL);
+	activate_uri_on_screen (uri, menuitem_to_screen (menuitem));
+	g_free (uri);
 }
 
 static void
 activate_home_uri (GtkWidget *menuitem,
 		   gpointer   data)
 {
-	activate_uri (menuitem, g_get_home_dir ());
+	activate_path (menuitem, g_get_home_dir ());
 }
 
 static void
 activate_desktop_uri (GtkWidget *menuitem,
 		      gpointer   data)
 {
-	activate_uri (menuitem,
-		      g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+	activate_path (menuitem,
+		       g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
 }
  
 static void
@@ -602,15 +573,15 @@
 	} else {
 		GMount *mount;
 		GFile  *root;
-		char   *rootpath;
+		char   *rooturi;
 
 		mount = g_volume_get_mount (G_VOLUME (source_object));
 		root = g_mount_get_root (mount);
-		rootpath = g_file_get_uri (root);
-		activate_uri_on_screen (rootpath, mount_data->screen);
+		rooturi = g_file_get_uri (root);
+		activate_uri_on_screen (rooturi, mount_data->screen);
 		g_object_unref (mount);
 		g_object_unref (root);
-		g_free (rootpath);
+		g_free (rooturi);
 	}
 
 	g_object_unref (mount_data->mount_op);

Modified: trunk/gnome-panel/panel-properties-dialog.c
==============================================================================
--- trunk/gnome-panel/panel-properties-dialog.c	(original)
+++ trunk/gnome-panel/panel-properties-dialog.c	Mon Aug  4 01:22:17 2008
@@ -31,6 +31,7 @@
 #include <glib/gi18n.h>
 #include <libgnomeui/gnome-icon-entry.h>
 
+#include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-glib.h>
 
 #include "nothing.h"

Modified: trunk/gnome-panel/panel-recent.c
==============================================================================
--- trunk/gnome-panel/panel-recent.c	(original)
+++ trunk/gnome-panel/panel-recent.c	Mon Aug  4 01:22:17 2008
@@ -28,6 +28,10 @@
 #include <string.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
+
+#include <libpanel-util/panel-error.h>
+#include <libpanel-util/panel-show.h>
+
 #include "menu.h"
 #include "panel-util.h"
 #include "panel-globals.h"
@@ -40,34 +44,9 @@
 show_uri (const char *uri, const char *mime_type, GdkScreen *screen,
 	  GError **error)
 {
-	char **env;
-	GFile *file;
-	GAppInfo *app;
-	GList *uris = NULL;
-	gboolean ret;
-
-	file = g_file_new_for_uri (uri);
-	app = g_app_info_get_default_for_type (mime_type, !g_file_is_native (file));
-	g_object_unref (file);
-
-	if (app == NULL) {
-		g_set_error (error, 0, 0,
-			     _("Could not find a suitable application."));
-		return FALSE;
-	}
-
-	env = panel_make_environment_for_screen (screen, NULL);
-
-	//FIXME: would g_app_info_launch_default_for_uri() be enough?
-	uris = g_list_append (uris, (gpointer)uri);
-	//FIXME: use GdkAppLaunchContext
-	ret = g_app_info_launch_uris (app, uris, NULL, error);
-	g_list_free (uris);
-
-	g_strfreev (env);
-	g_object_unref (app);
-
-	return ret;
+	return panel_show_uri_force_mime_type (screen, uri, mime_type,
+					       gtk_get_current_event_time (),
+					       error);
 }
 
 
@@ -120,7 +99,7 @@
 		g_free (uri_utf8);
 	}
 
-
+	/* we can unref it only after having used the data we fetched from it */
 	gtk_recent_info_unref (recent_info);
 }
 

Modified: trunk/gnome-panel/panel-run-dialog.c
==============================================================================
--- trunk/gnome-panel/panel-run-dialog.c	(original)
+++ trunk/gnome-panel/panel-run-dialog.c	Mon Aug  4 01:22:17 2008
@@ -44,11 +44,13 @@
 #include <libgnome/gnome-exec.h>
 #include <libgnome/gnome-util.h>
 #include <libgnomeui/gnome-entry.h>
-#include <libgnomeui/gnome-url.h>
 #include <gconf/gconf-client.h>
 #include <gmenu-tree.h>
 
+#include <libpanel-util/panel-error.h>
+#include <libpanel-util/panel-glib.h>
 #include <libpanel-util/panel-keyfile.h>
+#include <libpanel-util/panel-show.h>
 
 #include "nothing.h"
 #include "panel-gconf.h"
@@ -336,34 +338,6 @@
 	return result;
 }
 
-static gboolean
-panel_run_dialog_show_url (PanelRunDialog *dialog,
-	                   const char     *url,
-	                   const char     *escaped)
-{
-	GError    *error = NULL;
-	GdkScreen *screen;
-	
-	screen = gtk_window_get_screen (GTK_WINDOW (dialog->run_dialog));
-
-	gnome_url_show_on_screen (url, screen, &error);
-	if (error) {
-		char *primary;
-
-		primary = g_strdup_printf (_("Could not open location '%s'"),
-					   escaped);
-		panel_error_dialog (GTK_WINDOW (dialog->run_dialog), NULL,
-				    "cannot_show_url", TRUE,
-				    primary, error->message);
-		g_free (primary);
-
-		g_error_free (error);
-		return FALSE;
-	}
-	
-	return TRUE;
-}
-
 static void
 panel_run_dialog_execute (PanelRunDialog *dialog)
 {
@@ -434,8 +408,13 @@
 		 * parameter expansion and other magic for us. */
 		result = panel_run_dialog_launch_command (dialog, disk, escaped);
 	
-	if (!result)
-		result = panel_run_dialog_show_url (dialog, url, escaped);
+	if (!result) {
+		GdkScreen *screen;
+		
+		screen = gtk_window_get_screen (GTK_WINDOW (dialog->run_dialog));
+		result = panel_show_uri (screen, url,
+					 gtk_get_current_event_time (), NULL);
+	}
 		
 	if (result) {
 		/* only save working commands in history */
@@ -655,9 +634,9 @@
 					    &iter,
 					    COLUMN_VISIBLE, TRUE,
 					    -1);
-		} else if (panel_util_utf8_strstrcase (exec, text) != NULL ||
-			   panel_util_utf8_strstrcase (name, text) != NULL ||
-			   panel_util_utf8_strstrcase (comment, text) != NULL) {
+		} else if (panel_g_utf8_strstrcase (exec, text) != NULL ||
+			   panel_g_utf8_strstrcase (name, text) != NULL ||
+			   panel_g_utf8_strstrcase (comment, text) != NULL) {
 			gtk_list_store_set (dialog->program_list_store,
 					    &iter,
 					    COLUMN_VISIBLE, TRUE,

Modified: trunk/gnome-panel/panel-shell.c
==============================================================================
--- trunk/gnome-panel/panel-shell.c	(original)
+++ trunk/gnome-panel/panel-shell.c	Mon Aug  4 01:22:17 2008
@@ -28,6 +28,8 @@
 #include <string.h>
 #include <gtk/gtk.h>
 
+#include <libpanel-util/panel-error.h>
+
 #include "panel-shell.h"
 #include "panel-session.h"
 #include "panel-util.h"

Modified: trunk/gnome-panel/panel-util.c
==============================================================================
--- trunk/gnome-panel/panel-util.c	(original)
+++ trunk/gnome-panel/panel-util.c	Mon Aug  4 01:22:17 2008
@@ -21,13 +21,17 @@
 #include <unistd.h>
 #include <sys/types.h>
 
+#include <glib.h>
 #include <glib/gi18n.h>
+#include <glib/gstdio.h>
 #include <gio/gio.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
 
 #include <libgnome/gnome-desktop-item.h>
 #include <libgnome/gnome-util.h>
 #include <libgnomeui/gnome-help.h>
 
+#include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-glib.h>
 #include <libpanel-util/panel-keyfile.h>
 
@@ -354,62 +358,6 @@
 	return list;
 }
 
-GtkWidget *
-panel_error_dialog (GtkWindow  *parent,
-		    GdkScreen  *screen,
-		    const char *class,
-		    gboolean    auto_destroy,
-		    const char *primary_text,
-		    const char *secondary_text)
-{
-	GtkWidget *dialog;
-	char      *freeme;
-
-	freeme = NULL;
-
-	if (primary_text == NULL) {
-		g_warning ("NULL dialog");
-		 /* No need to translate this, this should NEVER happen */
-		freeme = g_strdup_printf ("Error with displaying error "
-					  "for dialog of class %s", class);
-		primary_text = freeme;
-	}
-
-	dialog = gtk_message_dialog_new (parent, 0, GTK_MESSAGE_ERROR,
-					 GTK_BUTTONS_OK, "%s", primary_text);
-	if (secondary_text != NULL)
-		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-							  "%s", secondary_text);
-
-	gtk_widget_add_events (dialog, GDK_KEY_PRESS_MASK);
-	g_signal_connect (dialog, "event",
-			  G_CALLBACK (panel_dialog_window_event), NULL);
-
-	if (screen)
-		gtk_window_set_screen (GTK_WINDOW (dialog), screen);
-
-	if (!parent) {
-		gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE);
-		/* FIXME: We need a title in this case, but we don't know what
-		 * the format should be. Let's put something simple until
-		 * the following bug gets fixed:
-		 * http://bugzilla.gnome.org/show_bug.cgi?id=165132 */
-		gtk_window_set_title (GTK_WINDOW (dialog), _("Error"));
-	}
-
-	gtk_widget_show_all (dialog);
-
-	if (auto_destroy)
-		g_signal_connect_swapped (G_OBJECT (dialog), "response",
-					  G_CALLBACK (gtk_widget_destroy),
-					  G_OBJECT (dialog));
-
-	if (freeme)
-		g_free (freeme);
-
-	return dialog;
-}
-
 int
 panel_find_applet_index (GtkWidget *widget)
 {
@@ -502,7 +450,7 @@
 
 	while (p != NULL) {
 		*p = '\0';
-		if (mkdir (parsed, 0700) != 0 &&
+		if (g_mkdir (parsed, 0700) != 0 &&
 		    errno != EEXIST && errno != ENOSYS) {
 			g_free (parsed);
 			return FALSE;
@@ -511,7 +459,7 @@
 		p = strchr (p+1, '/');
 	}
 
-	if (mkdir (parsed, 0700) != 0 &&
+	if (g_mkdir (parsed, 0700) != 0 &&
 	    errno != EEXIST && errno != ENOSYS) {
 		g_free (parsed);
 		return FALSE;
@@ -891,99 +839,6 @@
 	return uri;
 }
 
-static char *
-lookup_in_data_dir (const char *basename,
-                    const char *data_dir)
-{
-	char *path;
-
-	path = g_build_filename (data_dir, basename, NULL);
-	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
-		g_free (path);
-		return NULL;
-	}
-
-	return path;
-}
-
-char *
-panel_lookup_in_data_dirs (const char *basename)
-{
-	const char * const *system_data_dirs;
-	const char          *user_data_dir;
-	char                *retval;
-	int                  i;
-
-	user_data_dir    = g_get_user_data_dir ();
-	system_data_dirs = g_get_system_data_dirs ();
-
-	if ((retval = lookup_in_data_dir (basename, user_data_dir)))
-		return retval;
-
-	for (i = 0; system_data_dirs[i]; i++)
-		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
-			return retval;
-
-	return NULL;
-}
-
-/* Stolen from evolution-data-server/libedataserver/e-util.c:
- * e_util_unicode_get_utf8()
- * e_util_utf8_strstrcase() */
-static char *
-panel_util_unicode_get_utf8 (const char *text, gunichar *out)
-{
-	*out = g_utf8_get_char (text);
-	return (*out == (gunichar)-1) ? NULL : g_utf8_next_char (text);
-}
-
-const char *
-panel_util_utf8_strstrcase (const char *haystack, const char *needle)
-{
-	gunichar *nuni;
-	gunichar unival;
-	gint nlen;
-	const char *o, *p;
-
-	if (haystack == NULL) return NULL;
-	if (needle == NULL) return NULL;
-	if (strlen (needle) == 0) return haystack;
-	if (strlen (haystack) == 0) return NULL;
-
-	nuni = g_alloca (sizeof (gunichar) * strlen (needle));
-
-	nlen = 0;
-	for (p = panel_util_unicode_get_utf8 (needle, &unival); p && unival; p = panel_util_unicode_get_utf8 (p, &unival)) {
-		nuni[nlen++] = g_unichar_tolower (unival);
-	}
-	/* NULL means there was illegal utf-8 sequence */
-	if (!p) return NULL;
-
-	o = haystack;
-	for (p = panel_util_unicode_get_utf8 (o, &unival); p && unival; p = panel_util_unicode_get_utf8 (p, &unival)) {
-		gint sc;
-		sc = g_unichar_tolower (unival);
-		/* We have valid stripped char */
-		if (sc == nuni[0]) {
-			const char *q = p;
-			gint npos = 1;
-			while (npos < nlen) {
-				q = panel_util_unicode_get_utf8 (q, &unival);
-				if (!q || !unival) return NULL;
-				sc = g_unichar_tolower (unival);
-				if (sc != nuni[npos]) break;
-				npos++;
-			}
-			if (npos == nlen) {
-				return o;
-			}
-		}
-		o = p;
-	}
-
-	return NULL;
-}
-
 GdkPixbuf *
 panel_util_cairo_rgbdata_to_pixbuf (unsigned char *data,
 				    int            width,
@@ -1105,57 +960,6 @@
 	return NULL;
 }
 
-/* TODO: kill this when we can depend on GTK+ 2.14 */
-static GdkPixbuf *
-panel_util_gdk_pixbuf_load_from_stream (GInputStream  *stream)
-{
-#define LOAD_BUFFER_SIZE 65536
-	unsigned char buffer[LOAD_BUFFER_SIZE];
-	gssize bytes_read;
-	GdkPixbufLoader *loader;
-	GdkPixbuf *pixbuf;
-	gboolean got_eos;
-	
-
-	g_return_val_if_fail (stream != NULL, NULL);
-
-	got_eos = FALSE;
-	loader = gdk_pixbuf_loader_new ();
-	while (1) {
-		bytes_read = g_input_stream_read (stream, buffer, sizeof (buffer),
-						  NULL, NULL);
-		
-		if (bytes_read < 0) {
-			break;
-		}
-		if (bytes_read == 0) {
-			got_eos = TRUE;
-			break;
-		}
-		if (!gdk_pixbuf_loader_write (loader,
-					      buffer,
-					      bytes_read,
-					      NULL)) {
-			break;
-		}
-	}
-
-	g_input_stream_close (stream, NULL, NULL);
-	gdk_pixbuf_loader_close (loader, NULL);
-
-	pixbuf = NULL;
-	if (got_eos) {
-		pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
-		if (pixbuf != NULL) {
-			g_object_ref (pixbuf);
-		}
-	}
-
-	g_object_unref (loader);
-
-	return pixbuf;
-}
-
 GdkPixbuf *
 panel_util_get_pixbuf_from_g_loadable_icon (GIcon *gicon,
 					    int    size)
@@ -1172,7 +976,7 @@
 				       size,
 				       NULL, NULL, NULL);
 	if (stream) {
-		pixbuf = panel_util_gdk_pixbuf_load_from_stream (stream);
+		pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
 		g_object_unref (stream);
 	}
 

Modified: trunk/gnome-panel/panel-util.h
==============================================================================
--- trunk/gnome-panel/panel-util.h	(original)
+++ trunk/gnome-panel/panel-util.h	Mon Aug  4 01:22:17 2008
@@ -43,13 +43,6 @@
 				   GCompareFunc  compare,
 				   gboolean      free_data);
 
-GtkWidget      *panel_error_dialog      (GtkWindow  *parent,
-					 GdkScreen  *screen,
-					 const char *class,
-					 gboolean    auto_destroy,
-					 const char *primary_text,
-					 const char *secondary_text);
-
 int		panel_find_applet_index	(GtkWidget *widget);
 
 void		panel_push_window_busy	(GtkWidget *window);
@@ -82,10 +75,6 @@
 						const char *name);
 char *panel_make_unique_desktop_uri (const char *dir,
 				     const char *source);
-char *panel_lookup_in_data_dirs (const char *basename);
-
-const char *panel_util_utf8_strstrcase (const char *haystack,
-					const char *needle);
 
 GdkPixbuf *panel_util_cairo_rgbdata_to_pixbuf (unsigned char *data,
 					       int            width,

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Mon Aug  4 01:22:17 2008
@@ -35,6 +35,8 @@
 applets/wncklet/workspace-switcher.c
 applets/wncklet/workspace-switcher.glade
 applets/wncklet/workspace-switcher.schemas.in
+gnome-panel/libpanel-util/panel-error.c
+gnome-panel/libpanel-util/panel-show.c
 gnome-panel/GNOME_Panel.server.in
 gnome-panel/GNOME_Panel_Popup.xml
 gnome-panel/applet.c



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