[gnome-games/wip/exalm/gtk4: 228/238] ui: Stop using gtk_widget_get_toplevel()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/gtk4: 228/238] ui: Stop using gtk_widget_get_toplevel()
- Date: Mon, 19 Aug 2019 20:35:36 +0000 (UTC)
commit 222380f7e2fc16ad175eeb36bd55e5a65302b13d
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Mon Aug 19 20:20:40 2019 +0500
ui: Stop using gtk_widget_get_toplevel()
Use get_root() instead.
src/ui/keyboard-mapper.vala | 6 ++++--
src/ui/keyboard-tester.vala | 6 ++++--
src/ui/preferences-page-backup-restore.vala | 4 ++--
src/ui/preferences-subpage-gamepad.vala | 2 +-
src/ui/preferences-subpage-keyboard.vala | 2 +-
5 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/ui/keyboard-mapper.vala b/src/ui/keyboard-mapper.vala
index 016b912e..9b935f24 100644
--- a/src/ui/keyboard-mapper.vala
+++ b/src/ui/keyboard-mapper.vala
@@ -54,11 +54,13 @@ private class Games.KeyboardMapper : Gtk.Bin {
}
private void connect_to_keyboard () {
- get_toplevel ().add_controller (controller);
+ var window = get_root () as Gtk.Window;
+ window.add_controller (controller);
}
private void disconnect_from_keyboard () {
- get_toplevel ().remove_controller (controller);
+ var window = get_root () as Gtk.Window;
+ window.remove_controller (controller);
}
private void on_keyboard_event (Gtk.EventControllerKey controller, uint keyval, uint keycode,
Gdk.ModifierType state) {
diff --git a/src/ui/keyboard-tester.vala b/src/ui/keyboard-tester.vala
index e23d7389..355baa4b 100644
--- a/src/ui/keyboard-tester.vala
+++ b/src/ui/keyboard-tester.vala
@@ -38,11 +38,13 @@ private class Games.KeyboardTester : Gtk.Bin {
}
private void connect_to_keyboard () {
- get_toplevel ().add_controller (controller);
+ var window = get_root () as Gtk.Window;
+ window.add_controller (controller);
}
private void disconnect_from_keyboard () {
- get_toplevel ().remove_controller (controller);
+ var window = get_root () as Gtk.Window;
+ window.remove_controller (controller);
}
private bool on_key_press_event (Gtk.EventControllerKey controller, uint keyval, uint keycode,
Gdk.ModifierType state) {
diff --git a/src/ui/preferences-page-backup-restore.vala b/src/ui/preferences-page-backup-restore.vala
index 8d8fc349..5675d81d 100644
--- a/src/ui/preferences-page-backup-restore.vala
+++ b/src/ui/preferences-page-backup-restore.vala
@@ -8,7 +8,7 @@ private class Games.PreferencesPageBackupRestore : PreferencesPage {
[GtkCallback]
private void on_restore_clicked () {
- var toplevel = get_toplevel () as Gtk.Window;
+ var toplevel = get_root () as Gtk.Window;
var chooser = new Gtk.FileChooserNative (_("Restore save data"), toplevel,
Gtk.FileChooserAction.OPEN,
_("_Restore"), _("_Cancel"));
@@ -30,7 +30,7 @@ private class Games.PreferencesPageBackupRestore : PreferencesPage {
[GtkCallback]
private void on_backup_clicked () {
- var toplevel = get_toplevel () as Gtk.Window;
+ var toplevel = get_root () as Gtk.Window;
var chooser = new Gtk.FileChooserNative (_("Back up save data"), toplevel,
Gtk.FileChooserAction.SAVE,
_("_Back Up"), _("_Cancel"));
diff --git a/src/ui/preferences-subpage-gamepad.vala b/src/ui/preferences-subpage-gamepad.vala
index 8dabfb97..faecd554 100644
--- a/src/ui/preferences-subpage-gamepad.vala
+++ b/src/ui/preferences-subpage-gamepad.vala
@@ -179,7 +179,7 @@ private class Games.PreferencesSubpageGamepad : Gtk.Box, PreferencesSubpage {
private void reset_mapping () {
var message_dialog = new ResetControllerMappingDialog ();
- message_dialog.transient_for = get_toplevel () as Gtk.Window;
+ message_dialog.transient_for = get_root () as Gtk.Window;
message_dialog.response.connect ((response) => {
switch (response) {
case Gtk.ResponseType.ACCEPT:
diff --git a/src/ui/preferences-subpage-keyboard.vala b/src/ui/preferences-subpage-keyboard.vala
index 199bf66e..a0afc54c 100644
--- a/src/ui/preferences-subpage-keyboard.vala
+++ b/src/ui/preferences-subpage-keyboard.vala
@@ -163,7 +163,7 @@ private class Games.PreferencesSubpageKeyboard : Gtk.Box, PreferencesSubpage {
private void reset_mapping () {
var message_dialog = new ResetControllerMappingDialog ();
- message_dialog.transient_for = get_toplevel () as Gtk.Window;
+ message_dialog.transient_for = get_root () as Gtk.Window;
message_dialog.response.connect ((response) => {
switch (response) {
case Gtk.ResponseType.ACCEPT:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]