[polari] js: Stop using show_all()



commit 72168c0f2f1cd1e02da19e6896a5b863ce1a18af
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Sep 24 23:14:51 2020 +0200

    js: Stop using show_all()
    
    It is gone in GTK4, where widgets are visible by default.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/225>

 data/resources/entry-area.ui    |  4 +---
 data/resources/room-list-row.ui |  2 +-
 data/resources/user-details.ui  | 13 +++----------
 src/appNotifications.js         | 26 +++++++++++++++-----------
 src/chatView.js                 |  3 ++-
 src/connections.js              |  7 ++++---
 src/roomList.js                 |  2 +-
 src/roomStack.js                | 12 +++++++++---
 src/tabCompletion.js            |  6 +++++-
 src/userList.js                 | 20 +++++++++++---------
 10 files changed, 52 insertions(+), 43 deletions(-)
---
diff --git a/data/resources/entry-area.ui b/data/resources/entry-area.ui
index 665bf286..6b696ba2 100644
--- a/data/resources/entry-area.ui
+++ b/data/resources/entry-area.ui
@@ -78,7 +78,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="uploadLabel">
-                <property name="no-show-all">True</property>
                 <property name="visible" bind-source="confirmLabel"
                           bind-property="visible"
                           bind-flags="sync-create|invert-boolean" />
@@ -90,12 +89,11 @@
             </child>
             <child>
               <object class="GtkLabel" id="confirmLabel">
-                <property name="no-show-all">True</property>
                 <property name="halign">start</property>
                 <property name="hexpand">True</property>
                 <property name="ellipsize">end</property>
                 <property name="xalign">0</property>
-                <property name="visible">True</property>
+                <property name="visible">False</property>
               </object>
             </child>
             <child>
diff --git a/data/resources/room-list-row.ui b/data/resources/room-list-row.ui
index c61c2d56..6d4a48e9 100644
--- a/data/resources/room-list-row.ui
+++ b/data/resources/room-list-row.ui
@@ -17,7 +17,7 @@
             <property name="spacing">6</property>
             <child>
               <object class="GtkImage" id="icon">
-                <property name="no-show-all">True</property>
+                <property name="visible">False</property>
                 <property name="valign">baseline</property>
                 <property name="icon-size">1</property>
               </object>
diff --git a/data/resources/user-details.ui b/data/resources/user-details.ui
index 56820008..8bfd9f79 100644
--- a/data/resources/user-details.ui
+++ b/data/resources/user-details.ui
@@ -48,7 +48,6 @@
                 <property name="icon-name">document-open-recent-symbolic</property>
                 <property name="visible" bind-source="lastLabel"
                           bind-property="visible" bind-flags="sync-create"/>
-                <property name="no-show-all">True</property>
                 <property name="halign">start</property>
                 <style>
                   <class name="dim-label" />
@@ -65,7 +64,6 @@
                 <property name="label" translatable="yes">Last Activity:</property>
                 <property name="valign">start</property>
                 <property name="halign">start</property>
-                <property name="no-show-all">True</property>
                 <property name="visible" bind-source="lastLabel"
                           bind-property="visible" bind-flags="sync-create"/>
                 <property name="margin-start">20</property>
@@ -85,7 +83,6 @@
                 <property name="wrap">True</property>
                 <property name="hexpand">True</property>
                 <property name="visible">False</property>
-                <property name="no-show-all">True</property>
                 <property name="hexpand">True</property>
                 <property name="halign">start</property>
                 <style>
@@ -138,7 +135,6 @@
                           bind-property="visible" bind-flags="sync-create"/>
                 <property name="opacity" bind-source="notificationLabel"
                           bind-property="opacity" bind-flags="sync-create"/>
-                <property name="no-show-all">True</property>
                 <property name="halign">start</property>
                 <style>
                   <class name="dim-label" />
@@ -156,8 +152,7 @@
                 <property name="halign">start</property>
                 <property name="margin-start">20</property>
                 <property name="hexpand">True</property>
