[polari] ui: Move sidebars to PolariFixedSizeFrame
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] ui: Move sidebars to PolariFixedSizeFrame
- Date: Thu, 8 Aug 2013 13:12:38 +0000 (UTC)
commit 6cc9daa45e39fc8b7e5767ba355e68b48c70811d
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Jul 27 20:36:14 2013 +0200
ui: Move sidebars to PolariFixedSizeFrame
We don't want sidebars to change size when we/others join or leave
a room, so set a generous fixed size and ellipsize labels that grow
too large.
data/resources/main-window.ui | 92 +++++++++++++++++++++++++++--------------
src/application.js | 6 +++
src/mainWindow.js | 3 -
src/roomList.js | 4 --
src/userList.js | 9 ----
5 files changed, 67 insertions(+), 47 deletions(-)
---
diff --git a/data/resources/main-window.ui b/data/resources/main-window.ui
index 0e633ef..896413c 100644
--- a/data/resources/main-window.ui
+++ b/data/resources/main-window.ui
@@ -31,15 +31,21 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
- <!-- see commend for titlebar -->
- <property name="hpadding">6</property>
+ <!-- set vpadding to 0 so the separator label extends to the bottom;
+ other elements are not are center-aligned, so with the other
+ headerbar's (default) vpadding, they end up just right -->
+ <property name="vpadding">0</property>
+ <!-- the hpadding property confuses left_side_size_group, so we
+ add it as margin-left to the first button instead -->
+ <property name="hpadding">0</property>
<child>
<object class="GtkMenuButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="halign">center</property>
+ <property name="halign">end</property>
<property name="valign">center</property>
+ <property name="margin-left">6</property>
<property name="menu_model">join_menu</property>
<property name="action_name">app.room-menu</property>
<style>
@@ -82,36 +88,31 @@
<property name="pack_type">start</property>
</packing>
</child>
- </object>
- </child>
- <child>
- <object class="GtkHeaderBar" id="titlebar">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <!-- set vpadding to 0 so the separator label extends to the bottom;
- other elements are not are center-aligned, so with the other
- headerbar's (default) vpadding, they end up just right -->
- <property name="vpadding">0</property>
- <!-- the hpadding property confuses left_side_size_group, so we
- add it as margin-left to the separator label to account for
- the difference; this is why we set hpadding explicitly, though
- 6 should be the default value -->
- <property name="hpadding">6</property>
- <style>
- <class name="polari-titlebar"/>
- </style>
<child>
<object class="GtkLabel" id="titlebar_separator">
<property name="visible">True</property>
- <property name="margin-left">6</property>
<style>
<class name="polari-titlebar-separator"/>
</style>
</object>
<packing>
- <property name="pack_type">start</property>
+ <property name="pack_type">end</property>
</packing>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkHeaderBar" id="titlebar">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <!-- 6 should be the default value, but we set it explicitly
+ to make sure it matches the value used in the left group
+ (where we move the padding to the first element instead
+ to not confuse the size group, see comment for headerbar1 -->
+ <property name="hpadding">6</property>
+ <style>
+ <class name="polari-titlebar"/>
+ </style>
<child>
<object class="GtkToggleButton" id="button3">
<property name="visible">True</property>
@@ -177,12 +178,26 @@
<property name="hexpand">False</property>
<property name="transition_type">slide-right</property>
<child>
- <object class="GtkScrolledWindow" id="room_list_scrollview">
+ <object class="PolariFixedSizeFrame" id="frame1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">never</property>
+ <property name="hexpand">False</property>
+ <property name="width">200</property>
+ <style>
+ <class name="sidebar"/>
+ <class name="polari-sidebar"/>
+ <class name="polari-room-list"/>
+ </style>
<child>
- <placeholder/>
+ <object class="GtkScrolledWindow" id="room_list_scrollview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vexpand">True</property>
+ <property name="hexpand">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
</child>
</object>
</child>
@@ -226,12 +241,26 @@
<property name="hexpand">False</property>
<property name="transition_type">slide-left</property>
<child>
- <object class="GtkStack" id="user_list_stack">
+ <object class="PolariFixedSizeFrame" id="frame2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="transition_type">crossfade</property>
+ <property name="hexpand">False</property>
+ <property name="width">200</property>
+ <style>
+ <class name="sidebar"/>
+ <class name="polari-sidebar"/>
+ <class name="polari-user-list"/>
+ </style>
<child>
- <placeholder/>
+ <object class="GtkStack" id="user_list_stack">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="halign">fill</property>
+ <property name="transition_type">crossfade</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
</child>
</object>
</child>
@@ -332,6 +361,7 @@
<property name="mode">horizontal</property>
<widgets>
<widget name="headerbar1"/>
+ <widget name="frame1"/>
</widgets>
</object>
diff --git a/src/application.js b/src/application.js
index 0341b57..c11e060 100644
--- a/src/application.js
+++ b/src/application.js
@@ -1,6 +1,7 @@
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
+const Polari = imports.gi.Polari;
const Tp = imports.gi.TelepathyGLib;
const AccountsMonitor = imports.accountsMonitor;
@@ -35,6 +36,11 @@ const Application = new Lang.Class({
window._ = Gettext.gettext;
window.C_ = Gettext.pgettext;
+ Gtk.init(null);
+
+ let w = new Polari.FixedSizeFrame(); // register gtype
+ w.destroy();
+
let resource = Gio.Resource.load(Config.RESOURCE_DIR + '/polari.gresource');
resource._register();
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 7f99c28..1549d86 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -67,9 +67,6 @@ const MainWindow = new Lang.Class({
this._roomList = new RoomList.RoomList();
scroll.add(this._roomList.widget);
- let group = builder.get_object('left_side_size_group');
- group.add_widget(this._roomList.widget);
-
this._userListStack = builder.get_object('user_list_stack');
let revealer = builder.get_object('user_list_revealer');
diff --git a/src/roomList.js b/src/roomList.js
index 9e09412..93bc93b 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -82,14 +82,10 @@ const RoomList = new Lang.Class({
_init: function() {
this.widget = new Gtk.ListBox({ hexpand: false });
- this.widget.get_style_context().add_class('polari-room-list');
-
this.widget.set_selection_mode(Gtk.SelectionMode.BROWSE);
this.widget.set_header_func(Lang.bind(this, this._updateHeader));
this.widget.set_sort_func(Lang.bind(this, this._sort));
- this.widget.set_size_request(150, -1);
-
this.widget.connect('row-selected',
Lang.bind(this, this._onRowSelected));
diff --git a/src/userList.js b/src/userList.js
index 870f981..a66d54f 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -11,8 +11,6 @@ const UserList = new Lang.Class({
this.widget = new Gtk.ScrolledWindow();
this.widget.hscrollbar_policy = Gtk.PolicyType.NEVER;
- this.widget.set_size_request(150, -1);
-
this._list = new Gtk.ListBox();
this.widget.add(this._list);
@@ -22,12 +20,6 @@ const UserList = new Lang.Class({
this._room = room;
- /* tmp - use a stylesheet instead */
- let bg = new Gdk.RGBA();
- bg.parse("#eee");
- this._list.override_background_color(0, bg);
-
-
room.connect('member-renamed',
Lang.bind(this, this._onMemberRenamed));
room.connect('member-disconnected',
@@ -70,7 +62,6 @@ const UserList = new Lang.Class({
box.add(new Gtk.Image({ icon_name: 'avatar-default-symbolic' }));
box.add(new Gtk.Label({ label: member.alias,
halign: Gtk.Align.START,
- //max_width_chars: MAX_NICK_CHARS,
ellipsize: Pango.EllipsizeMode.END }));
row.add(box);
row.show_all();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]