From 85395208d287b12af23e8f8240a251579eb35097 Mon Sep 17 00:00:00 2001 From: Monsta Date: Thu, 18 Dec 2014 10:38:09 +0300 Subject: mate-keyboard-properties: catch (and print) any errors during UI load the code is taken from mate-keybinding-properties, so it may or may not be optimal, feel free to correct it if you wish. --- capplets/keyboard/mate-keyboard-properties.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'capplets/keyboard/mate-keyboard-properties.c') diff --git a/capplets/keyboard/mate-keyboard-properties.c b/capplets/keyboard/mate-keyboard-properties.c index 894bd0ec..f789e7a6 100644 --- a/capplets/keyboard/mate-keyboard-properties.c +++ b/capplets/keyboard/mate-keyboard-properties.c @@ -28,6 +28,7 @@ # include #endif +#include #include #include "capplet-util.h" @@ -56,11 +57,16 @@ create_dialog (void) GtkBuilder *dialog; GtkSizeGroup *size_group; GtkWidget *image; + GError *error = NULL; + static const gchar *uifile = MATECC_UI_DIR "/mate-keyboard-properties-dialog.ui"; dialog = gtk_builder_new (); - gtk_builder_add_from_file (dialog, MATECC_UI_DIR - "/mate-keyboard-properties-dialog.ui", - NULL); + if (gtk_builder_add_from_file (dialog, uifile, &error) == 0) { + g_warning ("Could not load UI: %s", error->message); + g_error_free (error); + g_object_unref (dialog); + return NULL; + } size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_size_group_add_widget (size_group, WID ("repeat_slow_label")); @@ -234,6 +240,9 @@ main (int argc, char **argv) typing_break_settings = g_settings_new (TYPING_BREAK_SCHEMA); dialog = create_dialog (); + if (!dialog) /* Warning was already printed to console */ + exit (EXIT_FAILURE); + setup_dialog (dialog); if (switch_to_typing_break_page) { gtk_notebook_set_current_page (GTK_NOTEBOOK -- cgit v1.2.1