-                <property name="no-show-all">True</property>
-                <property name="visible">True</property>
+                <property name="visible">False</property>
                 <property name="use-markup">True</property>
                 <property name="label" translatable="yes">Will notify if user appears online.</property>
                 <style>
@@ -184,8 +179,7 @@
             <property name="text" translatable="yes">Start Conversation</property>
             <property name="halign">fill</property>
             <property name="hexpand">True</property>
-            <property name="visible">True</property>
-            <property name="no-show-all">True</property>
+            <property name="visible">False</property>
           </object>
         </child>
         <!-- <child>
@@ -193,8 +187,7 @@
             <property name="text" translatable="yes">View Past Activity</property>
             <property name="halign">fill</property>
             <property name="hexpand">True</property>
-            <property name="visible">True</property>
-            <property name="no-show-all">True</property>
+            <property name="visible">False</property>
           </object>
         </child> -->
       </object>
diff --git a/src/appNotifications.js b/src/appNotifications.js
index dfb2fb76..13069ec1 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -35,24 +35,25 @@ class MessageNotification extends AppNotification {
 
         GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, TIMEOUT, this.close.bind(this));
 
-        this._box = new Gtk.Box({ spacing: 12 });
+        this._box = new Gtk.Box({ spacing: 12, visible: true });
 
         if (iconName)
-            this._box.add(new Gtk.Image({ icon_name: iconName }));
+            this._box.add(new Gtk.Image({ icon_name: iconName, visible: true }));
 
         this._box.add(new Gtk.Label({
             label,
             hexpand: true,
             ellipsize: Pango.EllipsizeMode.END,
+            visible: true,
         }));
 
-        let closeButton = new Gtk.Button({ relief: Gtk.ReliefStyle.NONE });
-        closeButton.image = new Gtk.Image({ icon_name: 'window-close-symbolic' });
+        let closeButton = new Gtk.Button({ relief: Gtk.ReliefStyle.NONE, visible: true });
+        closeButton.image = new Gtk.Image({ icon_name: 'window-close-symbolic', visible: true });
         closeButton.connect('clicked', this.close.bind(this));
         this._box.pack_end(closeButton, false, false, 0);
 
         this.add(this._box);
-        this.show_all();
+        this.show();
     }
 
 
@@ -121,7 +122,7 @@ class SimpleOutput extends CommandOutputNotification {
             wrap: true,
         });
         this.add(label);
-        this.show_all();
+        this.show();
     }
 });
 
@@ -138,8 +139,9 @@ class GridOutput extends CommandOutputNotification {
             column_homogeneous: true,
             row_spacing: 6,
             column_spacing: 18,
+            visible: true,
         });
-        grid.attach(new Gtk.Label({ label: header }), 0, 0, numCols, 1);
+        grid.attach(new Gtk.Label({ label: header, visible: true }), 0, 0, numCols, 1);
 
         let row = 1;
         for (let i = 0; i < numRows; i++) {
@@ -147,13 +149,13 @@ class GridOutput extends CommandOutputNotification {
                 let item = items[i + j * numRows];
                 if (!item)
                     continue;
-                let w = new Gtk.Label({ label: item });
+                let w = new Gtk.Label({ label: item, visible: true });
                 grid.attach(w, j, row, 1, 1);
             }
             row++;
         }
         this.add(grid);
-        this.show_all();
+        this.show();
     }
 });
 
@@ -164,7 +166,7 @@ class NotificationQueue extends Gtk.Frame {
             valign: Gtk.Align.START,
             halign: Gtk.Align.CENTER,
             margin_start: 24, margin_end: 24,
-            no_show_all: true,
+            visible: false,
         });
         this.get_style_context().add_class('app-notification');
 
@@ -237,6 +239,7 @@ export const MessageInfoBar = GObject.registerClass({
             label: `<b>${this._title}</b>`,
             use_markup: true,
             wrap: true,
+            visible: true,
         });
         box.add(this._titleLabel);
 
