[polari/wip/raresv/userTrackerAndPopoversRebase: 21/24] userDetails: add notification label and notification icon in the ui of the UserDetails class. userDe



commit 006096a42d875273d1ab93eb84b4b1e351419657
Author: raresv <rares visalom gmail com>
Date:   Mon Jul 11 14:27:21 2016 +0300

    userDetails: add notification label and notification icon in the ui of the UserDetails class.
    userDetails: labels now have the same font size
    and icons are dimmed.
    
    userDetails: add the notifications-enabled property and bind it to the notifyIcon and notifyLabel visible 
property.. Make the widgets invisible from the .ui (will be set to true later). Set notificationLabel text to 
'will notify...'.
    
    userDetails: fullnameLabel has ellipsise and max-witdh-chars set. userDetails: set the notificationLabel 
in the .ui file and make it translatable. userDetails: make labels translatable and remove unneeded comment.
    
    userDetails: fix the fullnameLabel, lastHeader and lastLabel
    labels in UserDetails. Font size is normal, without the
    <small> markup and there is a single space (horizontally)
    between the lastHeader and lastLabel.
    
    userDetails: update the max-width-chars property of the
    fullname label in the UserDetails class

 data/resources/user-details.ui |   44 +++++++++++++++++++++++++++++++++++++++-
 src/userList.js                |   25 ++++++++++++++++++----
 2 files changed, 63 insertions(+), 6 deletions(-)
---
diff --git a/data/resources/user-details.ui b/data/resources/user-details.ui
index 7d15f33..705eeba 100644
--- a/data/resources/user-details.ui
+++ b/data/resources/user-details.ui
@@ -42,6 +42,9 @@
                 <property name="visible">True</property>
                 <property name="halign">start</property>
                 <property name="margin-left">0</property>
+                <style>
+                  <class name="dim-label" />
+                </style>
               </object>
               <packing>
                 <property name="width">1</property>
@@ -54,7 +57,6 @@
                 <property name="label" translatable="yes">Last Activity:</property>
                 <property name="valign">start</property>
                 <property name="halign">start</property>
-                <property name="use-markup">True</property>
                 <property name="visible">True</property>
                 <property name="margin-start">20</property>
                 <style>
@@ -74,6 +76,7 @@
                 <property name="hexpand">True</property>
                 <property name="visible">True</property>
                 <property name="hexpand">True</property>
+                <property name="halign">start</property>
                 <style>
                   <class name="dim-label" />
                 </style>
@@ -89,6 +92,9 @@
                 <property name="visible">True</property>
                 <property name="halign">start</property>
                 <property name="margin-left">0</property>
+                <style>
+                  <class name="dim-label" />
+                </style>
               </object>
               <packing>
                 <property name="width">1</property>
@@ -103,6 +109,42 @@
                 <property name="visible">True</property>
                 <property name="margin-start">20</property>
                 <property name="hexpand">True</property>
+                <property name="use-markup">True</property>
+                <style>
+                  <class name="dim-label" />
+                </style>
+              </object>
+              <packing>
+                <property name="width">2</property>
+                <property name="top-attach">1</property>
+                <property name="left-attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="notificationIcon">
+                <property name="icon-name">alarm-symbolic</property>
+                <property name="visible">False</property>
+                <property name="halign">start</property>
+                <property name="margin-left">0</property>
+                <style>
+                  <class name="dim-label" />
+                </style>
+              </object>
+              <packing>
+                <property name="width">1</property>
+                <property name="top-attach">1</property>
+                <property name="left-attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="notificationLabel">
+                <property name="ellipsize">end</property>
+                <property name="halign">start</property>
+                <property name="visible">False</property>
+                <property name="margin-start">20</property>
+                <property name="hexpand">True</property>
+                <property name="use-markup">True</property>
+                <property name="label" translatable="yes">Will notify if user appears online.</property>
                 <style>
                   <class name="dim-label" />
                 </style>
diff --git a/src/userList.js b/src/userList.js
index b5dd17f..e8cd245 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -111,6 +111,8 @@ const UserDetails = new Lang.Class({
                        'fullnameLabel',
                        'lastHeader',
                        'lastLabel',
+                       'notificationIcon',
+                       'notificationLabel',
                        'separator',
                        'messageButton',
                        'pastActivityButton'],
@@ -118,7 +120,12 @@ const UserDetails = new Lang.Class({
                                                         'expanded',
                                                         'expanded',
                                                         READWRITE,
-                                                        false)},
+                                                        false),
+                  'notifications-enabled': GObject.ParamSpec.boolean('notifications-enabled',
+                                                             'notifications-enabled',
+                                                             'notifications-enabled',
+                                                             READWRITE,
+                                                             false)},
 
     _init: function(params) {
         this._expanded = false;
@@ -130,6 +137,14 @@ const UserDetails = new Lang.Class({
 
         this._updateButtonVisibility();
         this._detailsGrid.hide();
+
+        this._notificationIcon.no_show_all = true;
+        this._notificationLabel.no_show_all = true;
+
+        this.bind_property('notifications-enabled', this._notificationIcon, 'visible', 
GObject.BindingFlags.SYNC_CREATE);
+        this.bind_property('notifications-enabled', this._notificationLabel, 'visible', 
GObject.BindingFlags.SYNC_CREATE);
+
+        this._fullnameLabel.max_width_chars = 50;
     },
 
     set user(user) {
@@ -255,10 +270,10 @@ const UserDetails = new Lang.Class({
         this._userIcon.visible = true;
 
         if (last) {
-            this._lastHeader.label = '<small>' + _("Last Activity:") + '</small>';
+            this._lastHeader.label = _("Last Activity:");
             this._lastHeader.show();
 
-            this._lastLabel.label = '<small>' + this._formatLast(last) + '</small>';
+            this._lastLabel.label = this._formatLast(last);
             this._lastLabel.show();
         } else {
             this._lastHeader.hide();
@@ -269,7 +284,7 @@ const UserDetails = new Lang.Class({
     },
 
     _trackFallbackNick: function(nickname) {
-        this._lastHeader.label = '<small>' + _("Last Activity:") + '</small>';
+        this._lastHeader.label = _("Last Activity:");
         this._lastHeader.show();
 
         this._userIcon.visible = false;
@@ -305,7 +320,7 @@ const UserDetails = new Lang.Class({
 
         if (this._user == this._user.connection.self_contact) {
             this._messageButton.visible = false;
-            this._messageButton.sensitive = true; //does this even make sense?
+            this._messageButton.sensitive = true;
         } else {
             this._messageButton.visible = true;
             this._messageButton.sensitive = true;


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