diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-05-07 20:53:09 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-05-07 20:53:09 +0200 |
commit | 7004a8b66768d6d8f9b358fc6960dab9424514ad (patch) | |
tree | 1043bc53c1bb25d386d7ebd59bb9637aa50f204c /src/shutdown-dialog.vala | |
parent | 3c44cdf781d4fcb55b4e0c95043f172f218baaa7 (diff) | |
parent | bfb99d8737fd6c62fa24c6980a4d916008de17c4 (diff) | |
download | arctica-greeter-7004a8b66768d6d8f9b358fc6960dab9424514ad.tar.gz arctica-greeter-7004a8b66768d6d8f9b358fc6960dab9424514ad.tar.bz2 arctica-greeter-7004a8b66768d6d8f9b358fc6960dab9424514ad.zip |
Merge branch 'tari01-pr/dbus-server'
Attributes GH PR #46: https://github.com/ArcticaProject/arctica-greeter/pull/46
Diffstat (limited to 'src/shutdown-dialog.vala')
-rw-r--r-- | src/shutdown-dialog.vala | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/shutdown-dialog.vala b/src/shutdown-dialog.vala index d0820ee..9c5be6e 100644 --- a/src/shutdown-dialog.vala +++ b/src/shutdown-dialog.vala @@ -2,6 +2,7 @@ * * Copyright (C) 2013 Canonical Ltd * Copyright (C) 2015,2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> + * Copyright (C) 2023 Robert Tari * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as @@ -18,6 +19,7 @@ * Authors: Robert Ancell <robert.ancell@canonical.com> * Marco Trevisan <marco.trevisan@canonical.com> * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> + * Robert Tari <robert@tari.in> */ public enum ShutdownDialogType @@ -100,7 +102,17 @@ public class ShutdownDialog : Gtk.Fixed monitor_events.add (vbox_events); /* Split font family and size via regular expression. */ - Regex font_regexp = new Regex ("^([[:blank:]]*)(?<font_family>[ a-zA-Z0-9]+) (?<font_size>[0-9]+)([[:blank:]]*)$"); + Regex font_regexp = null; + + try + { + font_regexp = new Regex ("^([[:blank:]]*)(?<font_family>[ a-zA-Z0-9]+) (?<font_size>[0-9]+)([[:blank:]]*)$"); + } + catch (GLib.RegexError pError) + { + error ("Panic: Failed constructing RegEx: %s", pError.message); + } + MatchInfo font_info; if (font_regexp.match(font, 0, out font_info)) { font_family = font_info.fetch_named("font_family"); @@ -351,19 +363,26 @@ public class ShutdownDialog : Gtk.Fixed public void focus_next () { - (get_toplevel () as Gtk.Window).move_focus (Gtk.DirectionType.TAB_FORWARD); + Gtk.Window pWindow = (Gtk.Window) get_toplevel (); + pWindow.move_focus (Gtk.DirectionType.TAB_FORWARD); } public void focus_prev () { - (get_toplevel () as Gtk.Window).move_focus (Gtk.DirectionType.TAB_BACKWARD); + Gtk.Window pWindow = (Gtk.Window) get_toplevel (); + pWindow.move_focus (Gtk.DirectionType.TAB_BACKWARD); } public void cancel () { - var widget = (get_toplevel () as Gtk.Window).get_focus (); + Gtk.Window pWindow = (Gtk.Window) get_toplevel (); + var widget = pWindow.get_focus (); + if (widget is DialogButton) - (get_toplevel () as Gtk.Window).set_focus (null); + { + pWindow = (Gtk.Window) get_toplevel (); + pWindow.set_focus (null); + } else close (); } @@ -616,7 +635,8 @@ private class DialogButton : Gtk.Button public override bool leave_notify_event (Gdk.EventCrossing event) { - (get_toplevel () as Gtk.Window).set_focus (null); + Gtk.Window pWindow = (Gtk.Window) get_toplevel (); + pWindow.set_focus (null); return base.leave_notify_event (event); } |