[gnome-utils] [gsearchtool] Bug 582785: remove libgnome



commit 8b30f024886f326afc08e0fb6dfc40d7bde0bb53
Author: Dennis Cranston <Dennis_Cranston yahoo com>
Date:   Sun May 17 11:33:12 2009 -0700

    [gsearchtool] Bug 582785: remove libgnome
    
    Replace GnomeDesktopItem with GDesktopAppInfo.
---
 gsearchtool/ChangeLog               |    7 +++++
 gsearchtool/Makefile.am             |    4 +-
 gsearchtool/gsearchtool-callbacks.c |    1 -
 gsearchtool/gsearchtool-support.c   |   43 +++++++++++++---------------------
 4 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/gsearchtool/ChangeLog b/gsearchtool/ChangeLog
index da92f2c..0cccdbf 100644
--- a/gsearchtool/ChangeLog
+++ b/gsearchtool/ChangeLog
@@ -1,3 +1,10 @@
+2009-05-17  Dennis Cranston  <dennis_cranston yahoo com>
+
+	* configure.ac, Makefile.am: Use gio-unix.
+	* gsearchtool-callbacks.c: Remove gnome-desktop-item.h
+	* gsearchtool-support.c (open_file_with_filemanager):  
+	Replace GnomeDesktopItem with GDesktopAppInfo, Bug 582785.
+	
 2009-04-29  Dennis Cranston  <dennis_cranston yahoo com>
 
 	* gsearchtool-callbacks.c (build_popup_menu_for_file):  
diff --git a/gsearchtool/Makefile.am b/gsearchtool/Makefile.am
index e110986..799f2fc 100644
--- a/gsearchtool/Makefile.am
+++ b/gsearchtool/Makefile.am
@@ -4,7 +4,7 @@ SUBDIRS = data help
 
 INCLUDES = 	\
 	$(GNOME_UTILS_CFLAGS)					\
-	$(GNOMEDESKTOP_CFLAGS)					\
+	$(GIO_UNIX_CFLAGS)					\
 	$(LIBGNOME_CFLAGS)					\
 	-DG_DISABLE_DEPRECATED					\
 	-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" 	\
@@ -32,7 +32,7 @@ gnome_search_tool_SOURCES =     \
 gnome_search_tool_LDADD =   \
 	$(LIBGNOME_LIBS)    \
 	$(GNOME_UTILS_LIBS) \
-	$(GNOMEDESKTOP_LIBS)
+	$(GIO_UNIX_LIBS)
 
 man_MANS = gnome-search-tool.1
 
diff --git a/gsearchtool/gsearchtool-callbacks.c b/gsearchtool/gsearchtool-callbacks.c
index 81de1d2..41314d4 100644
--- a/gsearchtool/gsearchtool-callbacks.c
+++ b/gsearchtool/gsearchtool-callbacks.c
@@ -36,7 +36,6 @@
 #include <unistd.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
-#include <libgnome/gnome-desktop-item.h>
 
 #include <gnome.h>
 
diff --git a/gsearchtool/gsearchtool-support.c b/gsearchtool/gsearchtool-support.c
index 03d7185..9219152 100644
--- a/gsearchtool/gsearchtool-support.c
+++ b/gsearchtool/gsearchtool-support.c
@@ -35,7 +35,7 @@
 #include <regex.h>
 #include <gdk/gdkx.h>
 #include <gio/gio.h>
-#include <libgnome/gnome-desktop-item.h>
+#include <gio/gdesktopappinfo.h>
 
 #include <gnome.h>
 
@@ -1198,9 +1198,9 @@ gboolean
 open_file_with_filemanager (GtkWidget * window,
                             const gchar * file)
 {
-	GnomeDesktopItem * ditem;
- 	GdkScreen * screen;
-	GError * error = NULL;
+	GDesktopAppInfo * d_app_info;
+	GKeyFile * key_file;
+	GdkAppLaunchContext *ctx;
 	GList * list = NULL;
 	GAppInfo * g_app_info;
 	GFile * g_file;
@@ -1235,34 +1235,25 @@ open_file_with_filemanager (GtkWidget * window,
 				    "StartupNotify=true\n"
 				    "Type=Application\n",
 				    command);
+	key_file = g_key_file_new ();
+	g_key_file_load_from_data (key_file, contents, strlen(contents), G_KEY_FILE_NONE, NULL);
+	d_app_info = g_desktop_app_info_new_from_keyfile (key_file);
+	
+	if (d_app_info != NULL) {
+		ctx = gdk_app_launch_context_new ();
+		gdk_app_launch_context_set_screen (ctx, gtk_widget_get_screen (window));
 
-	ditem = gnome_desktop_item_new_from_string (NULL,
-	                                            contents,
-	                                            strlen (contents),
-	                                            GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
-	                                            NULL);
-	if (ditem != NULL) {
-		screen = gtk_widget_get_screen (window);
-
-		gnome_desktop_item_set_launch_time (ditem,
-		                                    gtk_get_current_event_time ());
-
-		gnome_desktop_item_launch_on_screen (ditem, list,
-		                                     GNOME_DESKTOP_ITEM_LAUNCH_APPEND_URIS | GNOME_DESKTOP_ITEM_LAUNCH_ONLY_ONE,
-						     screen, -1, &error);
-		gnome_desktop_item_unref (ditem);
-
-		if (error) {
-			g_error_free (error);
-			result = FALSE;
-		}
+		result = g_app_info_launch_uris (G_APP_INFO (d_app_info), list,  G_APP_LAUNCH_CONTEXT (ctx), NULL);
 	}
 	else {
 		result = FALSE;
 	}
 
-	g_object_unref (g_file);
 	g_object_unref (g_app_info);
+	g_object_unref (d_app_info);
+	g_object_unref (g_file);
+	g_object_unref (ctx);
+	g_key_file_free (key_file);
 	g_list_free (list);
 	g_free (contents);
 	g_free (command);



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