[Xfce4-commits] r27255 - in xarchiver/trunk: doc/html src
Giuseppe Torelli
colossus at xfce.org
Fri Jul 11 13:58:33 CEST 2008
Author: colossus
Date: 2008-07-11 11:58:33 +0000 (Fri, 11 Jul 2008)
New Revision: 27255
Modified:
xarchiver/trunk/doc/html/ch01.html
xarchiver/trunk/src/7zip.c
xarchiver/trunk/src/7zip.h
xarchiver/trunk/src/add_dialog.c
xarchiver/trunk/src/add_dialog.h
xarchiver/trunk/src/archive.c
xarchiver/trunk/src/archive.h
xarchiver/trunk/src/arj.c
xarchiver/trunk/src/arj.h
xarchiver/trunk/src/extract_dialog.c
xarchiver/trunk/src/interface.c
xarchiver/trunk/src/lha.c
xarchiver/trunk/src/lha.h
xarchiver/trunk/src/main.c
xarchiver/trunk/src/rar.c
xarchiver/trunk/src/rar.h
xarchiver/trunk/src/string_utils.c
xarchiver/trunk/src/string_utils.h
xarchiver/trunk/src/tar.c
xarchiver/trunk/src/tar.h
xarchiver/trunk/src/window.c
xarchiver/trunk/src/window.h
xarchiver/trunk/src/zip.c
xarchiver/trunk/src/zip.h
Log:
Deletion and extraction of filenames with ?*[]\() should finally work with all archives.
Moved xa_update_window_with_archive_entries() to window.c from archive.c
Made the current selected sidepane row to be unselected when the user navigates to the root entry.
Made the sidepane row to expand when clicked on it.
Added ability to save archives in different locations.
Removed unused parameter XArchive* from xa_escape_filenames() in string_utils.c
Modified: xarchiver/trunk/doc/html/ch01.html
===================================================================
--- xarchiver/trunk/doc/html/ch01.html 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/doc/html/ch01.html 2008-07-11 11:58:33 UTC (rev 27255)
@@ -11,7 +11,7 @@
to work.
</p><p>
<span class="application">Xarchiver</span> has these features:
- </p><div class="itemizedlist"><ul type="disc"><li><p>The most used archiver cmd-line options are supported in the Add and Extract dialog</p></li><li><p>Archives are detected by their magic header and not by the extension except for .tar.bz2 and .tar.gz</p></li><li><p>Drag and drop from and to Xarchiver window is supported with XDS protocol</p></li><li><p>ZIP and ARJ archive comment are supported. RAR comment is not yet supported because it's compressed inside the archive itself</p></li><li><p>Tabs Firefox style support</p></li><li><p>Ability to convert the archive to self-extracting for those archive types which support it</p></li><li><p>Smart detection of arj, zip and rar password encrypted archives</p></li><li><p>All the the output of the cmd-line archiver is displayed in the Xarchiver window</p></li><li><p>All common formats are supported: arj, bzip2, lha, gzip, 7z, rar, tar, tar.bz2, tar.gz, zip, DEB and RPM (only open,view and extract)</p></li><li><p>Support of RPM
files without RPM executable. This is useful on not RPM-based distributions like Slackware and Arch Linux</p></li><li><p>Zip, rar, arj and 7z password encrypted archives are fully supported (7z automatic password detection is not supported)</p></li></ul></div><p>
+ </p><div class="itemizedlist"><ul type="disc"><li><p>Archive directories can be browsed just like a file manager</p></li><li><p>Mime icon for each of the archive entries</p></li><li><p>The most used archiver cmd-line options are supported in the Add and Extract dialogs</p></li><li><p>Tabs Firefox style support</p></li><li><p>Multi-extract facility</p></li><li><p>Context menu on each of the archive entries with cut/copy/paste/rename abilities</p></li><li><p>Archives are detected by their magic header and not by the extension except for .tar.bz2 and .tar.gz</p></li><li><p>Drag and drop from and to Xarchiver window is supported with XDS protocol</p></li><li><p>ZIP and ARJ archive comment are supported. RAR comment is not supported because it's compressed inside the archive itself</p></li><li><p>Ability to convert the archive to self-extracting for those archive types which support it</p></li><li><p>Smart detection of arj, zip and rar password encrypted archives</p></li><li>
<p>All the the output of the cmd-line archiver is displayed in the Xarchiver window</p></li><li><p>All common formats are supported: arj, bzip2, gzip, lha, lzma, 7z, rar, tar, tar.bz2, tar.gz, tar.lzma, zip, deb and rpm packages (open and extract only)</p></li><li><p>DEB and RPM packages don't require their package managers. This is useful on not RPM-based distributions like Slackware and Arch Linux</p></li><li><p>Zip, rar, arj and 7z password encrypted archives are fully supported (7z automatic password detection is not supported)</p></li></ul></div><p>
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch01s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
Xarchiver 0.5
</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Where to get it</td></tr></table></div></body></html>
Modified: xarchiver/trunk/src/7zip.c
===================================================================
--- xarchiver/trunk/src/7zip.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/7zip.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Giuseppe Torelli - <colossus73 at gmail.com>
+ * Copyright (C) 2008 Giuseppe Torelli - <colossus73 at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -163,17 +163,30 @@
g_free(filename);
}
-void xa_7zip_delete (XArchive *archive,GString *files)
+void xa_7zip_delete (XArchive *archive,GSList *names)
{
- gchar *command,*exe = NULL;
+ gchar *command,*exe,*e_filename = NULL;
GSList *list = NULL;
+ GString *files = g_string_new("");
if (sevenzr)
exe = "7zr d ";
if (sevenza)
exe = "7za d ";
-
+
archive->status = XA_ARCHIVESTATUS_DELETE;
+ GSList *_names;
+
+ _names = names;
+ while (_names)
+ {
+ e_filename = xa_escape_filename((gchar*)_names->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (files,e_filename);
+ g_string_prepend_c (files,' ');
+ _names = _names->next;
+ }
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
command = g_strconcat (exe,archive->escaped_path," ",files->str,NULL);
g_string_free(files,TRUE);
list = g_slist_append(list,command);
@@ -181,16 +194,21 @@
xa_run_command (archive,list);
}
-void xa_7zip_add (XArchive *archive,GString *files,gchar *compression_string)
+void xa_7zip_add (XArchive *archive,GSList *names,gchar *compression_string)
{
GSList *list = NULL;
gchar *command,*exe = NULL;
+ GString *files = g_string_new("");
if (sevenzr)
exe = "7zr ";
if (sevenza)
exe = "7za ";
+ xa_cat_filenames(archive,names,files);
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
+
if (archive->location_entry_path != NULL)
chdir (archive->tmp);
@@ -219,23 +237,35 @@
xa_run_command (archive,list);
}
-void xa_7zip_extract(XArchive *archive,GString *files)
+void xa_7zip_extract(XArchive *archive,GSList *files)
{
- gchar *command = NULL;
- GSList *list = NULL;
+ gchar *command,*e_filename = NULL;
+ GSList *list = NULL,*_files = NULL;
+ GString *names = g_string_new("");
+ _files = files;
+ while (_files)
+ {
+ e_filename = xa_escape_filename((gchar*)_files->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (names,e_filename);
+ g_string_prepend_c (names,' ');
+ _files = _files->next;
+ }
+ g_slist_foreach(_files,(GFunc)g_free,NULL);
+ g_slist_free(_files);
+
if (archive->passwd != NULL)
command = g_strconcat ("7za " , archive->full_path ? "x" : "e",
" -p",archive->passwd,
archive->overwrite ? " -aoa" : " -aos",
" -bd ",
- archive->escaped_path , files->str , " -o",archive->extraction_path,NULL);
+ archive->escaped_path,names->str , " -o",archive->extraction_path,NULL);
else
command = g_strconcat ( "7za " , archive->full_path ? "x" : "e",
archive->overwrite ? " -aoa" : " -aos",
" -bd ",
- archive->escaped_path , files->str , " -o",archive->extraction_path,NULL);
- g_string_free(files,TRUE);
+ archive->escaped_path,names->str , " -o",archive->extraction_path,NULL);
+ g_string_free(names,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
Modified: xarchiver/trunk/src/7zip.h
===================================================================
--- xarchiver/trunk/src/7zip.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/7zip.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -26,9 +26,9 @@
#include "archive.h"
gboolean jump_header, last_line;
-void xa_7zip_delete (XArchive *,GString *);
-void xa_7zip_add (XArchive *,GString *,gchar *);
-void xa_7zip_extract(XArchive *,GString *);
+void xa_7zip_delete (XArchive *,GSList *);
+void xa_7zip_add (XArchive *,GSList *,gchar *);
+void xa_7zip_extract(XArchive *,GSList *);
void xa_7zip_test (XArchive *);
void xa_open_7zip (XArchive *archive);
void xa_get_7zip_line_content (gchar *line, gpointer data);
Modified: xarchiver/trunk/src/add_dialog.c
===================================================================
--- xarchiver/trunk/src/add_dialog.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/add_dialog.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -340,9 +340,7 @@
gchar *compression_string = NULL;
gboolean done = FALSE;
GSList *list = NULL;
- GString *filenames;
- filenames = g_string_new (" ");
while ( ! done )
{
switch (gtk_dialog_run(GTK_DIALOG(add_dialog->dialog1)))
@@ -402,21 +400,15 @@
gchar *current_dir = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(add_dialog->filechooserwidget1));
chdir (current_dir);
g_free (current_dir);
- xa_cat_filenames_basename(archive,list,filenames);
}
- else
- xa_cat_filenames(archive,list,filenames);
-
- xa_execute_add_commands (archive,filenames,list,compression_string);
- g_slist_foreach(list,(GFunc)g_free,NULL);
- g_slist_free(list);
+ xa_execute_add_commands (archive,list,compression_string);
if (compression_string != NULL)
g_free (compression_string);
}
}
}
-void xa_execute_add_commands (XArchive *archive,GString *names,GSList *list,gchar *compression_string)
+void xa_execute_add_commands (XArchive *archive,GSList *list,gchar *compression_string)
{
gchar *new_path = NULL;
gchar *esc,*esc2;
@@ -458,5 +450,5 @@
}
}
archive->status = XA_ARCHIVESTATUS_ADD;
- (*archive->add) (archive,names,compression_string);
+ (*archive->add) (archive,list,compression_string);
}
Modified: xarchiver/trunk/src/add_dialog.h
===================================================================
--- xarchiver/trunk/src/add_dialog.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/add_dialog.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -56,7 +56,7 @@
void password_toggled_cb ( GtkButton* ,gpointer);
void xa_parse_add_dialog_options ( XArchive *, Add_dialog_data *);
void xa_select_files_to_add ( GtkButton* ,gpointer );
-void xa_execute_add_commands ( XArchive *,GString *, GSList *, gchar *);
+void xa_execute_add_commands (XArchive *archive,GSList *list,gchar *compression_string);
void fix_adjustment_value (GtkAdjustment *,gpointer );
#endif
Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/archive.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -557,10 +557,9 @@
return fullpathname;
}
-void xa_fill_list_with_recursed_entries(XEntry *entry,GString **p_file_list,gchar *current_path)
+void xa_fill_list_with_recursed_entries(XEntry *entry,GSList **p_file_list,gchar *current_path)
{
gchar *full_path, *_full_path = NULL;
- gchar *quoted_path = NULL;
gint idx,current_page;
if (entry == NULL)
@@ -594,14 +593,12 @@
g_free (full_path);
full_path = _full_path;
}
- quoted_path = g_shell_quote(full_path);
- *p_file_list = g_string_prepend (*p_file_list,quoted_path);
- *p_file_list = g_string_prepend_c (*p_file_list,' ');
+ *p_file_list = g_slist_prepend (*p_file_list,full_path);
}
return;
}
-void xa_entries_to_filelist(XEntry *entry,GString **p_file_list,gchar *current_path)
+void xa_entries_to_filelist(XEntry *entry,GSList **p_file_list,gchar *current_path)
{
gchar *full_path;
gchar *quoted_path = NULL;
@@ -624,9 +621,7 @@
}
else
{
- quoted_path = g_shell_quote(full_path);
- *p_file_list = g_string_prepend (*p_file_list,quoted_path);
- *p_file_list = g_string_prepend_c (*p_file_list,' ');
+ *p_file_list = g_slist_prepend (*p_file_list,quoted_path);
}
}
Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/archive.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -68,10 +68,10 @@
typedef struct _XArchive XArchive;
typedef void (*parse_output_func) (gchar *line, gpointer);
-typedef void (*delete_func) (XArchive *,GString *);
-typedef void (*add_func) (XArchive *,GString *,gchar *);
-typedef void (*extract_func) (XArchive *,GString *);
-typedef void (*test_func) (XArchive *);
+typedef void (*delete_func) (XArchive *,GSList *);
+typedef void (*add_func) (XArchive *,GSList *,gchar *);
+typedef void (*extract_func) (XArchive *,GSList *);
+typedef void (*test_func) (XArchive *);
struct _XArchive
{
@@ -128,29 +128,29 @@
test_func test;
};
-void xa_spawn_async_process (XArchive *archive, gchar *command);
+void xa_spawn_async_process (XArchive *, gchar *);
XArchive *xa_init_archive_structure(gint);
-void xa_clean_archive_structure (XArchive *archive);
-gboolean xa_dump_child_error_messages (GIOChannel *ioc, GIOCondition cond, gpointer data);
-gboolean xa_create_temp_directory(XArchive *archive);
-void xa_delete_temp_directory(XArchive *archive,gboolean flag);
-gboolean xa_run_command (XArchive *archive,GSList *commands);
-gint xa_find_archive_index (gint page_num);
+void xa_clean_archive_structure (XArchive *);
+gboolean xa_dump_child_error_messages (GIOChannel *, GIOCondition , gpointer );
+gboolean xa_create_temp_directory(XArchive *);
+void xa_delete_temp_directory(XArchive *,gboolean );
+gboolean xa_run_command (XArchive *,GSList *);
+gint xa_find_archive_index (gint );
gint xa_get_new_archive_idx();
-XEntry *xa_alloc_memory_for_each_row ( guint nc,GType column_types[]);
-void xa_free_entry(XArchive *archive,XEntry *entry);
-XEntry *xa_find_child_entry(XEntry *entry, gchar *string);
-XEntry *xa_set_archive_entries_for_each_row(XArchive *archive,gchar *filename,gpointer *items);
-gpointer *xa_fill_archive_entry_columns_for_each_row (XArchive *archive,XEntry *entry,gpointer *items);
-XEntry* xa_find_entry_from_path(XEntry *root_entry,const gchar *fullpathname);
-gchar *xa_build_full_path_name_from_entry(XEntry *entry);
-void xa_fill_list_with_recursed_entries(XEntry *entry,GString **p_file_list,gchar *current_path);
-void xa_entries_to_filelist(XEntry *, GString **, gchar *);
-gboolean xa_detect_encrypted_archive (XArchive *archive);
+XEntry *xa_alloc_memory_for_each_row ( guint ,GType column_types[]);
+void xa_free_entry(XArchive *archive,XEntry *);
+XEntry *xa_find_child_entry(XEntry *, gchar *);
+XEntry *xa_set_archive_entries_for_each_row(XArchive *,gchar *,gpointer *);
+gpointer *xa_fill_archive_entry_columns_for_each_row (XArchive *,XEntry *,gpointer *);
+XEntry* xa_find_entry_from_path(XEntry *root_entry,const gchar *);
+gchar *xa_build_full_path_name_from_entry(XEntry *);
+void xa_fill_list_with_recursed_entries(XEntry *,GSList **,gchar *);
+void xa_entries_to_filelist(XEntry *, GSList **, gchar *);
+gboolean xa_detect_encrypted_archive (XArchive *);
void xa_browse_dir_sidebar (XEntry *, GtkTreeStore *,gchar *,GtkTreeIter *);
void xa_fill_dir_sidebar(XArchive *,gboolean);
-void xa_sidepane_row_selected(GtkTreeSelection *selection, gpointer data);
+void xa_sidepane_row_selected(GtkTreeSelection *, gpointer );
void xa_sidepane_select_row(XEntry *entry);
-gboolean _xa_sidepane_select_row(GtkTreeModel *model,GtkTreePath *path,GtkTreeIter *iter,gpointer data);
+gboolean _xa_sidepane_select_row(GtkTreeModel *,GtkTreePath *,GtkTreeIter *,gpointer );
XArchive *archive[100];
#endif
Modified: xarchiver/trunk/src/arj.c
===================================================================
--- xarchiver/trunk/src/arj.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/arj.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -149,12 +149,25 @@
}
}
-void xa_arj_delete (XArchive *archive,GString *files)
+void xa_arj_delete (XArchive *archive,GSList *names)
{
- gchar *command = NULL;
+ gchar *command,*e_filename = NULL;
GSList *list = NULL;
+ GSList *_names;
+ GString *files = g_string_new("");
archive->status = XA_ARCHIVESTATUS_DELETE;
+ _names = names;
+ while (_names)
+ {
+ e_filename = xa_escape_filename((gchar*)_names->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (files,e_filename);
+ g_string_prepend_c (files,' ');
+ _names = _names->next;
+ }
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
+
command = g_strconcat ("arj d ",archive->escaped_path," ",files->str,NULL);
g_string_free(files,TRUE);
list = g_slist_append(list,command);
@@ -162,11 +175,16 @@
xa_run_command (archive,list);
}
-void xa_arj_add (XArchive *archive,GString *files,gchar *compression_string)
+void xa_arj_add (XArchive *archive,GSList *names,gchar *compression_string)
{
GSList *list = NULL;
gchar *command = NULL;
+ GString *files = g_string_new("");
+ xa_cat_filenames(archive,names,files);
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
+
if (archive->location_entry_path != NULL)
chdir (archive->tmp);
@@ -196,11 +214,23 @@
xa_run_command (archive,list);
}
-void xa_arj_extract(XArchive *archive,GString *files)
+void xa_arj_extract(XArchive *archive,GSList *files)
{
- gchar *command = NULL;
- GSList *list = NULL;
-
+ gchar *command,*e_filename = NULL;
+ GSList *list = NULL,*_files = NULL;
+ GString *names = g_string_new("");
+
+ _files = files;
+ while (_files)
+ {
+ e_filename = xa_escape_filename((gchar*)_files->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (names,e_filename);
+ g_string_prepend_c (names,' ');
+ _files = _files->next;
+ }
+ g_slist_foreach(_files,(GFunc)g_free,NULL);
+ g_slist_free(_files);
+
if (archive->passwd != NULL)
command = g_strconcat ( "arj ",archive->full_path ? "x" : "e",
" -g",archive->passwd,
@@ -209,15 +239,15 @@
archive->freshen ? "-f " : "" ,
archive->update ? "-u " : " ",
"-y ",
- archive->escaped_path , " ",archive->extraction_path,files->str,NULL);
+ archive->escaped_path , " ",archive->extraction_path,names->str,NULL);
else
command = g_strconcat ( "arj ",archive->full_path ? "x" : "e",
archive->overwrite ? "" : " -n" ,
" -i " , archive->freshen ? "-f " : "",
archive->update ? "-u " : " ",
"-y ",
- archive->escaped_path , " ",archive->extraction_path,files->str,NULL);
- g_string_free(files,TRUE);
+ archive->escaped_path , " ",archive->extraction_path,names->str,NULL);
+ g_string_free(names,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
Modified: xarchiver/trunk/src/arj.h
===================================================================
--- xarchiver/trunk/src/arj.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/arj.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -27,9 +27,9 @@
#include "archive.h"
gboolean jump_header, encrypted, last_line;
unsigned short int arj_line;
-void xa_arj_delete (XArchive *,GString *);
-void xa_arj_add (XArchive *,GString *,gchar *);
-void xa_arj_extract(XArchive *,GString *);
+void xa_arj_delete (XArchive *,GSList *);
+void xa_arj_add (XArchive *,GSList *,gchar *);
+void xa_arj_extract(XArchive *,GSList *);
void xa_arj_test (XArchive *);
void xa_get_arj_line_content (gchar *line, gpointer data);
void xa_open_arj (XArchive *archive);
Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/extract_dialog.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -379,9 +379,8 @@
{
gchar *destination_path = NULL;
gboolean done = FALSE;
- GString *names;
+ GSList *names = NULL;
- names = g_string_new (" ");
if (unrar)
rar = "unrar";
else
@@ -462,7 +461,8 @@
}
}
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (dialog_data->selected_radio)))
- gtk_tree_selection_selected_foreach(selection,(GtkTreeSelectionForeachFunc) xa_concat_filenames,names);
+ gtk_tree_selection_selected_foreach(selection,(GtkTreeSelectionForeachFunc) xa_concat_filenames,&names);
+
(*archive->extract) (archive,names);
}
}
Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/interface.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -86,6 +86,7 @@
gtk_container_add (GTK_CONTAINER (menuitem1_menu), open1);
save1 = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group);
+ gtk_widget_set_sensitive(save1,FALSE);
gtk_widget_show (save1);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), save1);
@@ -1158,8 +1159,8 @@
gtk_widget_set_sensitive (new1, New);
gtk_widget_set_sensitive (Open_button, Open);
gtk_widget_set_sensitive (open1, Open);
- gtk_widget_set_sensitive (close1, Close);
gtk_widget_set_sensitive (save1, save);
+ gtk_widget_set_sensitive (close1, Close);
gtk_widget_set_sensitive (AddFile_button, add);
gtk_widget_set_sensitive (addfile, add);
gtk_widget_set_sensitive (Extract_button, extract);
@@ -1276,7 +1277,6 @@
unsigned int len = 0;
gint current_page;
gint idx;
- GString *names = g_string_new("");
GSList *list = NULL;
GtkTreeModel *model;
GtkTreePath *path;
@@ -1330,7 +1330,6 @@
/* This to store the dragged files inside the dropped archive dir */
archive[idx]->location_entry_path = g_strdup(full_pathname->str);
- xa_cat_filenames_basename(archive[idx],list,names);
dummy_password = archive[idx]->has_passwd;
full_path = archive[idx]->full_path;
add_recurse = archive[idx]->add_recurse;
@@ -1338,7 +1337,7 @@
archive[idx]->has_passwd = 0;
archive[idx]->full_path = 0;
archive[idx]->add_recurse = 1;
- xa_execute_add_commands(archive[idx],names,list,NULL);
+ xa_execute_add_commands(archive[idx],list,NULL);
archive[idx]->has_passwd = dummy_password;
archive[idx]->full_path = full_path;
Modified: xarchiver/trunk/src/lha.c
===================================================================
--- xarchiver/trunk/src/lha.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/lha.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -135,24 +135,43 @@
return FALSE;
}
-void xa_lha_delete (XArchive *archive,GString *files)
+void xa_lha_delete (XArchive *archive,GSList *names)
{
- gchar *command = NULL;
+ gchar *command,*e_filename = NULL;
GSList *list = NULL;
+ GString *files = g_string_new("");
archive->status = XA_ARCHIVESTATUS_DELETE;
- command = g_strconcat ("lha t " , archive->escaped_path, NULL);
+ GSList *_names;
+
+ _names = names;
+ while (_names)
+ {
+ e_filename = xa_escape_filename((gchar*)_names->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (files,e_filename);
+ g_string_prepend_c (files,' ');
+ _names = _names->next;
+ }
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
+
+ command = g_strconcat ("lha d " , archive->escaped_path," ",files->str,NULL);
g_string_free(files,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
-void xa_lha_add (XArchive *archive,GString *files,gchar *compression_string)
+void xa_lha_add (XArchive *archive,GSList *names,gchar *compression_string)
{
GSList *list = NULL;
gchar *command = NULL;
+ GString *files = g_string_new("");
+ xa_cat_filenames(archive,names,files);
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
+
if (archive->location_entry_path != NULL)
chdir (archive->tmp);
@@ -171,28 +190,27 @@
xa_run_command (archive,list);
}
-void xa_lha_extract(XArchive *archive,GString *files)
+void xa_lha_extract(XArchive *archive,GSList *files)
{
- gchar *command = NULL;
- GSList *list = NULL;
+ gchar *command,*e_filename = NULL;
+ GSList *list = NULL,*_files = NULL;
+ GString *names = g_string_new("");
- if (archive->passwd != NULL)
- command = g_strconcat ( "arj ",archive->full_path ? "x" : "e",
- " -g",archive->passwd,
- archive->overwrite ? "" : " -n" ,
- " -i " ,
- archive->freshen ? "-f " : "" ,
- archive->update ? "-u " : " ",
- "-y ",
- archive->escaped_path , " ",archive->extraction_path,files->str,NULL);
- else
- command = g_strconcat ( "arj ",archive->full_path ? "x" : "e",
- archive->overwrite ? "" : " -n" ,
- " -i " , archive->freshen ? "-f " : "",
- archive->update ? "-u " : " ",
- "-y ",
- archive->escaped_path , " ",archive->extraction_path,files->str,NULL);
- g_string_free(files,TRUE);
+ _files = files;
+ while (_files)
+ {
+ e_filename = xa_escape_filename((gchar*)_files->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (names,e_filename);
+ g_string_prepend_c (names,' ');
+ _files = _files->next;
+ }
+ g_slist_foreach(_files,(GFunc)g_free,NULL);
+ g_slist_free(_files);
+
+ command = g_strconcat ("lha ", archive->full_path ? "x" : "xi",
+ archive->overwrite ? "f" : "", "w=",
+ archive->extraction_path," ",archive->escaped_path,names->str,NULL);
+ g_string_free(names,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
Modified: xarchiver/trunk/src/lha.h
===================================================================
--- xarchiver/trunk/src/lha.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/lha.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -23,13 +23,13 @@
#include <gtk/gtk.h>
#include <string.h>
#include <stdlib.h>
-#include "interface.h"
#include "support.h"
+#include "string_utils.h"
#include "archive.h"
-void xa_lha_delete (XArchive *,GString *);
-void xa_lha_add (XArchive *,GString *,gchar *);
-void xa_lha_extract(XArchive *,GString *);
+void xa_lha_delete (XArchive *,GSList *);
+void xa_lha_add (XArchive *,GSList *,gchar *);
+void xa_lha_extract(XArchive *,GSList *);
void xa_lha_test (XArchive *);
void xa_get_lha_line_content (gchar *line, gpointer data);
void xa_open_lha (XArchive *archive);
Modified: xarchiver/trunk/src/main.c
===================================================================
--- xarchiver/trunk/src/main.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/main.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -39,10 +39,10 @@
extern int status;
Prefs_dialog_data *prefs_window = NULL;
-delete_func delete[XARCHIVETYPE_COUNT] = {NULL};
-add_func add[XARCHIVETYPE_COUNT] = {NULL};
+delete_func delete[XARCHIVETYPE_COUNT] = {NULL};
+add_func add[XARCHIVETYPE_COUNT] = {NULL};
extract_func extract[XARCHIVETYPE_COUNT] = {NULL};
-test_func test[XARCHIVETYPE_COUNT] = {NULL};
+test_func test[XARCHIVETYPE_COUNT] = {NULL};
static GOptionEntry entries[] =
{
@@ -187,7 +187,8 @@
archive->add_recurse = FALSE;
else
archive->add_recurse = TRUE;
- xa_execute_add_commands(archive,string,NULL,NULL);
+ //TODO: the second NULL is a GSList you must fill!
+ xa_execute_add_commands(archive,NULL,NULL);
}
}
/* Switch -a */
Modified: xarchiver/trunk/src/rar.c
===================================================================
--- xarchiver/trunk/src/rar.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/rar.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -204,27 +204,43 @@
}
}
-void xa_rar_delete (XArchive *archive,GString *files)
+void xa_rar_delete (XArchive *archive,GSList *names)
{
- gchar *command = NULL;
+ gchar *command,*e_filename = NULL;
GSList *list = NULL;
- GString *e_filenames = g_string_new("");
+ GString *files = g_string_new("");
archive->status = XA_ARCHIVESTATUS_DELETE;
- xa_escape_filename(files->str,e_filenames);
- command = g_strconcat ("rar d ",archive->escaped_path," ",e_filenames->str,NULL);
+ GSList *_names;
+
+ _names = names;
+ while (_names)
+ {
+ e_filename = xa_escape_filename((gchar*)_names->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (files,e_filename);
+ g_string_prepend_c (files,' ');
+ _names = _names->next;
+ }
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
+
+ command = g_strconcat ("rar d ",archive->escaped_path," ",files->str,NULL);
g_string_free(files,TRUE);
- g_string_free(e_filenames,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
-void xa_rar_add (XArchive *archive,GString *files,gchar *compression_string)
+void xa_rar_add (XArchive *archive,GSList *names,gchar *compression_string)
{
GSList *list = NULL;
gchar *command = NULL;
+ GString *files = g_string_new("");
+ xa_cat_filenames(archive,names,files);
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
+
if (archive->location_entry_path != NULL)
chdir (archive->tmp);
@@ -260,31 +276,42 @@
xa_run_command (archive,list);
}
-void xa_rar_extract(XArchive *archive,GString *files)
+void xa_rar_extract(XArchive *archive,GSList *files)
{
- gchar *rar = NULL;
- gchar *command = NULL;
- GSList *list = NULL;
-
+ gchar *rar, *command, *e_filename = NULL;
+ GSList *list = NULL,*_files = NULL;
+ GString *names = g_string_new("");
+
+ _files = files;
if (unrar)
rar = "unrar";
else
rar = "rar";
+ while (_files)
+ {
+ e_filename = xa_escape_filename((gchar*)_files->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (names,e_filename);
+ g_string_prepend_c (names,' ');
+ _files = _files->next;
+ }
+ g_slist_foreach(_files,(GFunc)g_free,NULL);
+ g_slist_free(_files);
+
if (archive->passwd != NULL)
command = g_strconcat (rar," ",archive->full_path ? "x " : "e ",
archive->freshen ? "-f " : "" , archive->update ? "-u " : "",
" -p",archive->passwd,
archive->overwrite ? " -o+" : " -o-",
" -idp ",
- archive->escaped_path , " " ,files->str,archive->extraction_path , NULL );
+ archive->escaped_path , " " ,names->str,archive->extraction_path , NULL );
else
command = g_strconcat (rar," ",archive->full_path ? "x " : "e ",
archive->freshen ? "-f " : "" , archive->update ? "-u " : "",
archive->overwrite ? "-o+" : "-o-",
" -idp ",
- archive->escaped_path , " " ,files->str,archive->extraction_path , NULL );
- g_string_free(files,TRUE);
+ archive->escaped_path , " " ,names->str,archive->extraction_path , NULL );
+ g_string_free(names,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
Modified: xarchiver/trunk/src/rar.h
===================================================================
--- xarchiver/trunk/src/rar.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/rar.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -26,9 +26,9 @@
#include "support.h"
#include "archive.h"
gboolean jump_header,read_filename, last_line, encrypted;
-void xa_rar_delete (XArchive *,GString *);
-void xa_rar_add (XArchive *,GString *,gchar *);
-void xa_rar_extract(XArchive *,GString *);
+void xa_rar_delete (XArchive *,GSList *);
+void xa_rar_add (XArchive *,GSList *,gchar *);
+void xa_rar_extract(XArchive *,GSList *);
void xa_rar_test (XArchive *);
void xa_get_rar_line_content (gchar *line, gpointer data);
void xa_open_rar ( XArchive *archive );
Modified: xarchiver/trunk/src/string_utils.c
===================================================================
--- xarchiver/trunk/src/string_utils.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/string_utils.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -112,7 +112,7 @@
}
return n;
}
-char *xa_escape_common_chars (const char *str, const char *meta_chars, const char prefix, const char postfix)
+char *xa_escape_common_chars (const char *str, const char *meta_chars, const char prefix, const char postfix)
{
int meta_chars_n = strlen (meta_chars);
char *escaped;
@@ -242,55 +242,56 @@
return utf8_string;
}
-void xa_escape_filename (gchar *filename,GString *data)
+gchar *xa_escape_filename (gchar *filename,gchar *meta_chars)
{
- gchar *esc_filename = NULL;
-
- esc_filename = xa_escape_common_chars (filename , " '*?[]", '\\', 0);
- g_string_prepend (data,esc_filename);
- g_string_prepend_c (data,' ');
+ return xa_escape_common_chars (filename , meta_chars, '\\', 0);
}
void xa_cat_filenames (XArchive *archive,GSList *list,GString *data)
{
+ gchar *basename, *name, *e_filename;
GSList *slist = list;
- gchar *name = NULL;
while (slist)
{
if (archive->location_entry_path != NULL)
{
- name = g_strconcat(archive->location_entry_path,slist->data,NULL);
- xa_escape_filename(name,data);
- g_free(name);
+ if (archive->full_path == 0)
+ {
+ basename = g_path_get_basename (slist->data);
+ name = g_strconcat(archive->location_entry_path,basename,NULL);
+ g_free(basename);
+ e_filename = xa_escape_filename(name,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (data,e_filename);
+ g_string_prepend_c (data,' ');
+ g_free(name);
+ }
+ else
+ {
+ name = g_strconcat(archive->location_entry_path,slist->data,NULL);
+ e_filename = xa_escape_filename(name,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (data,e_filename);
+ g_string_prepend_c (data,' ');
+ g_free(name);
+ }
}
else
- xa_escape_filename(slist->data,data);
- slist = slist->next;
- }
-}
-
-void xa_cat_filenames_basename (XArchive *archive,GSList *list,GString *data)
-{
- gchar *basename, *name;
- GSList *slist = list;
-
- while (slist)
- {
- if (archive->location_entry_path != NULL)
{
- basename = g_path_get_basename (slist->data);
- name = g_strconcat(archive->location_entry_path,basename,NULL);
- g_free(basename);
- xa_escape_filename(name,data);
- g_free(name);
+ if (archive->full_path == 0)
+ {
+ basename = g_path_get_basename (slist->data);
+ e_filename = xa_escape_filename(basename,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (data,e_filename);
+ g_string_prepend_c (data,' ');
+ g_free (basename);
+ }
+ else
+ {
+ e_filename = xa_escape_filename(slist->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (data,e_filename);
+ g_string_prepend_c (data,' ');
+ }
}
- else
- {
- basename = g_path_get_basename (slist->data);
- xa_escape_filename(basename,data);
- g_free (basename);
- }
slist = slist->next;
}
}
Modified: xarchiver/trunk/src/string_utils.h
===================================================================
--- xarchiver/trunk/src/string_utils.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/string_utils.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -39,7 +39,6 @@
gboolean match_patterns (char **patterns,const char *string,int flags);
gchar *xa_remove_path_from_archive_name(gchar *name);
void xa_cat_filenames (XArchive *,GSList *,GString *);
-void xa_cat_filenames_basename (XArchive *,GSList *,GString *);
-void xa_escape_filename (gchar *,GString *data);
+gchar *xa_escape_filename (gchar *filename,gchar *meta_chars);
#endif
Modified: xarchiver/trunk/src/tar.c
===================================================================
--- xarchiver/trunk/src/tar.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/tar.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -154,26 +154,40 @@
return FALSE;
}
-void xa_tar_delete (XArchive *archive,GString *files)
+void xa_tar_delete (XArchive *archive,GSList *files)
{
- gchar *command = NULL;
- GSList *list = NULL;
+ gchar *e_filename,*command = NULL;
+ GSList *_files,*list = NULL;
+ GString *names = g_string_new("");
+
+ _files = files;
+ while (_files)
+ {
+ e_filename = xa_escape_filename((gchar*)_files->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (names,e_filename);
+ g_string_prepend_c (names,' ');
+ _files = _files->next;
+ }
+ g_slist_foreach(files,(GFunc)g_free,NULL);
+ g_slist_free(files);
if (is_tar_compressed(archive->type))
- xa_add_delete_bzip2_gzip_lzma_compressed_tar(files,archive,0);
+ xa_add_delete_bzip2_gzip_lzma_compressed_tar(names,archive,0);
else
{
- command = g_strconcat (tar, " --delete -vf ",archive->escaped_path," ",files->str,NULL);
+ command = g_strconcat (tar, " --delete -vf ",archive->escaped_path," ",names->str,NULL);
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
}
-void xa_tar_add (XArchive *archive,GString *files,gchar *compression_string)
+void xa_tar_add (XArchive *archive,GSList *names,gchar *compression_string)
{
GSList *list = NULL;
gchar *command = NULL;
-
+ GString *files = g_string_new("");
+
+ xa_cat_filenames(archive,names,files);
if (archive->location_entry_path != NULL)
chdir (archive->tmp);
@@ -240,10 +254,22 @@
}
}
-void xa_tar_extract(XArchive *archive,GString *files)
+void xa_tar_extract(XArchive *archive,GSList *files)
{
- gchar *command = NULL;
- GSList *list = NULL;
+ gchar *command,*e_filename = NULL;
+ GSList *list = NULL,*_files = NULL;
+ GString *names = g_string_new("");
+
+ _files = files;
+ while (_files)
+ {
+ e_filename = xa_escape_filename((gchar*)_files->data,"$'`\"\\!?* ()[]&|:;<>#");
+ g_string_prepend (names,e_filename);
+ g_string_prepend_c (names,' ');
+ _files = _files->next;
+ }
+ g_slist_foreach(files,(GFunc)g_free,NULL);
+ g_slist_free(files);
switch (archive->type)
{
@@ -253,7 +279,7 @@
command = g_strconcat (tar, " -xvf " , archive->escaped_path,
archive->overwrite ? " --overwrite" : " --keep-old-files",
archive->tar_touch ? " --touch" : "",
- " -C ",archive->extraction_path,files->str,NULL);
+ " -C ",archive->extraction_path,names->str,NULL);
}
else
{
@@ -268,7 +294,7 @@
command = g_strconcat (tar, " -xjvf " , archive->escaped_path,
archive->overwrite ? " --overwrite" : " --keep-old-files",
archive->tar_touch ? " --touch" : "",
- " -C ",archive->extraction_path,files->str,NULL);
+ " -C ",archive->extraction_path,names->str,NULL);
}
else
{
@@ -283,7 +309,7 @@
command = g_strconcat (tar, " -xzvf " , archive->escaped_path,
archive->overwrite ? " --overwrite" : " --keep-old-files",
archive->tar_touch ? " --touch" : "",
- " -C ",archive->extraction_path,files->str,NULL);
+ " -C ",archive->extraction_path,names->str,NULL);
}
else
{
@@ -298,7 +324,7 @@
command = g_strconcat (tar, " --use-compress-program=lzma -xvf " , archive->escaped_path,
archive->overwrite ? " --overwrite" : " --keep-old-files",
archive->tar_touch ? " --touch" : "",
- " -C ",archive->extraction_path,files->str,NULL);
+ " -C ",archive->extraction_path,names->str,NULL);
}
else
{
@@ -312,18 +338,18 @@
}
if (command != NULL)
{
- g_string_free(files,TRUE);
+ g_string_free(names,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
}
-void xa_add_delete_bzip2_gzip_lzma_compressed_tar (GString *_list,XArchive *archive,gboolean add)
+void xa_add_delete_bzip2_gzip_lzma_compressed_tar (GString *files,XArchive *archive,gboolean add)
{
- gchar *command = NULL,*executable = NULL,*filename = NULL;
+ gchar *command,*executable = NULL,*filename = NULL;
gboolean result;
GSList *list = NULL;
-
+
switch (archive->type)
{
case XARCHIVETYPE_TAR_BZ2:
@@ -360,9 +386,9 @@
archive->remove_files ? "--remove-files " : "",
archive->update ? "-uvvf " : "-rvvf ",
archive->tmp,"/dummy",
- _list->str , NULL );
+ files->str , NULL );
else
- command = g_strconcat (tar," --no-wildcards --delete -f ",archive->tmp,"/dummy ",_list->str,NULL);
+ command = g_strconcat (tar," --no-wildcards --delete -f ",archive->tmp,"/dummy ",files->str,NULL);
list = g_slist_append(list,command);
command = g_strconcat (executable,archive->tmp,"/dummy",NULL);
@@ -384,14 +410,12 @@
XEntry *entry;
gchar *command = NULL;
GtkTreeSelection *selection;
- GString *names;
GtkTreeIter iter;
GList *row_list;
- GSList *list = NULL;
+ GSList *list = NULL,*files = NULL;
gboolean result;
+ GString *names = g_string_new("");
- names = g_string_new ("");
-
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(archive->treeview));
row_list = gtk_tree_selection_get_selected_rows(selection, &archive->model);
@@ -403,12 +427,10 @@
gtk_tree_model_get_iter(archive->model, &iter,row_list->data);
gtk_tree_model_get (archive->model,&iter,archive->nc+1,&entry,-1);
gtk_tree_path_free (row_list->data);
-
if (entry->is_dir)
- xa_fill_list_with_recursed_entries(entry, &names,"");
+ xa_fill_list_with_recursed_entries(entry, &files,"");
else
- g_string_prepend (names,xa_build_full_path_name_from_entry(entry));
-
+ files = g_slist_prepend(files,xa_build_full_path_name_from_entry(entry));
row_list = row_list->next;
}
g_list_free (row_list);
@@ -419,17 +441,18 @@
XEntry *entry = archive->root_entry;
while(entry)
{
- xa_entries_to_filelist(entry, &names,"");
+ xa_entries_to_filelist(entry, &files,"");
entry = entry->next;
}
}
-
result = xa_create_temp_directory (archive);
if (!result)
{
- g_string_free(names,TRUE);
+ g_slist_foreach(files,(GFunc)g_free,NULL);
+ g_slist_free(files);
return;
}
+ xa_cat_filenames(archive,files,names);
if (cpio_flag)
{
chdir (archive->tmp);
Modified: xarchiver/trunk/src/tar.h
===================================================================
--- xarchiver/trunk/src/tar.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/tar.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -26,14 +26,14 @@
#include "support.h"
#include "archive.h"
-void xa_open_tar ( XArchive *archive );
-void xa_tar_delete (XArchive *,GString *);
-void xa_tar_add (XArchive *,GString *,gchar *compression_string);
-void xa_tar_extract(XArchive *,GString *);
-void xa_get_tar_line_content (gchar *line, gpointer data);
-gboolean isTar ( FILE *ptr );
-gboolean is_tar_compressed (gint type);
-void xa_add_delete_bzip2_gzip_lzma_compressed_tar (GString *,XArchive *,gboolean add);
-void xa_extract_tar_without_directories ( gchar *, XArchive *,gchar *,gboolean cpio_flag);
+void xa_open_tar ( XArchive * );
+void xa_tar_delete (XArchive *,GSList *);
+void xa_tar_add (XArchive *,GSList *,gchar *);
+void xa_tar_extract(XArchive *,GSList *);
+void xa_get_tar_line_content (gchar *, gpointer );
+gboolean isTar (FILE *);
+gboolean is_tar_compressed (gint );
+void xa_add_delete_bzip2_gzip_lzma_compressed_tar (GString *,XArchive *,gboolean );
+void xa_extract_tar_without_directories ( gchar *, XArchive *,gchar *,gboolean );
#endif
Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/window.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -223,7 +223,7 @@
xa_add_page (archive[current_page]);
- xa_set_button_state (1,1,1,1,1,0,0,0,0 );
+ xa_set_button_state (0,0,0,1,1,0,0,0,0);
archive[current_page]->has_passwd = FALSE;
gtk_widget_set_sensitive(check_menu,FALSE);
gtk_widget_set_sensitive(properties,FALSE );
@@ -536,10 +536,9 @@
GList *row_list = NULL;
XEntry *entry = NULL;
GtkTreeIter iter;
- GString *names;
+ GSList *list = NULL;
gint current_page,id;
- names = g_string_new (" ");
current_page = gtk_notebook_get_current_page (notebook);
id = xa_find_archive_index (current_page);
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (archive[id]->treeview));
@@ -557,13 +556,12 @@
if (archive[id]->type == XARCHIVETYPE_TAR || is_tar_compressed(archive[id]->type))
goto one_file;
else
- xa_fill_list_with_recursed_entries(entry, &names,"");
+ xa_fill_list_with_recursed_entries(entry, &list,"");
}
else
{
one_file:
- g_string_prepend_c (names,' ');
- g_string_prepend (names,xa_build_full_path_name_from_entry(entry));
+ list = g_slist_prepend (list,xa_build_full_path_name_from_entry(entry));
}
row_list = row_list->next;
}
@@ -579,7 +577,7 @@
Update_StatusBar ( _("Deleting files from the archive, please wait..."));
archive[id]->status = XA_ARCHIVESTATUS_DELETE;
- (*archive[id]->delete) (archive[id],names);
+ (*archive[id]->delete) (archive[id],list);
}
void xa_add_files_archive (GtkMenuItem *menuitem,gpointer data)
@@ -1589,7 +1587,7 @@
gchar *no_uri_path;
gchar *to_send = "E";
GList *row_list = NULL;
- GString *names;
+ GSList *names = NULL;
gboolean full_path,overwrite;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (archive->treeview));
@@ -1636,8 +1634,7 @@
if (archive->extraction_path != NULL)
to_send = "S";
- names = g_string_new ("");
- gtk_tree_selection_selected_foreach (selection, (GtkTreeSelectionForeachFunc) xa_concat_filenames,names);
+ gtk_tree_selection_selected_foreach (selection, (GtkTreeSelectionForeachFunc) xa_concat_filenames,&names);
full_path = archive->full_path;
overwrite = archive->overwrite;
archive->full_path = 0;
@@ -1724,7 +1721,6 @@
response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't perform this action:"), msg );
return;
}
- GString *names = g_string_new (" ");
_current_dir = g_path_get_dirname (array[0]);
current_dir = g_filename_from_uri (_current_dir,NULL,NULL);
g_free (_current_dir);
@@ -1737,7 +1733,6 @@
list = g_slist_append(list,filename);
len++;
}
- xa_cat_filenames_basename(archive[idx],list,names);
dummy_password = archive[idx]->has_passwd;
full_path = archive[idx]->full_path;
add_recurse = archive[idx]->add_recurse;
@@ -1745,7 +1740,7 @@
archive[idx]->has_passwd = 0;
archive[idx]->full_path = 0;
archive[idx]->add_recurse = 1;
- xa_execute_add_commands(archive[idx],names,list,NULL);
+ xa_execute_add_commands(archive[idx],list,NULL);
archive[idx]->has_passwd = dummy_password;
archive[idx]->full_path = full_path;
@@ -1773,7 +1768,7 @@
return FALSE;
}
-void xa_concat_filenames (GtkTreeModel *model, GtkTreePath *treepath, GtkTreeIter *iter, GString *data)
+void xa_concat_filenames (GtkTreeModel *model, GtkTreePath *treepath, GtkTreeIter *iter, GSList **data)
{
XEntry *entry = NULL;
gchar *filename = NULL;
@@ -1785,8 +1780,7 @@
gtk_tree_model_get (model,iter,archive[idx]->nc+1,&entry,-1);
filename = xa_build_full_path_name_from_entry(entry);
- xa_escape_filename (filename,data);
- g_free (filename);
+ *data = g_slist_prepend (*data,filename);
}
void xa_select_all(GtkMenuItem *menuitem,gpointer user_data)
Modified: xarchiver/trunk/src/window.h
===================================================================
--- xarchiver/trunk/src/window.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/window.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -73,7 +73,7 @@
void on_options1_activate (GtkMenuItem *, gpointer);
void xa_extract_archive ( GtkMenuItem *, gpointer);
void xa_convert_sfx ( GtkMenuItem *, gpointer);
-void xa_concat_filenames (GtkTreeModel *, GtkTreePath *, GtkTreeIter *, GString *);
+void xa_concat_filenames (GtkTreeModel *, GtkTreePath *, GtkTreeIter *, GSList **);
void xa_select_all ( GtkMenuItem *, gpointer);
void xa_deselect_all ( GtkMenuItem *, gpointer);
void xa_show_archive_comment ( GtkMenuItem *, gpointer);
Modified: xarchiver/trunk/src/zip.c
===================================================================
--- xarchiver/trunk/src/zip.c 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/zip.c 2008-07-11 11:58:33 UTC (rev 27255)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Giuseppe Torelli - <colossus73 at gmail.com>
+ * Copyright (C) 2008 Giuseppe Torelli - <colossus73 at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -176,12 +176,14 @@
}
}
-void xa_zip_delete (XArchive *archive,GString *files)
+void xa_zip_delete (XArchive *archive,GSList *names)
{
gchar *command = NULL;
GSList *list = NULL;
-
+ GString *files = g_string_new("");
+
archive->status = XA_ARCHIVESTATUS_DELETE;
+ xa_zip_prepend_backslash(names,files);
command = g_strconcat ("zip -d ",archive->escaped_path," ",files->str,NULL);
g_string_free(files,TRUE);
list = g_slist_append(list,command);
@@ -189,10 +191,15 @@
xa_run_command (archive,list);
}
-void xa_zip_add (XArchive *archive,GString *files,gchar *compression_string)
+void xa_zip_add (XArchive *archive,GSList *names,gchar *compression_string)
{
GSList *list = NULL;
gchar *command = NULL;
+ GString *files = g_string_new("");
+
+ xa_cat_filenames(archive,names,files);
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
if (archive->location_entry_path != NULL)
chdir (archive->tmp);
@@ -224,10 +231,15 @@
xa_run_command (archive,list);
}
-void xa_zip_extract(XArchive *archive,GString *files)
+void xa_zip_extract(XArchive *archive,GSList *files)
{
gchar *command = NULL;
GSList *list = NULL;
+ GString *names = g_string_new("");
+
+ if (files == NULL)
+ g_print ("files è null\n");
+ xa_zip_prepend_backslash(files,names);
if ( archive->passwd != NULL )
command = g_strconcat ( "unzip ", archive->freshen ? "-f " : "",
@@ -235,14 +247,14 @@
archive->overwrite ? "-o" : "-n",
" -P " , archive->passwd,
archive->full_path ? " " : " -j ",
- archive->escaped_path , " -d ", archive->extraction_path,files->str,NULL);
+ archive->escaped_path , " -d ", archive->extraction_path,names->str,NULL);
else
command = g_strconcat ( "unzip ", archive->freshen ? "-f " : "",
archive->update ? "-u " : "",
archive->overwrite ? "-o " : "-n ",
archive->full_path ? "" : " -j ",
- archive->escaped_path , " -d ", archive->extraction_path,files->str,NULL);
- g_string_free(files,TRUE);
+ archive->escaped_path , " -d ", archive->extraction_path,names->str,NULL);
+ g_string_free(names,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
@@ -261,3 +273,22 @@
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
+
+ void xa_zip_prepend_backslash(GSList *names,GString *files)
+ {
+ gchar *e_filename,*e_filename2 = NULL;
+ GSList *_names;
+
+ _names = names;
+ while (_names)
+ {
+ e_filename = xa_escape_filename((gchar*)_names->data,"$'`\"\\!?* ()[]&|:;<>#");
+ e_filename2 = xa_escape_filename(e_filename,"*?[]");
+ g_free(e_filename);
+ g_string_prepend (files,e_filename2);
+ g_string_prepend_c (files,' ');
+ _names = _names->next;
+ }
+ g_slist_foreach(names,(GFunc)g_free,NULL);
+ g_slist_free(names);
+}
Modified: xarchiver/trunk/src/zip.h
===================================================================
--- xarchiver/trunk/src/zip.h 2008-07-11 10:07:13 UTC (rev 27254)
+++ xarchiver/trunk/src/zip.h 2008-07-11 11:58:33 UTC (rev 27255)
@@ -25,10 +25,11 @@
#include "support.h"
#include "archive.h"
-void xa_zip_delete (XArchive *,GString *);
-void xa_zip_add (XArchive *,GString *,gchar *);
-void xa_zip_extract(XArchive *,GString *);
+void xa_zip_delete (XArchive *,GSList *);
+void xa_zip_add (XArchive *,GSList *,gchar *);
+void xa_zip_extract(XArchive *,GSList *);
void xa_zip_test (XArchive *);
void xa_get_zip_line_content (gchar *line, gpointer data);
void xa_open_zip ( XArchive *);
+void xa_zip_prepend_backslash(GSList *names,GString *files);
#endif
More information about the Xfce4-commits
mailing list