From b72ab7ec2283018dd4fcce9c545b68f435126e22 Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 2 Feb 2020 15:39:06 +0100 Subject: dlg-extract: GtkFileChooserDialog instead of set extra widget --- po/POTFILES.in | 2 +- src/dlg-extract.c | 54 ++----- src/engrampa.gresource.xml | 2 +- src/ui/Makefile.am | 2 +- src/ui/dlg-extract.ui | 327 +++++++++++++++++++++++++++++++++++++++ src/ui/extract-dialog-options.ui | 223 -------------------------- 6 files changed, 342 insertions(+), 268 deletions(-) create mode 100644 src/ui/dlg-extract.ui delete mode 100644 src/ui/extract-dialog-options.ui diff --git a/po/POTFILES.in b/po/POTFILES.in index 6224e54..21960c9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -125,7 +125,7 @@ src/ui/app-menu.ui src/ui/batch-add-files.ui src/ui/batch-password.ui src/ui/delete.ui -src/ui/extract-dialog-options.ui +src/ui/dlg-extract.ui src/ui.h src/ui/menus-toolbars.ui src/ui/new.ui diff --git a/src/dlg-extract.c b/src/dlg-extract.c index e23e585..e5b53f3 100644 --- a/src/dlg-extract.c +++ b/src/dlg-extract.c @@ -295,34 +295,16 @@ 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->settings = g_settings_new (ENGRAMPA_SCHEMA_EXTRACT); data->window = window; data->selected_files = selected_files; data->base_dir_for_selection = base_dir_for_selection; data->extract_clicked = FALSE; - - data->dialog = gtk_file_chooser_dialog_new (_("Extract"), - GTK_WINDOW (data->window), - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - "gtk-cancel", GTK_RESPONSE_CANCEL, - FR_STOCK_EXTRACT, GTK_RESPONSE_OK, - "gtk-help", GTK_RESPONSE_HELP, - NULL); - - gtk_window_set_default_size (GTK_WINDOW (data->dialog), 530, 510); - - gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (data->dialog), FALSE); - gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (data->dialog), FALSE); - gtk_dialog_set_default_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK); - - data->builder = _gtk_builder_new_from_resource ("extract-dialog-options.ui"); - if (data->builder == NULL) { - g_object_unref (data->settings); - gtk_widget_destroy (data->dialog); - g_free (data); - return; - } - gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (data->dialog), GET_WIDGET ("extra_widget")); + data->dialog = GET_WIDGET ("dialog_extract"); /* Set widgets data. */ @@ -347,25 +329,13 @@ dlg_extract__common (FrWindow *window, /* Set the signals handlers. */ - g_signal_connect (G_OBJECT (data->dialog), - "destroy", - G_CALLBACK (destroy_cb), - data); - - g_signal_connect (G_OBJECT (data->dialog), - "response", - G_CALLBACK (file_sel_response_cb), - data); - - g_signal_connect (G_OBJECT (GET_WIDGET ("overwrite_checkbutton")), - "toggled", - G_CALLBACK (overwrite_toggled_cb), - data); - - g_signal_connect (G_OBJECT (GET_WIDGET ("file_pattern_entry")), - "changed", - G_CALLBACK (files_entry_changed_cb), - data); + gtk_builder_add_callback_symbols (data->builder, + "on_dialog_extract_destroy", G_CALLBACK (destroy_cb), + "on_dialog_extract_response", G_CALLBACK (file_sel_response_cb), + "on_overwrite_checkbutton_toggled", G_CALLBACK (overwrite_toggled_cb), + "on_file_pattern_entry_changed", G_CALLBACK (files_entry_changed_cb), + NULL); + gtk_builder_connect_signals (data->builder, data); /* Run dialog. */ diff --git a/src/engrampa.gresource.xml b/src/engrampa.gresource.xml index a3da9d0..1060005 100644 --- a/src/engrampa.gresource.xml +++ b/src/engrampa.gresource.xml @@ -6,8 +6,8 @@ ui/batch-add-files.ui ui/batch-password.ui ui/delete.ui + ui/dlg-extract.ui ui/engrampa.about - ui/extract-dialog-options.ui ui/menus-toolbars.ui ui/new.ui ui/password.ui diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am index 516483d..a1efbc4 100644 --- a/src/ui/Makefile.am +++ b/src/ui/Makefile.am @@ -4,8 +4,8 @@ EXTRA_DIST = \ batch-add-files.ui \ batch-password.ui \ delete.ui \ + dlg-extract.ui \ engrampa.about \ - extract-dialog-options.ui \ menus-toolbars.ui \ new.ui \ password.ui \ diff --git a/src/ui/dlg-extract.ui b/src/ui/dlg-extract.ui new file mode 100644 index 0000000..3a44384 --- /dev/null +++ b/src/ui/dlg-extract.ui @@ -0,0 +1,327 @@ + + + + + + True + False + help-browser + + + True + False + process-stop + + + True + False + extract-archive + + + False + Extract + dialog + select-folder + False + + + + + + + + False + vertical + + + False + end + + + _Help + True + True + True + image1 + True + + + True + True + 0 + + + + + _Cancel + True + True + True + image2 + True + + + True + True + 1 + + + + + _Extract + True + True + True + True + True + image3 + True + + + True + True + 2 + + + + + False + False + 0 + + + + + True + False + 6 + 6 + 6 + 6 + 6 + + + True + False + 0 + none + + + True + False + 12 + + + True + False + 6 + vertical + 6 + + + _All files + True + True + False + start + True + True + True + + + False + True + 0 + + + + + _Selected files + True + True + False + start + True + True + all_files_radiobutton + + + False + True + 1 + + + + + True + False + 6 + + + _Files: + True + True + False + start + True + True + all_files_radiobutton + + + + + + False + True + 0 + + + + + True + True + example: *.txt; *.doc + + + + + + + + False + True + 1 + + + + + False + True + 2 + + + + + + + + + True + False + Extract + + + + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 12 + + + True + False + 6 + vertical + 6 + + + Re-crea_te folders + True + True + False + start + True + True + + + False + True + 0 + + + + + Over_write existing files + True + True + False + start + True + True + + + + False + True + 1 + + + + + Do not e_xtract older files + True + True + False + start + True + True + + + False + True + 2 + + + + + + + + + True + False + Actions + + + + + + + + False + True + 1 + + + + + False + True + 2 + + + + + + button2 + button1 + button3 + + + diff --git a/src/ui/extract-dialog-options.ui b/src/ui/extract-dialog-options.ui deleted file mode 100644 index 36a5014..0000000 --- a/src/ui/extract-dialog-options.ui +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - True - False - 10 - 12 - - - True - False - vertical - 6 - - - True - False - Extract - 0 - - - - - - False - True - 0 - - - - - True - False - 12 - vertical - 6 - - - _All files - True - True - False - start - True - True - True - - - False - True - 0 - - - - - _Selected files - True - True - False - start - True - True - True - all_files_radiobutton - - - False - True - 1 - - - - - True - False - 6 - - - _Files: - True - True - False - start - True - True - True - all_files_radiobutton - - - False - True - 0 - - - - - True - True - example: *.txt; *.doc - - - - False - True - 1 - - - - - False - True - 2 - - - - - False - True - 1 - - - - - True - True - 0 - - - - - True - False - vertical - 6 - - - True - False - Actions - 0 - - - - - - False - True - 0 - - - - - True - False - 12 - vertical - 6 - - - Re-crea_te folders - True - True - False - start - True - True - - - False - True - 0 - - - - - Do not e_xtract older files - True - True - False - start - True - True - - - False - True - 1 - - - - - Over_write existing files - True - True - False - start - True - True - - - False - True - 1 - - - - - False - True - 1 - - - - - True - True - 1 - - - - -- cgit v1.2.1