@@ -245,12 +248,13 @@ export const MessageInfoBar = GObject.registerClass({
             valign: Gtk.Align.CENTER,
             label: this._subtitle,
             ellipsize: Pango.EllipsizeMode.END,
+            visible: true,
         });
         box.add(this._subtitleLabel);
 
         this.connect('response', () => (this.revealed = false));
 
-        box.show_all();
+        box.show();
     }
 
     get title() {
diff --git a/src/chatView.js b/src/chatView.js
index e39b491b..ba218f27 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -299,11 +299,12 @@ export default GObject.registerClass({
             editable: false, cursor_visible: false,
             wrap_mode: Gtk.WrapMode.WORD_CHAR,
             right_margin: MARGIN,
+            visible: true,
         });
         this._view.add_events(Gdk.EventMask.LEAVE_NOTIFY_MASK |
                               Gdk.EventMask.ENTER_NOTIFY_MASK);
         this.add(this._view);
-        this.show_all();
+        this.show();
 
         this._createTags();
 
diff --git a/src/connections.js b/src/connections.js
index 6d939268..a2c62d6f 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -48,20 +48,21 @@ class ConnectionRow extends Gtk.ListBoxRow {
             margin_end: 12,
             margin_top: 12,
             margin_bottom: 12,
+            visible: true,
         });
         this.add(box);
 
-        box.add(new Gtk.Label({ label: name, halign: Gtk.Align.START }));
+        box.add(new Gtk.Label({ label: name, halign: Gtk.Align.START, visible: true }));
 
         let insensitiveDesc = new Gtk.Label({
             label: _('Already added'),
             hexpand: true,
-            no_show_all: true,
             halign: Gtk.Align.END,
+            visible: false,
         });
         box.add(insensitiveDesc);
 
-        this.show_all();
+        this.show();
 
         this.bind_property('sensitive',
             insensitiveDesc, 'visible',
diff --git a/src/roomList.js b/src/roomList.js
index a93e29dc..5e03e628 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -673,7 +673,7 @@ class RoomList extends Gtk.ListBox {
         let placeholder = new Gtk.ListBoxRow({
             selectable: false,
             activatable: false,
-            no_show_all: true,
+            visible: false,
         });
         placeholder.account = account;
 
diff --git a/src/roomStack.js b/src/roomStack.js
index d299e7ec..6983cb38 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -199,12 +199,14 @@ class ChatPlaceholder extends Gtk.Overlay {
             icon_name: 'org.gnome.Polari-symbolic',
             pixel_size: 96, halign: Gtk.Align.END,
             margin_end: 14,
+            visible: true,
         });
 
         let title = new Gtk.Label({
             use_markup: true,
             halign: Gtk.Align.START,
             margin_start: 14,
+            visible: true,
         });
         title.label = `<span letter_spacing="4500">${_('Polari')}<${'/'}span>`;
         title.get_style_context().add_class('polari-background-title');
@@ -213,6 +215,7 @@ class ChatPlaceholder extends Gtk.Overlay {
             label: _('Join a room using the + button.'),
             halign: Gtk.Align.CENTER, wrap: true,
             margin_top: 24, use_markup: true,
+            visible: true,
         });
         description.get_style_context().add_class('polari-background-description');
 
@@ -227,14 +230,16 @@ class ChatPlaceholder extends Gtk.Overlay {
             hexpand: true,
             vexpand: true,
             valign: Gtk.Align.CENTER,
+            visible: true,
         });
         grid.get_style_context().add_class('polari-background');
         grid.attach(image, 0, 0, 1, 1);
         grid.attach(title, 1, 0, 1, 1);
         grid.attach(description, 0, 1, 2, 1);
+        inputPlaceholder.show();
         this.add(grid);
         this.add_overlay(inputPlaceholder);
-        this.show_all();
+        this.show();
     }
 });
 
