[polari/wip/bastianilso/error-handling] make an offline state label for roomList



commit ac0bdf03c761fcaa8098167143f08d6529a2b5fe
Author: Bastian Ilsø <bastianilso src gnome org>
Date:   Fri Jul 24 09:26:47 2015 +0200

    make an offline state label for roomList

 src/roomList.js |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index 9d21020..fa7fd5d 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -292,21 +292,29 @@ const RoomList = new Lang.Class({
                               GObject.BindingFlags.SYNC_CREATE);
         hbox.add(label);
 
-        let icon = new Gtk.Stack({ hhomogeneous: true });
-        icon.add_named(new Gtk.Image({icon_name: 'dialog-error-symbolic' }), 'error');
-        icon.add_named(new Gtk.Spinner({active: true}), 'connecting');
+        let icon = new Gtk.Stack({ vhomogeneous: true, valign: Gtk.Align.CENTER });
+        let error = new Gtk.Image({icon_name: 'dialog-error-symbolic',halign: Gtk.Align.START });
+        icon.add_named(error, 'error');
+        let connecting = new Gtk.Spinner({active: true, halign: Gtk.Align.START });
+        icon.add_named(connecting, 'connecting');
+        let offline = new Gtk.Label({ label: _("offline"), opacity: 0.5, halign: Gtk.Align.START });
+        icon.add_named(offline, 'offline');
         icon.add_named(new Gtk.Box({visible: false}), 'none');
         let displayStatus = function(binding) {
             let child = 'none';
             let status = binding.source.connection_status;
+            let reason = binding.source.connection_status_reason;
             //log('transformTo called');
             if (status == Tp.ConnectionStatus.CONNECTING) {
                 child = 'connecting';
                 //log('child set to connecting');
             } else if (status == Tp.ConnectionStatus.DISCONNECTED) {
                 //log('connection_status_reason: ' + binding.source.connection_status_reason)
-                child = 'error';
-                //log('child set to error');
+                if (reason == Tp.ConnectionStatusReason.REQUESTED)
+                    child = 'offline';
+                else
+                    child = 'error';
+                //log('child set to disconnected');
             }
             binding.target.visible_child_name = child;
         }


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