diff options
author | rbuj <[email protected]> | 2020-02-02 15:39:06 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-02-08 02:05:24 +0100 |
commit | b72ab7ec2283018dd4fcce9c545b68f435126e22 (patch) | |
tree | 17c4637c7215905997d2a9ba30013914c9baa0b0 | |
parent | b6fb2ef7ec53f8e5234e2e5e1a864300c16e704c (diff) | |
download | engrampa-b72ab7ec2283018dd4fcce9c545b68f435126e22.tar.bz2 engrampa-b72ab7ec2283018dd4fcce9c545b68f435126e22.tar.xz |
dlg-extract: GtkFileChooserDialog instead of set extra widget
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | src/dlg-extract.c | 54 | ||||
-rw-r--r-- | src/engrampa.gresource.xml | 2 | ||||
-rw-r--r-- | src/ui/Makefile.am | 2 | ||||
-rw-r--r-- | src/ui/dlg-extract.ui | 327 | ||||
-rw-r--r-- | src/ui/extract-dialog-options.ui | 223 |
6 files changed, 342 insertions, 268 deletions
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 @@ <file compressed="true">ui/batch-add-files.ui</file> <file compressed="true">ui/batch-password.ui</file> <file compressed="true">ui/delete.ui</file> + <file compressed="true">ui/dlg-extract.ui</file> <file compressed="true">ui/engrampa.about</file> - <file compressed="true">ui/extract-dialog-options.ui</file> <file compressed="true">ui/menus-toolbars.ui</file> <file compressed="true">ui/new.ui</file> <file compressed="true">ui/password.ui</file> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface> + <requires lib="gtk+" version="3.22"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">help-browser</property> + </object> + <object class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">process-stop</property> + </object> + <object class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">extract-archive</property> + </object> + <object class="GtkFileChooserDialog" id="dialog_extract"> + <property name="can_focus">False</property> + <property name="title" translatable="yes">Extract</property> + <property name="type_hint">dialog</property> + <property name="action">select-folder</property> + <property name="local_only">False</property> + <signal name="destroy" handler="on_dialog_extract_destroy" swapped="no"/> + <signal name="response" handler="on_dialog_extract_response" swapped="no"/> + <child> + <placeholder/> + </child> + <child internal-child="vbox"> + <object class="GtkBox"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child internal-child="action_area"> + <object class="GtkButtonBox"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="button2"> + <property name="label" translatable="yes">_Help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image1</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button1"> + <property name="label" translatable="yes">_Cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image2</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button3"> + <property name="label" translatable="yes">_Extract</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="image">image3</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="extra_widget"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">6</property> + <property name="margin_right">6</property> + <property name="margin_top">6</property> + <property name="margin_bottom">6</property> + <property name="spacing">6</property> + <child> + <object class="GtkFrame"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">6</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkRadioButton" id="all_files_radiobutton"> + <property name="label" translatable="yes">_All files</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="selected_files_radiobutton"> + <property name="label" translatable="yes">_Selected files</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <property name="group">all_files_radiobutton</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkRadioButton" id="file_pattern_radiobutton"> + <property name="label" translatable="yes">_Files:</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <property name="group">all_files_radiobutton</property> + <accessibility> + <relation type="label-for" target="file_pattern_entry"/> + </accessibility> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="file_pattern_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">example: *.txt; *.doc</property> + <property name="invisible_char">●</property> + <signal name="changed" handler="on_file_pattern_entry_changed" swapped="no"/> + <accessibility> + <relation type="labelled-by" target="file_pattern_radiobutton"/> + </accessibility> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Extract</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">6</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="recreate_dir_checkbutton"> + <property name="label" translatable="yes">Re-crea_te folders</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="overwrite_checkbutton"> + <property name="label" translatable="yes">Over_write existing files</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_overwrite_checkbutton_toggled" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="not_newer_checkbutton"> + <property name="label" translatable="yes">Do not e_xtract older files</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Actions</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-11">button2</action-widget> + <action-widget response="-6">button1</action-widget> + <action-widget response="-5">button3</action-widget> + </action-widgets> + </object> +</interface> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> -<interface> - <requires lib="gtk+" version="3.22"/> - <object class="GtkBox" id="extra_widget"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">10</property> - <property name="spacing">12</property> - <child> - <object class="GtkBox" id="box2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="Action">Extract</property> - <property name="xalign">0</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">12</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkRadioButton" id="all_files_radiobutton"> - <property name="label" translatable="yes">_All files</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="selected_files_radiobutton"> - <property name="label" translatable="yes">_Selected files</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - <property name="group">all_files_radiobutton</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkRadioButton" id="file_pattern_radiobutton"> - <property name="label" translatable="yes">_Files:</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - <property name="group">all_files_radiobutton</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="file_pattern_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">example: *.txt; *.doc</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Actions</property> - <property name="xalign">0</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">12</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkCheckButton" id="recreate_dir_checkbutton"> - <property name="label" translatable="yes">Re-crea_te folders</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="not_newer_checkbutton"> - <property name="label" translatable="yes">Do not e_xtract older files</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="overwrite_checkbutton"> - <property name="label" translatable="yes">Over_write existing files</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> -</interface> |