@@ -243,7 +248,7 @@ class RoomView extends Gtk.Overlay {
     _init(room, sizeGroup) {
         super._init({ name: `RoomView ${room.display_name}` });
 
-        let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
+        let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, visible: true });
         this.add(box);
 
         if (room.type === Tp.HandleType.CONTACT)
@@ -257,6 +262,7 @@ class RoomView extends Gtk.Overlay {
         this._entryArea = new EntryArea({
             room,
             sensitive: false,
+            visible: true,
         });
         box.add(this._entryArea);
 
@@ -275,7 +281,7 @@ class RoomView extends Gtk.Overlay {
             this._entryArea.pasteFile(file);
         });
 
-        this.show_all();
+        this.show();
     }
 
     set inputSensitive(sensitive) {
diff --git a/src/tabCompletion.js b/src/tabCompletion.js
index 32875682..63bb626c 100644
--- a/src/tabCompletion.js
+++ b/src/tabCompletion.js
@@ -39,13 +39,15 @@ export default class TabCompletion {
                 halign: Gtk.Align.START,
                 margin_start: 6,
                 margin_end: 6,
+                visible: true,
             }));
+            row.show();
             this._list.add(row);
         }
     }
 
     _showPopup() {
-        this._list.show_all();
+        this._list.show();
 
         let layout = this._entry.get_layout();
         let layoutIndex = this._entry.text_index_to_layout_index(this._startPos);
@@ -88,7 +90,9 @@ export default class TabCompletion {
                     halign: Gtk.Align.START,
                     margin_start: 6,
                     margin_end: 6,
+                    visible: true,
                 }));
+                row.show();
                 widgetMap.set(nick, row);
             }
         }
diff --git a/src/userList.js b/src/userList.js
index d42d1c47..cdb79651 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -47,17 +47,16 @@ class UserListPopover extends Gtk.Popover {
             margin_end: 6,
             margin_top: 6,
             margin_bottom: 6,
+            visible: true,
         });
         this.add(this._box);
 
-        this._revealer = new Gtk.Revealer();
+        this._revealer = new Gtk.Revealer({ visible: true });
         this._box.add(this._revealer);
 
-        this._entry = new Gtk.SearchEntry();
+        this._entry = new Gtk.SearchEntry({ visible: true });
         this._entry.connect('search-changed', this._updateFilter.bind(this));
         this._revealer.add(this._entry);
-
-        this._box.show_all();
     }
 
     _activeRoomChanged() {
@@ -458,7 +457,7 @@ class UserListRow extends Gtk.ListBoxRow {
     }
 
     _createWidget() {
-        let vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
+        let vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, visible: true });
         this.add(vbox);
 
         let hbox = new Gtk.Box({
@@ -467,10 +466,11 @@ class UserListRow extends Gtk.ListBoxRow {
             margin_top: 4,
             margin_bottom: 4,
             spacing: 4,
+            visible: true,
         });
         this._arrow = new Gtk.Image({
             icon_name: 'pan-end-symbolic',
-            no_show_all: true,
+            visible: false,
         });
         this._label = new Gtk.Label({
             label: this._user.alias,
@@ -479,15 +479,16 @@ class UserListRow extends Gtk.ListBoxRow {
             use_markup: true,
             ellipsize: Pango.EllipsizeMode.END,
             max_width_chars: MAX_USERS_WIDTH_CHARS,
+            visible: true,
         });
         hbox.add(this._label);
         hbox.add(this._arrow);
         vbox.add(hbox);
 
-        this._revealer = new Gtk.Revealer({ reveal_child: false });
+        this._revealer = new Gtk.Revealer({ reveal_child: false, visible: true });
         vbox.add(this._revealer);
 
-        this.show_all();
+        this.show();
     }
 
     _ensureDetails() {
@@ -625,7 +626,8 @@ class UserList extends Gtk.ScrolledWindow {
         });
         this._onChannelChanged(room);
 
-        this.show_all();
+        this._list.show();
+        this.show();
     }
 
     get numRows() {


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