From 252faeb6a6dd5a15154972cf15feec3692165bb9 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 28 Oct 2015 15:34:16 +0100 Subject: toggle-box.vala: Catch Glib.Error where it occurs when setting normal button style. --- src/toggle-box.vala | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/toggle-box.vala b/src/toggle-box.vala index fc6c579..91a3e57 100644 --- a/src/toggle-box.vala +++ b/src/toggle-box.vala @@ -44,6 +44,8 @@ public class ToggleBox : Gtk.Box public void set_normal_button_style (Gtk.Button button) { + try + { /* Tighten padding on buttons to not be so large, default color scheme for buttons */ var style = new Gtk.CssProvider (); style.load_from_data ("* {padding: 8px;}\n"+ @@ -56,7 +58,12 @@ public class ToggleBox : Gtk.Box " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BGCOLOR))+ "}\n", -1); button.get_style_context ().add_provider (style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - return; + } + catch (Error e) + { + debug ("Internal error loading session chooser style: %s", e.message); + } + return; } private Gtk.Button selected_button; @@ -125,14 +132,7 @@ public class ToggleBox : Gtk.Box item.add (hbox); hbox.show_all (); - try - { - set_normal_button_style (item); - } - catch (Error e) - { - debug ("Internal error loading session chooser style: %s", e.message); - } + set_normal_button_style (item); item.set_data ("toggle-list-key", key); return item; -- cgit v1.2.3