[polari] Replace Gtk.Widget.get_toplevel()
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] Replace Gtk.Widget.get_toplevel()
- Date: Fri, 3 Sep 2021 11:17:32 +0000 (UTC)
commit 1f03ea611ff7c0f7d3fedbd75c76715d9517fb7a
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Sep 25 19:50:30 2020 +0200
Replace Gtk.Widget.get_toplevel()
It has been superseded in GTK4, switch to our polyfill.
Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/228>
src/entryArea.js | 4 ++--
src/roomList.js | 8 ++++----
src/roomStack.js | 6 +++---
src/serverRoomManager.js | 4 ++--
src/userList.js | 6 +++---
5 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 840ef55a..17629849 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -175,7 +175,7 @@ export default GObject.registerClass({
this.connect('notify::sensitive', this._onSensitiveChanged.bind(this));
this.connect('realize', () => {
this._toplevelKeyController = new Gtk.EventControllerKey({
- widget: this.get_toplevel(),
+ widget: this.get_root(),
propagation_phase: Gtk.PropagationPhase.CAPTURE,
});
this._toplevelKeyController.connect('key-pressed',
@@ -303,7 +303,7 @@ export default GObject.registerClass({
}
_canFocusChatEntry() {
- let toplevelFocus = this._chatEntry.get_toplevel().get_focus();
+ const toplevelFocus = this._chatEntry.get_root().get_focus();
return this.sensitive &&
this._chatEntry.get_mapped() &&
!this._chatEntry['has-focus'] &&
diff --git a/src/roomList.js b/src/roomList.js
index 36ebdb50..7f25f971 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -615,7 +615,7 @@ class RoomList extends Gtk.ListBox {
vfunc_realize() {
super.vfunc_realize();
- let toplevel = this.get_toplevel();
+ const toplevel = this.get_root();
toplevel.connect('notify::active-room',
this._activeRoomChanged.bind(this));
this._activeRoomChanged();
@@ -669,7 +669,7 @@ class RoomList extends Gtk.ListBox {
if (this._roomManager.roomCount === 0)
return;
- let toplevel = this.get_toplevel();
+ const toplevel = this.get_root();
let current = this._roomRows.get(toplevel.active_room.id);
if (current !== row)
@@ -760,7 +760,7 @@ class RoomList extends Gtk.ListBox {
}
_activeRoomChanged() {
- let room = this.get_toplevel().active_room;
+ const room = this.get_root().active_room;
if (!room)
return;
let row = this._roomRows.get(room.id);
@@ -773,7 +773,7 @@ class RoomList extends Gtk.ListBox {
}
on_row_selected(row) {
- this.get_toplevel().active_room = row ? row.room : null;
+ this.get_root().active_room = row ? row.room : null;
if (row)
row.selected();
}
diff --git a/src/roomStack.js b/src/roomStack.js
index 54c23ca5..43eebdba 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -50,7 +50,7 @@ export default GObject.registerClass({
vfunc_realize() {
super.vfunc_realize();
- let toplevel = this.get_toplevel();
+ const toplevel = this.get_root();
toplevel.connect('notify::active-room',
this._activeRoomChanged.bind(this));
@@ -105,12 +105,12 @@ export default GObject.registerClass({
}
_activeRoomChanged() {
- let room = this.get_toplevel().active_room;
+ const room = this.get_root().active_room;
this.set_visible_child_name(room ? room.id : 'placeholder');
}
_updateSensitivity() {
- let room = this.get_toplevel().active_room;
+ const room = this.get_root().active_room;
if (!room)
return;
let sensitive = room && room.channel;
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index a8dd37be..005d322e 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -160,8 +160,8 @@ export const ServerRoomList = GObject.registerClass({
this._filterEntry.connect('stop-search', () => {
if (this._filterEntry.get_text().length > 0)
this._filterEntry.set_text('');
- else if (this.get_toplevel() instanceof Gtk.Dialog)
- this.get_toplevel().response(Gtk.ResponseType.CANCEL);
+ else if (this.get_root() instanceof Gtk.Dialog)
+ this.get_root().response(Gtk.ResponseType.CANCEL);
});
this._filterEntry.connect('activate', () => {
if (this._filterEntry.text.trim().length === 0)
diff --git a/src/userList.js b/src/userList.js
index ef34f2c6..d35fe886 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -32,7 +32,7 @@ class UserListPopover extends Gtk.Popover {
vfunc_realize() {
super.vfunc_realize();
- let toplevel = this.get_toplevel();
+ const toplevel = this.get_root();
toplevel.connect('notify::active-room',
this._activeRoomChanged.bind(this));
toplevel.connect('notify::view-height',
@@ -74,7 +74,7 @@ class UserListPopover extends Gtk.Popover {
if (!this.get_mapped())
return;
- let viewHeight = this.get_toplevel().view_height;
+ const viewHeight = this.get_root().view_height;
let [popoverHeight] = this.get_preferred_height();
let [userListHeight] = this._userList.get_preferred_height();
let chromeHeight = popoverHeight - userListHeight;
@@ -85,7 +85,7 @@ class UserListPopover extends Gtk.Popover {
if (this._userList)
return;
- let room = this.get_toplevel().active_room;
+ const room = this.get_root().active_room;
if (!room || room.type !== Tp.HandleType.ROOM)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]