file-roller r2357 - in trunk: . data data/glade src
- From: paobac svn gnome org
- To: svn-commits-list gnome org
- Subject: file-roller r2357 - in trunk: . data data/glade src
- Date: Mon, 7 Jul 2008 09:57:56 +0000 (UTC)
Author: paobac
Date: Mon Jul 7 09:57:56 2008
New Revision: 2357
URL: http://svn.gnome.org/viewvc/file-roller?rev=2357&view=rev
Log:
2008-07-07 Paolo Bacchilega <paobac svn gnome org>
* src/typedefs.h:
* src/main.c:
* src/fr-command-zoo.c:
* src/fr-command-rar.c:
* src/fr-command-jar.c:
* src/fr-command-arj.c:
* src/fr-command-7z.c:
Changed the FrMimeTypeDescription structure in order to compute
the mime type capabilities automatically in compute_supported_archive_types()
* src/fr-window.c:
* src/gtk-utils.h:
* src/gtk-utils.c: added a show_uri function, used in show_help_dialog
and fr-window.c:open_folder.
* src/preferences.h:
* src/fr-window.h:
* src/fr-window.c:
* src/fr-command-rar.c:
* src/fr-command-7z.c:
* src/fr-command.h:
* src/fr-command.c:
* src/fr-archive.h:
* src/fr-archive.c:
* src/dlg-password.c:
* src/dlg-batch-add.c:
* src/actions.c:
* data/glade/password.glade:
* data/glade/batch-add-files.glade:
Added support for header encryption. Implemented header encryption for
7zip and rar archives.
* data/file-roller.schemas: added the key /apps/file-roller/general/encrypt_header
Modified:
trunk/ChangeLog
trunk/data/file-roller.schemas
trunk/data/glade/batch-add-files.glade
trunk/data/glade/password.glade
trunk/src/actions.c
trunk/src/dlg-batch-add.c
trunk/src/dlg-password.c
trunk/src/fr-archive.c
trunk/src/fr-archive.h
trunk/src/fr-command-7z.c
trunk/src/fr-command-arj.c
trunk/src/fr-command-jar.c
trunk/src/fr-command-rar.c
trunk/src/fr-command-zip.c
trunk/src/fr-command-zoo.c
trunk/src/fr-command.c
trunk/src/fr-command.h
trunk/src/fr-window.c
trunk/src/fr-window.h
trunk/src/gtk-utils.c
trunk/src/gtk-utils.h
trunk/src/main.c
trunk/src/preferences.h
trunk/src/typedefs.h
Modified: trunk/data/file-roller.schemas
==============================================================================
--- trunk/data/file-roller.schemas (original)
+++ trunk/data/file-roller.schemas Mon Jul 7 09:57:56 2008
@@ -228,6 +228,18 @@
Possible values : very_fast, fast, normal, maximum.</long>
</locale>
</schema>
+
+ <schema>
+ <key>/schemas/apps/file-roller/general/encrypt_header</key>
+ <applyto>/apps/file-roller/general/encrypt_header</applyto>
+ <owner>file-roller</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Encrypt the archive header</short>
+ <long>Whether to encrypt the archive header. If the header is encrypted the password will be required to list the archive content as well.</long>
+ </locale>
+ </schema>
<schema>
<key>/schemas/apps/file-roller/general/migrate_directories</key>
@@ -385,6 +397,18 @@
<long></long>
</locale>
</schema>
+
+ <schema>
+ <key>/schemas/apps/file-roller/dialogs/batch-add/other_options</key>
+ <applyto>/apps/file-roller/dialogs/batch-add/other_options</applyto>
+ <owner>file-roller</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short></short>
+ <long></long>
+ </locale>
+ </schema>
</schemalist>
</gconfschemafile>
Modified: trunk/data/glade/batch-add-files.glade
==============================================================================
--- trunk/data/glade/batch-add-files.glade (original)
+++ trunk/data/glade/batch-add-files.glade Mon Jul 7 09:57:56 2008
@@ -142,7 +142,7 @@
<property name="height_request">64</property>
<property name="visible">True</property>
<property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
+ <property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
@@ -169,7 +169,7 @@
<property name="column_spacing">6</property>
<child>
- <widget class="GtkLabel" id="label28">
+ <widget class="GtkLabel" id="a_archive_label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Archive:</property>
<property name="use_underline">True</property>
@@ -198,9 +198,9 @@
</child>
<child>
- <widget class="GtkLabel" id="label46">
+ <widget class="GtkLabel" id="a_location_label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Location:</property>
+ <property name="label" translatable="yes">_Location:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -210,6 +210,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
+ <property name="mnemonic_widget">a_location_filechooserbutton</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -303,6 +304,126 @@
<property name="fill">True</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkExpander" id="a_other_options_expander">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="expanded">True</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkTable" id="table6">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="a_password_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Password:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">a_password_entry</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="a_password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">False</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">â</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="a_encrypt_header_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Encrypt the file list too</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <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="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label48">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Other Options</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: trunk/data/glade/password.glade
==============================================================================
--- trunk/data/glade/password.glade (original)
+++ trunk/data/glade/password.glade Mon Jul 7 09:57:56 2008
@@ -76,10 +76,35 @@
<property name="spacing">12</property>
<child>
- <widget class="GtkHBox" id="hbox18">
+ <widget class="GtkTable" id="table1">
<property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
<property name="homogeneous">False</property>
- <property name="spacing">5</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="pw_encrypt_header_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Encrypt the file list too</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <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="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
<child>
<widget class="GtkLabel" id="label34">
@@ -101,9 +126,12 @@
<property name="angle">0</property>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
</packing>
</child>
@@ -120,16 +148,18 @@
<property name="activates_default">True</property>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
Modified: trunk/src/actions.c
==============================================================================
--- trunk/src/actions.c (original)
+++ trunk/src/actions.c Mon Jul 7 09:57:56 2008
@@ -46,7 +46,7 @@
typedef struct {
FrWindow *window;
int *supported_types;
-
+
GtkWidget *file_sel;
GtkWidget *combo_box;
GtkWidget *password;
@@ -67,7 +67,7 @@
static void
new_archive (GtkWidget *file_sel,
- FrWindow *window,
+ FrWindow *window,
char *uri)
{
GtkWidget *archive_window;
@@ -91,7 +91,7 @@
/* when on Automatic the user provided extension needs to be supported,
otherwise an existing unsupported archive can be deleted (if the user
- provided name matches with its name) before we find out that the
+ provided name matches with its name) before we find out that the
archive is unsupported
*/
static gboolean
@@ -130,7 +130,7 @@
if (idx > 0) {
const char *path_ext;
char *default_ext;
-
+
path_ext = get_archive_filename_extension (path);
default_ext = mime_type_desc[data->supported_types[idx-1]].default_ext;
if (strcmp_null_tolerant (path_ext, default_ext) != 0) {
@@ -174,8 +174,8 @@
dir = g_file_get_parent (file);
info = g_file_query_info (dir,
- G_FILE_ATTRIBUTE_ACCESS_CAN_READ ","
- G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE ","
+ G_FILE_ATTRIBUTE_ACCESS_CAN_READ ","
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE ","
G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE,
0, NULL, &err);
if (err != NULL) {
@@ -260,9 +260,9 @@
return NULL;
}
}
-
+
g_object_unref (file);
-
+
return path;
}
@@ -301,20 +301,20 @@
const char *ext)
{
int i;
-
- if (data->password == NULL)
+
+ if (data->password == NULL)
return;
-
+
if (ext == NULL) {
gtk_widget_set_sensitive (data->password, FALSE);
gtk_widget_set_sensitive (data->password_label, FALSE);
return;
}
-
+
for (i = 0; mime_type_desc[i].mime_type != NULL; i++) {
if (strcmp (mime_type_desc[i].default_ext, ext) == 0) {
- gtk_widget_set_sensitive (data->password, mime_type_desc[i].supports_password);
- gtk_widget_set_sensitive (data->password_label, mime_type_desc[i].supports_password);
+ gtk_widget_set_sensitive (data->password, mime_type_desc[i].capabilities & FR_COMMAND_CAP_ENCRYPT);
+ gtk_widget_set_sensitive (data->password_label, mime_type_desc[i].capabilities & FR_COMMAND_CAP_ENCRYPT);
break;
}
}
@@ -331,21 +331,21 @@
char *basename_noext;
char *new_basename;
char *new_basename_uft8;
-
+
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->file_sel));
if (uri == NULL)
return;
-
+
ext = get_archive_filename_extension (uri);
if (ext == NULL)
ext = "";
-
+
idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->combo_box)) - 1;
if (idx < 0) {
if (data->password != NULL) {
gtk_widget_set_sensitive (data->password, TRUE);
gtk_widget_set_sensitive (data->password_label, TRUE);
- }
+ }
return;
}
@@ -357,7 +357,7 @@
new_basename_uft8 = g_uri_unescape_string (new_basename, NULL);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (data->file_sel), new_basename_uft8);
update_password_availability_for_ext (data, new_ext);
-
+
g_free (new_basename_uft8);
g_free (new_basename);
g_free (basename_noext);
@@ -377,7 +377,7 @@
data = g_new0 (SaveAsData, 1);
data->window = window;
data->supported_types = create_type;
-
+
file_sel = gtk_file_chooser_dialog_new (_("New"),
GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_SAVE,
@@ -436,15 +436,15 @@
/**/
g_signal_connect (G_OBJECT (file_sel),
- "response",
- G_CALLBACK (new_file_response_cb),
+ "response",
+ G_CALLBACK (new_file_response_cb),
data);
g_signal_connect (G_OBJECT (data->combo_box),
- "changed",
+ "changed",
G_CALLBACK (filetype_combobox_changed_cb),
data);
g_signal_connect (G_OBJECT (file_sel),
- "destroy",
+ "destroy",
G_CALLBACK (new_archive_dialog_destroy_cb),
data);
@@ -475,7 +475,7 @@
}
else {
FrWindow *original_window = g_object_get_data (G_OBJECT (file_sel), "fr_window");
- if (window != original_window)
+ if (window != original_window)
fr_window_destroy_with_error_dialog (window);
}
}
@@ -502,7 +502,7 @@
window = fr_window_archive_open (window, uri, GTK_WINDOW (file_sel));
g_signal_connect (G_OBJECT (window),
- "archive_loaded",
+ "archive_loaded",
G_CALLBACK (window_archive_loaded_cb),
file_sel);
@@ -546,9 +546,9 @@
g_object_set_data (G_OBJECT (file_sel), "fr_window", window);
g_signal_connect (G_OBJECT (file_sel),
- "response",
- G_CALLBACK (open_file_response_cb),
- file_sel);
+ "response",
+ G_CALLBACK (open_file_response_cb),
+ file_sel);
gtk_window_set_modal (GTK_WINDOW (file_sel), TRUE);
gtk_widget_show (file_sel);
@@ -586,9 +586,9 @@
path = get_archive_filename_from_selector (data);
if (path == NULL)
return;
-
+
fr_window_archive_save_as (data->window, path, gtk_entry_get_text (GTK_ENTRY (data->password)));
-
+
gtk_widget_destroy (data->file_sel);
g_free (path);
}
@@ -620,7 +620,7 @@
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
NULL);
data->file_sel = file_sel;
-
+
gtk_dialog_set_default_response (GTK_DIALOG (file_sel), GTK_RESPONSE_OK);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (file_sel), FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (file_sel), TRUE);
@@ -641,7 +641,7 @@
if (err != NULL) {
g_warning ("Failed to get display name for uri %s: %s", uri, err->message);
g_clear_error (&err);
- }
+ }
else {
gtk_file_chooser_set_current_name (
GTK_FILE_CHOOSER (file_sel),
@@ -663,9 +663,9 @@
gtk_file_filter_add_pattern (filter, "*");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_sel), filter);
- data->password = gtk_entry_new ();
+ data->password = gtk_entry_new ();
gtk_entry_set_visibility (GTK_ENTRY (data->password), FALSE);
-
+
/**/
table = gtk_table_new (2, 2, FALSE);
@@ -696,38 +696,38 @@
data->password_label = label = gtk_label_new_with_mnemonic (_("_Encrypt with password:"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
-
+
gtk_box_pack_start (GTK_BOX (hbox), data->password, FALSE, TRUE, 0);
-
+
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
-
+
gtk_widget_show_all (table);
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (file_sel), table);
-
+
/* set the default data */
-
+
password = fr_window_get_password (window);
if (password == NULL)
password = "";
gtk_entry_set_text (GTK_ENTRY (data->password), password);
-
+
/**/
g_signal_connect (G_OBJECT (file_sel),
- "response",
- G_CALLBACK (save_file_response_cb),
+ "response",
+ G_CALLBACK (save_file_response_cb),
data);
g_signal_connect (G_OBJECT (file_sel),
- "destroy",
+ "destroy",
G_CALLBACK (save_file_destroy_cb),
data);
g_signal_connect (G_OBJECT (data->combo_box),
- "changed",
+ "changed",
G_CALLBACK (filetype_combobox_changed_cb),
data);
@@ -879,7 +879,7 @@
void
-activate_action_find (GtkAction *action,
+activate_action_find (GtkAction *action,
gpointer data)
{
FrWindow *window = data;
@@ -1092,7 +1092,7 @@
"51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA")
};
char *license_text;
-
+
license_text = g_strjoin ("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL);
gtk_show_about_dialog (GTK_WINDOW (window),
Modified: trunk/src/dlg-batch-add.c
==============================================================================
--- trunk/src/dlg-batch-add.c (original)
+++ trunk/src/dlg-batch-add.c Mon Jul 7 09:57:56 2008
@@ -54,6 +54,10 @@
GtkWidget *a_location_filechooserbutton;
GtkWidget *add_image;
GtkWidget *a_archive_type_combo_box;
+ GtkWidget *a_password_entry;
+ GtkWidget *a_password_label;
+ GtkWidget *a_encrypt_header_checkbutton;
+ GtkWidget *a_other_options_expander;
GList *file_list;
gboolean add_clicked;
@@ -94,6 +98,33 @@
}
+static void
+set_archive_password (DialogData *data)
+{
+ int *save_type_list;
+ int idx;
+
+ if (data->single_file)
+ save_type_list = single_file_save_type;
+ else
+ save_type_list = save_type;
+
+ idx = gtk_combo_box_get_active (GTK_COMBO_BOX (data->a_archive_type_combo_box));
+ if (mime_type_desc[save_type_list[idx]].capabilities & FR_COMMAND_CAP_ENCRYPT) {
+ char *pwd;
+
+ pwd = (char*) gtk_entry_get_text (GTK_ENTRY (data->a_password_entry));
+ if (pwd != NULL) {
+ pwd = g_strstrip (pwd);
+ if (strcmp (pwd, "") != 0) {
+ fr_window_set_password (data->window, pwd);
+ if (mime_type_desc[save_type_list[idx]].capabilities & FR_COMMAND_CAP_ENCRYPT_HEADER)
+ fr_window_set_encrypt_header (data->window, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton)));
+ }
+ }
+ }
+}
+
/* called when the "add" button is pressed. */
static void
add_clicked_cb (GtkWidget *widget,
@@ -138,9 +169,9 @@
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,
+ _("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));
@@ -159,7 +190,7 @@
g_free (archive_name);
return;
}
-
+
if (! check_permissions (archive_dir, R_OK|W_OK|X_OK)) {
GtkWidget *d;
@@ -249,7 +280,10 @@
archive_name = g_strconcat (tmp, archive_ext, NULL);
g_free (tmp);
archive_file = g_strconcat (archive_dir, "/", archive_name, NULL);
+
eel_gconf_set_string (PREF_BATCH_ADD_DEFAULT_EXTENSION, archive_ext);
+ eel_gconf_set_boolean (PREF_BATCH_OTHER_OPTIONS, gtk_expander_get_expanded (GTK_EXPANDER (data->a_other_options_expander)));
+ eel_gconf_set_boolean (PREF_ENCRYPT_HEADER, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton)));
if (uri_is_dir (archive_file)) {
GtkWidget *d;
@@ -294,8 +328,8 @@
file = g_file_new_for_uri (archive_file);
g_file_delete (file, NULL, &err);
if (err != NULL) {
- g_warning ("Failed to delete file %s: %s",
- archive_file,
+ g_warning ("Failed to delete file %s: %s",
+ archive_file,
err->message);
g_clear_error (&err);
}
@@ -308,7 +342,7 @@
return;
}
}
-
+ set_archive_password (data);
gtk_widget_destroy (data->dialog);
if (! uri_exists (archive_file))
@@ -323,6 +357,29 @@
static void
+update_password_availability_for_mime_type (DialogData *data,
+ const char *mime_type)
+{
+ int i;
+
+ if (mime_type == NULL) {
+ gtk_widget_set_sensitive (data->a_password_entry, FALSE);
+ gtk_widget_set_sensitive (data->a_password_label, FALSE);
+ return;
+ }
+
+ for (i = 0; mime_type_desc[i].mime_type != NULL; i++) {
+ if (strcmp (mime_type_desc[i].mime_type, mime_type) == 0) {
+ gtk_widget_set_sensitive (data->a_password_entry, mime_type_desc[i].capabilities & FR_COMMAND_CAP_ENCRYPT);
+ gtk_widget_set_sensitive (data->a_password_label, mime_type_desc[i].capabilities & FR_COMMAND_CAP_ENCRYPT);
+ gtk_widget_set_sensitive (data->a_encrypt_header_checkbutton, mime_type_desc[i].capabilities & FR_COMMAND_CAP_ENCRYPT_HEADER);
+ break;
+ }
+ }
+}
+
+
+static void
archive_type_combo_box_changed_cb (GtkComboBox *combo_box,
DialogData *data)
{
@@ -337,6 +394,7 @@
mime_type = mime_type_desc[save_type_list[idx]].mime_type;
gtk_image_set_from_pixbuf (GTK_IMAGE (data->add_image), get_mime_type_pixbuf (mime_type, ARCHIVE_ICON_SIZE, NULL));
+ update_password_availability_for_mime_type (data, mime_type);
}
@@ -368,20 +426,42 @@
}
+static void
+update_sensitivity (DialogData *data)
+{
+ const char *password;
+ gboolean void_password;
+
+ password = gtk_entry_get_text (GTK_ENTRY (data->a_password_entry));
+ void_password = (password == NULL) || (strcmp (password, "") == 0);
+ gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton), void_password);
+ gtk_widget_set_sensitive (GTK_WIDGET (data->a_encrypt_header_checkbutton), ! void_password);
+}
+
+
+static void
+password_entry_changed_cb (GtkEditable *editable,
+ gpointer user_data)
+{
+ update_sensitivity ((DialogData *) user_data);
+}
+
+
void
dlg_batch_add_files (FrWindow *window,
GList *file_list)
{
- DialogData *data;
- GtkWidget *cancel_button;
- GtkWidget *add_button;
- GtkWidget *a_archive_type_box;
- char *automatic_name = NULL;
- char *default_ext;
- const char *first_filename;
- char *parent;
- int i;
- int *save_type_list;
+ DialogData *data;
+ GtkWidget *cancel_button;
+ GtkWidget *add_button;
+ GtkWidget *a_archive_type_box;
+ GtkSizeGroup *size_group;
+ char *automatic_name = NULL;
+ char *default_ext;
+ const char *first_filename;
+ char *parent;
+ int i;
+ int *save_type_list;
if (file_list == NULL)
return;
@@ -404,6 +484,10 @@
data->dialog = glade_xml_get_widget (data->gui, "batch_add_files_dialog");
data->a_add_to_entry = glade_xml_get_widget (data->gui, "a_add_to_entry");
data->a_location_filechooserbutton = glade_xml_get_widget (data->gui, "a_location_filechooserbutton");
+ data->a_password_entry = glade_xml_get_widget (data->gui, "a_password_entry");
+ data->a_password_label = glade_xml_get_widget (data->gui, "a_password_label");
+ data->a_other_options_expander = glade_xml_get_widget (data->gui, "a_other_options_expander");
+ data->a_encrypt_header_checkbutton = glade_xml_get_widget (data->gui, "a_encrypt_header_checkbutton");
add_button = glade_xml_get_widget (data->gui, "a_add_button");
cancel_button = glade_xml_get_widget (data->gui, "a_cancel_button");
@@ -413,9 +497,16 @@
/* Set widgets data. */
+ size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ gtk_size_group_add_widget (size_group, glade_xml_get_widget (data->gui, "a_archive_label"));
+ gtk_size_group_add_widget (size_group, glade_xml_get_widget (data->gui, "a_location_label"));
+ gtk_size_group_add_widget (size_group, glade_xml_get_widget (data->gui, "a_password_label"));
+
gtk_button_set_use_stock (GTK_BUTTON (add_button), TRUE);
gtk_button_set_label (GTK_BUTTON (add_button), FR_STOCK_CREATE_ARCHIVE);
-
+ gtk_expander_set_expanded (GTK_EXPANDER (data->a_other_options_expander), eel_gconf_get_boolean (PREF_BATCH_OTHER_OPTIONS, FALSE));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton), eel_gconf_get_boolean (PREF_ENCRYPT_HEADER, FALSE));
+
first_filename = (char*) file_list->data;
parent = remove_level_from_path (first_filename);
@@ -446,10 +537,9 @@
else
save_type_list = save_type;
- for (i = 0; save_type_list[i] != -1; i++) {
+ for (i = 0; save_type_list[i] != -1; i++)
gtk_combo_box_append_text (GTK_COMBO_BOX (data->a_archive_type_combo_box),
mime_type_desc[save_type_list[i]].default_ext);
- }
gtk_box_pack_start (GTK_BOX (a_archive_type_box), data->a_archive_type_combo_box, TRUE, TRUE, 0);
gtk_widget_show_all (a_archive_type_box);
@@ -472,6 +562,10 @@
"changed",
G_CALLBACK (archive_type_combo_box_changed_cb),
data);
+ g_signal_connect (G_OBJECT (data->a_password_entry),
+ "changed",
+ G_CALLBACK (password_entry_changed_cb),
+ data);
/* Run dialog. */
@@ -483,6 +577,8 @@
gtk_editable_select_region (GTK_EDITABLE (data->a_add_to_entry),
0, -1);
+ update_sensitivity (data);
+
gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
gtk_window_present (GTK_WINDOW (data->dialog));
}
Modified: trunk/src/dlg-password.c
==============================================================================
--- trunk/src/dlg-password.c (original)
+++ trunk/src/dlg-password.c Mon Jul 7 09:57:56 2008
@@ -25,8 +25,11 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
-#include "gtk-utils.h"
#include "fr-window.h"
+#include "gconf-utils.h"
+#include "gtk-utils.h"
+#include "preferences.h"
+
#define GLADE_FILE "password.glade"
@@ -37,6 +40,7 @@
FrWindow *window;
GtkWidget *dialog;
GtkWidget *pw_password_entry;
+ GtkWidget *pw_encrypt_header_checkbutton;
} DialogData;
@@ -55,13 +59,18 @@
int response_id,
DialogData *data)
{
- char *password;
+ char *password;
+ gboolean encrypt_header;
switch (response_id) {
case GTK_RESPONSE_OK:
password = _gtk_entry_get_locale_text (GTK_ENTRY (data->pw_password_entry));
fr_window_set_password (data->window, password);
g_free (password);
+
+ encrypt_header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->pw_encrypt_header_checkbutton));
+ eel_gconf_set_boolean (PREF_ENCRYPT_HEADER, encrypt_header);
+ fr_window_set_encrypt_header (data->window, encrypt_header);
break;
default:
break;
@@ -90,10 +99,12 @@
data->dialog = glade_xml_get_widget (data->gui, "password_dialog");
data->pw_password_entry = glade_xml_get_widget (data->gui, "pw_password_entry");
+ data->pw_encrypt_header_checkbutton = glade_xml_get_widget (data->gui, "pw_encrypt_header_checkbutton");
/* Set widgets data. */
_gtk_entry_set_locale_text (GTK_ENTRY (data->pw_password_entry), fr_window_get_password (window));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->pw_encrypt_header_checkbutton), fr_window_get_encrypt_header (window));
/* Set the signals handlers. */
Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c (original)
+++ trunk/src/fr-archive.c Mon Jul 7 09:57:56 2008
@@ -56,6 +56,7 @@
char *dest_dir;
gboolean update;
char *password;
+ gboolean encrypt_header;
FrCompression compression;
} DroppedItemsData;
@@ -67,6 +68,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
DroppedItemsData *data;
@@ -81,6 +83,7 @@
data->update = update;
if (password != NULL)
data->password = g_strdup (password);
+ data->encrypt_header = encrypt_header;
data->compression = compression;
return data;
@@ -124,6 +127,7 @@
FrArchive *archive;
char *uri;
char *password;
+ gboolean encrypt_header;
FrAction action;
GList *file_list;
char *base_uri;
@@ -1328,6 +1332,7 @@
gboolean update,
gboolean recursive,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
GList *new_file_list = NULL;
@@ -1444,6 +1449,7 @@
update,
recursive,
password,
+ encrypt_header,
compression);
prev->next = scan;
}
@@ -1472,6 +1478,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
fr_archive_stoppable (archive, TRUE);
@@ -1483,6 +1490,7 @@
update,
FALSE,
password,
+ encrypt_header,
compression);
fr_process_start (archive->process);
}
@@ -1503,6 +1511,7 @@
xfer_data->dest_dir,
FALSE,
xfer_data->password,
+ xfer_data->encrypt_header,
xfer_data->compression);
xfer_data_free (xfer_data);
}
@@ -1533,6 +1542,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression,
const char *tmp_dir)
{
@@ -1589,6 +1599,7 @@
xfer_data->update = update;
xfer_data->dest_dir = g_strdup (dest_dir);
xfer_data->password = g_strdup (password);
+ xfer_data->encrypt_header = encrypt_header;
xfer_data->compression = compression;
xfer_data->tmp_dir = g_strdup (tmp_dir);
@@ -1628,6 +1639,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
if (uri_is_local (base_dir)) {
@@ -1638,6 +1650,7 @@
dest_dir,
update,
password,
+ encrypt_header,
compression);
g_free (local_dir);
}
@@ -1648,6 +1661,7 @@
dest_dir,
update,
password,
+ encrypt_header,
compression,
fr_archive_get_temp_work_dir (archive));
}
@@ -1662,6 +1676,7 @@
char *dest_dir;
gboolean update;
char *password;
+ gboolean encrypt_header;
FrCompression compression;
} AddWithWildcardData;
@@ -1705,6 +1720,7 @@
aww_data->dest_dir,
aww_data->update,
aww_data->password,
+ aww_data->encrypt_header,
aww_data->compression);
path_list_free (file_list);
}
@@ -1723,6 +1739,7 @@
gboolean update,
gboolean follow_links,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
AddWithWildcardData *aww_data;
@@ -1735,6 +1752,7 @@
aww_data->dest_dir = g_strdup (dest_dir);
aww_data->update = update;
aww_data->password = g_strdup (password);
+ aww_data->encrypt_header = encrypt_header;
aww_data->compression = compression;
g_signal_emit (G_OBJECT (archive),
@@ -1767,6 +1785,7 @@
char *dest_dir;
gboolean update;
char *password;
+ gboolean encrypt_header;
FrCompression compression;
} AddDirectoryData;
@@ -1815,6 +1834,7 @@
ad_data->dest_dir,
ad_data->update,
ad_data->password,
+ ad_data->encrypt_header,
ad_data->compression);
path_list_free (file_list);
}
@@ -1830,6 +1850,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
@@ -1843,6 +1864,7 @@
ad_data->dest_dir = g_strdup (dest_dir);
ad_data->update = update;
ad_data->password = g_strdup (password);
+ ad_data->encrypt_header = encrypt_header;
ad_data->compression = compression;
g_signal_emit (G_OBJECT (archive),
@@ -1865,6 +1887,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
@@ -1878,6 +1901,7 @@
ad_data->dest_dir = g_strdup (dest_dir);
ad_data->update = update;
ad_data->password = g_strdup (password);
+ ad_data->encrypt_header = encrypt_header;
ad_data->compression = compression;
g_signal_emit (G_OBJECT (archive),
@@ -1962,6 +1986,7 @@
data->dest_dir,
data->update,
data->password,
+ data->encrypt_header,
data->compression);
g_free (first_base_dir);
@@ -1991,6 +2016,7 @@
data->dest_dir,
data->update,
data->password,
+ data->encrypt_header,
data->compression);
g_free (base_dir);
@@ -2016,6 +2042,7 @@
data->dest_dir,
data->update,
data->password,
+ data->encrypt_header,
data->compression);
g_list_free (only_names_list);
@@ -2044,6 +2071,7 @@
data->update,
FALSE,
data->password,
+ data->encrypt_header,
data->compression);
g_list_free (singleton);
g_free (basedir);
@@ -2063,6 +2091,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
GList *scan;
@@ -2099,6 +2128,7 @@
dest_dir,
update,
password,
+ encrypt_header,
compression);
add_dropped_items (archive->priv->dropped_items_data);
}
Modified: trunk/src/fr-archive.h
==============================================================================
--- trunk/src/fr-archive.h (original)
+++ trunk/src/fr-archive.h Mon Jul 7 09:57:56 2008
@@ -53,15 +53,15 @@
gboolean can_create_compressed_file;
gboolean is_compressed_file; /* Whether the file is not an
* archive that can contain
- * many files but simply a
- * compressed file, for
- * example foo.txt.gz is a
- * compressed file, foo.zip
+ * many files but simply a
+ * compressed file, for
+ * example foo.txt.gz is a
+ * compressed file, foo.zip
* is not. */
- gboolean read_only; /* Whether archive is
- * read-only for whatever
+ gboolean read_only; /* Whether archive is
+ * read-only for whatever
* reason. */
- gboolean have_permissions; /* true if we have the
+ gboolean have_permissions; /* true if we have the
* permissions to write the
* file. */
@@ -74,9 +74,9 @@
/* -- Signals -- */
void (*start) (FrArchive *archive,
- FrAction action);
+ FrAction action);
void (*done) (FrArchive *archive,
- FrAction action,
+ FrAction action,
FrProcError *error);
void (*progress) (FrArchive *archive,
double fraction);
@@ -112,7 +112,7 @@
const char *password);
gboolean fr_archive_load_local (FrArchive *archive,
const char *uri,
- const char *password);
+ const char *password);
void fr_archive_reload (FrArchive *archive,
const char *password);
void fr_archive_rename (FrArchive *archive,
@@ -127,6 +127,7 @@
gboolean update,
gboolean recursive,
const char *password,
+ gboolean encrypt_header,
FrCompression compression);
void fr_archive_remove (FrArchive *archive,
GList *file_list,
@@ -162,6 +163,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression);
void fr_archive_add_with_wildcard (FrArchive *archive,
const char *include_files,
@@ -169,9 +171,10 @@
const char *exclude_folders,
const char *base_dir,
const char *dest_dir,
- gboolean update,
+ gboolean update,
gboolean follow_links,
const char *password,
+ gboolean encrypt_header,
FrCompression compression);
void fr_archive_add_directory (FrArchive *archive,
const char *directory,
@@ -179,6 +182,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression);
void fr_archive_add_items (FrArchive *archive,
GList *item_list,
@@ -186,6 +190,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression);
void fr_archive_add_dropped_items (FrArchive *archive,
GList *item_list,
@@ -193,6 +198,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression);
void fr_archive_test (FrArchive *archive,
const char *password);
Modified: trunk/src/fr-command-7z.c
==============================================================================
--- trunk/src/fr-command-7z.c (original)
+++ trunk/src/fr-command-7z.c Mon Jul 7 09:57:56 2008
@@ -263,6 +263,8 @@
fr_process_add_arg (comm->process, "-y");
fr_process_add_arg (comm->process, "-l");
add_password_arg (comm, password, FALSE);
+ if ((password != NULL) && (*password != 0) && comm->encrypt_header)
+ fr_process_add_arg (comm->process, "-mhe=on");
switch (compression) {
case FR_COMPRESSION_VERY_FAST:
@@ -417,16 +419,15 @@
return capabilities;
if (is_mime_type (mime_type, "application/x-7z-compressed"))
- capabilities |= FR_COMMAND_CAP_READ_WRITE;
+ capabilities |= FR_COMMAND_CAP_READ_WRITE | FR_COMMAND_CAP_ENCRYPT | FR_COMMAND_CAP_ENCRYPT_HEADER;
else if (is_program_in_path ("7z")) {
capabilities |= FR_COMMAND_CAP_READ;
- if (is_mime_type (mime_type, "application/x-cbr")
- || is_mime_type (mime_type, "application/x-cbz")
+ if (is_mime_type (mime_type, "application/x-cbz")
|| is_mime_type (mime_type, "application/x-executable")
|| is_mime_type (mime_type, "application/zip"))
{
- capabilities |= FR_COMMAND_CAP_WRITE;
+ capabilities |= FR_COMMAND_CAP_WRITE | FR_COMMAND_CAP_ENCRYPT;
}
}
Modified: trunk/src/fr-command-arj.c
==============================================================================
--- trunk/src/fr-command-arj.c (original)
+++ trunk/src/fr-command-arj.c Mon Jul 7 09:57:56 2008
@@ -49,7 +49,7 @@
{
struct tm tm = {0, };
char **fields;
-
+
tm.tm_isdst = -1;
/* date */
@@ -120,7 +120,7 @@
if (*name_field == '/') {
fdata->full_path = g_strdup (name_field);
fdata->original_path = fdata->full_path;
- }
+ }
else {
fdata->full_path = g_strconcat ("/", name_field, NULL);
fdata->original_path = fdata->full_path + 1;
@@ -130,7 +130,7 @@
fdata->name = g_strdup (file_name_from_path (fdata->full_path));
fdata->path = remove_level_from_path (fdata->full_path);
- }
+ }
else if (arj_comm->line_no == 2) { /* Read file size and date. */
FileData *fdata;
char **fields;
@@ -145,7 +145,7 @@
if (strcmp (fields[1], "MS-DOS") == 0)
fdata->encrypted = (g_ascii_strcasecmp (fields[7], "11") == 0);
else
- fdata->encrypted = (g_ascii_strcasecmp (fields[9], "11") == 0);
+ fdata->encrypted = (g_ascii_strcasecmp (fields[9], "11") == 0);
g_strfreev (fields);
if (*fdata->name == 0)
@@ -154,7 +154,7 @@
fr_command_add_file (comm, fdata);
arj_comm->fdata = NULL;
}
-
+
arj_comm->line_no++;
}
@@ -198,7 +198,7 @@
if (update)
fr_process_add_arg (comm->process, "-u");
- if (password != NULL)
+ if (password != NULL)
fr_process_add_arg_concat (comm->process, "-g/", password, NULL);
switch (compression) {
@@ -264,7 +264,7 @@
else
fr_process_add_arg (comm->process, "x");
- if (dest_dir != NULL)
+ if (dest_dir != NULL)
fr_process_add_arg_concat (comm->process, "-ht/", dest_dir, NULL);
if (! overwrite)
@@ -273,7 +273,7 @@
if (skip_older)
fr_process_add_arg (comm->process, "-u");
- if (password != NULL)
+ if (password != NULL)
fr_process_add_arg_concat (comm->process, "-g/", password, NULL);
else
fr_process_add_arg (comm->process, "-g/");
@@ -297,7 +297,7 @@
{
fr_process_begin_command (comm->process, "arj");
fr_process_add_arg (comm->process, "t");
- if (password != NULL)
+ if (password != NULL)
fr_process_add_arg_concat (comm->process, "-g/", password, NULL);
fr_process_add_arg (comm->process, "-i");
fr_process_add_arg (comm->process, "-y");
@@ -323,23 +323,23 @@
const char *arj_mime_type[] = { "application/x-arj", NULL };
-const char **
+const char **
fr_command_arj_get_mime_types (FrCommand *comm)
{
return arj_mime_type;
}
-FrCommandCap
+FrCommandCap
fr_command_arj_get_capabilities (FrCommand *comm,
const char *mime_type)
{
FrCommandCap capabilities;
-
- capabilities = FR_COMMAND_CAP_ARCHIVE_MANY_FILES;
- if (is_program_in_path ("arj"))
+
+ capabilities = FR_COMMAND_CAP_ARCHIVE_MANY_FILES | FR_COMMAND_CAP_ENCRYPT;
+ if (is_program_in_path ("arj"))
capabilities |= FR_COMMAND_CAP_READ_WRITE;
-
+
return capabilities;
}
Modified: trunk/src/fr-command-jar.c
==============================================================================
--- trunk/src/fr-command-jar.c (original)
+++ trunk/src/fr-command-jar.c Mon Jul 7 09:57:56 2008
@@ -164,7 +164,7 @@
{
FrCommandCap capabilities;
- capabilities |= FR_COMMAND_CAP_ARCHIVE_MANY_FILES;
+ capabilities = FR_COMMAND_CAP_ARCHIVE_MANY_FILES;
if (is_program_in_path ("zip"))
capabilities |= FR_COMMAND_CAP_READ_WRITE;
Modified: trunk/src/fr-command-rar.c
==============================================================================
--- trunk/src/fr-command-rar.c (original)
+++ trunk/src/fr-command-rar.c Mon Jul 7 09:57:56 2008
@@ -125,7 +125,7 @@
if (*name_field == '/') {
fdata->full_path = g_strdup (name_field);
fdata->original_path = fdata->full_path;
- }
+ }
else {
fdata->full_path = g_strconcat ("/", name_field, NULL);
fdata->original_path = fdata->full_path + 1;
@@ -133,7 +133,7 @@
fdata->link = NULL;
fdata->path = remove_level_from_path (fdata->full_path);
- }
+ }
else {
FileData *fdata;
@@ -148,18 +148,18 @@
if ((fields[5][1] == 'D') || (fields[5][0] == 'd')) {
char *tmp;
-
+
tmp = fdata->full_path;
fdata->full_path = g_strconcat (fdata->full_path, "/", NULL);
-
+
fdata->original_path = g_strdup (fdata->original_path);
fdata->free_original_path = TRUE;
-
+
g_free (tmp);
-
+
fdata->name = dir_name_from_path (fdata->full_path);
fdata->dir = TRUE;
- }
+ }
else
fdata->name = g_strdup (file_name_from_path (fdata->full_path));
@@ -178,8 +178,12 @@
const char *password,
gboolean disable_query)
{
- if ((password != NULL) && (password[0] != '\0'))
- fr_process_add_arg_concat (comm->process, "-p", password, NULL);
+ if ((password != NULL) && (password[0] != '\0')) {
+ if (comm->encrypt_header)
+ fr_process_add_arg_concat (comm->process, "-hp", password, NULL);
+ else
+ fr_process_add_arg_concat (comm->process, "-p", password, NULL);
+ }
else if (disable_query)
fr_process_add_arg (comm->process, "-p-");
}
@@ -359,21 +363,21 @@
fr_command_rar_handle_error (FrCommand *comm,
FrProcError *error)
{
- if (error->type != FR_PROC_ERROR_COMMAND_ERROR)
+ if (error->type != FR_PROC_ERROR_COMMAND_ERROR)
return;
-
+
if (error->status == 3) {
error->type = FR_PROC_ERROR_ASK_PASSWORD;
}
else {
GList *scan;
-
+
if (error->status <= 1)
error->type = FR_PROC_ERROR_NONE;
-
+
for (scan = g_list_last (comm->process->err.raw); scan; scan = scan->prev) {
char *line = scan->data;
-
+
if (strstr (line, "password incorrect") != NULL) {
error->type = FR_PROC_ERROR_ASK_PASSWORD;
break;
@@ -383,30 +387,30 @@
}
-const char *rar_mime_type[] = { "application/x-cbr",
- "application/x-rar",
+const char *rar_mime_type[] = { "application/x-cbr",
+ "application/x-rar",
NULL };
-const char **
+const char **
fr_command_rar_get_mime_types (FrCommand *comm)
{
return rar_mime_type;
}
-FrCommandCap
+FrCommandCap
fr_command_rar_get_capabilities (FrCommand *comm,
const char *mime_type)
{
FrCommandCap capabilities;
-
- capabilities = FR_COMMAND_CAP_ARCHIVE_MANY_FILES;
- if (is_program_in_path ("rar"))
+
+ capabilities = FR_COMMAND_CAP_ARCHIVE_MANY_FILES | FR_COMMAND_CAP_ENCRYPT | FR_COMMAND_CAP_ENCRYPT_HEADER;
+ if (is_program_in_path ("rar"))
capabilities |= FR_COMMAND_CAP_READ_WRITE;
- else if (is_program_in_path ("unrar"))
+ else if (is_program_in_path ("unrar"))
capabilities |= FR_COMMAND_CAP_READ;
-
+
return capabilities;
}
Modified: trunk/src/fr-command-zip.c
==============================================================================
--- trunk/src/fr-command-zip.c (original)
+++ trunk/src/fr-command-zip.c Mon Jul 7 09:57:56 2008
@@ -249,7 +249,7 @@
fr_process_add_arg (comm->process, comm->filename);
- for (scan = file_list; scan; scan = scan->next)
+ for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
@@ -270,7 +270,7 @@
fr_process_add_arg (comm->process, "-d");
fr_process_add_arg (comm->process, comm->filename);
- for (scan = file_list; scan; scan = scan->next)
+ for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
@@ -309,7 +309,7 @@
add_password_arg (comm, password);
fr_process_add_arg (comm->process, comm->filename);
- for (scan = file_list; scan; scan = scan->next)
+ for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
@@ -340,15 +340,15 @@
else {
GList *output;
GList *scan;
-
+
if (comm->action == FR_ACTION_TESTING_ARCHIVE)
output = comm->process->out.raw;
else
output = comm->process->err.raw;
-
+
for (scan = g_list_last (output); scan; scan = scan->prev) {
char *line = scan->data;
-
+
if (strstr (line, "incorrect password") != NULL) {
error->type = FR_PROC_ERROR_ASK_PASSWORD;
break;
@@ -360,34 +360,34 @@
const char *zip_mime_type[] = { "application/x-cbz",
- "application/x-executable",
- "application/zip",
+ "application/x-executable",
+ "application/zip",
NULL };
-const char **
+const char **
fr_command_zip_get_mime_types (FrCommand *comm)
{
return zip_mime_type;
}
-FrCommandCap
+FrCommandCap
fr_command_zip_get_capabilities (FrCommand *comm,
const char *mime_type)
{
FrCommandCap capabilities;
-
- capabilities |= FR_COMMAND_CAP_ARCHIVE_MANY_FILES;
+
+ capabilities = FR_COMMAND_CAP_ARCHIVE_MANY_FILES | FR_COMMAND_CAP_ENCRYPT;
if (is_program_in_path ("zip")) {
if (strcmp (mime_type, "application/x-executable") == 0)
capabilities |= FR_COMMAND_CAP_READ;
else
- capabilities |= FR_COMMAND_CAP_ALL;
- }
- else if (is_program_in_path ("unzip"))
+ capabilities |= FR_COMMAND_CAP_READ_WRITE;
+ }
+ else if (is_program_in_path ("unzip"))
capabilities |= FR_COMMAND_CAP_READ;
-
+
return capabilities;
}
Modified: trunk/src/fr-command-zoo.c
==============================================================================
--- trunk/src/fr-command-zoo.c (original)
+++ trunk/src/fr-command-zoo.c Mon Jul 7 09:57:56 2008
@@ -165,7 +165,7 @@
field = eat_spaces (field);
field = strchr (field, ' ');
field = eat_spaces (field);
- } else
+ } else
field = eat_spaces (field);
return field;
@@ -173,7 +173,7 @@
static void
-process_zoo_line (char *line,
+process_zoo_line (char *line,
gpointer data)
{
FileData *fdata;
@@ -252,7 +252,7 @@
fr_process_set_working_dir (comm->process, base_dir);
- if (update)
+ if (update)
fr_process_add_arg (comm->process, "auP");
else
fr_process_add_arg (comm->process, "aP");
@@ -327,28 +327,28 @@
const char *zoo_mime_type[] = { "application/x-zoo", NULL };
-const char **
+const char **
fr_command_zoo_get_mime_types (FrCommand *comm)
{
return zoo_mime_type;
}
-FrCommandCap
+FrCommandCap
fr_command_zoo_get_capabilities (FrCommand *comm,
const char *mime_type)
{
FrCommandCap capabilities;
-
- capabilities |= FR_COMMAND_CAP_ARCHIVE_MANY_FILES;
- if (is_program_in_path ("zoo"))
+
+ capabilities = FR_COMMAND_CAP_ARCHIVE_MANY_FILES;
+ if (is_program_in_path ("zoo"))
capabilities |= FR_COMMAND_CAP_READ_WRITE;
-
+
return capabilities;
}
-static void
+static void
fr_command_zoo_class_init (FrCommandZooClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
@@ -368,12 +368,12 @@
afc->get_capabilities = fr_command_zoo_get_capabilities;
}
-
-static void
+
+static void
fr_command_zoo_init (FrCommand *comm)
{
comm->propAddCanUpdate = TRUE;
- comm->propAddCanReplace = FALSE;
+ comm->propAddCanReplace = FALSE;
comm->propExtractCanAvoidOverwrite = FALSE;
comm->propExtractCanSkipOlder = FALSE;
comm->propExtractCanJunkPaths = FALSE;
@@ -382,7 +382,7 @@
}
-static void
+static void
fr_command_zoo_finalize (GObject *object)
{
g_return_if_fail (object != NULL);
Modified: trunk/src/fr-command.c
==============================================================================
--- trunk/src/fr-command.c (original)
+++ trunk/src/fr-command.c Mon Jul 7 09:57:56 2008
@@ -58,17 +58,17 @@
static void fr_command_finalize (GObject *object);
char *action_names[] = { "NONE",
- "CREATING_NEW_ARCHIVE",
- "LOADING_ARCHIVE",
- "LISTING_CONTENT",
- "DELETING_FILES",
- "TESTING_ARCHIVE",
- "GETTING_FILE_LIST",
- "COPYING_FILES_FROM_REMOTE",
- "ADDING_FILES",
- "EXTRACTING_FILES",
- "COPYING_FILES_TO_REMOTE",
- "CREATING_ARCHIVE",
+ "CREATING_NEW_ARCHIVE",
+ "LOADING_ARCHIVE",
+ "LISTING_CONTENT",
+ "DELETING_FILES",
+ "TESTING_ARCHIVE",
+ "GETTING_FILE_LIST",
+ "COPYING_FILES_FROM_REMOTE",
+ "ADDING_FILES",
+ "EXTRACTING_FILES",
+ "COPYING_FILES_TO_REMOTE",
+ "CREATING_ARCHIVE",
"SAVING_REMOTE_ARCHIVE" };
GType
@@ -167,20 +167,20 @@
const char **void_mime_types = { NULL };
-const char **
+const char **
base_fr_command_get_mime_types (FrCommand *comm)
{
return void_mime_types;
}
-FrCommandCap
+FrCommandCap
base_fr_command_get_capabilities (FrCommand *comm,
const char *mime_type)
{
return FR_COMMAND_CAP_NONE;
}
-
+
static void
base_fr_command_set_mime_type (FrCommand *comm,
@@ -196,9 +196,9 @@
gpointer data)
{
FrCommand *comm = FR_COMMAND (data);
-
+
g_signal_emit (G_OBJECT (comm),
- fr_command_signals[START],
+ fr_command_signals[START],
0,
comm->action);
}
@@ -218,9 +218,9 @@
fr_process_start (comm->process);
else
g_signal_emit (G_OBJECT (comm),
- fr_command_signals[DONE],
+ fr_command_signals[DONE],
0,
- comm->action,
+ comm->action,
&process->error);
}
@@ -231,18 +231,18 @@
{
if (comm->process != NULL) {
g_signal_handlers_disconnect_matched (G_OBJECT (comm->process),
- G_SIGNAL_MATCH_DATA,
- 0,
- 0, NULL,
+ G_SIGNAL_MATCH_DATA,
+ 0,
+ 0, NULL,
0,
comm);
g_object_unref (G_OBJECT (comm->process));
comm->process = NULL;
}
-
+
if (process == NULL)
return;
-
+
g_object_ref (G_OBJECT (process));
comm->process = process;
g_signal_connect (G_OBJECT (comm->process),
@@ -317,13 +317,13 @@
parent_class = g_type_class_peek_parent (class);
gobject_class = G_OBJECT_CLASS (class);
-
+
/* virtual functions */
-
+
gobject_class->finalize = fr_command_finalize;
gobject_class->set_property = fr_command_set_property;
gobject_class->get_property = fr_command_get_property;
-
+
class->list = base_fr_command_list;
class->add = base_fr_command_add;
class->delete = base_fr_command_delete;
@@ -339,9 +339,9 @@
class->done = NULL;
class->progress = NULL;
class->message = NULL;
-
+
/* signals */
-
+
fr_command_signals[START] =
g_signal_new ("start",
G_TYPE_FROM_CLASS (class),
@@ -349,7 +349,7 @@
G_STRUCT_OFFSET (FrCommandClass, start),
NULL, NULL,
fr_marshal_VOID__INT,
- G_TYPE_NONE,
+ G_TYPE_NONE,
1, G_TYPE_INT);
fr_command_signals[DONE] =
g_signal_new ("done",
@@ -379,9 +379,9 @@
fr_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING);
-
+
/* properties */
-
+
g_object_class_install_property (gobject_class,
PROP_PROCESS,
g_param_spec_object ("process",
@@ -402,7 +402,7 @@
"Mime type",
"The file mime-type",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE));
}
@@ -410,7 +410,7 @@
fr_command_init (FrCommand *comm)
{
comm->files = g_ptr_array_sized_new (INITIAL_SIZE);
-
+
comm->filename = NULL;
comm->e_filename = NULL;
comm->fake_load = FALSE;
@@ -423,7 +423,7 @@
comm->propExtractCanJunkPaths = FALSE;
comm->propPassword = FALSE;
comm->propTest = FALSE;
- comm->propCanExtractAll = TRUE;
+ comm->propCanExtractAll = TRUE;
comm->propCanDeleteNonEmptyFolders = TRUE;
comm->propCanExtractNonEmptyFolders = TRUE;
}
@@ -443,7 +443,7 @@
g_free (comm->filename);
if (comm->e_filename != NULL)
g_free (comm->e_filename);
- if (comm->files != NULL)
+ if (comm->files != NULL)
g_ptr_array_free_full (comm->files, (GFunc) file_data_free, NULL);
fr_command_set_process (comm, NULL);
@@ -468,7 +468,7 @@
g_free (comm->e_filename);
comm->e_filename = NULL;
}
-
+
if (filename == NULL)
return;
@@ -477,11 +477,11 @@
current_dir = g_get_current_dir ();
comm->filename = g_strconcat (current_dir,
- "/",
- filename,
+ "/",
+ filename,
NULL);
g_free (current_dir);
- }
+ }
else
comm->filename = g_strdup (filename);
@@ -509,7 +509,7 @@
fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
fr_process_use_standard_locale (FR_COMMAND (comm)->process, TRUE);
-
+
if (!comm->fake_load)
FR_COMMAND_GET_CLASS (G_OBJECT (comm))->list (comm, password);
}
@@ -522,14 +522,16 @@
gboolean update,
gboolean recursive,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
fr_command_progress (comm, -1.0);
+ comm->encrypt_header = encrypt_header;
comm->action = FR_ACTION_ADDING_FILES;
fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
-
+
FR_COMMAND_GET_CLASS (G_OBJECT (comm))->add (comm,
file_list,
base_dir,
@@ -549,7 +551,7 @@
comm->action = FR_ACTION_DELETING_FILES;
fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
-
+
FR_COMMAND_GET_CLASS (G_OBJECT (comm))->delete (comm, file_list);
}
@@ -568,9 +570,9 @@
comm->action = FR_ACTION_EXTRACTING_FILES;
fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
-
+
FR_COMMAND_GET_CLASS (G_OBJECT (comm))->extract (comm,
- file_list,
+ file_list,
dest_dir,
overwrite,
skip_older,
@@ -588,7 +590,7 @@
comm->action = FR_ACTION_TESTING_ARCHIVE;
fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
-
+
FR_COMMAND_GET_CLASS (G_OBJECT (comm))->test (comm, password);
}
@@ -605,19 +607,19 @@
fr_command_recompress (FrCommand *comm,
FrCompression compression)
{
- fr_command_progress (comm, -1.0);
+ fr_command_progress (comm, -1.0);
FR_COMMAND_GET_CLASS (G_OBJECT (comm))->recompress (comm, compression);
}
-const char **
+const char **
fr_command_get_mime_types (FrCommand *comm)
{
return FR_COMMAND_GET_CLASS (G_OBJECT (comm))->get_mime_types (comm);
}
-FrCommandCap
+FrCommandCap
fr_command_get_capabilities (FrCommand *comm,
const char *mime_type)
{
@@ -626,7 +628,7 @@
gboolean
-fr_command_is_capable_of (FrCommand *comm,
+fr_command_is_capable_of (FrCommand *comm,
FrCommandCaps requested_capabilities)
{
return (((comm->capabilities ^ requested_capabilities) & requested_capabilities) == 0);
@@ -634,17 +636,17 @@
/* fraction == -1 means : I don't known how much time the current operation
- * will take, the dialog will display this info pulsing
- * the progress bar.
- * fraction in [0.0, 1.0] means the amount of work, in percentage,
- * accomplished.
+ * will take, the dialog will display this info pulsing
+ * the progress bar.
+ * fraction in [0.0, 1.0] means the amount of work, in percentage,
+ * accomplished.
*/
void
fr_command_progress (FrCommand *comm,
double fraction)
{
g_signal_emit (G_OBJECT (comm),
- fr_command_signals[PROGRESS],
+ fr_command_signals[PROGRESS],
0,
fraction);
}
@@ -655,7 +657,7 @@
const char *msg)
{
g_signal_emit (G_OBJECT (comm),
- fr_command_signals[MESSAGE],
+ fr_command_signals[MESSAGE],
0,
msg);
}
Modified: trunk/src/fr-command.h
==============================================================================
--- trunk/src/fr-command.h (original)
+++ trunk/src/fr-command.h Mon Jul 7 09:57:56 2008
@@ -66,11 +66,11 @@
GObject __parent;
GPtrArray *files; /* Array of FileData* */
-
+
/*<protected>*/
-
+
/* properties the command supports. */
-
+
guint propAddCanUpdate : 1;
guint propAddCanReplace : 1;
guint propAddCanStoreFolders : 1;
@@ -84,10 +84,14 @@
guint propCanExtractNonEmptyFolders : 1;
/* progress data */
-
- int n_file;
+
+ int n_file;
int n_files;
-
+
+ /*<protected>*/
+
+ gboolean encrypt_header;
+
/*<private>*/
FrProcess *process; /* the process object used to execute
@@ -97,7 +101,7 @@
char *e_filename; /* escaped archive filename. */
const char *mime_type;
FrCommandCaps capabilities;
-
+
gboolean fake_load; /* if TRUE does nothing when the list
* operation is invoked. */
};
@@ -116,9 +120,9 @@
gboolean update,
gboolean recursive,
const char *password,
- FrCompression compression);
+ FrCompression compression);
void (*delete) (FrCommand *comm,
- GList *file_list);
+ GList *file_list);
void (*extract) (FrCommand *comm,
GList *file_list,
const char *dest_dir,
@@ -142,7 +146,7 @@
/*<signals>*/
void (*start) (FrCommand *comm,
- FrAction action);
+ FrAction action);
void (*done) (FrCommand *comm,
FrAction action,
FrProcError *error);
@@ -163,9 +167,10 @@
gboolean update,
gboolean recursive,
const char *password,
- FrCompression compression);
+ gboolean encrypt_header,
+ FrCompression compression);
void fr_command_delete (FrCommand *comm,
- GList *file_list);
+ GList *file_list);
void fr_command_extract (FrCommand *comm,
GList *file_list,
const char *dest_dir,
@@ -178,14 +183,14 @@
void fr_command_uncompress (FrCommand *comm);
void fr_command_recompress (FrCommand *comm,
FrCompression compression);
-gboolean fr_command_is_capable_of (FrCommand *comm,
+gboolean fr_command_is_capable_of (FrCommand *comm,
FrCommandCaps capabilities);
const char ** fr_command_get_mime_types (FrCommand *comm);
FrCommandCap fr_command_get_capabilities (FrCommand *comm,
const char *mime_type);
void fr_command_set_mime_type (FrCommand *comm,
const char *mime_type);
-gboolean fr_command_is_capable_of (FrCommand *comm,
+gboolean fr_command_is_capable_of (FrCommand *comm,
FrCommandCaps capabilities);
/* protected functions */
Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c (original)
+++ trunk/src/fr-window.c Mon Jul 7 09:57:56 2008
@@ -123,6 +123,7 @@
char *temp_dir;
FrArchive *new_archive;
char *password;
+ gboolean encrypt_header;
char *new_file;
} FRConvertData;
@@ -308,6 +309,7 @@
GList * history_current;
char * password;
char * password_for_paste;
+ gboolean encrypt_header;
FrCompression compression;
guint activity_timeout_handle; /* activity timeout
@@ -2174,23 +2176,12 @@
open_folder (GtkWindow *parent,
const char *folder)
{
-#ifdef GTK_2_13
- GdkAppLaunchContext *app_context;
- GError *error = NULL;
-#else
- GAppLaunchContext *app_context;
- GError *error = NULL;
-#endif
+ GError *error = NULL;
+
if (folder == NULL)
return;
-#ifdef GTK_2_13
- app_context = gdk_app_launch_context_new ();
-#else
- app_context = g_app_launch_context_new ();
-#endif
-
- if (! g_app_info_launch_default_for_uri (folder, G_APP_LAUNCH_CONTEXT (app_context), &error)) {
+ if (! show_uri (gtk_window_get_screen (parent), folder, GDK_CURRENT_TIME, &error)) {
GtkWidget *d;
char *utf8_name;
char *message;
@@ -2210,7 +2201,6 @@
g_free (message);
g_clear_error (&error);
}
- g_object_unref (app_context);
}
@@ -3083,6 +3073,7 @@
FALSE,
TRUE,
window->priv->convert_data.password,
+ window->priv->convert_data.encrypt_header,
window->priv->compression);
g_free (source_dir);
}
@@ -5358,11 +5349,13 @@
window->priv->password = NULL;
window->priv->compression = preferences_get_compression_level ();
+ window->priv->encrypt_header = eel_gconf_get_boolean (PREF_ENCRYPT_HEADER, FALSE);
window->priv->convert_data.converting = FALSE;
window->priv->convert_data.temp_dir = NULL;
window->priv->convert_data.new_archive = NULL;
window->priv->convert_data.password = NULL;
+ window->priv->convert_data.encrypt_header = FALSE;
window->priv->stoppable = TRUE;
@@ -6154,6 +6147,7 @@
fr_window_get_current_location (window),
update,
window->priv->password,
+ window->priv->encrypt_header,
window->priv->compression);
path_list_free (files);
@@ -6180,6 +6174,7 @@
update,
follow_links,
window->priv->password,
+ window->priv->encrypt_header,
window->priv->compression);
}
@@ -6191,6 +6186,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
fr_archive_add_directory (window->archive,
@@ -6199,6 +6195,7 @@
(dest_dir == NULL)? fr_window_get_current_location (window): dest_dir,
update,
password,
+ encrypt_header,
compression);
}
@@ -6210,6 +6207,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression)
{
fr_archive_add_items (window->archive,
@@ -6218,6 +6216,7 @@
(dest_dir == NULL)? fr_window_get_current_location (window): dest_dir,
update,
password,
+ encrypt_header,
compression);
}
@@ -6233,6 +6232,7 @@
fr_window_get_current_location (window),
update,
window->priv->password,
+ window->priv->encrypt_header,
window->priv->compression);
}
@@ -6505,6 +6505,23 @@
}
+void
+fr_window_set_encrypt_header (FrWindow *window,
+ gboolean encrypt_header)
+{
+ g_return_val_if_fail (window != NULL, NULL);
+
+ window->priv->encrypt_header = encrypt_header;
+}
+
+
+gboolean
+fr_window_get_encrypt_header (FrWindow *window)
+{
+ return window->priv->encrypt_header;
+}
+
+
FrCompression
fr_window_get_compression (FrWindow *window)
{
@@ -7003,6 +7020,7 @@
FALSE,
TRUE,
window->priv->password,
+ window->priv->encrypt_header,
window->priv->compression);
path_list_free (new_file_list);
@@ -7380,6 +7398,7 @@
FALSE,
FALSE,
window->priv->password,
+ window->priv->encrypt_header,
window->priv->compression);
path_list_free (new_file_list);
@@ -7748,6 +7767,7 @@
FALSE,
FALSE,
window->priv->password,
+ window->priv->encrypt_header,
window->priv->compression);
path_list_free (file_list);
}
Modified: trunk/src/fr-window.h
==============================================================================
--- trunk/src/fr-window.h (original)
+++ trunk/src/fr-window.h Mon Jul 7 09:57:56 2008
@@ -136,6 +136,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression);
void fr_window_archive_add_items (FrWindow *window,
GList *dir_list,
@@ -143,6 +144,7 @@
const char *dest_dir,
gboolean update,
const char *password,
+ gboolean encrypt_header,
FrCompression compression);
void fr_window_archive_add_dropped_items (FrWindow *window,
GList *item_list,
@@ -164,12 +166,15 @@
gboolean overwrite,
gboolean junk_paths,
const char *password);
-void fr_window_archive_test (FrWindow *window);
+void fr_window_archive_test (FrWindow *window);
void fr_window_set_password (FrWindow *window,
const char *password);
void fr_window_set_password_for_paste (FrWindow *window,
- const char *password);
+ const char *password);
const char *fr_window_get_password (FrWindow *window);
+void fr_window_set_encrypt_header (FrWindow *window,
+ gboolean encrypt_header);
+gboolean fr_window_get_encrypt_header (FrWindow *window);
FrCompression fr_window_get_compression (FrWindow *window);
/**/
@@ -203,10 +208,10 @@
gboolean *has_dirs);
GList * fr_window_get_selection (FrWindow *window,
gboolean from_sidebar,
- char **return_base_dir);
+ char **return_base_dir);
GtkTreeModel *
fr_window_get_list_store (FrWindow *window);
-void fr_window_find (FrWindow *window);
+void fr_window_find (FrWindow *window);
void fr_window_select_all (FrWindow *window);
void fr_window_unselect_all (FrWindow *window);
void fr_window_set_sort_type (FrWindow *window,
@@ -244,7 +249,7 @@
GList *file_list,
GAppInfo *app);
gboolean fr_window_update_files (FrWindow *window,
- GList *file_list);
+ GList *file_list);
void fr_window_update_columns_visibility (FrWindow *window);
void fr_window_update_history_list (FrWindow *window);
void fr_window_set_default_dir (FrWindow *window,
@@ -304,6 +309,6 @@
GtkSelectionData *selection_data,
GList *path_list);
-void fr_window_update_dialog_closed (FrWindow *window);
+void fr_window_update_dialog_closed (FrWindow *window);
#endif /* FR_WINDOW_H */
Modified: trunk/src/gtk-utils.c
==============================================================================
--- trunk/src/gtk-utils.c (original)
+++ trunk/src/gtk-utils.c Mon Jul 7 09:57:56 2008
@@ -860,23 +860,38 @@
}
+gboolean
+show_uri (GdkScreen *screen,
+ const char *uri,
+ guint32 timestamp,
+ GError **error)
+{
+ gboolean result;
+
+#ifndef GTK_2_13
+ GAppLaunchContext *app_context;
+
+ app_context = g_app_launch_context_new ();
+ result = g_app_info_launch_default_for_uri (uri, G_APP_LAUNCH_CONTEXT (app_context), error);
+
+ g_object_unref (app_context);
+#else
+ result = gtk_show_uri (screen, uri, timestamp, error);
+#endif
+
+ return result;
+}
+
+
void
show_help_dialog (GtkWindow *parent,
const char *section)
{
-#ifdef GTK_2_13
- GdkAppLaunchContext *app_context;
- char *uri;
- GError *error = NULL;
-#else
- GAppLaunchContext *app_context;
- char *uri;
- GError *error = NULL;
-#endif
+ char *uri;
+ GError *error = NULL;
uri = g_strconcat ("ghelp:file-roller", section ? "?" : NULL, section, NULL);
- app_context = g_app_launch_context_new ();
- if (! g_app_info_launch_default_for_uri (uri, G_APP_LAUNCH_CONTEXT (app_context), &error)) {
+ if (! show_uri (gtk_window_get_screen (parent), uri, GDK_CURRENT_TIME, &error)) {
GtkWidget *dialog;
dialog = _gtk_message_dialog_new (parent,
@@ -898,6 +913,5 @@
g_clear_error (&error);
}
- g_object_unref (app_context);
g_free (uri);
}
Modified: trunk/src/gtk-utils.h
==============================================================================
--- trunk/src/gtk-utils.h (original)
+++ trunk/src/gtk-utils.h Mon Jul 7 09:57:56 2008
@@ -75,11 +75,15 @@
int icon_size);
GdkPixbuf * get_icon_pixbuf (GtkIconTheme *icon_theme,
GThemedIcon *icon,
- int size);
+ int size);
GdkPixbuf * get_mime_type_pixbuf (const char *mime_type,
int icon_size,
GtkIconTheme *icon_theme);
int get_folder_pixbuf_size_for_list (GtkWidget *widget);
+gboolean show_uri (GdkScreen *screen,
+ const char *uri,
+ guint32 timestamp,
+ GError **error);
void show_help_dialog (GtkWindow *parent,
const char *section);
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Mon Jul 7 09:57:56 2008
@@ -79,44 +79,46 @@
static int extract_here;
static char *default_url = NULL;
+/* The capabilities are computed automatically in
+ * compute_supported_archive_types() so it's correct to initialize to 0 here. */
FrMimeTypeDescription mime_type_desc[] = {
- { "application/x-7z-compressed", ".7z", N_("7-Zip (.7z)"), TRUE, TRUE },
- { "application/x-7z-compressed-tar", ".tar.7z", N_("Tar compressed with 7z (.tar.7z)"), FALSE, TRUE },
- { "application/x-ace", ".ace", N_("Ace (.ace)"), FALSE, FALSE },
- { "application/x-alz", ".alz", NULL, TRUE, TRUE },
- { "application/x-ar", ".ar", N_("Ar (.ar)"), FALSE, TRUE },
- { "application/x-arj", ".arj", N_("Arj (.arj)"), TRUE, TRUE },
- { "application/x-bzip", ".bz2", NULL, FALSE, FALSE },
- { "application/x-bzip-compressed-tar", ".tar.bz2", N_("Tar compressed with bzip2 (.tar.bz2)"), FALSE, TRUE },
- { "application/x-bzip1", ".bz", NULL, FALSE, FALSE },
- { "application/x-bzip1-compressed-tar", ".tar.bz", N_("Tar compressed with bzip (.tar.bz)"), FALSE, TRUE },
- { "application/x-cabinet", ".cab", N_("Cabinet (.cab)"), FALSE, TRUE },
- { "application/x-cbr", ".cbr", N_("Rar Archived Comic Book (.cbr)"), TRUE, TRUE },
- { "application/x-cbz", ".cbz", N_("Zip Archived Comic Book (.cbz)"), TRUE, TRUE },
- { "application/x-cd-image", ".iso", NULL, FALSE, TRUE },
- { "application/x-compress", ".Z", NULL, FALSE, FALSE },
- { "application/x-compressed-tar", ".tar.gz", N_("Tar compressed with gzip (.tar.gz)"), FALSE, TRUE },
- { "application/x-cpio", ".cpio", NULL, FALSE, TRUE },
- { "application/x-deb", ".deb", NULL, FALSE, TRUE },
- { "application/x-ear", ".ear", N_("Ear (.ear)"), TRUE, TRUE },
- { "application/x-executable", ".exe", N_("Self-extracting zip (.exe)"), TRUE, TRUE },
- { "application/x-gzip", ".gz", NULL, FALSE, FALSE },
- { "application/x-java-archive", ".jar", N_("Jar (.jar)"), TRUE, TRUE },
- { "application/x-lha", ".lzh", N_("Lha (.lzh)"), FALSE, TRUE },
- { "application/x-lzma", ".lzma", NULL, FALSE, FALSE },
- { "application/x-lzma-compressed-tar", ".tar.lzma", N_("Tar compressed with lzma (.tar.lzma)"), FALSE, TRUE },
- { "application/x-lzop", ".lzo", NULL, FALSE, FALSE },
- { "application/x-lzop-compressed-tar", ".tar.lzo", N_("Tar compressed with lzop (.tar.lzo)"), FALSE, TRUE },
- { "application/x-rar", ".rar", N_("Rar (.rar)"), TRUE, TRUE },
- { "application/x-rpm", ".rpm", NULL, FALSE, TRUE },
- { "application/x-rzip", ".rz", NULL, FALSE, FALSE },
- { "application/x-tar", ".tar", N_("Tar uncompressed (.tar)"), FALSE, TRUE },
- { "application/x-tarz", ".tar.Z", N_("Tar compressed with compress (.tar.Z)"), FALSE, TRUE },
- { "application/x-stuffit", ".sit", NULL, FALSE, TRUE },
- { "application/x-war", ".war", N_("War (.war)"), TRUE, TRUE },
- { "application/x-zoo", ".zoo", N_("Zoo (.zoo)"), FALSE, TRUE },
- { "application/zip", ".zip", N_("Zip (.zip)"), TRUE, TRUE },
- { NULL, NULL, NULL, FALSE, FALSE }
+ { "application/x-7z-compressed", ".7z", N_("7-Zip (.7z)"), 0 },
+ { "application/x-7z-compressed-tar", ".tar.7z", N_("Tar compressed with 7z (.tar.7z)"), 0 },
+ { "application/x-ace", ".ace", N_("Ace (.ace)"), 0 },
+ { "application/x-alz", ".alz", NULL, 0 },
+ { "application/x-ar", ".ar", N_("Ar (.ar)"), 0 },
+ { "application/x-arj", ".arj", N_("Arj (.arj)"), 0 },
+ { "application/x-bzip", ".bz2", NULL, 0 },
+ { "application/x-bzip-compressed-tar", ".tar.bz2", N_("Tar compressed with bzip2 (.tar.bz2)"), 0 },
+ { "application/x-bzip1", ".bz", NULL, 0 },
+ { "application/x-bzip1-compressed-tar", ".tar.bz", N_("Tar compressed with bzip (.tar.bz)"), 0 },
+ { "application/x-cabinet", ".cab", N_("Cabinet (.cab)"), 0 },
+ { "application/x-cbr", ".cbr", N_("Rar Archived Comic Book (.cbr)"), 0 },
+ { "application/x-cbz", ".cbz", N_("Zip Archived Comic Book (.cbz)"), 0 },
+ { "application/x-cd-image", ".iso", NULL, 0 },
+ { "application/x-compress", ".Z", NULL, 0 },
+ { "application/x-compressed-tar", ".tar.gz", N_("Tar compressed with gzip (.tar.gz)"), 0 },
+ { "application/x-cpio", ".cpio", NULL, 0 },
+ { "application/x-deb", ".deb", NULL, 0 },
+ { "application/x-ear", ".ear", N_("Ear (.ear)"), 0 },
+ { "application/x-executable", ".exe", N_("Self-extracting zip (.exe)"), 0 },
+ { "application/x-gzip", ".gz", NULL, 0 },
+ { "application/x-java-archive", ".jar", N_("Jar (.jar)"), 0 },
+ { "application/x-lha", ".lzh", N_("Lha (.lzh)"), 0 },
+ { "application/x-lzma", ".lzma", NULL, 0 },
+ { "application/x-lzma-compressed-tar", ".tar.lzma", N_("Tar compressed with lzma (.tar.lzma)"), 0 },
+ { "application/x-lzop", ".lzo", NULL, 0 },
+ { "application/x-lzop-compressed-tar", ".tar.lzo", N_("Tar compressed with lzop (.tar.lzo)"), 0 },
+ { "application/x-rar", ".rar", N_("Rar (.rar)"), 0 },
+ { "application/x-rpm", ".rpm", NULL, 0 },
+ { "application/x-rzip", ".rz", NULL, 0 },
+ { "application/x-tar", ".tar", N_("Tar uncompressed (.tar)"), 0 },
+ { "application/x-tarz", ".tar.Z", N_("Tar compressed with compress (.tar.Z)"), 0 },
+ { "application/x-stuffit", ".sit", NULL, 0 },
+ { "application/x-war", ".war", N_("War (.war)"), 0 },
+ { "application/x-zoo", ".zoo", N_("Zoo (.zoo)"), 0 },
+ { "application/zip", ".zip", N_("Zip (.zip)"), 0 },
+ { NULL, NULL, NULL, 0 }
};
FrExtensionType file_ext_type[] = {
@@ -650,6 +652,7 @@
g_warning ("mime type not recognized: %s", cap->mime_type);
continue;
}
+ mime_type_desc[idx].capabilities |= cap->capabilities;
if (cap->capabilities & FR_COMMAND_CAP_READ)
add_if_non_present (open_type, &o_i, idx);
if (cap->capabilities & FR_COMMAND_CAP_WRITE) {
Modified: trunk/src/preferences.h
==============================================================================
--- trunk/src/preferences.h (original)
+++ trunk/src/preferences.h Mon Jul 7 09:57:56 2008
@@ -48,6 +48,7 @@
#define PREF_EDIT_EDITORS "/apps/file-roller/general/editors"
#define PREF_ADD_COMPRESSION_LEVEL "/apps/file-roller/general/compression_level"
+#define PREF_ENCRYPT_HEADER "/apps/file-roller/general/encrypt_header"
#define PREF_MIGRATE_DIRECTORIES "/apps/file-roller/general/migrate_directories"
#define PREF_EXTRACT_OVERWRITE "/apps/file-roller/dialogs/extract/overwrite"
@@ -64,6 +65,7 @@
#define PREF_ADD_NO_SYMLINKS "/apps/file-roller/dialogs/add/no_symlinks"
#define PREF_BATCH_ADD_DEFAULT_EXTENSION "/apps/file-roller/dialogs/batch-add/default_extension"
+#define PREF_BATCH_OTHER_OPTIONS "/apps/file-roller/dialogs/batch-add/other_options"
#define PREF_DESKTOP_ICON_THEME "/desktop/gnome/file_views/icon_theme"
#define PREF_DESKTOP_MENUS_HAVE_TEAROFF "/desktop/gnome/interface/menus_have_tearoff"
Modified: trunk/src/typedefs.h
==============================================================================
--- trunk/src/typedefs.h (original)
+++ trunk/src/typedefs.h Mon Jul 7 09:57:56 2008
@@ -69,35 +69,16 @@
GError *gerror;
} FrProcError;
-typedef struct {
- char *mime_type;
- char *default_ext;
- char *name;
- gboolean supports_password;
- gboolean supports_many_files;
-} FrMimeTypeDescription;
-
-typedef struct {
- char *ext;
- char *mime_type;
-} FrExtensionType;
-
-typedef struct {
- char *command;
- const char *mime_type;
- gboolean can_open;
- gboolean can_save;
-} FrCommandDescription;
-
typedef enum {
FR_COMMAND_CAP_NONE = 0,
FR_COMMAND_CAP_READ = 1 << 0,
FR_COMMAND_CAP_WRITE = 1 << 1,
- FR_COMMAND_CAP_ARCHIVE_MANY_FILES = 1 << 2
+ FR_COMMAND_CAP_ARCHIVE_MANY_FILES = 1 << 2,
+ FR_COMMAND_CAP_ENCRYPT = 1 << 3,
+ FR_COMMAND_CAP_ENCRYPT_HEADER = 1 << 4
} FrCommandCap;
#define FR_COMMAND_CAP_READ_WRITE (FR_COMMAND_CAP_READ | FR_COMMAND_CAP_WRITE)
-#define FR_COMMAND_CAP_ALL (FR_COMMAND_CAP_READ | FR_COMMAND_CAP_WRITE | FR_COMMAND_CAP_ARCHIVE_MANY_FILES)
typedef guint8 FrCommandCaps;
@@ -112,5 +93,23 @@
GPtrArray *caps; /* array of FrMimeTypeCap */
} FrRegisteredCommand;
-#endif /* TYPEDEFS_H */
+typedef struct {
+ const char *mime_type;
+ char *default_ext;
+ char *name;
+ FrCommandCaps capabilities;
+} FrMimeTypeDescription;
+
+typedef struct {
+ char *ext;
+ const char *mime_type;
+} FrExtensionType;
+typedef struct {
+ char *command;
+ const char *mime_type;
+ gboolean can_open;
+ gboolean can_save;
+} FrCommandDescription;
+
+#endif /* TYPEDEFS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]