[gnome-shell/wip/fmuellner/notification-redux: 9/88] autorunManager: Use a regular urgent notification



commit 1054007b73ef4741c65b85d827633d060006a9ad
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 12 15:38:17 2015 +0100

    autorunManager: Use a regular urgent notification

 data/theme/gnome-shell.css         |    5 ---
 js/ui/components/autorunManager.js |   60 +++++++++--------------------------
 2 files changed, 16 insertions(+), 49 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 010ecba..2d2ccfc 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -1679,11 +1679,6 @@ StScrollBar StButton#vhandle:active {
     icon-size: 1.09em;
 }
 
-.hotplug-transient-box {
-    spacing: 6px;
-    padding: 2px 72px 2px 12px;
-}
-
 .hotplug-notification-item {
     padding: 2px 10px;
 }
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index 3c6514c..2197fb4 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -167,7 +167,7 @@ const AutorunManager = new Lang.Class({
         this._session = new GnomeSession.SessionManager();
         this._volumeMonitor = Gio.VolumeMonitor.get();
 
-        this._transDispatcher = new AutorunTransientDispatcher(this);
+        this._transDispatcher = new AutorunDispatcher(this);
     },
 
     enable: function() {
@@ -256,8 +256,8 @@ const AutorunManager = new Lang.Class({
     },
 });
 
-const AutorunTransientDispatcher = new Lang.Class({
-    Name: 'AutorunTransientDispatcher',
+const AutorunDispatcher = new Lang.Class({
+    Name: 'AutorunDispatcher',
 
     _init: function(manager) {
         this._manager = manager;
@@ -303,7 +303,7 @@ const AutorunTransientDispatcher = new Lang.Class({
             return;
      
         // add a new source
-        this._sources.push(new AutorunTransientSource(this._manager, mount, apps));
+        this._sources.push(new AutorunSource(this._manager, mount, apps));
     },
 
     addMount: function(mount, apps, contentTypes) {
@@ -352,8 +352,8 @@ const AutorunTransientDispatcher = new Lang.Class({
     }
 });
 
-const AutorunTransientSource = new Lang.Class({
-    Name: 'AutorunTransientSource',
+const AutorunSource = new Lang.Class({
+    Name: 'AutorunSource',
     Extends: MessageTray.Source,
 
     _init: function(manager, mount, apps) {
@@ -363,7 +363,7 @@ const AutorunTransientSource = new Lang.Class({
 
         this.parent(mount.get_name());
 
-        this._notification = new AutorunTransientNotification(this._manager, this);
+        this._notification = new AutorunNotification(this._manager, this);
 
         // add ourselves as a source, and popup the notification
         Main.messageTray.add(this);
@@ -375,34 +375,24 @@ const AutorunTransientSource = new Lang.Class({
     }
 });
 
-const AutorunTransientNotification = new Lang.Class({
-    Name: 'AutorunTransientNotification',
+const AutorunNotification = new Lang.Class({
+    Name: 'AutorunNotification',
     Extends: MessageTray.Notification,
 
     _init: function(manager, source) {
-        this.parent(source, source.title, null, { customContent: true });
+        this.parent(source, source.title);
 
         this._manager = manager;
-        this._box = new St.BoxLayout({ style_class: 'hotplug-transient-box',
-                                       vertical: true });
-        this.addActor(this._box);
-
         this._mount = source.mount;
 
         source.apps.forEach(Lang.bind(this, function (app) {
             let actor = this._buttonForApp(app);
 
             if (actor)
-                this._box.add(actor, { x_fill: true,
-                                       x_align: St.Align.START });
+                this.addButton(actor);
         }));
 
-        this._box.add(this._buttonForEject(), { x_fill: true,
-                                                x_align: St.Align.START });
-
-        // set the notification to transient and urgent, so that it
-        // expands out
-        this.setTransient(true);
+        // set the notification to urgent, so that it expands out
         this.setUrgency(MessageTray.Urgency.CRITICAL);
     },
 
@@ -432,29 +422,11 @@ const AutorunTransientNotification = new Lang.Class({
         return button;
     },
 
-    _buttonForEject: function() {
-        let box = new St.BoxLayout();
-        let icon = new St.Icon({ icon_name: 'media-eject-symbolic',
-                                 style_class: 'hotplug-notification-item-icon' });
-        box.add(icon);
-
-        let label = new St.Bin({ y_align: St.Align.MIDDLE,
-                                 child: new St.Label
-                                 ({ text: _("Eject") })
-                               });
-        box.add(label);
-
-        let button = new St.Button({ child: box,
-                                     x_fill: true,
-                                     x_align: St.Align.START,
-                                     button_mask: St.ButtonMask.ONE,
-                                     style_class: 'hotplug-notification-item' });
-
-        button.connect('clicked', Lang.bind(this, function() {
-            this._manager.ejectMount(this._mount);
-        }));
+    _onClicked: function() {
+        this.parent();
 
-        return button;
+        let app = Gio.app_info_get_default_for_type('inode/directory', false);
+        startAppForMount(app, this._mount);
     }
 });
 


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