[gnome-boxes] app: Add notify_machine_installed() method



commit a83373a628c6e6c5955da752ed988a43a9275f66
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 19 13:38:52 2015 +0100

    app: Add notify_machine_installed() method
    
    Add a method to launch a system notification to inform the user that
    installation of a box is complete. The notification is only launched if
    machine's window (which would be main window if machine is not running
    in any window currently) is not active.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746751

 src/app.vala |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index ac2a646..23beb30 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -423,6 +423,20 @@ private class Boxes.App: Gtk.Application {
         assert (default_connection != null);
     }
 
+    public void notify_machine_installed (Machine machine) {
+        if (machine.window.is_active) {
+            debug ("Window is focused, no need for system notification");
+
+            return;
+        }
+
+        var msg = _("Box '%s' installed and ready to use").printf (machine.name);
+        var notification = new GLib.Notification (msg);
+        notification.add_button ("Launch", "app.launch-box::" + machine.name);
+
+        send_notification (null, notification);
+    }
+
     private async void setup_sources () {
         var dir = File.new_for_path (get_user_pkgconfig_source ());
         var new_sources = new GLib.List<CollectionSource> ();


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