[file-roller] make the "New Archive" dialog look like the "Compress" dialog
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] make the "New Archive" dialog look like the "Compress" dialog
- Date: Fri, 10 Aug 2012 10:21:27 +0000 (UTC)
commit 900d2b1ad7ada8799763653a714e69697b45d854
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Aug 10 12:15:22 2012 +0200
make the "New Archive" dialog look like the "Compress" dialog
[bug #681232]
data/org.gnome.FileRoller.gschema.xml.in | 35 +-
po/POTFILES.in | 4 +-
src/dlg-batch-add.c | 568 ++-----------------------
src/file-roller.gresource.xml | 2 +-
src/fr-new-archive-dialog.c | 516 +++++++++--------------
src/fr-new-archive-dialog.h | 8 +-
src/fr-window.c | 27 +-
src/glib-utils.c | 26 +-
src/preferences.h | 8 +-
src/ui/Makefile.am | 2 +-
src/ui/{batch-password.ui => ask-password.ui} | 0
src/ui/batch-add-files.ui | 369 ----------------
src/ui/new-archive-dialog.ui | 295 +++++++++++++
13 files changed, 586 insertions(+), 1274 deletions(-)
---
diff --git a/data/org.gnome.FileRoller.gschema.xml.in b/data/org.gnome.FileRoller.gschema.xml.in
index d86d876..6ddfd52 100644
--- a/data/org.gnome.FileRoller.gschema.xml.in
+++ b/data/org.gnome.FileRoller.gschema.xml.in
@@ -159,8 +159,8 @@
<schema id="org.gnome.FileRoller.Dialogs" path="/org/gnome/file-roller/dialogs/">
<child name="extract" schema="org.gnome.FileRoller.Dialogs.Extract"/>
+ <child name="new" schema="org.gnome.FileRoller.Dialogs.New"/>
<child name="add" schema="org.gnome.FileRoller.Dialogs.Add"/>
- <child name="batch-add" schema="org.gnome.FileRoller.Dialogs.BatchAdd"/>
<child name="last-output" schema="org.gnome.FileRoller.Dialogs.LastOutput"/>
</schema>
@@ -175,6 +175,25 @@
</key>
</schema>
+ <schema id="org.gnome.FileRoller.Dialogs.New" path="/org/gnome/file-roller/dialogs/new/" gettext-domain="file-roller">
+ <key name="default-extension" type="s">
+ <default>'.tar.gz'</default>
+ </key>
+ <key name="other-options" type="b">
+ <default>false</default>
+ </key>
+ <key name="encrypt-header" type="b">
+ <default>false</default>
+ <_summary>Encrypt the archive header</_summary>
+ <_description>Whether to encrypt the archive header. If the header is encrypted the password will be required to list the archive content as well.</_description>
+ </key>
+ <key name="volume-size" type="i">
+ <default>0</default>
+ <_summary>Default volume size</_summary>
+ <_description>The default size for volumes.</_description>
+ </key>
+ </schema>
+
<schema id="org.gnome.FileRoller.Dialogs.Add" path="/org/gnome/file-roller/dialogs/add/" gettext-domain="file-roller">
<key name="current-folder" type="s">
<default>''</default>
@@ -205,20 +224,6 @@
</key>
</schema>
- <schema id="org.gnome.FileRoller.Dialogs.BatchAdd" path="/org/gnome/file-roller/dialogs/batch-add/" gettext-domain="file-roller">
- <key name="default-extension" type="s">
- <default>'.tar.gz'</default>
- </key>
- <key name="other-options" type="b">
- <default>false</default>
- </key>
- <key name="volume-size" type="i">
- <default>0</default>
- <_summary>Default volume size</_summary>
- <_description>The default size for volumes.</_description>
- </key>
- </schema>
-
<schema id="org.gnome.FileRoller.Dialogs.LastOutput" path="/org/gnome/file-roller/dialogs/last-output/" gettext-domain="file-roller">
<key name="width" type="i">
<default>-1</default>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 669eab9..e240889 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -106,6 +106,8 @@ src/gio-utils.c
src/gio-utils.h
src/glib-utils.c
src/glib-utils.h
+src/gth-icon-cache.c
+src/gth-icon-cache.h
src/gth-menu-button.c
src/gth-menu-button.h
src/gtk-utils.c
@@ -126,7 +128,6 @@ src/typedefs.h
[type: gettext/glade]src/ui/add-dialog-options.ui
[type: gettext/glade]src/ui/add-options.ui
[type: gettext/glade]src/ui/app-menu.ui
-[type: gettext/glade]src/ui/batch-add-files.ui
[type: gettext/glade]src/ui/batch-password.ui
[type: gettext/glade]src/ui/delete.ui
[type: gettext/glade]src/ui/error-dialog.ui
@@ -136,6 +137,7 @@ src/ui.h
[type: gettext/glade]src/ui/menus-toolbars.ui
[type: gettext/glade]src/ui/message-dialog.ui
[type: gettext/glade]src/ui/new-archive-dialog-options.ui
+[type: gettext/glade]src/ui/new-archive-dialog.ui
[type: gettext/glade]src/ui/password.ui
[type: gettext/glade]src/ui/progress-dialog.ui
[type: gettext/glade]src/ui/properties.ui
diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c
index 24f36f0..cd24d5a 100644
--- a/src/dlg-batch-add.c
+++ b/src/dlg-batch-add.c
@@ -20,447 +20,36 @@
*/
#include <config.h>
-#include <string.h>
-#include <math.h>
-#include <unistd.h>
-#include <gio/gio.h>
-#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include "dlg-batch-add.h"
#include "file-utils.h"
-#include "fr-init.h"
-#include "fr-stock.h"
+#include "fr-new-archive-dialog.h"
#include "fr-window.h"
-#include "gtk-utils.h"
#include "glib-utils.h"
-#include "preferences.h"
-#include "typedefs.h"
-
-
-#define ARCHIVE_ICON_SIZE (48)
-#define BAD_CHARS "/\\*"
-#define GET_WIDGET(x) (_gtk_builder_get_widget (data->builder, (x)))
-
-
-typedef struct {
- FrWindow *window;
- GSettings *settings;
- GSettings *settings_general;
- GtkBuilder *builder;
- int *supported_types;
- GtkWidget *archive_type_combo_box;
- GList *file_list;
- gboolean creating;
- const char *last_mime_type;
- gboolean single_file;
-} DialogData;
-
-
-static const char *
-get_ext (DialogData *data)
-{
- int idx;
-
- idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->archive_type_combo_box));
-
- return mime_type_desc[data->supported_types[idx]].default_ext;
-}
-
-
-static const char *
-get_mime_type (DialogData *data)
-{
- int idx;
-
- idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->archive_type_combo_box));
-
- return mime_type_desc[data->supported_types[idx]].mime_type;
-}
-
-
-/* called when the main dialog is closed. */
-static void
-destroy_cb (GtkWidget *widget,
- DialogData *data)
-{
- g_settings_set_string (data->settings, PREF_BATCH_ADD_DEFAULT_EXTENSION, get_ext (data));
- /*g_settings_set_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS, data->add_clicked ? FALSE : gtk_expander_get_expanded (GTK_EXPANDER (GET_WIDGET ("a_other_options_expander"))));*/
- g_settings_set_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton"))));
-
- if (! data->creating)
- fr_window_stop_batch (data->window);
-
- g_object_unref (data->builder);
- g_object_unref (data->settings_general);
- g_object_unref (data->settings);
- g_free (data);
-}
static void
-set_archive_options (DialogData *data)
+dialog_response_cb (GtkDialog *dialog,
+ int response_id,
+ gpointer user_data)
{
- int idx;
-
- idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->archive_type_combo_box));
- if (mime_type_desc[data->supported_types[idx]].capabilities & FR_ARCHIVE_CAN_ENCRYPT) {
- const char *pwd;
-
- pwd = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("a_password_entry")));
- if (pwd != NULL) {
- if (strcmp (pwd, "") != 0) {
- fr_window_set_password (data->window, pwd);
- if (mime_type_desc[data->supported_types[idx]].capabilities & FR_ARCHIVE_CAN_ENCRYPT_HEADER)
- fr_window_set_encrypt_header (data->window, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton"))));
- }
- }
- }
-
- if ((mime_type_desc[data->supported_types[idx]].capabilities & FR_ARCHIVE_CAN_CREATE_VOLUMES)
- && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_volume_checkbutton"))))
- {
- double value;
- int size;
-
- value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")));
- size = floor (value * MEGABYTE);
- g_settings_set_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE, size);
- fr_window_set_volume_size (data->window, (guint) size);
- }
-}
-
-
-static void
-add_clicked_cb (GtkWidget *widget,
- DialogData *data)
-{
- FrWindow *window = data->window;
- char *archive_name;
- GFile *archive_folder;
- GFile *archive_file;
- char *tmp;
- const char *archive_ext;
- const char *mime_type;
- gboolean do_not_add = FALSE;
- GError *error = NULL;
-
- /* Collect data */
-
- archive_name = g_uri_escape_string (gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("a_add_to_entry"))), NULL, FALSE);
-
- /* Check whether the user entered a valid archive name. */
-
- if ((archive_name == NULL) || (*archive_name == '\0')) {
- GtkWidget *d;
+ FrWindow *window = user_data;
- d = _gtk_error_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- NULL,
- _("Could not create the archive"),
- "%s",
- _("You have to specify an archive name."));
- gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
- g_free (archive_name);
+ if (response_id == GTK_RESPONSE_OK) {
+ GFile *file;
+ const char *mime_type;
- return;
- }
- else if (_g_strchrs (archive_name, BAD_CHARS)) {
- GtkWidget *d;
- char *utf8_name = g_filename_display_name (archive_name);
-
- d = _gtk_error_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- NULL,
- _("Could not create the archive"),
- _("The name \"%s\" is not valid because it cannot contain the characters: %s\n\n%s"),
- utf8_name,
- BAD_CHARS,
- _("Please use a different name."));
- gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
-
- g_free (utf8_name);
- g_free (archive_name);
-
- return;
- }
-
- /* Check directory existence. */
-
- archive_folder = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (GET_WIDGET ("a_location_filechooserbutton")));
- if (archive_folder == NULL) {
- g_free (archive_name);
- return;
- }
-
- if (! _g_file_check_permissions (archive_folder, R_OK|W_OK|X_OK)) {
- GtkWidget *d;
-
- d = _gtk_error_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- NULL,
- _("Could not create the archive"),
- "%s",
- _("You don't have the right permissions to create an archive in the destination folder."));
- gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
-
- g_object_unref (archive_folder);
- g_free (archive_name);
-
- return;
- }
-
- if (! _g_file_query_is_dir (archive_folder)) {
- GtkWidget *d;
- int r;
- char *folder_name;
- char *msg;
-
- folder_name = _g_file_get_display_basename (archive_folder);
- msg = g_strdup_printf (_("Destination folder \"%s\" does not exist.\n\nDo you want to create it?"), folder_name);
- g_free (folder_name);
-
- d = _gtk_message_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
- GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
- msg,
- NULL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- _("Create _Folder"), GTK_RESPONSE_YES,
- NULL);
-
- gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES);
- r = gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
-
- g_free (msg);
-
- do_not_add = (r != GTK_RESPONSE_YES);
- }
-
- if (! do_not_add && ! _g_file_make_directory_tree (archive_folder, 0755, &error)) {
- GtkWidget *d;
-
- d = _gtk_error_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- NULL,
- _("Could not create the archive"),
- _("Could not create the destination folder: %s."),
- error->message);
- gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
-
- g_error_free (error);
- g_object_unref (archive_folder);
- g_free (archive_name);
-
- return;
- }
-
- if (do_not_add) {
- GtkWidget *d;
-
- d = _gtk_message_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_DIALOG_WARNING,
- _("Archive not created"),
- NULL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
- gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
-
- g_object_unref (archive_folder);
- g_free (archive_name);
-
- return;
- }
-
- /**/
-
- archive_ext = get_ext (data);
- mime_type = get_mime_type (data);
-
- tmp = archive_name;
- archive_name = g_strconcat (tmp, archive_ext, NULL);
- g_free (tmp);
- archive_file = g_file_get_child_for_display_name (archive_folder, archive_name, NULL);
-
- if (_g_file_query_is_dir (archive_file)) {
- GtkWidget *d;
-
- d = _gtk_error_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- NULL,
- _("Could not create the archive"),
- "%s",
- _("You have to specify an archive name."));
- gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
-
- g_free (archive_name);
- g_object_unref (archive_folder);
- g_object_unref (archive_file);
-
- return;
- }
-
- if (g_file_query_exists (archive_file, NULL)) {
- GtkWidget *d;
- int r;
-
- d = _gtk_message_dialog_new (GTK_WINDOW (GET_WIDGET ("dialog")),
- GTK_DIALOG_MODAL,
- GTK_STOCK_DIALOG_QUESTION,
- _("The archive is already present. Do you want to overwrite it?"),
- NULL,
- GTK_STOCK_NO, GTK_RESPONSE_NO,
- _("_Overwrite"), GTK_RESPONSE_YES,
- NULL);
-
- gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES);
- r = gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
-
- if (r == GTK_RESPONSE_YES) {
- GError *err = NULL;
-
- g_file_delete (archive_file, NULL, &err);
- if (err != NULL) {
- g_warning ("Failed to delete file: %s", err->message);
- g_clear_error (&err);
- }
- }
- else {
- g_free (archive_name);
- g_object_unref (archive_folder);
- g_object_unref (archive_file);
+ file = fr_new_archive_dialog_get_file (FR_NEW_ARCHIVE_DIALOG (dialog), &mime_type);
+ if (file == NULL)
return;
- }
- }
-
- data->creating = TRUE;
- set_archive_options (data);
- gtk_widget_destroy (GET_WIDGET ("dialog"));
-
- fr_window_create_archive_and_continue (window, archive_file, mime_type, NULL);
-
- g_free (archive_name);
- g_object_unref (archive_folder);
- g_object_unref (archive_file);
-}
-
-
-static void
-update_sensitivity_for_mime_type (DialogData *data,
- const char *mime_type)
-{
- int i;
-
- if (mime_type == NULL) {
- gtk_widget_set_sensitive (GET_WIDGET ("a_password_entry"), FALSE);
- gtk_widget_set_sensitive (GET_WIDGET ("a_password_label"), FALSE);
- gtk_widget_set_sensitive (GET_WIDGET ("a_encrypt_header_checkbutton"), FALSE);
- gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton")), TRUE);
- gtk_widget_set_sensitive (GET_WIDGET ("a_volume_box"), FALSE);
- return;
- }
-
- for (i = 0; mime_type_desc[i].mime_type != NULL; i++) {
- if (strcmp (mime_type_desc[i].mime_type, mime_type) == 0) {
- gboolean sensitive;
-
- sensitive = mime_type_desc[i].capabilities & FR_ARCHIVE_CAN_ENCRYPT;
- gtk_widget_set_sensitive (GET_WIDGET ("a_password_entry"), sensitive);
- gtk_widget_set_sensitive (GET_WIDGET ("a_password_label"), sensitive);
-
- sensitive = mime_type_desc[i].capabilities & FR_ARCHIVE_CAN_ENCRYPT_HEADER;
- gtk_widget_set_sensitive (GET_WIDGET ("a_encrypt_header_checkbutton"), sensitive);
- gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton")), ! sensitive);
- sensitive = mime_type_desc[i].capabilities & FR_ARCHIVE_CAN_CREATE_VOLUMES;
- gtk_widget_set_sensitive (GET_WIDGET ("a_volume_box"), sensitive);
-
- break;
- }
- }
-}
-
-
-static void
-archive_type_combo_box_changed_cb (GtkComboBox *combo_box,
- DialogData *data)
-{
- const char *mime_type;
- int idx = gtk_combo_box_get_active (combo_box);
- GdkPixbuf *icon;
-
- mime_type = mime_type_desc[data->supported_types[idx]].mime_type;
-
- icon = _g_mime_type_get_icon (mime_type, ARCHIVE_ICON_SIZE, NULL);
- if (icon != NULL) {
- gtk_image_set_from_pixbuf (GTK_IMAGE (GET_WIDGET ("archive_icon_image")), icon);
- g_object_unref (icon);
+ fr_window_create_archive_and_continue (window, file, mime_type, NULL);
+ g_object_unref (file);
}
+ else
+ fr_window_stop_batch (window);
- update_sensitivity_for_mime_type (data, mime_type);
-}
-
-
-static void
-update_archive_type_combo_box_from_ext (DialogData *data,
- const char *ext)
-{
- int idx = 0;
- int i;
-
- if (ext == NULL) {
- gtk_combo_box_set_active (GTK_COMBO_BOX (data->archive_type_combo_box), 0);
- return;
- }
-
- for (i = 0; data->supported_types[i] != -1; i++)
- if (strcmp (ext, mime_type_desc[data->supported_types[i]].default_ext) == 0) {
- idx = i;
- break;
- }
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (data->archive_type_combo_box), idx);
-}
-
-
-static void
-update_sensitivity (DialogData *data)
-{
- const char *password;
- gboolean has_password;
-
- gtk_widget_set_sensitive (GET_WIDGET ("a_volume_spinbutton"),
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_volume_checkbutton"))));
-
- password = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("a_password_entry")));
- has_password = (password != NULL) && (*password != '\0');
- gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton")), ! has_password);
- gtk_widget_set_sensitive (GET_WIDGET ("a_encrypt_header_checkbutton"), has_password);
-}
-
-
-static void
-password_entry_notify_text_cb (GObject *object,
- GParamSpec *spec,
- gpointer user_data)
-{
- update_sensitivity ((DialogData *) user_data);
-}
-
-
-static void
-volume_toggled_cb (GtkToggleButton *toggle_button,
- gpointer user_data)
-{
- update_sensitivity ((DialogData *) user_data);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
@@ -468,117 +57,38 @@ void
dlg_batch_add_files (FrWindow *window,
GList *file_list)
{
- DialogData *data;
- GtkSizeGroup *size_group;
- char *automatic_name = NULL;
- char *default_ext;
- GFile *first_file;
- GFile *parent;
- int i;
+ GFile *first_file;
+ GFile *parent;
+ char *filename;
+ GtkWidget *dialog;
- if (file_list == NULL)
- return;
-
- data = g_new0 (DialogData, 1);
- data->settings = g_settings_new (FILE_ROLLER_SCHEMA_BATCH_ADD);
- data->settings_general = g_settings_new (FILE_ROLLER_SCHEMA_GENERAL);
- data->builder = _gtk_builder_new_from_resource ("batch-add-files.ui");
- if (data->builder == NULL) {
- g_free (data);
- return;
- }
-
- data->window = window;
- data->file_list = file_list;
- data->single_file = ((file_list->next == NULL) && _g_file_query_is_file (G_FILE (file_list->data)));
- data->creating = FALSE;
-
- /* Set widgets data. */
-
- size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- gtk_size_group_add_widget (size_group, GET_WIDGET ("a_archive_label"));
- gtk_size_group_add_widget (size_group, GET_WIDGET ("a_location_label"));
- gtk_size_group_add_widget (size_group, GET_WIDGET ("a_password_label"));
-
- gtk_button_set_use_stock (GTK_BUTTON (GET_WIDGET ("a_add_button")), TRUE);
- gtk_button_set_label (GTK_BUTTON (GET_WIDGET ("a_add_button")), FR_STOCK_CREATE_ARCHIVE);
- gtk_expander_set_expanded (GTK_EXPANDER (GET_WIDGET ("a_other_options_expander")), FALSE /*g_settings_get_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS)*/);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton")), g_settings_get_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")), (double) g_settings_get_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
+ g_return_if_fail (file_list != NULL);
first_file = G_FILE (file_list->data);
parent = g_file_get_parent (first_file);
+ filename = NULL;
if (file_list->next == NULL)
- automatic_name = g_file_get_basename (first_file);
+ filename = g_file_get_basename (first_file);
else
- automatic_name = g_file_get_basename (parent);
+ filename = g_file_get_basename (parent);
- _gtk_entry_set_filename_text (GTK_ENTRY (GET_WIDGET ("a_add_to_entry")), automatic_name);
- g_free (automatic_name);
+ if (! _g_file_check_permissions (parent, R_OK | W_OK)) {
+ g_object_unref (parent);
+ parent = g_object_ref (_g_file_get_home ());
+ }
- if (_g_file_check_permissions (parent, R_OK | W_OK))
- gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (GET_WIDGET ("a_location_filechooserbutton")), parent, NULL);
- else
- gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (GET_WIDGET ("a_location_filechooserbutton")), _g_file_get_home (), NULL);
+ dialog = fr_new_archive_dialog_new (_("Compress"),
+ NULL,
+ FR_NEW_ARCHIVE_ACTION_NEW,
+ parent,
+ filename);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (dialog_response_cb),
+ window);
+ gtk_window_present (GTK_WINDOW (dialog));
g_object_unref (parent);
-
- /* archive type combobox */
-
- data->archive_type_combo_box = gtk_combo_box_text_new ();
- if (data->single_file)
- data->supported_types = single_file_save_type;
- else
- data->supported_types = save_type;
- sort_mime_types_by_extension (data->supported_types);
-
- for (i = 0; data->supported_types[i] != -1; i++)
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->archive_type_combo_box),
- mime_type_desc[data->supported_types[i]].default_ext);
-
- gtk_box_pack_start (GTK_BOX (GET_WIDGET ("a_archive_type_box")), data->archive_type_combo_box, TRUE, TRUE, 0);
- gtk_widget_show_all (GET_WIDGET ("a_archive_type_box"));
-
- /* Set the signals handlers. */
-
- g_signal_connect (GET_WIDGET ("dialog"),
- "destroy",
- G_CALLBACK (destroy_cb),
- data);
- g_signal_connect_swapped (GET_WIDGET ("a_cancel_button"),
- "clicked",
- G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (GET_WIDGET ("dialog")));
- g_signal_connect (G_OBJECT (GET_WIDGET ("a_add_button")),
- "clicked",
- G_CALLBACK (add_clicked_cb),
- data);
- g_signal_connect (G_OBJECT (data->archive_type_combo_box),
- "changed",
- G_CALLBACK (archive_type_combo_box_changed_cb),
- data);
- g_signal_connect (GET_WIDGET ("a_password_entry"),
- "notify::text",
- G_CALLBACK (password_entry_notify_text_cb),
- data);
- g_signal_connect (GET_WIDGET ("a_volume_checkbutton"),
- "toggled",
- G_CALLBACK (volume_toggled_cb),
- data);
-
- /* Run dialog. */
-
- default_ext = g_settings_get_string (data->settings, PREF_BATCH_ADD_DEFAULT_EXTENSION);
- update_archive_type_combo_box_from_ext (data, default_ext);
- g_free (default_ext);
-
- gtk_widget_grab_focus (GET_WIDGET ("a_add_to_entry"));
- gtk_editable_select_region (GTK_EDITABLE (GET_WIDGET ("a_add_to_entry")),
- 0, -1);
-
- update_sensitivity (data);
-
- gtk_window_set_modal (GTK_WINDOW (GET_WIDGET ("dialog")), FALSE);
- gtk_window_present (GTK_WINDOW (GET_WIDGET ("dialog")));
+ g_free (filename);
}
diff --git a/src/file-roller.gresource.xml b/src/file-roller.gresource.xml
index e3106b4..a0c5018 100644
--- a/src/file-roller.gresource.xml
+++ b/src/file-roller.gresource.xml
@@ -4,7 +4,6 @@
<file compressed="true">ui/add-dialog-options.ui</file>
<file compressed="true">ui/add-options.ui</file>
<file compressed="true">ui/app-menu.ui</file>
- <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/error-dialog.ui</file>
@@ -12,6 +11,7 @@
<file compressed="true">ui/file-selector.ui</file>
<file compressed="true">ui/menus-toolbars.ui</file>
<file compressed="true">ui/message-dialog.ui</file>
+ <file compressed="true">ui/new-archive-dialog.ui</file>
<file compressed="true">ui/new-archive-dialog-options.ui</file>
<file compressed="true">ui/password.ui</file>
<file compressed="true">ui/progress-dialog.ui</file>
diff --git a/src/fr-new-archive-dialog.c b/src/fr-new-archive-dialog.c
index 5991b52..2574d22 100644
--- a/src/fr-new-archive-dialog.c
+++ b/src/fr-new-archive-dialog.c
@@ -33,13 +33,13 @@
#include "preferences.h"
-#define GET_WIDGET(x) (_gtk_builder_get_widget (self->priv->builder, (x)))
-#define DEFAULT_EXTENSION ".tar.gz"
-#define MEGABYTE (1024 * 1024)
-#define MIME_TYPE_INDEX_KEY "fr-mime-type-idx"
+#define GET_WIDGET(x) (_gtk_builder_get_widget (self->priv->builder, (x)))
+#define MEGABYTE (1024 * 1024)
+#define ARCHIVE_ICON_SIZE 48
struct _FrNewArchiveDialogPrivate {
+ GSettings *settings;
GtkBuilder *builder;
int *supported_types;
GHashTable *supported_ext;
@@ -49,7 +49,7 @@ struct _FrNewArchiveDialogPrivate {
};
-G_DEFINE_TYPE (FrNewArchiveDialog, fr_new_archive_dialog, GTK_TYPE_FILE_CHOOSER_DIALOG)
+G_DEFINE_TYPE (FrNewArchiveDialog, fr_new_archive_dialog, GTK_TYPE_DIALOG)
static void
@@ -59,6 +59,7 @@ fr_new_archive_dialog_finalize (GObject *object)
self = FR_NEW_ARCHIVE_DIALOG (object);
+ g_object_unref (self->priv->settings);
g_object_unref (self->priv->builder);
g_hash_table_unref (self->priv->supported_ext);
@@ -66,15 +67,45 @@ fr_new_archive_dialog_finalize (GObject *object)
}
+static int
+get_selected_format (FrNewArchiveDialog *self)
+{
+ return self->priv->supported_types[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("extension_comboboxtext")))];
+}
+
+
+static void
+fr_new_archive_dialog_unmap (GtkWidget *widget)
+{
+ FrNewArchiveDialog *self;
+ int n_format;
+
+ self = FR_NEW_ARCHIVE_DIALOG (widget);
+
+ g_settings_set_boolean (self->priv->settings, PREF_NEW_ENCRYPT_HEADER, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("encrypt_header_checkbutton"))));
+ g_settings_set_int (self->priv->settings, PREF_NEW_VOLUME_SIZE, gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("volume_spinbutton"))) * MEGABYTE);
+
+ n_format = get_selected_format (self);
+ g_settings_set_string (self->priv->settings, PREF_NEW_DEFAULT_EXTENSION, mime_type_desc[n_format].default_ext);
+
+ GTK_WIDGET_CLASS (fr_new_archive_dialog_parent_class)->unmap (widget);
+}
+
+
static void
fr_new_archive_dialog_class_init (FrNewArchiveDialogClass *klass)
{
- GObjectClass *object_class;
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
g_type_class_add_private (klass, sizeof (FrNewArchiveDialogPrivate));
- object_class = (GObjectClass*) klass;
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = fr_new_archive_dialog_finalize;
object_class->finalize = fr_new_archive_dialog_finalize;
+
+ widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->unmap = fr_new_archive_dialog_unmap;
}
@@ -82,6 +113,7 @@ static void
fr_new_archive_dialog_init (FrNewArchiveDialog *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, FR_TYPE_NEW_ARCHIVE_DIALOG, FrNewArchiveDialogPrivate);
+ self->priv->settings = g_settings_new (FILE_ROLLER_SCHEMA_NEW);
self->priv->builder = NULL;
self->priv->supported_ext = g_hash_table_new (g_str_hash, g_str_equal);
}
@@ -97,47 +129,6 @@ _fr_new_archive_dialog_update_sensitivity (FrNewArchiveDialog *self)
static void
-_fr_new_archive_dialog_update_sensitivity_for_ext (FrNewArchiveDialog *self,
- const char *ext)
-{
- const char *mime_type;
- int i;
-
- self->priv->can_encrypt = FALSE;
- self->priv->can_encrypt_header = FALSE;
- self->priv->can_create_volumes = FALSE;
-
- mime_type = get_mime_type_from_extension (ext);
-
- if (mime_type == NULL) {
- gtk_widget_set_sensitive (GET_WIDGET ("password_entry"), FALSE);
- gtk_widget_set_sensitive (GET_WIDGET ("password_label"), FALSE);
- gtk_widget_set_sensitive (GET_WIDGET ("encrypt_header_checkbutton"), FALSE);
- gtk_widget_set_sensitive (GET_WIDGET ("volume_box"), FALSE);
- return;
- }
-
- for (i = 0; mime_type_desc[i].mime_type != NULL; i++) {
- if (strcmp (mime_type_desc[i].mime_type, mime_type) == 0) {
- self->priv->can_encrypt = mime_type_desc[i].capabilities & FR_ARCHIVE_CAN_ENCRYPT;
- gtk_widget_set_sensitive (GET_WIDGET ("password_entry"), self->priv->can_encrypt);
- gtk_widget_set_sensitive (GET_WIDGET ("password_label"), self->priv->can_encrypt);
-
- self->priv->can_encrypt_header = mime_type_desc[i].capabilities & FR_ARCHIVE_CAN_ENCRYPT_HEADER;
- gtk_widget_set_sensitive (GET_WIDGET ("encrypt_header_checkbutton"), self->priv->can_encrypt_header);
-
- self->priv->can_create_volumes = mime_type_desc[i].capabilities & FR_ARCHIVE_CAN_CREATE_VOLUMES;
- gtk_widget_set_sensitive (GET_WIDGET ("volume_box"), self->priv->can_create_volumes);
-
- break;
- }
- }
-
- _fr_new_archive_dialog_update_sensitivity (self);
-}
-
-
-static void
password_entry_changed_cb (GtkEditable *editable,
gpointer user_data)
{
@@ -153,95 +144,35 @@ volume_toggled_cb (GtkToggleButton *toggle_button,
}
-static int
-_fr_new_archive_dialog_get_format (FrNewArchiveDialog *self,
- const char *uri)
-{
- GtkFileFilter *filter;
- int idx;
-
- filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (self));
- if (filter == NULL)
- return -1;
-
- idx = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (filter), MIME_TYPE_INDEX_KEY)) - 1;
- if (idx < 0) {
- const char *ext;
-
- /* get the format from the extension */
-
- ext = _g_filename_get_extension (uri);
- if (ext == NULL)
- ext = DEFAULT_EXTENSION;
- idx = GPOINTER_TO_INT (g_hash_table_lookup (self->priv->supported_ext, ext)) - 1;
- }
-
- return idx;
-}
-
-
static void
-filter_notify_cb (GObject *gobject,
- GParamSpec *pspec,
- gpointer user_data)
+extension_comboboxtext_changed_cb (GtkComboBox *combo_box,
+ gpointer user_data)
{
FrNewArchiveDialog *self = user_data;
- const char *uri;
- const char *ext;
int n_format;
+ GdkPixbuf *icon_pixbuf;
- uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (self));
- if (uri == NULL)
- return;
-
- n_format = _fr_new_archive_dialog_get_format (self, uri);
- if (n_format < 0)
- return;
-
- ext = get_archive_filename_extension (uri);
- if (ext == NULL)
- ext = mime_type_desc[self->priv->supported_types[n_format]].default_ext;
-
- _fr_new_archive_dialog_update_sensitivity_for_ext (self, ext);
+ n_format = get_selected_format (self);
- if (uri != NULL) {
- const char *new_ext;
- const char *basename;
- char *basename_noext;
- char *new_basename;
- char *new_basename_uft8;
+ self->priv->can_encrypt = mime_type_desc[n_format].capabilities & FR_ARCHIVE_CAN_ENCRYPT;
+ gtk_widget_set_sensitive (GET_WIDGET ("password_entry"), self->priv->can_encrypt);
+ gtk_widget_set_sensitive (GET_WIDGET ("password_label"), self->priv->can_encrypt);
- new_ext = mime_type_desc[self->priv->supported_types[n_format]].default_ext;
- basename = _g_path_get_basename (uri);
- if (g_str_has_suffix (basename, ext))
- basename_noext = g_strndup (basename, strlen (basename) - strlen (ext));
- else
- basename_noext = g_strdup (basename);
- new_basename = g_strconcat (basename_noext, new_ext, NULL);
- new_basename_uft8 = g_uri_unescape_string (new_basename, NULL);
+ self->priv->can_encrypt_header = mime_type_desc[n_format].capabilities & FR_ARCHIVE_CAN_ENCRYPT_HEADER;
+ gtk_widget_set_sensitive (GET_WIDGET ("encrypt_header_checkbutton"), self->priv->can_encrypt_header);
- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (self), new_basename_uft8);
- _fr_new_archive_dialog_update_sensitivity_for_ext (self, new_ext);
+ self->priv->can_create_volumes = mime_type_desc[n_format].capabilities & FR_ARCHIVE_CAN_CREATE_VOLUMES;
+ gtk_widget_set_sensitive (GET_WIDGET ("volume_box"), self->priv->can_create_volumes);
- g_free (new_basename_uft8);
- g_free (new_basename);
- g_free (basename_noext);
+ icon_pixbuf = _g_mime_type_get_icon (mime_type_desc[n_format].mime_type,
+ ARCHIVE_ICON_SIZE,
+ gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (self))));
+ if (icon_pixbuf != NULL) {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (GET_WIDGET ("archive_icon")), icon_pixbuf);
+ g_object_unref (icon_pixbuf);
}
-}
-
-static gboolean
-all_supported_files_filter_func (const GtkFileFilterInfo *filter_info,
- gpointer data)
-{
- FrNewArchiveDialog *self = data;
- const char *ext;
-
- ext = _g_filename_get_extension (filter_info->uri);
- if (ext != NULL)
- return g_hash_table_lookup (self->priv->supported_ext, ext) != NULL;
- else
- return FALSE;
+ _fr_new_archive_dialog_update_sensitivity (self);
}
@@ -249,124 +180,79 @@ static void
_fr_new_archive_dialog_construct (FrNewArchiveDialog *self,
GtkWindow *parent,
FrNewArchiveAction action,
+ GFile *folder,
const char *default_name)
{
- GSettings *settings;
- GtkFileFilter *filter;
- int i;
+ char *active_extension;
+ int active_extension_idx;
+ int i;
- gtk_file_chooser_set_action (GTK_FILE_CHOOSER (self), GTK_FILE_CHOOSER_ACTION_SAVE);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (self), FALSE);
- gtk_window_set_modal (GTK_WINDOW (self), TRUE);
+ gtk_window_set_modal (GTK_WINDOW (self), (parent != NULL));
gtk_window_set_transient_for (GTK_WINDOW (self), parent);
+ gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (self), 5);
- self->priv->builder = _gtk_builder_new_from_resource ("new-archive-dialog-options.ui");
+ self->priv->builder = _gtk_builder_new_from_resource ("new-archive-dialog.ui");
if (self->priv->builder == NULL)
return;
- gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self))), GET_WIDGET ("content"));
+ gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
switch (action) {
case FR_NEW_ARCHIVE_ACTION_NEW:
self->priv->supported_types = create_type;
- gtk_window_set_title (GTK_WINDOW (self), C_("File", "New"));
gtk_dialog_add_button (GTK_DIALOG (self), FR_STOCK_CREATE_ARCHIVE, GTK_RESPONSE_OK);
break;
case FR_NEW_ARCHIVE_ACTION_SAVE_AS:
self->priv->supported_types = save_type;
- gtk_window_set_title (GTK_WINDOW (self), C_("File", "Save"));
gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_SAVE, GTK_RESPONSE_OK);
break;
}
gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
- sort_mime_types_by_description (self->priv->supported_types);
+ sort_mime_types_by_extension (self->priv->supported_types);
/* Set widgets data. */
- gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (self), GET_WIDGET ("extra_widget"));
-
- if (default_name != NULL)
- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (self), default_name);
-
- /**/
-
- gtk_expander_set_expanded (GTK_EXPANDER (GET_WIDGET ("other_options_expander")), FALSE);
-
- settings = g_settings_new (FILE_ROLLER_SCHEMA_GENERAL);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("encrypt_header_checkbutton")), g_settings_get_boolean (settings, PREF_GENERAL_ENCRYPT_HEADER));
- g_object_unref (settings);
+ if (default_name != NULL) {
+ char *default_name_no_ext;
- settings = g_settings_new (FILE_ROLLER_SCHEMA_BATCH_ADD);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET("volume_spinbutton")), (double) g_settings_get_int (settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
- g_object_unref (settings);
+ default_name_no_ext = _g_path_remove_extension (default_name);
+ gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("filename_entry")), default_name_no_ext);
- /* file filter */
+ g_free (default_name_no_ext);
+ }
+ gtk_widget_grab_focus (GET_WIDGET ("filename_entry"));
+ gtk_editable_select_region (GTK_EDITABLE (GET_WIDGET ("filename_entry")), 0, -1);
- /* all files */
+ if (folder == NULL)
+ folder = _g_file_get_home ();
+ gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (GET_WIDGET ("parent_filechooserbutton")), folder, NULL);
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_pattern (filter, "*");
- gtk_file_filter_set_name (filter, _("All Files"));
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self), filter);
+ gtk_expander_set_expanded (GTK_EXPANDER (GET_WIDGET ("other_options_expander")), FALSE);
- /* all supported files */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("encrypt_header_checkbutton")),
+ g_settings_get_boolean (self->priv->settings, PREF_NEW_ENCRYPT_HEADER));
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_custom (filter,
- GTK_FILE_FILTER_URI,
- all_supported_files_filter_func,
- self,
- NULL);
- gtk_file_filter_set_name (filter, _("All Supported Files"));
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self), filter);
- gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (self), filter);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("volume_spinbutton")),
+ (double) g_settings_get_int (self->priv->settings, PREF_NEW_VOLUME_SIZE) / MEGABYTE);
+ active_extension = g_settings_get_string (self->priv->settings, PREF_NEW_DEFAULT_EXTENSION);
+ active_extension_idx = 0;
for (i = 0; self->priv->supported_types[i] != -1; i++) {
- int idx;
- GString *name;
- int n_ext;
- int e;
-
- filter = gtk_file_filter_new ();
- g_object_set_data (G_OBJECT (filter), MIME_TYPE_INDEX_KEY, GINT_TO_POINTER (i + 1));
-
- idx = self->priv->supported_types[i];
- name = g_string_new (_(mime_type_desc[idx].name));
- g_string_append (name, " (");
-
- n_ext = 0;
- for (e = 0; file_ext_type[e].ext != NULL; e++) {
- if (_g_str_equal (file_ext_type[e].mime_type, mime_type_desc[idx].mime_type)) {
- char *ext;
- char *pattern;
-
- ext = file_ext_type[e].ext;
- g_hash_table_insert (self->priv->supported_ext, ext, GINT_TO_POINTER (i + 1));
- n_ext++;
-
- if (n_ext > 1)
- g_string_append (name, ", ");
- g_string_append (name, "*");
- g_string_append (name, ext);
-
- pattern = g_strdup_printf ("*%s", ext);
- gtk_file_filter_add_pattern (filter, pattern);
-
- g_free (pattern);
- }
- }
-
- g_string_append (name, ")");
- gtk_file_filter_set_name (filter, name->str);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self), filter);
-
- g_string_free (name, TRUE);
+ if (strcmp (active_extension, mime_type_desc[self->priv->supported_types[i]].default_ext) == 0)
+ active_extension_idx = i;
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (GET_WIDGET ("extension_comboboxtext")),
+ mime_type_desc[self->priv->supported_types[i]].default_ext);
}
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("extension_comboboxtext")), active_extension_idx);
+ g_free (active_extension);
- gtk_widget_set_vexpand (GET_WIDGET ("extra_widget"), FALSE);
+ gtk_widget_set_vexpand (GET_WIDGET ("other_options_expander"), FALSE);
_fr_new_archive_dialog_update_sensitivity (self);
+ extension_comboboxtext_changed_cb (GTK_COMBO_BOX (GET_WIDGET ("extension_comboboxtext")), self);
/* Set the signals handlers. */
@@ -378,137 +264,134 @@ _fr_new_archive_dialog_construct (FrNewArchiveDialog *self,
"toggled",
G_CALLBACK (volume_toggled_cb),
self);
- g_signal_connect (self,
- "notify::filter",
- G_CALLBACK (filter_notify_cb),
+ g_signal_connect (GET_WIDGET ("extension_comboboxtext"),
+ "changed",
+ G_CALLBACK (extension_comboboxtext_changed_cb),
self);
}
GtkWidget *
-fr_new_archive_dialog_new (GtkWindow *parent,
+fr_new_archive_dialog_new (const char *title,
+ GtkWindow *parent,
FrNewArchiveAction action,
+ GFile *folder,
const char *default_name)
{
FrNewArchiveDialog *self;
- self = g_object_new (FR_TYPE_NEW_ARCHIVE_DIALOG, NULL);
- _fr_new_archive_dialog_construct (self, parent, action, default_name);
+ self = g_object_new (FR_TYPE_NEW_ARCHIVE_DIALOG, "title", title, NULL);
+ _fr_new_archive_dialog_construct (self, parent, action, folder, default_name);
return (GtkWidget *) self;
}
-static int
-_fr_new_archive_dialog_get_archive_type (FrNewArchiveDialog *self)
+GFile *
+fr_new_archive_dialog_get_file (FrNewArchiveDialog *self,
+ const char **mime_type)
{
- const char *uri;
- const char *ext;
+ const char *basename;
+ int n_format;
+ char *basename_ext;
+ GFile *parent;
+ GFile *file;
+ GError *error = NULL;
+ const char *file_mime_type;
+ GFileInfo *parent_info;
+ GtkWidget *dialog;
- uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (self));
- if (uri == NULL)
- return -1;
+ /* Check whether the user entered a valid archive name. */
- ext = get_archive_filename_extension (uri);
- if (ext == NULL) {
- int n_format;
+ basename = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("filename_entry")));
+ if ((basename == NULL) || (*basename == '\0')) {
+ GtkWidget *d;
- n_format = _fr_new_archive_dialog_get_format (self, uri);
- if (n_format >= 0)
- return self->priv->supported_types[n_format];
+ d = _gtk_error_dialog_new (GTK_WINDOW (self),
+ GTK_DIALOG_MODAL,
+ NULL,
+ _("Could not create the archive"),
+ "%s",
+ _("You have to specify an archive name."));
+ gtk_dialog_run (GTK_DIALOG (d));
+ gtk_widget_destroy (GTK_WIDGET (d));
- ext = DEFAULT_EXTENSION;
+ return NULL;
}
- return get_mime_type_index (get_mime_type_from_extension (ext));
-}
+ /* file */
+ n_format = get_selected_format (self);
+ parent = gtk_file_chooser_get_current_folder_file (GTK_FILE_CHOOSER (GET_WIDGET ("parent_filechooserbutton")));
+ if (parent == NULL) {
+ GtkWidget *d;
-GFile *
-fr_new_archive_dialog_get_file (FrNewArchiveDialog *self,
- const char **mime_type)
-{
- char *uri;
- int n_format;
- const char *file_mime_type;
- GFile *file, *dir;
- GFileInfo *dir_info;
- GError *err = NULL;
- GtkWidget *dialog;
+ d = _gtk_error_dialog_new (GTK_WINDOW (self),
+ GTK_DIALOG_MODAL,
+ NULL,
+ _("Could not create the archive"),
+ "%s",
+ _("You have to specify an archive name."));
+ gtk_dialog_run (GTK_DIALOG (d));
+ gtk_widget_destroy (GTK_WIDGET (d));
- /* uri */
+ return NULL;
+ }
- uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (self));
- if ((uri == NULL) || (*uri == 0)) {
- g_free (uri);
+ basename_ext = g_strconcat (basename, mime_type_desc[n_format].default_ext, NULL);
+ file = g_file_get_child_for_display_name (parent, basename_ext, &error);
+ if (file == NULL) {
dialog = _gtk_error_dialog_new (GTK_WINDOW (self),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_DIALOG_MODAL,
NULL,
_("Could not create the archive"),
"%s",
- _("You have to specify an archive name."));
+ error->message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_error_free (error);
+ g_free (basename_ext);
+ g_object_unref (parent);
return NULL;
}
+ g_free (basename_ext);
+
/* mime type */
- n_format = _fr_new_archive_dialog_get_format (self, uri);
- if (n_format >= 0)
- file_mime_type = mime_type_desc[self->priv->supported_types[n_format]].mime_type;
- else
- file_mime_type = NULL;
+ file_mime_type = mime_type_desc[n_format].mime_type;
if (mime_type != NULL)
*mime_type = file_mime_type;
- if (file_mime_type == NULL) {
- dialog = _gtk_error_dialog_new (GTK_WINDOW (self),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- NULL,
- _("Could not create the archive"),
- "%s",
- _("Archive type not supported."));
- gtk_dialog_run (GTK_DIALOG (dialog));
+ /* check permissions */
- gtk_widget_destroy (GTK_WIDGET (dialog));
- g_free (uri);
+ parent_info = g_file_query_info (parent,
+ (G_FILE_ATTRIBUTE_ACCESS_CAN_READ ","
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE ","
+ G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE","
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME),
+ 0,
+ NULL,
+ &error);
- return NULL;
- }
+ g_object_unref (parent);
- /* check permissions */
+ if (error != NULL) {
+ g_warning ("Failed to get permission for extraction dir: %s", error->message);
+
+ g_clear_error (&error);
+ g_object_unref (parent_info);
+ g_object_unref (file);
- file = g_file_new_for_uri (uri);
- dir = g_file_get_parent (file);
- dir_info = g_file_query_info (dir,
- G_FILE_ATTRIBUTE_ACCESS_CAN_READ ","
- G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE ","
- G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE","
- G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
- 0, NULL, &err);
-
- g_object_unref (dir);
- g_object_unref (file);
-
- if (err != NULL) {
- g_warning ("Failed to get permission for extraction dir: %s",
- err->message);
- g_clear_error (&err);
- g_object_unref (dir_info);
- g_free (uri);
return NULL;
}
- if (! g_file_info_get_attribute_boolean (dir_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
- g_object_unref (dir_info);
- g_free (uri);
-
+ if (! g_file_info_get_attribute_boolean (parent_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
dialog = _gtk_error_dialog_new (GTK_WINDOW (self),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_DIALOG_MODAL,
NULL,
_("Could not create the archive"),
"%s",
@@ -516,12 +399,15 @@ fr_new_archive_dialog_get_file (FrNewArchiveDialog *self,
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_object_unref (parent_info);
+ g_object_unref (file);
+
return NULL;
}
- /* overwrite confirmation */
+ g_object_unref (parent_info);
- file = g_file_new_for_uri (uri);
+ /* overwrite confirmation */
if (g_file_query_exists (file, NULL)) {
char *filename;
@@ -531,9 +417,9 @@ fr_new_archive_dialog_get_file (FrNewArchiveDialog *self,
filename = _g_file_get_display_basename (file);
message = g_strdup_printf (_("A file named \"%s\" already exists. Do you want to replace it?"), filename);
- secondary_message = g_strdup_printf (_("The file already exists in \"%s\". Replacing it will overwrite its contents."), g_file_info_get_display_name (dir_info));
+ secondary_message = g_strdup_printf (_("The file already exists in \"%s\". Replacing it will overwrite its contents."), g_file_info_get_display_name (parent_info));
dialog = _gtk_message_dialog_new (GTK_WINDOW (self),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_DIALOG_MODAL,
GTK_STOCK_DIALOG_QUESTION,
message,
secondary_message,
@@ -548,33 +434,27 @@ fr_new_archive_dialog_get_file (FrNewArchiveDialog *self,
g_free (filename);
if (overwrite) {
- g_file_delete (file, NULL, &err);
- if (err != NULL) {
+ g_file_delete (file, NULL, &error);
+ if (error != NULL) {
dialog = _gtk_error_dialog_new (GTK_WINDOW (self),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_DIALOG_MODAL,
NULL,
_("Could not delete the old archive."),
"%s",
- err->message);
+ error->message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
- g_error_free (err);
- g_free (uri);
+ g_error_free (error);
g_object_unref (file);
return NULL;
}
}
- else {
- g_free (uri);
- uri = NULL;
- }
+ else
+ g_clear_object (&file);
}
- g_object_unref (dir_info);
- g_free (uri);
-
return file;
}
@@ -583,13 +463,11 @@ const char *
fr_new_archive_dialog_get_password (FrNewArchiveDialog *self)
{
const char *password = NULL;
- int idx;
+ int n_format;
- idx = _fr_new_archive_dialog_get_archive_type (self);
- if (idx < 0)
- return NULL;
+ n_format = get_selected_format (self);
- if (mime_type_desc[idx].capabilities & FR_ARCHIVE_CAN_ENCRYPT)
+ if (mime_type_desc[n_format].capabilities & FR_ARCHIVE_CAN_ENCRYPT)
password = (char*) gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("password_entry")));
return password;
@@ -600,17 +478,15 @@ gboolean
fr_new_archive_dialog_get_encrypt_header (FrNewArchiveDialog *self)
{
gboolean encrypt_header = FALSE;
- int idx;
+ int n_format;
- idx = _fr_new_archive_dialog_get_archive_type (self);
- if (idx < 0)
- return FALSE;
+ n_format = get_selected_format (self);
- if (mime_type_desc[idx].capabilities & FR_ARCHIVE_CAN_ENCRYPT) {
+ if (mime_type_desc[n_format].capabilities & FR_ARCHIVE_CAN_ENCRYPT) {
const char *password = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("password_entry")));
if (password != NULL) {
if (strcmp (password, "") != 0) {
- if (mime_type_desc[idx].capabilities & FR_ARCHIVE_CAN_ENCRYPT_HEADER)
+ if (mime_type_desc[n_format].capabilities & FR_ARCHIVE_CAN_ENCRYPT_HEADER)
encrypt_header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("encrypt_header_checkbutton")));
}
}
@@ -624,13 +500,11 @@ int
fr_new_archive_dialog_get_volume_size (FrNewArchiveDialog *self)
{
guint volume_size = 0;
- int idx;
+ int n_format;
- idx = _fr_new_archive_dialog_get_archive_type (self);
- if (idx < 0)
- return 0;
+ n_format = get_selected_format (self);
- if ((mime_type_desc[idx].capabilities & FR_ARCHIVE_CAN_CREATE_VOLUMES)
+ if ((mime_type_desc[n_format].capabilities & FR_ARCHIVE_CAN_CREATE_VOLUMES)
&& gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("volume_checkbutton"))))
{
double value;
diff --git a/src/fr-new-archive-dialog.h b/src/fr-new-archive-dialog.h
index 940a9a0..e431703 100644
--- a/src/fr-new-archive-dialog.h
+++ b/src/fr-new-archive-dialog.h
@@ -41,17 +41,19 @@ typedef struct _FrNewArchiveDialogClass FrNewArchiveDialogClass;
typedef struct _FrNewArchiveDialogPrivate FrNewArchiveDialogPrivate;
struct _FrNewArchiveDialog {
- GtkFileChooserDialog parent_instance;
+ GtkDialog parent_instance;
FrNewArchiveDialogPrivate *priv;
};
struct _FrNewArchiveDialogClass {
- GtkFileChooserDialogClass parent_class;
+ GtkDialogClass parent_class;
};
GType fr_new_archive_dialog_get_type (void);
-GtkWidget * fr_new_archive_dialog_new (GtkWindow *parent,
+GtkWidget * fr_new_archive_dialog_new (const char *title,
+ GtkWindow *parent,
FrNewArchiveAction action,
+ GFile *folder,
const char *default_name);
GFile * fr_new_archive_dialog_get_file (FrNewArchiveDialog *dialog,
const char **mime_type);
diff --git a/src/fr-window.c b/src/fr-window.c
index 98dcd03..a361248 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -4086,12 +4086,11 @@ fr_window_drag_data_received (GtkWidget *widget,
else
archive_name = g_file_get_basename (first_file);
- dialog = fr_new_archive_dialog_new (GTK_WINDOW (window),
+ dialog = fr_new_archive_dialog_new (_("New"),
+ GTK_WINDOW (window),
FR_NEW_ARCHIVE_ACTION_SAVE_AS,
+ fr_window_get_open_default_dir (window),
archive_name);
- gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (dialog),
- fr_window_get_open_default_dir (window),
- NULL);
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (new_archive_dialog_response_cb),
@@ -7147,10 +7146,11 @@ fr_window_action_new_archive (FrWindow *window)
{
GtkWidget *dialog;
- dialog = fr_new_archive_dialog_new (GTK_WINDOW (window),
+ dialog = fr_new_archive_dialog_new (_("New"),
+ GTK_WINDOW (window),
FR_NEW_ARCHIVE_ACTION_NEW,
+ fr_window_get_open_default_dir (window),
NULL);
- gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (dialog), fr_window_get_open_default_dir (window), NULL);
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (new_archive_dialog_response_cb),
@@ -7271,6 +7271,7 @@ archive_extraction_ready_for_convertion_cb (GObject *source_object,
gpointer user_data)
{
FrWindow *window = user_data;
+ GList *list;
GError *error = NULL;
if (! fr_archive_operation_finish (FR_ARCHIVE (source_object), result, &error)) {
@@ -7278,8 +7279,9 @@ archive_extraction_ready_for_convertion_cb (GObject *source_object,
return;
}
+ list = g_list_prepend (NULL, window->priv->convert_data.temp_dir);
fr_archive_add_files (window->priv->convert_data.new_archive,
- NULL,
+ list,
window->priv->convert_data.temp_dir,
NULL,
FALSE,
@@ -7291,6 +7293,8 @@ archive_extraction_ready_for_convertion_cb (GObject *source_object,
window->priv->cancellable,
archive_add_ready_for_conversion_cb,
window);
+
+ g_list_free (list);
}
@@ -7420,8 +7424,8 @@ save_as_archive_dialog_response_cb (GtkDialog *dialog,
encrypt_header = fr_new_archive_dialog_get_encrypt_header (FR_NEW_ARCHIVE_DIALOG (dialog));
volume_size = fr_new_archive_dialog_get_volume_size (FR_NEW_ARCHIVE_DIALOG (dialog));
- settings = g_settings_new (FILE_ROLLER_SCHEMA_BATCH_ADD);
- g_settings_set_int (settings, PREF_BATCH_ADD_VOLUME_SIZE, volume_size);
+ settings = g_settings_new (FILE_ROLLER_SCHEMA_NEW);
+ g_settings_set_int (settings, PREF_NEW_VOLUME_SIZE, volume_size);
g_object_unref (settings);
fr_window_archive_save_as (window, file, mime_type, password, encrypt_header, volume_size);
@@ -7451,10 +7455,11 @@ fr_window_action_save_as (FrWindow *window)
}
}
- dialog = fr_new_archive_dialog_new (GTK_WINDOW (window),
+ dialog = fr_new_archive_dialog_new (_("Save"),
+ GTK_WINDOW (window),
FR_NEW_ARCHIVE_ACTION_SAVE_AS,
+ fr_window_get_open_default_dir (window),
archive_name);
- gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (dialog), fr_window_get_open_default_dir (window), NULL);
g_signal_connect (G_OBJECT (dialog),
"response",
G_CALLBACK (save_as_archive_dialog_response_cb),
diff --git a/src/glib-utils.c b/src/glib-utils.c
index ff23a1c..8affc97 100644
--- a/src/glib-utils.c
+++ b/src/glib-utils.c
@@ -913,31 +913,19 @@ _g_path_remove_ending_separator (const char *path)
}
-gchar *
+char *
_g_path_remove_extension (const gchar *path)
{
- int len;
- int p;
- const char *ptr = path;
- char *new_path;
-
- if (! path)
- return NULL;
+ const char *ext;
- len = strlen (path);
- if (len == 1)
+ ext = _g_filename_get_extension (path);
+ if (ext == NULL)
return g_strdup (path);
-
- p = len - 1;
- while ((p > 0) && (ptr[p] != '.'))
- p--;
- if (p == 0)
- p = len;
- new_path = g_strndup (path, (guint) p);
-
- return new_path;
+ else
+ return g_strndup (path, strlen (path) - strlen (ext));
}
+
/* Check whether the dirname is contained in filename */
gboolean
_g_path_is_parent_of (const char *dirname,
diff --git a/src/preferences.h b/src/preferences.h
index 99f69d0..c36ee8c 100644
--- a/src/preferences.h
+++ b/src/preferences.h
@@ -31,8 +31,8 @@
#define FILE_ROLLER_SCHEMA_UI FILE_ROLLER_SCHEMA ".UI"
#define FILE_ROLLER_SCHEMA_GENERAL FILE_ROLLER_SCHEMA ".General"
#define FILE_ROLLER_SCHEMA_DIALOGS FILE_ROLLER_SCHEMA ".Dialogs"
+#define FILE_ROLLER_SCHEMA_NEW FILE_ROLLER_SCHEMA_DIALOGS ".New"
#define FILE_ROLLER_SCHEMA_ADD FILE_ROLLER_SCHEMA_DIALOGS ".Add"
-#define FILE_ROLLER_SCHEMA_BATCH_ADD FILE_ROLLER_SCHEMA_DIALOGS ".BatchAdd"
#define FILE_ROLLER_SCHEMA_EXTRACT FILE_ROLLER_SCHEMA_DIALOGS ".Extract"
#define FILE_ROLLER_SCHEMA_LAST_OUTPUT FILE_ROLLER_SCHEMA_DIALOGS ".LastOutput"
@@ -69,9 +69,9 @@
#define PREF_ADD_RECURSIVE "recursive"
#define PREF_ADD_NO_FOLLOW_SYMLINKS "no-symlinks"
-#define PREF_BATCH_ADD_DEFAULT_EXTENSION "default-extension"
-#define PREF_BATCH_ADD_OTHER_OPTIONS "other-options"
-#define PREF_BATCH_ADD_VOLUME_SIZE "volume-size"
+#define PREF_NEW_DEFAULT_EXTENSION "default-extension"
+#define PREF_NEW_ENCRYPT_HEADER "encrypt-header"
+#define PREF_NEW_VOLUME_SIZE "volume-size"
#define NAUTILUS_SCHEMA "org.gnome.nautilus.preferences"
#define NAUTILUS_CLICK_POLICY "click-policy"
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 42914f2..f22d1e1 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -2,7 +2,6 @@ EXTRA_DIST = \
add-dialog-options.ui \
add-options.ui \
app-menu.ui \
- batch-add-files.ui \
batch-password.ui \
delete.ui \
error-dialog.ui \
@@ -10,6 +9,7 @@ EXTRA_DIST = \
file-selector.ui \
menus-toolbars.ui \
message-dialog.ui \
+ new-archive-dialog.ui \
new-archive-dialog-options.ui \
password.ui \
progress-dialog.ui \
diff --git a/src/ui/batch-password.ui b/src/ui/ask-password.ui
similarity index 100%
rename from src/ui/batch-password.ui
rename to src/ui/ask-password.ui
diff --git a/src/ui/new-archive-dialog.ui b/src/ui/new-archive-dialog.ui
new file mode 100644
index 0000000..842e7b3
--- /dev/null
+++ b/src/ui/new-archive-dialog.ui
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkHBox" id="content">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="archive_icon">
+ <property name="width_request">64</property>
+ <property name="height_request">64</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="stock">gtk-info</property>
+ <property name="icon-size">6</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkTable" id="table5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="archive_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Filename:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">filename_entry</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="location_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Location:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">parent_filechooserbutton</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFileChooserButton" id="parent_filechooserbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action">select-folder</property>
+ <property name="local_only">False</property>
+ <property name="title" translatable="yes">Location</property>
+ <property name="width_chars">15</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox30">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="filename_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="activates_default">True</property>
+ <property name="width_chars">35</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="extension_comboboxtext">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="entry_text_column">0</property>
+ <property name="id_column">1</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</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="GtkExpander" id="other_options_expander">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="margin_top">6</property>
+ <property name="expanded">True</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkTable" id="table6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="password_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Password:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">password_entry</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">â</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="encrypt_header_checkbutton">
+ <property name="label" translatable="yes">_Encrypt the file list too</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="volume_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="volume_checkbutton">
+ <property name="label" translatable="yes" comments="this is part of a sentence, for example "split into volumes of 10.0 MB", where MB stands for megabyte.">Split into _volumes of</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="volume_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="width_chars">6</property>
+ <property name="invisible_char_set">True</property>
+ <property name="adjustment">volume_adjustment</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label50">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" comments="MB means megabytes">MB</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label48">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Other Options</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</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>
+ <object class="GtkAdjustment" id="volume_adjustment">
+ <property name="lower">0.10000000000000001</property>
+ <property name="upper">10000000000</property>
+ <property name="value">10</property>
+ <property name="step_increment">0.10000000000000001</property>
+ <property name="page_increment">10</property>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]