diff options
author | rbuj <[email protected]> | 2020-01-30 17:03:35 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-03-25 13:28:50 +0100 |
commit | 16ae921196f21a6f9c95f27fe94bf61f0df9eda1 (patch) | |
tree | 19e7ec574332e162a48ef29d4d234857ea8346c7 /src | |
parent | fbcbacb489100dbb876de3b2f5226f87e8f10092 (diff) | |
download | engrampa-16ae921196f21a6f9c95f27fe94bf61f0df9eda1.tar.bz2 engrampa-16ae921196f21a6f9c95f27fe94bf61f0df9eda1.tar.xz |
Terminate the application if the resource doesn't exists
Diffstat (limited to 'src')
-rw-r--r-- | src/dlg-add-files.c | 4 | ||||
-rw-r--r-- | src/dlg-add-folder.c | 11 | ||||
-rw-r--r-- | src/dlg-ask-password.c | 8 | ||||
-rw-r--r-- | src/dlg-batch-add.c | 8 | ||||
-rw-r--r-- | src/dlg-delete.c | 7 | ||||
-rw-r--r-- | src/dlg-extract.c | 5 | ||||
-rw-r--r-- | src/dlg-new.c | 8 | ||||
-rw-r--r-- | src/dlg-password.c | 8 | ||||
-rw-r--r-- | src/dlg-prop.c | 7 | ||||
-rw-r--r-- | src/dlg-update.c | 8 | ||||
-rw-r--r-- | src/gtk-utils.c | 19 | ||||
-rw-r--r-- | src/gtk-utils.h | 2 |
12 files changed, 11 insertions, 84 deletions
diff --git a/src/dlg-add-files.c b/src/dlg-add-files.c index bdce319..6842811 100644 --- a/src/dlg-add-files.c +++ b/src/dlg-add-files.c @@ -140,9 +140,7 @@ add_files_cb (GtkWidget *widget, DialogData *data; char *folder; - builder = _gtk_builder_new_from_resource ("dlg-add-files.ui"); - if (builder == NULL) - return; + builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "dlg-add-files.ui"); data = g_new0 (DialogData, 1); data->window = callback_data; diff --git a/src/dlg-add-folder.c b/src/dlg-add-folder.c index 56d619a..3bc5db6 100644 --- a/src/dlg-add-folder.c +++ b/src/dlg-add-folder.c @@ -204,10 +204,7 @@ add_folder_cb (GtkWidget *widget, GtkBuilder *builder; DialogData *data; - builder = _gtk_builder_new_from_resource ("dlg-add-folder.ui"); - if (builder == NULL) { - return; - } + builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "dlg-add-folder.ui"); data = g_new0 (DialogData, 1); data->window = callback_data; @@ -668,11 +665,7 @@ load_options_cb (GtkWidget *w, aod_data = g_new0 (LoadOptionsDialogData, 1); aod_data->data = data; - aod_data->builder = _gtk_builder_new_from_resource ("add-options.ui"); - if (aod_data->builder == NULL) { - g_free (aod_data); - return; - } + aod_data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "add-options.ui"); /* Get the widgets. */ diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c index 6196deb..292e465 100644 --- a/src/dlg-ask-password.c +++ b/src/dlg-ask-password.c @@ -97,13 +97,7 @@ dlg_ask_password__common (FrWindow *window, char *name = NULL; data = g_new0 (DialogData, 1); - - data->builder = _gtk_builder_new_from_resource ("batch-password.ui"); - if (data->builder == NULL) { - g_free (data); - return; - } - + data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "batch-password.ui"); data->window = window; data->pwd_type = pwd_type; diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c index 8e30bd4..7e416e6 100644 --- a/src/dlg-batch-add.c +++ b/src/dlg-batch-add.c @@ -484,13 +484,7 @@ dlg_batch_add_files (FrWindow *window, data = g_new0 (DialogData, 1); data->settings = g_settings_new (ENGRAMPA_SCHEMA_BATCH_ADD); data->settings_general = g_settings_new (ENGRAMPA_SCHEMA_GENERAL); - - data->builder = _gtk_builder_new_from_resource ("batch-add-files.ui"); - if (data->builder == NULL) { - g_free (data); - return; - } - + data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "batch-add-files.ui"); data->window = window; data->file_list = file_list; data->single_file = ((file_list->next == NULL) && uri_is_file ((char*) file_list->data)); diff --git a/src/dlg-delete.c b/src/dlg-delete.c index 59f7b52..824e2ec 100644 --- a/src/dlg-delete.c +++ b/src/dlg-delete.c @@ -114,12 +114,7 @@ dlg_delete__common (FrWindow *window, data = g_new (DialogData, 1); data->window = window; data->selected_files = selected_files; - - data->builder = _gtk_builder_new_from_resource ("delete.ui"); - if (data->builder == NULL) { - g_free (data); - return; - } + data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "delete.ui"); /* Get the widgets. */ diff --git a/src/dlg-extract.c b/src/dlg-extract.c index e5b53f3..5eda7dc 100644 --- a/src/dlg-extract.c +++ b/src/dlg-extract.c @@ -295,10 +295,7 @@ dlg_extract__common (FrWindow *window, DialogData *data; data = g_new0 (DialogData, 1); - if ((data->builder = _gtk_builder_new_from_resource ("dlg-extract.ui")) == NULL) { - g_free (data); - return; - } + data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "dlg-extract.ui"); data->settings = g_settings_new (ENGRAMPA_SCHEMA_EXTRACT); data->window = window; data->selected_files = selected_files; diff --git a/src/dlg-new.c b/src/dlg-new.c index 7412dfa..fbc1e8d 100644 --- a/src/dlg-new.c +++ b/src/dlg-new.c @@ -272,13 +272,7 @@ dlg_new_archive (FrWindow *window, int i; data = g_new0 (DlgNewData, 1); - - data->builder = _gtk_builder_new_from_resource ("new.ui"); - if (data->builder == NULL) { - g_free (data); - return NULL; - } - + data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "new.ui"); data->window = window; data->supported_types = supported_types; sort_mime_types_by_description (data->supported_types); diff --git a/src/dlg-password.c b/src/dlg-password.c index 0ce51e5..4d7a52e 100644 --- a/src/dlg-password.c +++ b/src/dlg-password.c @@ -88,13 +88,7 @@ dlg_password (GtkWidget *widget, DialogData *data; data = g_new0 (DialogData, 1); - - data->builder = _gtk_builder_new_from_resource ("password.ui"); - if (data->builder == NULL) { - g_free (data); - return; - } - + data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "password.ui"); data->window = window; /* Get the widgets. */ diff --git a/src/dlg-prop.c b/src/dlg-prop.c index b7087f2..59cfca2 100644 --- a/src/dlg-prop.c +++ b/src/dlg-prop.c @@ -72,12 +72,7 @@ dlg_prop (FrWindow *window) double ratio; data = g_new (DialogData, 1); - - data->builder = _gtk_builder_new_from_resource ("properties.ui"); - if (data->builder == NULL) { - g_free (data); - return; - } + data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "properties.ui"); /* Get the widgets. */ diff --git a/src/dlg-update.c b/src/dlg-update.c index c813b1d..80bee40 100644 --- a/src/dlg-update.c +++ b/src/dlg-update.c @@ -284,13 +284,7 @@ dlg_update (FrWindow *window) GtkTreeViewColumn *column; data = g_new0 (DialogData, 1); - - data->builder = _gtk_builder_new_from_resource ("update.ui"); - if (data->builder == NULL) { - g_free (data); - return NULL; - } - + data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "update.ui"); data->file_list = NULL; data->window = window; diff --git a/src/gtk-utils.c b/src/gtk-utils.c index 263773a..1e45ef8 100644 --- a/src/gtk-utils.c +++ b/src/gtk-utils.c @@ -573,25 +573,6 @@ show_help_dialog (GtkWindow *parent, } -GtkBuilder * -_gtk_builder_new_from_resource (const char *resource_path) -{ - GtkBuilder *builder; - char *full_path; - GError *error = NULL; - - builder = gtk_builder_new (); - full_path = g_strconcat (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S, resource_path, NULL); - if (! gtk_builder_add_from_resource (builder, full_path, &error)) { - g_warning ("%s\n", error->message); - g_clear_error (&error); - } - g_free (full_path); - - return builder; -} - - GtkWidget * _gtk_builder_get_widget (GtkBuilder *builder, const char *name) diff --git a/src/gtk-utils.h b/src/gtk-utils.h index 3d6c260..a3c9ff4 100644 --- a/src/gtk-utils.h +++ b/src/gtk-utils.h @@ -65,8 +65,6 @@ GdkPixbuf * get_mime_type_pixbuf (const char *mime_type, GtkIconTheme *icon_theme); void show_help_dialog (GtkWindow *parent, const char *section); -GtkBuilder * - _gtk_builder_new_from_resource (const char *resource_path); GtkWidget * _gtk_builder_get_widget (GtkBuilder *builder, const char *name); |