[polari/wip/fmuellner/widget-names: 3/3] debug: Set widgets' CSS names to help identifying them



commit afde7ef89719c757c08102a9adf178b3978f9ada
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jul 18 22:32:53 2016 +0200

    debug: Set widgets' CSS names to help identifying them
    
    It's useless for styling, but makes it much easier to identify a widget
    corresponding to a particular user, room or account in the inspector :-)

 src/connections.js | 4 +++-
 src/roomList.js    | 6 +++++-
 src/roomStack.js   | 2 +-
 src/userList.js    | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/connections.js b/src/connections.js
index 9509085..870b57d 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -40,13 +40,15 @@ class ConnectionRow extends Gtk.ListBoxRow {
 
         super._init(params);
 
+        let name = NetworksManager.getDefault().getNetworkName(this._id);
+        this.name = `ConnectionRow ${name}`;
+
         this.bind_property('sensitive', this, 'activatable',
                            GObject.BindingFlags.SYNC_CREATE);
 
         let box = new Gtk.Box({ spacing: 12, margin: 12 });
         this.add(box);
 
-        let name = NetworksManager.getDefault().getNetworkName(this._id);
         box.add(new Gtk.Label({ label: name, halign: Gtk.Align.START }));
 
         let insensitiveDesc = new Gtk.Label({ label: _("Already added"),
diff --git a/src/roomList.js b/src/roomList.js
index b45acc4..708df77 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -23,7 +23,7 @@ var RoomRow = GObject.registerClass({
     InternalChildren: ['eventBox', 'icon', 'roomLabel', 'counter'],
 }, class RoomRow extends Gtk.ListBoxRow {
     _init(room) {
-        super._init();
+        super._init({ name: `RoomRow ${room.display_name}` });
 
         this._room = room;
         this._popover = null;
@@ -157,10 +157,14 @@ var RoomListHeader = GObject.registerClass({
         this._account = params.account;
         delete params.account;
 
+        params.name = `RoomListHeader ${this._account.display_name}`;
+
         this._app = Gio.Application.get_default();
 
         super._init(params);
 
+        this.popover.name = `ConnectionPopover ${this._account.display_name}`;
+
         this.popover.set_default_widget(this._popoverPassword);
         this.popover.connect('notify::visible', _onPopoverVisibleChanged);
         this.popover.connect('closed', () => {
diff --git a/src/roomStack.js b/src/roomStack.js
index 0de230a..9ad9b41 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -188,7 +188,7 @@ class ChatPlaceholder extends Gtk.Overlay {
 var RoomView = GObject.registerClass(
 class RoomView extends Gtk.Overlay {
     _init(room, sizeGroup) {
-        super._init();
+        super._init({ name: `RoomView ${room.display_name}` });
 
         let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
         this.add(box);
diff --git a/src/userList.js b/src/userList.js
index 05bfe52..82f7449 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -433,7 +433,7 @@ class UserListRow extends Gtk.ListBoxRow {
     _init(user) {
         this._user = user;
 
-        super._init();
+        super._init({ name: `UserListRow ${user.alias}` });
 
         this._createWidget();
 


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