From c9b2de2b43d1575a85b5d0344c4a0bd1eb9f93fa Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 5 May 2023 04:31:30 +0200 Subject: Add missing error handlers --- src/prompt-box.vala | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/prompt-box.vala') diff --git a/src/prompt-box.vala b/src/prompt-box.vala index e1dc629..f429bc6 100644 --- a/src/prompt-box.vala +++ b/src/prompt-box.vala @@ -2,6 +2,7 @@ * * Copyright (C) 2011,2012 Canonical Ltd * Copyright (C) 2015,2017 Mike Gabriel + * 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 * Michael Terry * Mike Gabriel + * Robert Tari */ public class PromptBox : FadableBox @@ -176,7 +178,17 @@ public class PromptBox : FadableBox fixed.add (box_grid); /* Split font family and size via regular expression. */ - Regex font_regexp = new Regex ("^([[:blank:]]*)(?[ a-zA-Z0-9]+) (?[0-9]+)([[:blank:]]*)$"); + Regex font_regexp = null; + + try + { + font_regexp = new Regex ("^([[:blank:]]*)(?[ a-zA-Z0-9]+) (?[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"); @@ -310,7 +322,7 @@ public class PromptBox : FadableBox small_name_label = new FadingLabel (""); - var style_ctx = small_name_label.get_style_context(); + var style_ctx = small_name_label.get_style_context(); try { -- cgit v1.2.3 From a919238f30e02cc996eb842d0ab4a0922964d77e Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sat, 6 May 2023 02:45:49 +0200 Subject: Fix some deprecations --- src/prompt-box.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/prompt-box.vala') diff --git a/src/prompt-box.vala b/src/prompt-box.vala index f429bc6..5716ab1 100644 --- a/src/prompt-box.vala +++ b/src/prompt-box.vala @@ -238,7 +238,7 @@ public class PromptBox : FadableBox name_label.vexpand = true; name_label.yalign = 0.5f; name_label.xalign = 0.0f; - name_label.margin_left = 2; + name_label.margin_start = 2; name_label.set_size_request (-1, grid_size); name_label.show (); name_grid.attach (name_label, COL_NAME_LABEL, ROW_NAME, 1, 1); @@ -340,7 +340,7 @@ public class PromptBox : FadableBox small_name_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); small_name_label.yalign = 0.5f; small_name_label.xalign = 0.0f; - small_name_label.margin_left = 2; + small_name_label.margin_start = 2; small_name_label.set_size_request (-1, grid_size); small_name_label.show (); small_name_grid.attach (small_name_label, 1, 0, 1, 1); -- cgit v1.2.3