[gthumb] added focus stealing prevention code when launching an application



commit acc7d2760508f393280ccef38e802caadb6995c8
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Jan 15 11:20:49 2011 +0100

    added focus stealing prevention code when launching an application

 extensions/file_manager/callbacks.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 5d42725..fa3fb3f 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -854,13 +854,14 @@ static void
 activate_open_with_application_item (GtkMenuItem *menuitem,
 				     gpointer     data)
 {
-	GthBrowser *browser = data;
-	GList      *items;
-	GList      *file_list;
-	GList      *uris;
-	GList      *scan;
-	GAppInfo   *appinfo;
-	GError     *error = NULL;
+	GthBrowser          *browser = data;
+	GList               *items;
+	GList               *file_list;
+	GList               *uris;
+	GList               *scan;
+	GAppInfo            *appinfo;
+	GdkAppLaunchContext *context;
+	GError              *error = NULL;
 
 	items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
 	file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);
@@ -875,11 +876,16 @@ activate_open_with_application_item (GtkMenuItem *menuitem,
 	appinfo = g_object_get_data (G_OBJECT (menuitem), "appinfo");
 	g_return_if_fail (G_IS_APP_INFO (appinfo));
 
-	if (! g_app_info_launch_uris (appinfo, uris, NULL, &error))
+	context = gdk_app_launch_context_new ();
+	gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (GTK_WIDGET (browser)));
+	gdk_app_launch_context_set_timestamp (context, 0);
+	gdk_app_launch_context_set_icon (context, g_app_info_get_icon (appinfo));
+	if (! g_app_info_launch_uris (appinfo, uris, G_APP_LAUNCH_CONTEXT (context), &error))
 		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser),
 						    _("Could not perform the operation"),
 						    &error);
 
+	g_object_unref (context);
 	g_list_free (uris);
 	_g_object_list_unref (file_list);
 	_gtk_tree_path_list_free (items);



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