summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
authorMonsta <[email protected]>2014-12-18 10:38:09 +0300
committerMonsta <[email protected]>2014-12-18 10:38:09 +0300
commit85395208d287b12af23e8f8240a251579eb35097 (patch)
tree75f8dd0ba2c745aca892c186b8e26025c4f823a6 /capplets
parent17dccaa7c69f0ab8e278699a5d138662ce8126b5 (diff)
downloadmate-control-center-85395208d287b12af23e8f8240a251579eb35097.tar.bz2
mate-control-center-85395208d287b12af23e8f8240a251579eb35097.tar.xz
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.
Diffstat (limited to 'capplets')
-rw-r--r--capplets/keyboard/mate-keyboard-properties.c15
1 files changed, 12 insertions, 3 deletions
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 <config.h>
#endif
+#include <stdlib.h>
#include <gio/gio.h>
#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