[gnome-shell] network: Add an empty state to the wifi dialog and adjust the sizing



commit 362e0bf1eccf77ae70bb7f535d828a1a455446e7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Aug 12 13:19:32 2013 -0400

    network: Add an empty state to the wifi dialog and adjust the sizing
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705916

 data/theme/gnome-shell.css |    9 +++++----
 js/ui/status/network.js    |   22 +++++++++++++++++++++-
 2 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 9e11870..e81e882 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -272,7 +272,9 @@ StScrollBar StButton#vhandle:active {
 /* Network */
 
 .nm-dialog {
-    max-height: 400px;
+    max-height: 500px;
+    min-height: 450px;
+    min-width: 470px;
 }
 
 .nm-dialog-content {
@@ -1369,9 +1371,8 @@ StScrollBar StButton#vhandle:active {
     height: 72px;
 }
 
-.no-messages-label {
-    font-family: cantarell, sans-serif;
-    font-size: 11pt;
+.no-messages-label,
+.no-networks-label {
     color: #999999;
 }
 
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 3ced9ca..2b5efeb 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -604,6 +604,10 @@ const NMWirelessDialog = new Lang.Class({
         this._connectButton.can_focus = connectSensitive;
     },
 
+    _updateVisibility: function() {
+        this._noNetworksLabel.visible = (this._networks.length == 0);
+    },
+
     _buildLayout: function() {
         let headline = new St.BoxLayout({ style_class: 'nm-dialog-header-hbox' });
 
@@ -624,12 +628,24 @@ const NMWirelessDialog = new Lang.Class({
         this.contentLayout.style_class = 'nm-dialog-content';
         this.contentLayout.add(headline);
 
+        this._stack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
+
         this._itemBox = new St.BoxLayout({ vertical: true });
         this._scrollView = new St.ScrollView({ style_class: 'nm-dialog-scroll-view' });
+        this._scrollView.set_x_expand(true);
+        this._scrollView.set_y_expand(true);
         this._scrollView.set_policy(Gtk.PolicyType.NEVER,
                                     Gtk.PolicyType.AUTOMATIC);
         this._scrollView.add_actor(this._itemBox);
-        this.contentLayout.add(this._scrollView);
+        this._stack.add_child(this._scrollView);
+
+        this._noNetworksLabel = new St.Label({ style_class: 'no-networks-label',
+                                               x_align: Clutter.ActorAlign.CENTER,
+                                               y_align: Clutter.ActorAlign.CENTER,
+                                               text: _("No Networks") });
+        this._stack.add_child(this._noNetworksLabel);
+
+        this.contentLayout.add(this._stack, { expand: true });
 
         this._disconnectButton = this.addButton({ action: Lang.bind(this, this.close),
                                                   label: _("Cancel"),
@@ -824,6 +840,8 @@ const NMWirelessDialog = new Lang.Class({
             this._createNetworkItem(network);
             this._itemBox.insert_child_at_index(network.item.actor, newPos);
         }
+
+        this._updateVisibility();
     },
 
     _accessPointRemoved: function(device, accessPoint) {
@@ -844,6 +862,8 @@ const NMWirelessDialog = new Lang.Class({
             network.item.updateBestAP(network.accessPoints[0]);
             this._resortItems();
         }
+
+        this._updateVisibility();
     },
 
     _resortItems: function() {


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