diff options
author | rbuj <[email protected]> | 2020-04-02 15:59:02 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-06-05 14:38:12 +0200 |
commit | c60e1cfb6c4296bcc9c4f05da3484f22e7f15770 (patch) | |
tree | 7eb0b2d21b9c589fa29fa6b30d6e9c41d7340352 /src/dlg-add-folder.c | |
parent | 1cbdb4442b82a58576f16b664e647755ff964037 (diff) | |
download | engrampa-c60e1cfb6c4296bcc9c4f05da3484f22e7f15770.tar.bz2 engrampa-c60e1cfb6c4296bcc9c4f05da3484f22e7f15770.tar.xz |
gtk-utils: Remove _gtk_builder_get_widget
Diffstat (limited to 'src/dlg-add-folder.c')
-rw-r--r-- | src/dlg-add-folder.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/dlg-add-folder.c b/src/dlg-add-folder.c index 3bc5db6..926da11 100644 --- a/src/dlg-add-folder.c +++ b/src/dlg-add-folder.c @@ -39,6 +39,8 @@ #define UNUSED_VARIABLE #endif +#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x)))) + typedef struct { FrWindow *window; GSettings *settings; @@ -209,13 +211,13 @@ add_folder_cb (GtkWidget *widget, data = g_new0 (DialogData, 1); data->window = callback_data; data->settings = g_settings_new (ENGRAMPA_SCHEMA_ADD); - data->dialog = _gtk_builder_get_widget (builder, "dialog_add_folder"); - data->add_if_newer_checkbutton = _gtk_builder_get_widget (builder, "add_if_newer_checkbutton"); - data->exclude_symlinks = _gtk_builder_get_widget (builder, "exclude_symlinks"); - data->include_subfold_checkbutton = _gtk_builder_get_widget (builder, "include_subfold_checkbutton"); - data->include_files_entry = _gtk_builder_get_widget (builder, "include_files_entry"); - data->exclude_files_entry = _gtk_builder_get_widget (builder, "exclude_files_entry"); - data->exclude_folders_entry = _gtk_builder_get_widget (builder, "exclude_folders_entry"); + data->dialog = GET_WIDGET ("dialog_add_folder"); + data->add_if_newer_checkbutton = GET_WIDGET ("add_if_newer_checkbutton"); + data->exclude_symlinks = GET_WIDGET ("exclude_symlinks"); + data->include_subfold_checkbutton = GET_WIDGET ("include_subfold_checkbutton"); + data->include_files_entry = GET_WIDGET ("include_files_entry"); + data->exclude_files_entry = GET_WIDGET ("exclude_files_entry"); + data->exclude_folders_entry = GET_WIDGET ("exclude_folders_entry"); /* set data */ dlg_add_folder_load_last_options (data); @@ -516,7 +518,6 @@ dlg_add_folder_save_last_options (DialogData *data) typedef struct { DialogData *data; - GtkBuilder *builder; GtkWidget *dialog; GtkWidget *aod_treeview; GtkTreeModel *aod_model; @@ -527,7 +528,6 @@ static void aod_destroy_cb (GtkWidget *widget, LoadOptionsDialogData *aod_data) { - g_object_unref (aod_data->builder); g_free (aod_data); } @@ -656,8 +656,8 @@ load_options_cb (GtkWidget *w, DialogData *data) { LoadOptionsDialogData *aod_data; + GtkBuilder *builder; GtkWidget *ok_button; - GtkWidget *cancel_button; GtkWidget *remove_button; GtkCellRenderer *renderer; GtkTreeViewColumn *column; @@ -665,16 +665,15 @@ load_options_cb (GtkWidget *w, aod_data = g_new0 (LoadOptionsDialogData, 1); aod_data->data = data; - aod_data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "add-options.ui"); + builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "add-options.ui"); /* Get the widgets. */ - aod_data->dialog = _gtk_builder_get_widget (aod_data->builder, "add_options_dialog"); - aod_data->aod_treeview = _gtk_builder_get_widget (aod_data->builder, "aod_treeview"); + aod_data->dialog = GET_WIDGET ("add_options_dialog"); + aod_data->aod_treeview = GET_WIDGET ("aod_treeview"); - ok_button = _gtk_builder_get_widget (aod_data->builder, "aod_okbutton"); - cancel_button = _gtk_builder_get_widget (aod_data->builder, "aod_cancelbutton"); - remove_button = _gtk_builder_get_widget (aod_data->builder, "aod_remove_button"); + ok_button = GET_WIDGET ("aod_okbutton"); + remove_button = GET_WIDGET ("aod_remove_button"); /* Set the signals handlers. */ @@ -686,7 +685,7 @@ load_options_cb (GtkWidget *w, "row_activated", G_CALLBACK (aod_activated_cb), aod_data); - g_signal_connect_swapped (G_OBJECT (cancel_button), + g_signal_connect_swapped (gtk_builder_get_object (builder, "aod_cancelbutton"), "clicked", G_CALLBACK (gtk_widget_destroy), G_OBJECT (aod_data->dialog)); @@ -699,6 +698,8 @@ load_options_cb (GtkWidget *w, G_CALLBACK (aod_remove_cb), aod_data); + g_object_unref (builder); + /* Set data. */ aod_data->aod_model = GTK_TREE_MODEL (gtk_list_store_new (2, |