[polari/wip/bastianilso/error-handling: 2/3] WIP: turn roomListHeader into a button
- From: Bastian Ilsø Hougaard <bastianilso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/bastianilso/error-handling: 2/3] WIP: turn roomListHeader into a button
- Date: Fri, 14 Aug 2015 09:27:20 +0000 (UTC)
commit ce55e6dedf6b6b39556b6c7fd39ffb8affde3a3d
Author: Bastian Ilsø <bastianilso src gnome org>
Date: Fri Aug 14 11:11:48 2015 +0200
WIP: turn roomListHeader into a button
crashes when pressing tab after pressing.
if insensitive, the label text turns grey atm..
might be fixed with lapos redesign of sidebar tho.
src/roomList.js | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index 05b7716..2d578fb 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -129,29 +129,33 @@ const RoomListHeader = new Lang.Class({
this._networkMonitor = Gio.NetworkMonitor.get_default();
this._app = Gio.Application.get_default();
- this.widget = new Gtk.Box({ margin_bottom: 4, spacing: 2, hexpand: true,
- orientation: Gtk.Orientation.HORIZONTAL,
- visible: true });
+
+ this.widget = new Gtk.Button({ sensitive: false, margin_bottom: 4,
+ hexpand: true, visible: true })
+ this.widget.get_style_context().remove_class('button');
this.widget.get_style_context().add_class('room-list-header');
+ this.widget.connect('clicked', Lang.bind(this, function () {
+ this._popover.show_all();
+ }));
- let label = new Gtk.Label({ xalign: 0, margin: 4,
- hexpand: true,
- max_width_chars: 15,
+ let headerBox = new Gtk.Box({ spacing: 2, hexpand: true,
+ orientation: Gtk.Orientation.HORIZONTAL,
+ visible: true });
+ this.widget.add(headerBox);
+ let label = new Gtk.Label({ xalign: 0, hexpand: true, max_width_chars: 15,
ellipsize: Pango.EllipsizeMode.END });
+ this.widget.get_style_context().remove_class('button');
account.bind_property('display-name', label, 'label',
GObject.BindingFlags.SYNC_CREATE);
- this.widget.add(label);
+ headerBox.add(label);
this._iconStack = new Gtk.Stack({ vhomogeneous: true, valign: Gtk.Align.CENTER,
margin_end: 4 });
this._iconStack.transition_type = Gtk.StackTransitionType.CROSSFADE;
- let errorIcon = new Gtk.Button({ image: new Gtk.Image({icon_name: 'dialog-error-symbolic'}),
+ let errorIcon = new Gtk.Image({ icon_name: 'dialog-error-symbolic',
halign: Gtk.Align.END });
- errorIcon.get_style_context().remove_class('button');
- errorIcon.connect('clicked', Lang.bind(this, function () {
- this._popover.show_all();
- }));
+
this._popover = new Gtk.Popover({ modal: true,
position: Gtk.PositionType.BOTTOM });
let popoverBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL,
@@ -176,10 +180,10 @@ const RoomListHeader = new Lang.Class({
this._iconStack.add_named(errorIcon, 'error');
- let connecting = new Gtk.Spinner({active: true, halign: Gtk.Align.START });
+ let connecting = new Gtk.Spinner({ active: true, halign: Gtk.Align.START });
this._iconStack.add_named(connecting, 'connecting');
- this._iconStack.add_named(new Gtk.Box({visible: false}), 'none');
+ this._iconStack.add_named(new Gtk.Box({ visible: false }), 'none');
let displayStatus = function(binding) {
let status = binding.source.connection_status;
@@ -188,7 +192,7 @@ const RoomListHeader = new Lang.Class({
}
this._account.connect('notify::connection-status', Lang.bind(this,
this._updateConnectionStatusIcon));
- this.widget.add(this._iconStack);
+ headerBox.add(this._iconStack);
this.widget.show_all();
this._updateConnectionStatusIcon();
@@ -266,6 +270,8 @@ const RoomListHeader = new Lang.Class({
break;
}
}
+ this.widget.sensitive = status == Tp.ConnectionStatus.DISCONNECTED &&
+ reason != Tp.ConnectionStatusReason.REQUESTED;
this._iconStack.visible_child_name = child;
},
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]