[polari/wip/fmuellner/combined-gsoc: 65/103] moved the UserPopover widgets into .user-popover.ui



commit b2431b6fd95de430464113af484d62795d9f63a0
Author: raresv <rares visalom gmail com>
Date:   Sat Jul 16 16:16:45 2016 +0300

    moved the UserPopover widgets into .user-popover.ui

 data/org.gnome.Polari.data.gresource.xml |    1 +
 data/resources/user-popover.ui           |   61 ++++++++++++++++++++++++++++++
 src/userList.js                          |   31 ++++-----------
 3 files changed, 71 insertions(+), 22 deletions(-)
---
diff --git a/data/org.gnome.Polari.data.gresource.xml b/data/org.gnome.Polari.data.gresource.xml
index a981a36..f288cc1 100644
--- a/data/org.gnome.Polari.data.gresource.xml
+++ b/data/org.gnome.Polari.data.gresource.xml
@@ -14,5 +14,6 @@
     <file alias="ui/room-list-header.ui" preprocess="xml-stripblanks">resources/room-list-header.ui</file>
     <file alias="ui/room-list-row.ui" preprocess="xml-stripblanks">resources/room-list-row.ui</file>
     <file alias="ui/user-details.ui" preprocess="xml-stripblanks">resources/user-details.ui</file>
+    <file alias="ui/user-popover.ui" preprocess="xml-stripblanks">resources/user-popover.ui</file>
   </gresource>
 </gresources>
diff --git a/data/resources/user-popover.ui b/data/resources/user-popover.ui
new file mode 100644
index 0000000..35aa464
--- /dev/null
+++ b/data/resources/user-popover.ui
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="Gjs_UserPopover" parent="GtkPopover">
+    <property name="hexpand">False</property>
+    <child>
+      <object class="GtkBox" id="userPopoverVBox">
+        <property name="orientation">vertical</property>
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkBox" id="userPopoverHeaderHBox">
+            <property name="orientation">horizontal</property>
+            <property name="visible">True</property>
+            <property name="halign">fill</property>
+            <property name="margin">9</property>
+            <child>
+              <object class="GtkBox" id="userPopoverInfoVBox">
+                <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>
+                  </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>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkToggleButton" id="notifyButton">
+                <property name="hexpand">True</property>
+                <property name="halign">end</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="icon-name">alarm-symbolic</property>
+                    <property name="visible">True</property>
+                    <property name="halign">center</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="Gjs_UserDetails" id="userDetails">
+            <property name="visible">True</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/userList.js b/src/userList.js
index bc90d8a..ace17d0 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -334,6 +334,14 @@ const UserDetails = new Lang.Class({
 const UserPopover = new Lang.Class({
     Name: 'UserPopover',
     Extends: Gtk.Popover,
+    Template: 'resource:///org/gnome/Polari/ui/user-popover.ui',
+    InternalChildren: ['userPopoverVBox',
+                       'userPopoverHeaderHBox',
+                       'userPopoverInfoVBox',
+                       'nickLabel',
+                       'statusLabel',
+                       'notifyButton',
+                       'userDetails'],
 
     _init: function(params) {
         this._room = params.room;
@@ -346,33 +354,12 @@ const UserPopover = new Lang.Class({
 
         this._app = Gio.Application.get_default();
 
-        this._nickLabel = new Gtk.Label({ halign: Gtk.Align.START, margin_top: 0, ellipsize: 
Pango.EllipsizeMode.END, max_width_chars: MAX_USERS_WIDTH_CHARS });
-        this._statusLabel = new Gtk.Label({ halign: Gtk.Align.START, margin_bottom: 0, use_markup: true });
-
-        this._headervbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, halign: Gtk.Align.FILL });
-        this._headervbox.add(this._nickLabel);
-        this._headervbox.add(this._statusLabel);
-
-        this._hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, halign: Gtk.Align.FILL, margin: 
9 });
-        this._hbox.add(this._headervbox);
-
-        this._notifyButton = new Gtk.ToggleButton({ image: new Gtk.Image({ icon_name: 'alarm-symbolic' }), 
halign: Gtk.Align.END, hexpand: true });
         this._notifyButton.bind_property('sensitive', this._notifyButton, 'visible', 0);
 
-        this._hbox.add(this._notifyButton);
-
-
-        this._userDetails = new UserDetails();
         this.bind_property('visible', this._userDetails, 'expanded', 0);
         this._notifyButton.bind_property('active', this._userDetails, 'notifications-enabled', 
GObject.BindingFlags.SYNC_CREATE);
 
-        this._vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
-        this._vbox.add(this._hbox);
-        this._vbox.add(this._userDetails);
-
-        this.add(this._vbox);
-
-        this._vbox.show_all();
+        this.show_all();
     },
 
     set nickname(nickname) {


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