file-roller r2374 - in trunk: . data/glade src
- From: paobac svn gnome org
- To: svn-commits-list gnome org
- Subject: file-roller r2374 - in trunk: . data/glade src
- Date: Mon, 21 Jul 2008 20:44:12 +0000 (UTC)
Author: paobac
Date: Mon Jul 21 20:44:12 2008
New Revision: 2374
URL: http://svn.gnome.org/viewvc/file-roller?rev=2374&view=rev
Log:
2008-07-21 Paolo Bacchilega <paobac svn gnome org>
* src/fr-process.h:
* src/fr-process.c:
New function: fr_process_add_arg_printf
* src/fr-command-tar.c:
* src/fr-command-rar.c:
* src/fr-command-7z.c:
Fixed command line arguments for listfiles.
* src/fr-command-7z.c:
Read the entry attribute to detect directories.
* src/typedefs.h:
* src/fr-window.c:
* src/fr-command.c:
* src/fr-archive.h:
* src/fr-archive.c:
* src/dlg-batch-add.c:
* data/glade/batch-add-files.glade:
Added ability to create multi-volume archives.
Modified:
trunk/ChangeLog
trunk/data/glade/batch-add-files.glade
trunk/src/dlg-batch-add.c
trunk/src/fr-archive.c
trunk/src/fr-archive.h
trunk/src/fr-command-7z.c
trunk/src/fr-command-rar.c
trunk/src/fr-command-tar.c
trunk/src/fr-command.c
trunk/src/fr-process.c
trunk/src/fr-process.h
trunk/src/fr-window.c
trunk/src/typedefs.h
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 21 20:44:12 2008
@@ -313,84 +313,176 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkTable" id="table6">
+ <widget class="GtkAlignment" id="alignment2">
<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>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
- <widget class="GtkCheckButton" id="a_encrypt_header_checkbutton">
+ <widget class="GtkTable" id="table6">
<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>
+ <property name="n_rows">3</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>
+
+ <child>
+ <widget class="GtkHBox" id="a_volume_box">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="a_volume_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Split in _volumes of</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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="a_volume_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">10 1 1000 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label50">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes" comments="MB means megabytes">MB</property>
+ <property name="use_underline">False</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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ </packing>
+ </child>
</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>
Modified: trunk/src/dlg-batch-add.c
==============================================================================
--- trunk/src/dlg-batch-add.c (original)
+++ trunk/src/dlg-batch-add.c Mon Jul 21 20:44:12 2008
@@ -54,10 +54,13 @@
GtkWidget *a_location_filechooserbutton;
GtkWidget *add_image;
GtkWidget *a_archive_type_combo_box;
+ GtkWidget *a_other_options_expander;
GtkWidget *a_password_entry;
GtkWidget *a_password_label;
GtkWidget *a_encrypt_header_checkbutton;
- GtkWidget *a_other_options_expander;
+ GtkWidget *a_volume_checkbutton;
+ GtkWidget *a_volume_spinbutton;
+ GtkWidget *a_volume_box;
GList *file_list;
gboolean add_clicked;
@@ -99,10 +102,10 @@
static void
-set_archive_password (DialogData *data)
+set_archive_options (DialogData *data)
{
- int *save_type_list;
- int idx;
+ int *save_type_list;
+ int idx;
if (data->single_file)
save_type_list = single_file_save_type;
@@ -123,8 +126,18 @@
}
}
}
+
+ if ((mime_type_desc[save_type_list[idx]].capabilities & FR_COMMAND_CAN_CREATE_VOLUMES)
+ && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_volume_checkbutton)))
+ {
+ double value;
+
+ value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (data->a_volume_spinbutton));
+ fr_window_set_volume_size (data->window, (guint) floor (value * 1024 * 1024));
+ }
}
+
/* called when the "add" button is pressed. */
static void
add_clicked_cb (GtkWidget *widget,
@@ -342,7 +355,7 @@
return;
}
}
- set_archive_password (data);
+ set_archive_options (data);
gtk_widget_destroy (data->dialog);
fr_window_archive_new (window, archive_file);
@@ -354,22 +367,33 @@
static void
-update_password_availability_for_mime_type (DialogData *data,
- const char *mime_type)
+update_sensitivity_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);
+ gtk_widget_set_sensitive (data->a_encrypt_header_checkbutton, FALSE);
+ gtk_widget_set_sensitive (data->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) {
- gtk_widget_set_sensitive (data->a_password_entry, mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT);
- gtk_widget_set_sensitive (data->a_password_label, mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT);
- gtk_widget_set_sensitive (data->a_encrypt_header_checkbutton, mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT_HEADER);
+ gboolean sensitive;
+
+ sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT;
+ gtk_widget_set_sensitive (data->a_password_entry, sensitive);
+ gtk_widget_set_sensitive (data->a_password_label, sensitive);
+
+ sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_ENCRYPT_HEADER;
+ gtk_widget_set_sensitive (data->a_encrypt_header_checkbutton, sensitive);
+
+ sensitive = mime_type_desc[i].capabilities & FR_COMMAND_CAN_CREATE_VOLUMES;
+ gtk_widget_set_sensitive (data->a_volume_box, sensitive);
+
break;
}
}
@@ -391,7 +415,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);
+ update_sensitivity_for_mime_type (data, mime_type);
}
@@ -432,7 +456,8 @@
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);
+ /*gtk_widget_set_sensitive (GTK_WIDGET (data->a_encrypt_header_checkbutton), ! void_password);*/
+ gtk_widget_set_sensitive (data->a_volume_spinbutton, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_volume_checkbutton)));
}
@@ -444,6 +469,14 @@
}
+static void
+volume_toggled_cb (GtkToggleButton *toggle_button,
+ gpointer user_data)
+{
+ update_sensitivity ((DialogData *) user_data);
+}
+
+
void
dlg_batch_add_files (FrWindow *window,
GList *file_list)
@@ -486,6 +519,10 @@
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");
+ data->a_volume_checkbutton = glade_xml_get_widget (data->gui, "a_volume_checkbutton");
+ data->a_volume_spinbutton = glade_xml_get_widget (data->gui, "a_volume_spinbutton");
+ data->a_volume_box = glade_xml_get_widget (data->gui, "a_volume_box");
+
add_button = glade_xml_get_widget (data->gui, "a_add_button");
cancel_button = glade_xml_get_widget (data->gui, "a_cancel_button");
a_archive_type_box = glade_xml_get_widget (data->gui, "a_archive_type_box");
@@ -563,6 +600,10 @@
"changed",
G_CALLBACK (password_entry_changed_cb),
data);
+ g_signal_connect (G_OBJECT (data->a_volume_checkbutton),
+ "toggled",
+ G_CALLBACK (volume_toggled_cb),
+ data);
/* Run dialog. */
Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c (original)
+++ trunk/src/fr-archive.c Mon Jul 21 20:44:12 2008
@@ -58,6 +58,7 @@
char *password;
gboolean encrypt_header;
FrCompression compression;
+ guint volume_size;
} DroppedItemsData;
@@ -69,7 +70,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression)
+ FrCompression compression,
+ guint volume_size)
{
DroppedItemsData *data;
@@ -85,6 +87,7 @@
data->password = g_strdup (password);
data->encrypt_header = encrypt_header;
data->compression = compression;
+ data->volume_size = volume_size;
return data;
}
@@ -136,6 +139,7 @@
char *password;
gboolean encrypt_header;
FrCompression compression;
+ guint volume_size;
} XferData;
@@ -1459,7 +1463,8 @@
gboolean recursive,
const char *password,
gboolean encrypt_header,
- FrCompression compression)
+ FrCompression compression,
+ guint volume_size)
{
GList *new_file_list = NULL;
gboolean base_dir_created = FALSE;
@@ -1477,6 +1482,7 @@
"password", password,
"encrypt_header", encrypt_header,
"compression", compression,
+ "volume_size", volume_size,
NULL);
fr_archive_stoppable (archive, fr_archive_add_is_stoppable (archive));
@@ -1657,7 +1663,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression)
+ FrCompression compression,
+ guint volume_size)
{
fr_archive_stoppable (archive, TRUE);
fr_process_clear (archive->process);
@@ -1669,7 +1676,8 @@
FALSE,
password,
encrypt_header,
- compression);
+ compression,
+ volume_size);
fr_process_start (archive->process);
}
@@ -1690,7 +1698,8 @@
FALSE,
xfer_data->password,
xfer_data->encrypt_header,
- xfer_data->compression);
+ xfer_data->compression,
+ xfer_data->volume_size);
xfer_data_free (xfer_data);
}
@@ -1722,6 +1731,7 @@
const char *password,
gboolean encrypt_header,
FrCompression compression,
+ guint volume_size,
const char *tmp_dir)
{
GList *sources = NULL, *destinations = NULL;
@@ -1779,6 +1789,7 @@
xfer_data->password = g_strdup (password);
xfer_data->encrypt_header = encrypt_header;
xfer_data->compression = compression;
+ xfer_data->volume_size = volume_size;
xfer_data->tmp_dir = g_strdup (tmp_dir);
g_signal_emit (G_OBJECT (archive),
@@ -1818,7 +1829,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression)
+ FrCompression compression,
+ guint volume_size)
{
if (uri_is_local (base_dir)) {
char *local_dir = g_filename_from_uri (base_dir, NULL, NULL);
@@ -1829,7 +1841,8 @@
update,
password,
encrypt_header,
- compression);
+ compression,
+ volume_size);
g_free (local_dir);
}
else
@@ -1841,6 +1854,7 @@
password,
encrypt_header,
compression,
+ volume_size,
fr_archive_get_temp_work_dir (archive));
}
@@ -1856,6 +1870,7 @@
char *password;
gboolean encrypt_header;
FrCompression compression;
+ guint volume_size;
} AddWithWildcardData;
@@ -1899,7 +1914,8 @@
aww_data->update,
aww_data->password,
aww_data->encrypt_header,
- aww_data->compression);
+ aww_data->compression,
+ aww_data->volume_size);
path_list_free (file_list);
path_list_free (dirs_list);
@@ -1918,7 +1934,8 @@
gboolean follow_links,
const char *password,
gboolean encrypt_header,
- FrCompression compression)
+ FrCompression compression,
+ guint volume_size)
{
AddWithWildcardData *aww_data;
@@ -1932,6 +1949,7 @@
aww_data->password = g_strdup (password);
aww_data->encrypt_header = encrypt_header;
aww_data->compression = compression;
+ aww_data->volume_size = volume_size;
g_signal_emit (G_OBJECT (archive),
fr_archive_signals[START],
@@ -1965,6 +1983,7 @@
char *password;
gboolean encrypt_header;
FrCompression compression;
+ guint volume_size;
} AddDirectoryData;
@@ -2013,7 +2032,8 @@
ad_data->update,
ad_data->password,
ad_data->encrypt_header,
- ad_data->compression);
+ ad_data->compression,
+ ad_data->volume_size);
path_list_free (file_list);
}
@@ -2029,7 +2049,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression)
+ FrCompression compression,
+ guint volume_size)
{
AddDirectoryData *ad_data;
@@ -2044,6 +2065,7 @@
ad_data->password = g_strdup (password);
ad_data->encrypt_header = encrypt_header;
ad_data->compression = compression;
+ ad_data->volume_size = volume_size;
g_signal_emit (G_OBJECT (archive),
fr_archive_signals[START],
@@ -2066,7 +2088,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression)
+ FrCompression compression,
+ guint volume_size)
{
AddDirectoryData *ad_data;
@@ -2081,6 +2104,7 @@
ad_data->password = g_strdup (password);
ad_data->encrypt_header = encrypt_header;
ad_data->compression = compression;
+ ad_data->volume_size = volume_size;
g_signal_emit (G_OBJECT (archive),
fr_archive_signals[START],
@@ -2165,7 +2189,8 @@
data->update,
data->password,
data->encrypt_header,
- data->compression);
+ data->compression,
+ data->volume_size);
g_free (first_base_dir);
dropped_items_data_free (archive->priv->dropped_items_data);
@@ -2195,7 +2220,8 @@
data->update,
data->password,
data->encrypt_header,
- data->compression);
+ data->compression,
+ data->volume_size);
g_free (base_dir);
g_free (path);
@@ -2221,7 +2247,8 @@
data->update,
data->password,
data->encrypt_header,
- data->compression);
+ data->compression,
+ data->volume_size);
g_list_free (only_names_list);
g_free (first_basedir);
@@ -2237,6 +2264,7 @@
"password", data->password,
"encrypt_header", data->encrypt_header,
"compression", data->compression,
+ "volume_size", data->volume_size,
NULL);
fr_process_clear (archive->process);
fr_command_uncompress (archive->command);
@@ -2272,7 +2300,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression)
+ FrCompression compression,
+ guint volume_size)
{
GList *scan;
char *archive_uri;
@@ -2309,7 +2338,8 @@
update,
password,
encrypt_header,
- compression);
+ compression,
+ volume_size);
add_dropped_items (archive->priv->dropped_items_data);
}
@@ -3135,9 +3165,7 @@
{
fr_archive_stoppable (archive, TRUE);
- g_object_set (archive->command,
- "password", password,
- NULL);
+ g_object_set (archive->command, "password", password, NULL);
fr_process_clear (archive->process);
fr_command_set_n_files (archive->command, 0);
fr_command_test (archive->command);
Modified: trunk/src/fr-archive.h
==============================================================================
--- trunk/src/fr-archive.h (original)
+++ trunk/src/fr-archive.h Mon Jul 21 20:44:12 2008
@@ -130,7 +130,8 @@
gboolean recursive,
const char *password,
gboolean encrypt_header,
- FrCompression compression);
+ FrCompression compression,
+ guint volume_size);
void fr_archive_remove (FrArchive *archive,
GList *file_list,
FrCompression compression);
@@ -167,7 +168,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression);
+ FrCompression compression,
+ guint volume_size);
void fr_archive_add_with_wildcard (FrArchive *archive,
const char *include_files,
const char *exclude_files,
@@ -178,7 +180,8 @@
gboolean follow_links,
const char *password,
gboolean encrypt_header,
- FrCompression compression);
+ FrCompression compression,
+ guint volume_size);
void fr_archive_add_directory (FrArchive *archive,
const char *directory,
const char *base_dir,
@@ -186,7 +189,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression);
+ FrCompression compression,
+ guint volume_size);
void fr_archive_add_items (FrArchive *archive,
GList *item_list,
const char *base_dir,
@@ -194,7 +198,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression);
+ FrCompression compression,
+ guint volume_size);
void fr_archive_add_dropped_items (FrArchive *archive,
GList *item_list,
const char *base_dir,
@@ -202,7 +207,8 @@
gboolean update,
const char *password,
gboolean encrypt_header,
- FrCompression compression);
+ FrCompression compression,
+ guint volume_size);
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 21 20:44:12 2008
@@ -161,6 +161,8 @@
fdata->encrypted = TRUE;
}
else if (strcmp (fields[0], "Attributes") == 0) {
+ if (fields[1][0] == 'D')
+ fdata->dir = TRUE;
}
g_strfreev (fields);
}
@@ -242,7 +244,7 @@
sprintf (Progress_Message, "%s%s", message_prefix, file_name_from_path (Progress_Filename));
fr_command_message (comm, Progress_Message);
- fraction= (double) ++comm->n_file / (comm->n_files + 1);
+ fraction = (double) ++comm->n_file / (comm->n_files + 1);
fr_command_progress (comm, fraction);
}
}
@@ -295,6 +297,7 @@
add_password_arg (comm, comm->password, FALSE);
if ((comm->password != NULL) && (*comm->password != 0) && comm->encrypt_header)
fr_process_add_arg (comm->process, "-mhe=on");
+
/* fr_process_add_arg (comm->process, "-ms=off"); FIXME: solid mode off? */
switch (comm->compression) {
@@ -311,6 +314,9 @@
if (is_mime_type (comm->mime_type, "application/x-executable"))
fr_process_add_arg (comm->process, "-sfx");
+ if (comm->volume_size > 0)
+ fr_process_add_arg_printf (comm->process, "-v%ub", comm->volume_size);
+
if (from_file != NULL)
fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL);
@@ -475,7 +481,7 @@
return capabilities;
if (is_mime_type (mime_type, "application/x-7z-compressed"))
- capabilities |= FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER;
+ capabilities |= FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER | FR_COMMAND_CAN_CREATE_VOLUMES;
else if (is_program_in_path ("7z")) {
capabilities |= FR_COMMAND_CAN_READ;
Modified: trunk/src/fr-command-rar.c
==============================================================================
--- trunk/src/fr-command-rar.c (original)
+++ trunk/src/fr-command-rar.c Mon Jul 21 20:44:12 2008
@@ -322,17 +322,20 @@
add_password_arg (comm, comm->password, FALSE);
+ if (comm->volume_size > 0)
+ fr_process_add_arg_printf (comm->process, "-v%ub", comm->volume_size);
+
/* disable percentage indicator */
fr_process_add_arg (comm->process, "-Idp");
- if (from_file != NULL)
- fr_process_add_arg_concat (comm->process, "-n@", from_file, NULL);
-
fr_process_add_arg (comm->process, "--");
fr_process_add_arg (comm->process, comm->filename);
+
if (from_file == NULL)
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
+ else
+ fr_process_add_arg_concat (comm->process, "@", from_file, NULL);
fr_process_end_command (comm->process);
}
@@ -374,14 +377,14 @@
fr_process_begin_command (comm->process, "rar");
fr_process_add_arg (comm->process, "d");
- if (from_file != NULL)
- fr_process_add_arg_concat (comm->process, "-n@", from_file, NULL);
-
fr_process_add_arg (comm->process, "--");
fr_process_add_arg (comm->process, comm->filename);
+
if (from_file == NULL)
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
+ else
+ fr_process_add_arg_concat (comm->process, "@", from_file, NULL);
fr_process_end_command (comm->process);
}
@@ -447,14 +450,14 @@
/* disable percentage indicator */
fr_process_add_arg (comm->process, "-Idp");
- if (from_file != NULL)
- fr_process_add_arg_concat (comm->process, "-n@", from_file, NULL);
-
fr_process_add_arg (comm->process, "--");
fr_process_add_arg (comm->process, comm->filename);
+
if (from_file == NULL)
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
+ else
+ fr_process_add_arg_concat (comm->process, "@", from_file, NULL);
if (dest_dir != NULL)
fr_process_add_arg (comm->process, dest_dir);
@@ -553,7 +556,7 @@
capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES | FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER;
if (is_program_in_path ("rar"))
- capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ capabilities |= FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_CREATE_VOLUMES;
else if (is_program_in_path ("unrar"))
capabilities |= FR_COMMAND_CAN_READ;
Modified: trunk/src/fr-command-tar.c
==============================================================================
--- trunk/src/fr-command-tar.c (original)
+++ trunk/src/fr-command-tar.c Mon Jul 21 20:44:12 2008
@@ -316,6 +316,7 @@
}
fr_process_add_arg (comm->process, "-rf");
+ fr_process_add_arg (comm->process, c_tar->uncomp_filename);
if (from_file != NULL) {
fr_process_add_arg (comm->process, "-T");
@@ -323,7 +324,7 @@
}
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+
if (from_file == NULL)
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
@@ -368,6 +369,7 @@
fr_process_add_arg (comm->process, "-v");
fr_process_add_arg (comm->process, "--delete");
fr_process_add_arg (comm->process, "-f");
+ fr_process_add_arg (comm->process, c_tar->uncomp_filename);
if (from_file != NULL) {
fr_process_add_arg (comm->process, "-T");
@@ -375,7 +377,7 @@
}
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+
if (from_file == NULL)
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
@@ -419,6 +421,7 @@
fr_process_add_arg (comm->process, "--keep-newer-files");
fr_process_add_arg (comm->process, "-xf");
+ fr_process_add_arg (comm->process, comm->filename);
add_compress_arg (comm);
if (dest_dir != NULL) {
@@ -432,7 +435,7 @@
}
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, comm->filename);
+
if (from_file == NULL)
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
Modified: trunk/src/fr-command.c
==============================================================================
--- trunk/src/fr-command.c (original)
+++ trunk/src/fr-command.c Mon Jul 21 20:44:12 2008
@@ -499,6 +499,7 @@
comm->propCanExtractAll = TRUE;
comm->propCanDeleteNonEmptyFolders = TRUE;
comm->propCanExtractNonEmptyFolders = TRUE;
+ comm->propListFromFile = FALSE;
}
Modified: trunk/src/fr-process.c
==============================================================================
--- trunk/src/fr-process.c (original)
+++ trunk/src/fr-process.c Mon Jul 21 20:44:12 2008
@@ -55,11 +55,11 @@
typedef struct {
GList *args; /* command to execute */
char *dir; /* working directory */
- guint sticky : 1; /* whether the command must be
- * executed even if a previous
+ guint sticky : 1; /* whether the command must be
+ * executed even if a previous
* command has failed. */
- guint ignore_error : 1; /* whether to continue to execute
- * other commands if this command
+ guint ignore_error : 1; /* whether to continue to execute
+ * other commands if this command
* fails. */
ContinueFunc continue_func;
gpointer continue_data;
@@ -137,14 +137,14 @@
&line,
&length,
&terminator_pos,
- NULL)) == G_IO_STATUS_NORMAL)
+ NULL)) == G_IO_STATUS_NORMAL)
{
line[terminator_pos] = 0;
channel->raw = g_list_prepend (channel->raw, line);
- if (channel->line_func != NULL)
+ if (channel->line_func != NULL)
(*channel->line_func) (line, channel->line_data);
}
-
+
return (status == G_IO_STATUS_AGAIN);
}
@@ -162,7 +162,7 @@
fr_channel_data_reset (FrChannelData *channel)
{
fr_channel_data_close_source (channel);
-
+
if (channel->raw != NULL) {
g_list_foreach (channel->raw, (GFunc) g_free, NULL);
g_list_free (channel->raw);
@@ -183,7 +183,7 @@
int fd)
{
const char *charset;
-
+
fr_channel_data_reset (channel);
channel->source = g_io_channel_unix_new (fd);
g_io_channel_set_flags (channel->source, G_IO_FLAG_NONBLOCK, NULL);
@@ -205,11 +205,11 @@
gboolean running;
gboolean stopping;
- gint current_command;
+ gint current_command;
gint error_command; /* command that coused an error. */
gboolean use_standard_locale;
- gboolean sticky_only; /* whether to execute only sticky
+ gboolean sticky_only; /* whether to execute only sticky
* commands. */
};
@@ -285,7 +285,7 @@
fr_process_init (FrProcess *process)
{
process->priv = g_new0 (FrProcessPrivate, 1);
-
+
process->term_on_stop = TRUE;
process->priv->comm = g_ptr_array_new ();
@@ -330,7 +330,7 @@
fr_process_stop_priv (process, FALSE);
fr_process_clear (process);
-
+
g_ptr_array_free (process->priv->comm, FALSE);
fr_channel_data_free (&process->out);
@@ -358,9 +358,9 @@
info = fr_command_info_new ();
info->args = g_list_prepend (NULL, g_strdup (arg));
-
+
g_ptr_array_add (process->priv->comm, info);
-
+
process->priv->n_comm++;
process->priv->current_comm = process->priv->n_comm;
}
@@ -385,7 +385,7 @@
info = fr_command_info_new ();
info->args = g_list_prepend (NULL, g_strdup (arg));
-
+
g_ptr_array_index (process->priv->comm, index) = info;
}
@@ -449,7 +449,7 @@
void
-fr_process_add_arg_concat (FrProcess *process,
+fr_process_add_arg_concat (FrProcess *process,
const char *arg1,
...)
{
@@ -463,13 +463,31 @@
while ((s = va_arg (args, char*)) != NULL)
g_string_append (arg, s);
va_end (args);
-
+
fr_process_add_arg (process, arg->str);
g_string_free (arg, TRUE);
}
void
+fr_process_add_arg_printf (FrProcess *fr_proc,
+ const char *format,
+ ...)
+{
+ va_list args;
+ char *arg;
+
+ va_start (args, format);
+ arg = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ fr_process_add_arg (fr_proc, arg);
+
+ g_free (arg);
+}
+
+
+void
fr_process_set_arg_at (FrProcess *process,
int n_comm,
int n_arg,
@@ -578,7 +596,7 @@
gpointer data)
{
g_return_if_fail (process != NULL);
-
+
process->out.line_func = func;
process->out.line_data = data;
}
@@ -590,7 +608,7 @@
gpointer data)
{
g_return_if_fail (process != NULL);
-
+
process->err.line_func = func;
process->err.line_data = data;
}
@@ -603,7 +621,7 @@
{
FrProcess *process = user_data;
- if (process->priv->use_standard_locale)
+ if (process->priv->use_standard_locale)
putenv ("LC_ALL=C");
}
@@ -616,26 +634,26 @@
char **argv;
int out_fd, err_fd;
int i = 0;
-
+
debug (DEBUG_INFO, "%d/%d) ", process->priv->current_command, process->priv->n_comm);
info = g_ptr_array_index (process->priv->comm, process->priv->current_command);
argv = g_new (char *, g_list_length (info->args) + 1);
- for (scan = info->args; scan; scan = scan->next)
+ for (scan = info->args; scan; scan = scan->next)
argv[i++] = scan->data;
argv[i] = NULL;
-
+
#ifdef DEBUG
{
int j;
- if (process->priv->use_standard_locale)
+ if (process->priv->use_standard_locale)
g_print ("\tLC_ALL=C\n");
if (info->dir != NULL)
g_print ("\tcd %s\n", info->dir);
-
+
g_print ("\t");
for (j = 0; j < i; j++)
g_print ("%s ", argv[j]);
@@ -658,7 +676,7 @@
NULL,
&out_fd,
&err_fd,
- &process->error.gerror))
+ &process->error.gerror))
{
process->error.type = FR_PROC_ERROR_SPAWN;
g_signal_emit (G_OBJECT (process),
@@ -672,7 +690,7 @@
fr_channel_data_set_fd (&process->out, out_fd);
fr_channel_data_set_fd (&process->err, err_fd);
-
+
process->priv->check_timeout = g_timeout_add (REFRESH_RATE,
check_child,
process);
@@ -684,7 +702,7 @@
int i)
{
FrCommandInfo *info;
-
+
info = g_ptr_array_index (process->priv->comm, i);
return info->sticky;
}
@@ -705,7 +723,7 @@
}
process->priv->sticky_only = TRUE;
- if (emit_signal)
+ if (emit_signal)
g_signal_emit (G_OBJECT (process),
fr_process_signals[STICKY_ONLY],
0);
@@ -784,7 +802,7 @@
process->priv->current_command++;
} while ((process->priv->current_command <= process->priv->n_comm)
&& ! command_is_sticky (process, process->priv->current_command));
- }
+ }
else
process->priv->current_command++;
@@ -795,10 +813,10 @@
}
/* Done */
-
+
process->priv->current_command = -1;
process->priv->use_standard_locale = FALSE;
-
+
if (process->out.raw != NULL)
process->out.raw = g_list_reverse (process->out.raw);
if (process->err.raw != NULL)
@@ -860,7 +878,7 @@
g_signal_emit (G_OBJECT (process),
fr_process_signals[DONE],
0);
- }
+ }
else {
process->priv->running = TRUE;
start_current_command (process);
Modified: trunk/src/fr-process.h
==============================================================================
--- trunk/src/fr-process.h (original)
+++ trunk/src/fr-process.h Mon Jul 21 20:44:12 2008
@@ -38,7 +38,7 @@
typedef struct _FrProcess FrProcess;
typedef struct _FrProcessClass FrProcessClass;
typedef struct _FrProcessPrivate FrProcessPrivate;
-
+
typedef void (*ProcFunc) (gpointer data);
typedef gboolean (*ContinueFunc) (gpointer data);
typedef void (*LineFunc) (char *line, gpointer data);
@@ -55,8 +55,8 @@
/*< public >*/
- gboolean term_on_stop; /* whether we must terminate the
- * command when calling
+ gboolean term_on_stop; /* whether we must terminate the
+ * command when calling
* fr_process_stop. */
/*< public read-only >*/
@@ -67,7 +67,7 @@
/*< protected >*/
- gboolean restart; /* whether to restart the process
+ gboolean restart; /* whether to restart the process
* after an error. */
FrProcessPrivate *priv;
@@ -86,42 +86,45 @@
GType fr_process_get_type (void);
FrProcess * fr_process_new (void);
void fr_process_clear (FrProcess *fr_proc);
-void fr_process_begin_command (FrProcess *fr_proc,
+void fr_process_begin_command (FrProcess *fr_proc,
const char *arg);
-void fr_process_begin_command_at (FrProcess *fr_proc,
+void fr_process_begin_command_at (FrProcess *fr_proc,
const char *arg,
int index);
-void fr_process_add_arg (FrProcess *fr_proc,
+void fr_process_add_arg (FrProcess *fr_proc,
const char *arg);
-void fr_process_add_arg_concat (FrProcess *fr_proc,
+void fr_process_add_arg_concat (FrProcess *fr_proc,
const char *arg,
...);
-void fr_process_set_arg_at (FrProcess *fr_proc,
+void fr_process_add_arg_printf (FrProcess *fr_proc,
+ const char *format,
+ ...) G_GNUC_PRINTF (2, 3);
+void fr_process_set_arg_at (FrProcess *fr_proc,
int n_comm,
int n_arg,
const char *arg);
-void fr_process_set_begin_func (FrProcess *fr_proc,
+void fr_process_set_begin_func (FrProcess *fr_proc,
ProcFunc func,
gpointer func_data);
-void fr_process_set_end_func (FrProcess *fr_proc,
+void fr_process_set_end_func (FrProcess *fr_proc,
ProcFunc func,
gpointer func_data);
-void fr_process_set_continue_func (FrProcess *fr_proc,
+void fr_process_set_continue_func (FrProcess *fr_proc,
ContinueFunc func,
gpointer func_data);
void fr_process_end_command (FrProcess *fr_proc);
-void fr_process_set_working_dir (FrProcess *fr_proc,
+void fr_process_set_working_dir (FrProcess *fr_proc,
const char *arg);
-void fr_process_set_sticky (FrProcess *fr_proc,
+void fr_process_set_sticky (FrProcess *fr_proc,
gboolean sticky);
-void fr_process_set_ignore_error (FrProcess *fr_proc,
+void fr_process_set_ignore_error (FrProcess *fr_proc,
gboolean ignore_error);
void fr_process_use_standard_locale (FrProcess *fr_proc,
gboolean use_stand_locale);
-void fr_process_set_out_line_func (FrProcess *fr_proc,
+void fr_process_set_out_line_func (FrProcess *fr_proc,
LineFunc func,
gpointer func_data);
-void fr_process_set_err_line_func (FrProcess *fr_proc,
+void fr_process_set_err_line_func (FrProcess *fr_proc,
LineFunc func,
gpointer func_data);
void fr_process_start (FrProcess *fr_proc);
Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c (original)
+++ trunk/src/fr-window.c Mon Jul 21 20:44:12 2008
@@ -3097,7 +3097,8 @@
TRUE,
window->priv->convert_data.password,
window->priv->convert_data.encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
g_free (source_dir);
}
else {
@@ -5383,6 +5384,7 @@
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->volume_size = 0;
window->priv->convert_data.converting = FALSE;
window->priv->convert_data.temp_dir = NULL;
@@ -5947,6 +5949,7 @@
window->priv->copy_data = NULL;
fr_window_set_password (window, NULL);
+ fr_window_set_volume_size(window, 0);
fr_window_history_clear (window);
window->priv->archive_new = FALSE;
@@ -6181,7 +6184,8 @@
update,
window->priv->password,
window->priv->encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
path_list_free (files);
g_free (base_dir);
@@ -6208,7 +6212,8 @@
follow_links,
window->priv->password,
window->priv->encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
}
@@ -6226,7 +6231,8 @@
update,
window->priv->password,
window->priv->encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
}
@@ -6244,7 +6250,8 @@
update,
window->priv->password,
window->priv->encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
}
@@ -6260,7 +6267,8 @@
update,
window->priv->password,
window->priv->encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
}
@@ -7064,7 +7072,8 @@
TRUE,
window->priv->password,
window->priv->encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
path_list_free (new_file_list);
path_list_free (file_list);
@@ -7442,7 +7451,8 @@
FALSE,
window->priv->password,
window->priv->encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
path_list_free (new_file_list);
@@ -7810,7 +7820,8 @@
FALSE,
window->priv->password,
window->priv->encrypt_header,
- window->priv->compression);
+ window->priv->compression,
+ window->priv->volume_size);
path_list_free (file_list);
}
Modified: trunk/src/typedefs.h
==============================================================================
--- trunk/src/typedefs.h (original)
+++ trunk/src/typedefs.h Mon Jul 21 20:44:12 2008
@@ -76,7 +76,8 @@
FR_COMMAND_CAN_WRITE = 1 << 1,
FR_COMMAND_CAN_ARCHIVE_MANY_FILES = 1 << 2,
FR_COMMAND_CAN_ENCRYPT = 1 << 3,
- FR_COMMAND_CAN_ENCRYPT_HEADER = 1 << 4
+ FR_COMMAND_CAN_ENCRYPT_HEADER = 1 << 4,
+ FR_COMMAND_CAN_CREATE_VOLUMES = 1 << 5
} FrCommandCap;
#define FR_COMMAND_CAN_READ_WRITE (FR_COMMAND_CAN_READ | FR_COMMAND_CAN_WRITE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]