[gnome-terminal] utils: No need to error check the builder data
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] utils: No need to error check the builder data
- Date: Tue, 8 Jan 2013 22:25:02 +0000 (UTC)
commit 86b7b785d76a1df0702466dc069fb8aa5a2fd9a6
Author: Christian Persch <chpe gnome org>
Date: Thu Dec 20 19:58:23 2012 +0100
utils: No need to error check the builder data
Now that it's built in, just assert when things go wrong.
src/terminal-accels.c | 13 ++++++-------
src/terminal-app.c | 21 ++++++++++-----------
src/terminal-encoding.c | 18 +++++++-----------
src/terminal-search-dialog.c | 24 ++++++++++--------------
src/terminal-util.c | 9 +++------
src/terminal-util.h | 6 +++---
6 files changed, 39 insertions(+), 52 deletions(-)
---
diff --git a/src/terminal-accels.c b/src/terminal-accels.c
index 37582ee..04a44e6 100644
--- a/src/terminal-accels.c
+++ b/src/terminal-accels.c
@@ -427,13 +427,12 @@ terminal_edit_keys_dialog_show (GtkWindow *transient_parent)
if (edit_keys_dialog != NULL)
goto done;
- if (!terminal_util_load_builder_resource ("/org/gnome/terminal/ui/keybinding-editor.ui",
- "keybindings-dialog", &dialog,
- "disable-mnemonics-checkbutton", &disable_mnemonics_button,
- "disable-menu-accel-checkbutton", &disable_menu_accel_button,
- "accelerators-treeview", &tree_view,
- NULL))
- return;
+ terminal_util_load_builder_resource ("/org/gnome/terminal/ui/keybinding-editor.ui",
+ "keybindings-dialog", &dialog,
+ "disable-mnemonics-checkbutton", &disable_mnemonics_button,
+ "disable-menu-accel-checkbutton", &disable_menu_accel_button,
+ "accelerators-treeview", &tree_view,
+ NULL);
terminal_util_bind_mnemonic_label_sensitivity (dialog);
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 5d85296..2b9f793 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -1043,17 +1043,16 @@ terminal_app_manage_profiles (TerminalApp *app,
return;
}
- if (!terminal_util_load_builder_resource ("/org/gnome/terminal/ui/profile-manager.ui",
- "profile-manager", &dialog,
- "profiles-treeview-container", &tree_view_container,
- "new-profile-button", &new_button,
- "edit-profile-button", &edit_button,
- "clone-profile-button", &clone_button,
- "delete-profile-button", &remove_button,
- "default-profile-hbox", &default_hbox,
- "default-profile-label", &default_label,
- NULL))
- return;
+ terminal_util_load_builder_resource ("/org/gnome/terminal/ui/profile-manager.ui",
+ "profile-manager", &dialog,
+ "profiles-treeview-container", &tree_view_container,
+ "new-profile-button", &new_button,
+ "edit-profile-button", &edit_button,
+ "clone-profile-button", &clone_button,
+ "delete-profile-button", &remove_button,
+ "default-profile-hbox", &default_hbox,
+ "default-profile-label", &default_label,
+ NULL);
app->manage_profiles_dialog = GTK_WIDGET (dialog);
app->manage_profiles_new_button = GTK_WIDGET (new_button);
diff --git a/src/terminal-encoding.c b/src/terminal-encoding.c
index db97e40..13ee088 100644
--- a/src/terminal-encoding.c
+++ b/src/terminal-encoding.c
@@ -459,17 +459,13 @@ terminal_encoding_dialog_show (GtkWindow *transient_parent)
data = g_new (EncodingDialogData, 1);
- if (!terminal_util_load_builder_resource ("/org/gnome/terminal/ui/encodings-dialog.ui",
- "encodings-dialog", &data->dialog,
- "add-button", &data->add_button,
- "remove-button", &data->remove_button,
- "available-treeview", &data->available_tree_view,
- "displayed-treeview", &data->active_tree_view,
- NULL))
- {
- g_free (data);
- return;
- }
+ terminal_util_load_builder_resource ("/org/gnome/terminal/ui/encodings-dialog.ui",
+ "encodings-dialog", &data->dialog,
+ "add-button", &data->add_button,
+ "remove-button", &data->remove_button,
+ "available-treeview", &data->available_tree_view,
+ "displayed-treeview", &data->active_tree_view,
+ NULL);
g_object_set_data_full (G_OBJECT (data->dialog), "GT::Data", data, (GDestroyNotify) encoding_dialog_data_free);
diff --git a/src/terminal-search-dialog.c b/src/terminal-search-dialog.c
index 7986e5c..490e7be 100644
--- a/src/terminal-search-dialog.c
+++ b/src/terminal-search-dialog.c
@@ -83,20 +83,16 @@ terminal_search_dialog_new (GtkWindow *parent)
priv = g_new0 (TerminalSearchDialogPrivate, 1);
- if (!terminal_util_load_builder_resource ("/org/gnome/terminal/ui/find-dialog.ui",
- "find-dialog", &dialog,
- "search-label", &priv->search_label,
- "search-entry", &priv->search_entry,
- "match-case-checkbutton", &priv->match_case_checkbutton,
- "entire-word-checkbutton", &priv->entire_word_checkbutton,
- "regex-checkbutton", &priv->regex_checkbutton,
- "search-backwards-checkbutton", &priv->backwards_checkbutton,
- "wrap-around-checkbutton", &priv->wrap_around_checkbutton,
- NULL))
- {
- g_free (priv);
- return NULL;
- }
+ terminal_util_load_builder_resource ("/org/gnome/terminal/ui/find-dialog.ui",
+ "find-dialog", &dialog,
+ "search-label", &priv->search_label,
+ "search-entry", &priv->search_entry,
+ "match-case-checkbutton", &priv->match_case_checkbutton,
+ "entire-word-checkbutton", &priv->entire_word_checkbutton,
+ "regex-checkbutton", &priv->regex_checkbutton,
+ "search-backwards-checkbutton", &priv->backwards_checkbutton,
+ "wrap-around-checkbutton", &priv->wrap_around_checkbutton,
+ NULL);
g_object_set_qdata_full (G_OBJECT (dialog), get_quark (), priv,
(GDestroyNotify) terminal_search_dialog_private_destroy);
diff --git a/src/terminal-util.c b/src/terminal-util.c
index ff71041..170a6af 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -404,7 +404,7 @@ terminal_util_get_licence_text (void)
return g_strjoin ("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL);
}
-gboolean
+void
terminal_util_load_builder_resource (const char *path,
const char *object_name,
...)
@@ -424,10 +424,8 @@ terminal_util_load_builder_resource (const char *path,
objectptr = va_arg (args, GObject**);
*objectptr = gtk_builder_get_object (builder, object_name);
- if (!*objectptr) {
- g_warning ("Failed to fetch object \"%s\"\n", object_name);
- break;
- }
+ if (!*objectptr)
+ g_error ("Failed to fetch object \"%s\" from resource \"%s\"\n", object_name, path);
object_name = va_arg (args, const char*);
}
@@ -435,7 +433,6 @@ terminal_util_load_builder_resource (const char *path,
va_end (args);
g_object_unref (builder);
- return object_name == NULL;
}
gboolean
diff --git a/src/terminal-util.h b/src/terminal-util.h
index 3db2955..d752fa0 100644
--- a/src/terminal-util.h
+++ b/src/terminal-util.h
@@ -57,9 +57,9 @@ char *terminal_util_concat_uris (char **uris,
char *terminal_util_get_licence_text (void);
-gboolean terminal_util_load_builder_resource (const char *path,
- const char *object_name,
- ...);
+void terminal_util_load_builder_resource (const char *path,
+ const char *object_name,
+ ...);
gboolean terminal_util_dialog_response_on_delete (GtkWindow *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]