[baobab] Focus Nautilus window when opening a folder



commit 9ffd6fc23e35474934825d367f4357936de647d0
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Sat Jul 20 19:26:45 2013 +0200

    Focus Nautilus window when opening a folder
    
    If we don't pass the current event timestamp, the focus-stealing
    prevention mechanism will open it in the background.

 src/baobab-window.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index e7505cd..82fe105 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -398,9 +398,11 @@ namespace Baobab {
                 var info = file.query_info (FileAttribute.STANDARD_CONTENT_TYPE, 0, null);
                 var content = info.get_content_type ();
                 var appinfo = AppInfo.get_default_for_type (content, true);
+                var context = get_display ().get_app_launch_context ();
+                context.set_timestamp (Gtk.get_current_event_time ());
                 var files = new List<File>();
                 files.append (file);
-                appinfo.launch(files, null);
+                appinfo.launch(files, context);
             } catch (Error e) {
                 message (_("Failed to open file"), e.message, Gtk.MessageType.ERROR);
             }


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