[polari/wip/raresv/finalRebase: 13/18] userPopover: add notify action in the popover.



commit 96ba88c4308fe87602b739e978ebb6d57f7885f3
Author: raresv <rares visalom gmail com>
Date:   Thu Aug 18 21:03:16 2016 +0300

    userPopover: add notify action in the popover.

 data/resources/user-popover.ui |   65 +++++++++++++++++++++++++++++++--------
 src/userList.js                |    4 ++
 2 files changed, 55 insertions(+), 14 deletions(-)
---
diff --git a/data/resources/user-popover.ui b/data/resources/user-popover.ui
index 4da620a..b1c3355 100644
--- a/data/resources/user-popover.ui
+++ b/data/resources/user-popover.ui
@@ -9,26 +9,63 @@
         <property name="orientation">vertical</property>
         <property name="visible">True</property>
         <child>
-          <object class="GtkLabel" id="nickLabel">
-            <property name="halign">start</property>
-            <property name="margin-top">0</property>
-            <property name="ellipsize">end</property>
-            <property name="max-width-chars">17</property>
-            <property name="visible">True</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkLabel" id="statusLabel">
-            <property name="halign">start</property>
-            <property name="margin-bottom">0</property>
-            <property name="use-markup">True</property>
-            <property name="label" translatable="yes"></property>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
             <property name="visible">True</property>
+            <property name="halign">fill</property>
+            <property name="margin">9</property>
+            <child>
+              <object class="GtkBox">
+                <property name="orientation">vertical</property>
+                <property name="visible">True</property>
+                <property name="halign">fill</property>
+                <child>
+                  <object class="GtkLabel" id="nickLabel">
+                    <property name="halign">start</property>
+                    <property name="margin-top">0</property>
+                    <property name="ellipsize">end</property>
+                    <property name="max-width-chars">17</property>
+                    <property name="visible">True</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="statusLabel">
+                    <property name="halign">start</property>
+                    <property name="margin-bottom">0</property>
+                    <property name="use-markup">True</property>
+                    <property name="label" translatable="yes"></property>
+                    <property name="visible">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkToggleButton" id="notifyButton">
+                <property name="hexpand">True</property>
+                <property name="halign">end</property>
+                <property name="valign">center</property>
+                <property name="visible">True</property>
+                <property name="visible" bind-source="notifyButton"
+                          bind-property="sensitive"
+                          bind-flags="sync-create"/>
+                <child>
+                  <object class="GtkImage">
+                    <property name="icon-name">polari-user-notify-symbolic</property>
+                    <property name="visible">True</property>
+                    <property name="halign">center</property>
+                    <property name="visible">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
         </child>
         <child>
           <object class="Gjs_UserDetails" id="userDetails">
             <property name="visible">True</property>
+            <property name="notifications-enabled" bind-source="notifyButton"
+                      bind-property="active"
+                      bind-flags="sync-create"/>
             <!-- trigger details update on visibility changes -->
             <property name="expanded" bind-source="Gjs_UserPopover"
                       bind-property="visible"
diff --git a/src/userList.js b/src/userList.js
index 1030c66..36639ec 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -324,6 +324,7 @@ const UserPopover = new Lang.Class({
     Template: 'resource:///org/gnome/Polari/ui/user-popover.ui',
     InternalChildren: ['nickLabel',
                        'statusLabel',
+                       'notifyButton',
                        'userDetails'],
 
     _init: function(params) {
@@ -361,6 +362,9 @@ const UserPopover = new Lang.Class({
         this._nickLabel.label = this._nickname;
         this._userDetails.nickname = nickname;
 
+        let actionName = this._userTracker.getNotifyActionName(this._nickname);
+        this._notifyButton.action_name = actionName;
+
         this._setBasenick(Polari.util_get_basenick(nickname));
     },
 


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