[file-roller] added focus stealing prevention code



commit 1a31dc3abbe42dcee6de79495bca0af1d69991cc
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Jan 15 11:09:44 2011 +0100

    added focus stealing prevention code
    
    [bug #318108]

 src/fr-window.c |   35 ++++++++++++++++++++++++-----------
 1 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index bfd9f9b..9de18d4 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -8050,16 +8050,23 @@ fr_window_open_files_with_application (FrWindow *window,
 				       GList    *file_list,
 				       GAppInfo *app)
 {
-	GList  *uris = NULL, *scan;
-	GError *error = NULL;
+	GList               *uris;
+	GList               *scan;
+	GdkAppLaunchContext *context;
+	GError              *error = NULL;
 
 	if (window->priv->activity_ref > 0)
 		return;
 
+	uris = NULL;
 	for (scan = file_list; scan; scan = scan->next)
 		uris = g_list_prepend (uris, g_filename_to_uri (scan->data, NULL, NULL));
 
-	if (! g_app_info_launch_uris (app, uris, NULL, &error)) {
+	context = gdk_app_launch_context_new ();
+	gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (GTK_WIDGET (window)));
+	gdk_app_launch_context_set_timestamp (context, 0);
+
+	if (! g_app_info_launch_uris (app, uris, G_APP_LAUNCH_CONTEXT (context), &error)) {
 		_gtk_error_dialog_run (GTK_WINDOW (window),
 				       _("Could not perform the operation"),
 				       "%s",
@@ -8067,6 +8074,7 @@ fr_window_open_files_with_application (FrWindow *window,
 		g_clear_error (&error);
 	}
 
+	g_object_unref (context);
 	path_list_free (uris);
 }
 
@@ -8246,13 +8254,14 @@ monitor_extracted_files (OpenFilesData *odata)
 static gboolean
 fr_window_open_extracted_files (OpenFilesData *odata)
 {
-	GList      *file_list = odata->cdata->file_list;
-	gboolean    result = FALSE;
-	const char *first_file;
-	const char *first_mime_type;
-	GAppInfo   *app;
-	GList      *files_to_open = NULL;
-	GError     *error = NULL;
+	GList               *file_list = odata->cdata->file_list;
+	const char          *first_file;
+	const char          *first_mime_type;
+	GAppInfo            *app;
+	GList               *files_to_open = NULL;
+	GdkAppLaunchContext *context;
+	gboolean             result;
+	GError              *error = NULL;
 
 	g_return_val_if_fail (file_list != NULL, FALSE);
 
@@ -8303,7 +8312,10 @@ fr_window_open_extracted_files (OpenFilesData *odata)
 		}
 	}
 
-	result = g_app_info_launch_uris (app, files_to_open, NULL, &error);
+	context = gdk_app_launch_context_new ();
+	gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (GTK_WIDGET (odata->window)));
+	gdk_app_launch_context_set_timestamp (context, 0);
+	result = g_app_info_launch_uris (app, files_to_open, G_APP_LAUNCH_CONTEXT (context), &error);
 	if (! result) {
 		_gtk_error_dialog_run (GTK_WINDOW (odata->window),
 				       _("Could not perform the operation"),
@@ -8312,6 +8324,7 @@ fr_window_open_extracted_files (OpenFilesData *odata)
 		g_clear_error (&error);
 	}
 
+	g_object_unref (context);
 	g_object_unref (app);
 	path_list_free (files_to_open);
 



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