[polari] userPopover: Allow requesting a notification when a user comes online
- From: Rares Visalom <raresvisalom src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] userPopover: Allow requesting a notification when a user comes online
- Date: Mon, 10 Oct 2016 22:09:22 +0000 (UTC)
commit aee427350e65138ccc0975143fce0780b3565b85
Author: raresv <rares visalom gmail com>
Date: Sat Aug 20 19:32:16 2016 +0300
userPopover: Allow requesting a notification when a user comes online
As the user popover is still available when nicks are offline, it is
a good place to expose the newly added notify-user functionality, so
add a toggle button to the popover to get a notification when the user
comes online.
https://bugzilla.gnome.org/show_bug.cgi?id=760853
data/resources/user-popover.ui | 63 +++++++++++++++++++++++++++++++--------
src/userList.js | 4 ++
2 files changed, 54 insertions(+), 13 deletions(-)
---
diff --git a/data/resources/user-popover.ui b/data/resources/user-popover.ui
index adc2d76..e080ab1 100644
--- a/data/resources/user-popover.ui
+++ b/data/resources/user-popover.ui
@@ -8,25 +8,62 @@
<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>
+ <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="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 96d6b90..17901e9 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -330,6 +330,7 @@ const UserPopover = new Lang.Class({
Template: 'resource:///org/gnome/Polari/ui/user-popover.ui',
InternalChildren: ['nickLabel',
'statusLabel',
+ 'notifyButton',
'userDetails'],
_init: function(params) {
@@ -367,6 +368,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]