Author: colossus
Date: 2007-08-24 13:33:51 +0000 (Fri, 24 Aug 2007)
New Revision: 26009
Modified:
xarchiver/trunk/src/archive.c
xarchiver/trunk/src/archive.h
xarchiver/trunk/src/bzip2.c
xarchiver/trunk/src/deb.c
xarchiver/trunk/src/extract_dialog.c
xarchiver/trunk/src/extract_dialog.h
xarchiver/trunk/src/lzma.c
xarchiver/trunk/src/lzma.h
xarchiver/trunk/src/pref_dialog.c
xarchiver/trunk/src/pref_dialog.h
xarchiver/trunk/src/rpm.c
xarchiver/trunk/src/window.c
Log:
Modified the function xa_run_command() to receive the archive structure.
Begin fixing extraction of tar files without the full path though so hard to
accomplish!
Added option "Open image files with" in the pref dialog.
Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/archive.c 2007-08-24 13:33:51 UTC (rev 26009)
@@ -23,8 +23,6 @@
#include "mime.h"
#include "support.h"
#include "window.h"
-#include <sys/types.h>
-#include <dirent.h>
static gboolean xa_process_output (GIOChannel *ioc, GIOCondition cond,
gpointer data);
@@ -225,27 +223,24 @@
g_free (archive);
}
-gboolean xa_delete_temp_directory (gchar *dir_name, gboolean flag)
+gboolean xa_delete_temp_directory (gchar *dir_name,gboolean flag)
{
- DIR *dirp;
- struct dirent *dp;
+ gchar *command;
+ gboolean result;
+ gint current_page;
+ gint idx;
+ current_page = gtk_notebook_get_current_page(notebook);
+ idx = xa_find_archive_index (current_page);
+
chdir (dir_name);
- dirp = opendir(dir_name);
- if (dirp == NULL)
- return FALSE;
-
- while ((dp = readdir(dirp)) != NULL)
- {
- if (dp->d_name[0] != '.')
- unlink (dp->d_name);
- }
- closedir(dirp);
- rmdir (dir_name);
- return TRUE;
+ command = g_strconcat ("rm -rf ",dir_name,NULL);
+ result = xa_run_command (archive[idx],command,flag );
+ g_free (command);
+ return result;
}
-gboolean xa_create_temp_directory ( gchar tmp_dir[] )
+gboolean xa_create_temp_directory (gchar tmp_dir[])
{
strcpy (tmp_dir,"/tmp/xa-XXXXXX");
if ( mkdtemp ( tmp_dir ) == 0)
@@ -258,26 +253,21 @@
return TRUE;
}
-gboolean xa_run_command ( gchar *command , gboolean watch_child_flag )
+gboolean xa_run_command (XArchive *archive,gchar *command , gboolean
watch_child_flag)
{
- gint current_page;
- gint idx;
int status;
gboolean waiting = TRUE;
int ps;
- current_page = gtk_notebook_get_current_page (notebook);
- idx = xa_find_archive_index ( current_page );
-
- archive[idx]->parse_output = 0;
- xa_spawn_async_process ( archive[idx],command,0);
- if ( archive[idx]->child_pid == 0 )
+ archive->parse_output = 0;
+ xa_spawn_async_process ( archive,command,0);
+ if ( archive->child_pid == 0 )
return FALSE;
gtk_widget_show (viewport2);
while (waiting)
{
- ps = waitpid (archive[idx]->child_pid, &status, WNOHANG);
+ ps = waitpid (archive->child_pid, &status, WNOHANG);
if (ps < 0)
waiting = FALSE;
else
@@ -286,7 +276,7 @@
if (watch_child_flag)
{
- xa_watch_child (archive[idx]->child_pid, status, archive[idx]);
+ xa_watch_child (archive->child_pid, status, archive);
return TRUE;
}
return TRUE;
@@ -378,6 +368,17 @@
g_free(entry);
}
+void xa_store_entries_in_gslist (XEntry *entry, GSList **list)
+{
+ if (entry == NULL)
+ return;
+
+ *list = g_slist_prepend (*list,entry->filename);
+
+ xa_store_entries_in_gslist(entry->child, list);
+ xa_store_entries_in_gslist(entry->next, list);
+}
+
XEntry *xa_find_archive_entry(XEntry *entry, gchar *string)
{
if (entry == NULL)
Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/archive.h 2007-08-24 13:33:51 UTC (rev 26009)
@@ -120,12 +120,13 @@
void xa_clean_archive_structure ( XArchive *archive);
gboolean xa_dump_child_error_messages (GIOChannel *ioc, GIOCondition cond,
gpointer data);
gboolean xa_create_temp_directory (gchar tmp_dir[]);
-gboolean xa_delete_temp_directory ( gchar *dir_name, gboolean flag);
-gboolean xa_run_command ( gchar *command , gboolean watch_child_flag );
+gboolean xa_delete_temp_directory (gchar *dir_name, gboolean flag);
+gboolean xa_run_command (XArchive *archive,gchar *command , gboolean
watch_child_flag);
gint xa_find_archive_index (gint page_num);
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);
+void xa_store_entries_in_gslist (XEntry *entry,GSList **);
XEntry *xa_find_archive_entry(XEntry *entry, gchar *string);
XEntry *xa_set_archive_entries_for_each_row (XArchive *archive,gchar
*filename,gboolean encrypted,gpointer *items);
gpointer *xa_fill_archive_entry_columns_for_each_row (XArchive *archive,XEntry
*entry,gpointer *items);
Modified: xarchiver/trunk/src/bzip2.c
===================================================================
--- xarchiver/trunk/src/bzip2.c 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/bzip2.c 2007-08-24 13:33:51 UTC (rev 26009)
@@ -110,7 +110,7 @@
else
command = g_strconcat ("cp -f ", archive->escaped_path,
" /tmp" , filename_only, flag ? ".gz" : ".bz2", NULL);
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command , 0);
g_free (command);
if (result == 0)
return ;
@@ -119,7 +119,7 @@
else
command = g_strconcat (flag ? "gzip -f -d -n " : "bzip2
-f -d ","/tmp",filename_only, flag ? ".gz" : ".bz2", NULL);
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command , 0);
g_free (command);
if (result == 0)
return;
@@ -140,7 +140,7 @@
command = g_strconcat ("mv -f
/tmp",filename_only, " ", archive->extraction_path,NULL);
}
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command , 0);
g_free (command);
if (result == 0)
return;
@@ -172,10 +172,12 @@
}
/* Let's copy the archive to /tmp first */
+
+ //TODO: replace /tmp with the user chosen dir in the pref dialog
temp_name = g_strconcat ( " /tmp", g_strrstr (archive->escaped_path ,
"/"), NULL);
command = g_strconcat ("cp -ar " ,archive->escaped_path,temp_name,NULL);
if ( ! cli)
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command , 0);
else
result = SpawnSyncCommand ( command );
g_free (command);
@@ -186,9 +188,9 @@
}
command = g_strconcat (dummy ? "gzip -f " : "bzip2 ", "-f -d
",temp_name,NULL);
if ( ! cli )
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command , 0);
else
- result = SpawnSyncCommand ( command );
+ result = SpawnSyncCommand (command);
g_free (command);
if (result == 0)
{
@@ -228,7 +230,7 @@
else
command = g_strconcat (tar, " --delete -f " , temp_name ,
list->str , NULL );
if ( ! cli)
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
else
result = SpawnSyncCommand ( command );
g_free (command);
@@ -248,9 +250,9 @@
command = g_strconcat ( dummy ? "gzip -f " : "bzip2 ", "-f " ,
temp_name , NULL );
if ( ! cli )
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command , 0);
else
- result = SpawnSyncCommand ( command );
+ result = SpawnSyncCommand (command);
g_free (command);
if (result == 0)
@@ -265,9 +267,9 @@
/* Let's move the modified archive from /tmp to the original archive
location */
command = g_strconcat ( "mv " , temp_name , file_ext, " "
,archive->escaped_path, NULL );
if ( ! cli )
- result = xa_run_command (command , 1);
+ result = xa_run_command (archive,command,1);
else
- result = SpawnSyncCommand ( command );
+ result = SpawnSyncCommand (command);
g_free (command);
g_free (temp_name);
Modified: xarchiver/trunk/src/deb.c
===================================================================
--- xarchiver/trunk/src/deb.c 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/deb.c 2007-08-24 13:33:51 UTC (rev 26009)
@@ -47,7 +47,7 @@
/* Copy the .deb archive to the unique dir */
command = g_strconcat ("cp ",archive->escaped_path,archive->tmp,NULL);
- result = xa_run_command ( command , 0);
+ result = xa_run_command (archive,command,0);
g_free (command);
if (result == FALSE)
return;
@@ -55,7 +55,7 @@
/* Ok, let's now extract the .deb archive with ar */
chdir (tmp_dir);
command = g_strconcat ("ar xv" , archive->tmp, NULL);
- result = xa_run_command ( command , 0);
+ result = xa_run_command (archive,command,0);
g_free (command);
g_free (archive->tmp);
Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c 2007-08-24 07:41:59 UTC (rev
26008)
+++ xarchiver/trunk/src/extract_dialog.c 2007-08-24 13:33:51 UTC (rev
26009)
@@ -392,9 +392,9 @@
g_free (text);
}
g_free (destination_path);
- tar = g_find_program_in_path ("gtar");
- if (tar == NULL)
- tar = g_strdup ("tar");
+ tar = g_find_program_in_path ("gtar");
+ if (tar == NULL)
+ tar = g_strdup ("tar");
switch ( archive->type )
{
case XARCHIVETYPE_BZIP2:
@@ -435,7 +435,7 @@
}
else
{
-
xa_extract_tar_without_directories ( "tar -xvf " , archive->escaped_path,
archive->overwrite,archive->tar_touch,archive->extraction_path, FALSE );
+
xa_extract_tar_without_directories ( "tar -xvf ",archive,NULL,FALSE );
command = NULL;
}
break;
@@ -450,7 +450,8 @@
}
else
{
-
xa_extract_tar_without_directories ( "tar -xvjf " , archive->escaped_path,
archive->overwrite,archive->tar_touch,archive->extraction_path , FALSE );
+ g_print ("ALL files\n");
+
xa_extract_tar_without_directories ( "tar -xvjf
",archive,archive->extraction_path,FALSE );
command = NULL;
}
break;
@@ -465,7 +466,7 @@
}
else
{
-
xa_extract_tar_without_directories ( "tar -xvzf " , archive->escaped_path,
archive->overwrite,archive->tar_touch,archive->extraction_path, FALSE );
+
xa_extract_tar_without_directories ( "tar -xvzf
",archive,archive->extraction_path,FALSE );
command = NULL;
}
break;
@@ -480,7 +481,7 @@
}
else
{
-
xa_extract_tar_without_directories ( "tar --use-compress-program=lzma -xvf " ,
archive->escaped_path,
archive->overwrite,archive->tar_touch,archive->extraction_path, FALSE );
+
xa_extract_tar_without_directories ( "tar --use-compress-program=lzma -xvf
",archive,NULL,FALSE);
command = NULL;
}
break;
@@ -495,7 +496,7 @@
}
else
{
-
xa_extract_tar_without_directories ( "tar -xvzf " , archive->tmp,
archive->overwrite,archive->tar_touch,archive->extraction_path, FALSE );
+
xa_extract_tar_without_directories ( "tar -xvzf ",archive,archive->tmp,FALSE );
command = NULL;
}
break;
@@ -524,7 +525,7 @@
}
else
{
-
xa_extract_tar_without_directories ( "tar -xvzf " , archive->escaped_path,
archive->overwrite,archive->tar_touch,archive->extraction_path , TRUE);
+
xa_extract_tar_without_directories ( "tar -xvzf " ,
archive,archive->escaped_path,TRUE);
command = NULL;
}
break;
@@ -567,7 +568,7 @@
}
g_free (tar);
- if ( command != NULL )
+ if (command != NULL)
return command;
}
else
@@ -638,7 +639,7 @@
}
else
{
- xa_extract_tar_without_directories ( "tar -xvf " ,
archive->escaped_path, archive->overwrite,archive->tar_touch,path, FALSE );
+ xa_extract_tar_without_directories ( "tar -xvf " ,
archive,archive->escaped_path,FALSE );
command = NULL;
}
break;
@@ -653,7 +654,7 @@
}
else
{
- xa_extract_tar_without_directories ( "tar -xjvf " ,
archive->escaped_path, archive->overwrite,archive->tar_touch,path, FALSE );
+ xa_extract_tar_without_directories ( "tar -xjvf " ,
archive,archive->escaped_path,FALSE );
command = NULL;
}
break;
@@ -668,7 +669,7 @@
}
else
{
- xa_extract_tar_without_directories ( "tar -xzvf " ,
archive->escaped_path, archive->overwrite,archive->tar_touch,path, FALSE );
+ xa_extract_tar_without_directories ( "tar -xzvf " ,
archive,archive->escaped_path,FALSE );
command = NULL;
}
break;
@@ -683,7 +684,7 @@
}
else
{
- xa_extract_tar_without_directories ( "tar
--use-compress-program=lzma -xvf " , archive->escaped_path,
archive->overwrite,archive->tar_touch,path, FALSE );
+ xa_extract_tar_without_directories ( "tar
--use-compress-program=lzma -xvf " , archive,archive->escaped_path,FALSE );
command = NULL;
}
break;
@@ -698,7 +699,7 @@
}
else
{
- xa_extract_tar_without_directories ( "tar -xvzf " ,
archive->tmp, archive->overwrite,archive->tar_touch,archive->extraction_path,
FALSE );
+ xa_extract_tar_without_directories ( "tar -xvzf " ,
archive,archive->tmp,FALSE );
command = NULL;
}
break;
@@ -727,7 +728,7 @@
}
else
{
- xa_extract_tar_without_directories ( "tar -xvzf " ,
archive->escaped_path, archive->overwrite,archive->tar_touch,path , TRUE);
+ xa_extract_tar_without_directories ( "tar -xvzf " ,
archive,archive->escaped_path,TRUE);
command = NULL;
}
break;
@@ -778,7 +779,7 @@
return command;
}
-gboolean xa_extract_tar_without_directories ( gchar *string, gchar
*escaped_path, gboolean overwrite, gboolean tar_touch, gchar *extract_path,
gboolean cpio_flag )
+gboolean xa_extract_tar_without_directories ( gchar *string, XArchive
*archive, gchar *extract_path,gboolean cpio_flag)
{
gchar *command = NULL;
gchar *name = NULL;
@@ -786,31 +787,26 @@
gchar tmp_dir[14] = "";
GtkTreeSelection *selection;
GString *names, *unescaped_names;
- gboolean end = FALSE;
GtkTreeIter iter;
GList *row_list;
GSList *filenames = NULL;
+ GSList *xxx = NULL;
gboolean result;
- gint current_page;
- gint idx;
- current_page = gtk_notebook_get_current_page(notebook);
- idx = xa_find_archive_index (current_page);
-
names = g_string_new ("");
unescaped_names = g_string_new ("");
- selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW
(archive[idx]->treeview) );
- row_list = gtk_tree_selection_get_selected_rows (selection,
&archive[idx]->model);
+ selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW
(archive->treeview) );
+ row_list = gtk_tree_selection_get_selected_rows (selection,
&archive->model);
if (row_list != NULL)
{
while (row_list)
{
- gtk_tree_model_get_iter(archive[idx]->model, &iter,
row_list->data);
- gtk_tree_model_get (archive[idx]->model, &iter,
- 0, &name,
- 1, &permission,
+ gtk_tree_model_get_iter(archive->model, &iter,
row_list->data);
+ gtk_tree_model_get (archive->model, &iter,
+ 1, &name,
+ 3, &permission,
-1);
gtk_tree_path_free (row_list->data);
@@ -826,20 +822,18 @@
}
else
{
- end = gtk_tree_model_get_iter_first (archive[idx]->model ,
&iter);
- while (end)
+ /* *Here we have to fill a GSList with all the filenames in the
archive so that we can use mv on all of them */
+ XEntry *entry;
+ GSList *s = archive->entries;
+
+ for (; s; s = s->next)
{
- gtk_tree_model_get (archive[idx]->model, &iter, 0,
&name,
-
1, &permission, -1);
- if (strstr (permission ,"d") == NULL)
- {
- ConcatenateFileNames2 ( name , names );
- filenames = g_slist_append ( filenames,name );
- }
- g_free (permission);
- end = gtk_tree_model_iter_next
(archive[idx]->model,&iter);
+ entry = s->data;
+ xa_store_entries_in_gslist(entry,&xxx);
}
}
+ filenames = g_slist_reverse(xxx);
+
result = xa_create_temp_directory (tmp_dir);
if (result == 0)
return FALSE;
@@ -847,14 +841,14 @@
if (cpio_flag)
{
chdir (tmp_dir);
- command = g_strconcat ( "cpio --make-directories -F " ,
archive[idx]->tmp , " -i" , NULL );
+ command = g_strconcat ( "cpio --make-directories -F " ,
archive->tmp , " -i" , NULL );
}
else
- command = g_strconcat ( string, escaped_path,
-
overwrite ? " --overwrite" : " --keep-old-files",
-
tar_touch ? " --touch" : "",
+ command = g_strconcat ( string, archive->escaped_path,
+
archive->overwrite ? " --overwrite" : " --keep-old-files",
+
archive->tar_touch ? " --touch" : "",
" -C " , tmp_dir , names->str, NULL );
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
g_string_free (names, TRUE);
g_free (command);
@@ -866,26 +860,29 @@
return FALSE;
}
chdir (tmp_dir);
+
while (filenames)
{
- gchar *unescaped = EscapeBadChars ( filenames->data ,
"$\'`\"\\!?* ()[]&|@#:;");
+ gchar *unescaped = EscapeBadChars ( (gchar*)filenames->data ,
"$\'`\"\\!?* ()[]&|@#:;");
g_string_prepend ( unescaped_names, unescaped );
g_string_prepend_c (unescaped_names, ' ');
g_free (unescaped);
filenames = filenames->next;
}
command = g_strconcat ( "mv -f ", unescaped_names->str, " " ,
extract_path , NULL );
- result = xa_run_command (command , 0);
+ g_print ("%s\n",command);
+ result = xa_run_command (archive,command,0);
g_free (command);
g_slist_free (filenames);
g_string_free ( unescaped_names, TRUE );
if (result == 0 || stop_flag)
{
- xa_delete_temp_directory ( tmp_dir, 0 );
+ xa_delete_temp_directory (tmp_dir,0);
gtk_widget_hide (viewport2);
Update_StatusBar (_("Operation canceled."));
return FALSE;
}
+
if (cpio_flag)
xa_delete_temp_directory ( tmp_dir, 0 );
else
Modified: xarchiver/trunk/src/extract_dialog.h
===================================================================
--- xarchiver/trunk/src/extract_dialog.h 2007-08-24 07:41:59 UTC (rev
26008)
+++ xarchiver/trunk/src/extract_dialog.h 2007-08-24 13:33:51 UTC (rev
26009)
@@ -68,7 +68,7 @@
void update_fresh_toggled_cb (GtkToggleButton *button, Extract_dialog_data
*data);
gchar *xa_parse_extract_dialog_options ( XArchive *archive ,
Extract_dialog_data *dialog_data, GtkTreeSelection *selection);
gchar *xa_extract_single_files ( XArchive *archive , GString *files, gchar
*path);
-gboolean xa_extract_tar_without_directories ( gchar *string, gchar
*escaped_path, gboolean overwrite, gboolean tar_touch, gchar *extract_path ,
gboolean cpio_flag);
+gboolean xa_extract_tar_without_directories ( gchar *string, XArchive
*archive,gchar *extract_path,gboolean cpio_flag);
void xa_choose_extraction_directory (GtkWidget *widget, gpointer data);
#endif
Modified: xarchiver/trunk/src/lzma.c
===================================================================
--- xarchiver/trunk/src/lzma.c 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/lzma.c 2007-08-24 13:33:51 UTC (rev 26009)
@@ -27,15 +27,14 @@
FILE *fd;
-extern gboolean TarOpen (GIOChannel *ioc, GIOCondition cond, gpointer data);
extern int output_fd;
extern gboolean cli;
-
short int l;
-void OpenLzma ( XArchive *archive )
+void xa_open_lzma ( XArchive *archive )
{
gchar *command;
+ unsigned short int i;
if ( g_str_has_suffix ( archive->escaped_path , ".tar.lzma") ||
g_str_has_suffix ( archive->escaped_path , ".tlz") )
{
@@ -49,6 +48,7 @@
archive->dummy_size = 0;
archive->nr_of_files = 0;
archive->nr_of_dirs = 0;
+ archive->nc = 6;
archive->format ="TAR.LZMA";
archive->parse_output = xa_get_tar_line_content;
@@ -60,9 +60,13 @@
if ( archive->child_pid == 0 )
return;
- char *names[]= {(_("Filename")),(_("Permissions")),(_("Symbolic
Link")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"))};
- GType types[]=
{G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING};
-// xa_create_liststore ( 7, names , (GType *)types, archive );
+ GType types[]=
{G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING};
+ archive->column_types = g_malloc0(sizeof(types));
+ for (i = 0; i < 8; i++)
+ archive->column_types[i] = types[i];
+
+ char *names[]= {(_("Points
to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"))};
+ xa_create_liststore (archive,names);
archive->type = XARCHIVETYPE_TAR_LZMA;
}
else
@@ -106,7 +110,7 @@
else
command = g_strconcat ("cp -f ", archive->escaped_path,
" /tmp" , filename_only, ".lzma", NULL);
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
g_free (command);
if (result == 0)
return ;
@@ -115,7 +119,7 @@
else
command = g_strconcat ("lzma -f -d
","/tmp",filename_only, ".lzma", NULL);
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
g_free (command);
if (result == 0)
return;
@@ -130,7 +134,7 @@
command = g_strconcat ("mv -f /tmp",filename_only, " ",
archive->extraction_path,NULL);
}
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
g_free (command);
if (result == 0)
return;
@@ -165,7 +169,7 @@
temp_name = g_strconcat ( " /tmp", g_strrstr (archive->escaped_path ,
"/"), NULL);
command = g_strconcat ("cp -ar " ,archive->escaped_path,temp_name,NULL);
if ( ! cli)
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
else
result = SpawnSyncCommand ( command );
g_free (command);
@@ -176,7 +180,7 @@
}
command = g_strconcat ("lzma ", "-f -d ",temp_name,NULL);
if ( ! cli )
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
else
result = SpawnSyncCommand ( command );
g_free (command);
@@ -209,7 +213,7 @@
else
command = g_strconcat (tar, " --delete -f " , temp_name ,
list->str , NULL );
if ( ! cli)
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
else
result = SpawnSyncCommand ( command );
g_free (command);
@@ -229,7 +233,7 @@
command = g_strconcat ( "lzma ", "-f " , temp_name , NULL );
if ( ! cli )
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive,command,0);
else
result = SpawnSyncCommand ( command );
g_free (command);
@@ -244,7 +248,7 @@
/* Let's move the modified archive from /tmp to the original archive
location */
command = g_strconcat ( "mv " , temp_name , file_ext, " "
,archive->escaped_path, NULL );
if ( ! cli )
- result = xa_run_command (command , 1);
+ result = xa_run_command (archive,command,1);
else
result = SpawnSyncCommand ( command );
g_free (command);
Modified: xarchiver/trunk/src/lzma.h
===================================================================
--- xarchiver/trunk/src/lzma.h 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/lzma.h 2007-08-24 13:33:51 UTC (rev 26009)
@@ -21,10 +21,13 @@
#define LZMA_H
#include <gtk/gtk.h>
-#include "interface.h"
+#include <string.h>
+#include <stdlib.h>
+#include "string_utils.h"
#include "support.h"
+#include "archive.h"
-void OpenLzma ( XArchive *archive );
+void xa_open_lzma ( XArchive *archive );
void lzma_extract ( XArchive *archive );
void xa_add_delete_tar_lzma( GString *list , XArchive *archive , gboolean add
);
#endif
Modified: xarchiver/trunk/src/pref_dialog.c
===================================================================
--- xarchiver/trunk/src/pref_dialog.c 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/pref_dialog.c 2007-08-24 13:33:51 UTC (rev 26009)
@@ -202,7 +202,7 @@
gtk_container_add (GTK_CONTAINER (frame3), alignment3);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 12, 0);
- table2 = gtk_table_new (4, 2,FALSE);
+ table2 = gtk_table_new (5, 2,FALSE);
gtk_container_add (GTK_CONTAINER (alignment3), table2);
gtk_table_set_row_spacings (GTK_TABLE (table2), 2);
gtk_table_set_col_spacings (GTK_TABLE (table2), 4);
@@ -229,19 +229,31 @@
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_SHRINK), 0, 0);
- label8 = gtk_label_new (_("Preferred temp directory:"));
+ label8 = gtk_label_new (_("Open image files with:"));
gtk_table_attach (GTK_TABLE (table2), label8, 0, 1, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_SHRINK), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
+ prefs_data->combo_prefered_viewer = gtk_combo_box_new_text();
+ gtk_combo_box_append_text (GTK_COMBO_BOX
(prefs_data->combo_prefered_viewer), _("choose...") );
+ gtk_table_attach (GTK_TABLE (table2),
prefs_data->combo_prefered_viewer, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (GTK_SHRINK), 0, 0);
+
+ label9 = gtk_label_new (_("Preferred temp directory:"));
+ gtk_table_attach (GTK_TABLE (table2), label9, 0, 1, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (GTK_SHRINK), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);
prefs_data->combo_prefered_temp_dir = gtk_combo_box_new_text();
gtk_combo_box_append_text (GTK_COMBO_BOX
(prefs_data->combo_prefered_temp_dir), _("/tmp") );
gtk_combo_box_append_text (GTK_COMBO_BOX
(prefs_data->combo_prefered_temp_dir), _("choose...") );
- gtk_table_attach (GTK_TABLE (table2),
prefs_data->combo_prefered_temp_dir, 1, 2, 2, 3,
+ gtk_table_attach (GTK_TABLE (table2),
prefs_data->combo_prefered_temp_dir, 1, 2, 3, 4,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_SHRINK), 0, 0);
+
prefs_data->check_save_geometry = gtk_check_button_new_with_mnemonic
(_("Save window geometry"));
- gtk_table_attach (GTK_TABLE (table2), prefs_data->check_save_geometry,
0, 2, 3, 4,
+ gtk_table_attach (GTK_TABLE (table2), prefs_data->check_save_geometry,
0, 2, 4, 5,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_SHRINK), 0, 0);
gtk_button_set_focus_on_click (GTK_BUTTON
(prefs_data->check_save_geometry), FALSE);
@@ -315,6 +327,7 @@
g_key_file_set_integer
(xa_key_file,PACKAGE,"preferred_web_browser",gtk_combo_box_get_active
(GTK_COMBO_BOX(prefs_data->combo_prefered_web_browser)));
g_key_file_set_integer
(xa_key_file,PACKAGE,"preferred_editor",gtk_combo_box_get_active
(GTK_COMBO_BOX(prefs_data->combo_prefered_editor)));
+ g_key_file_set_integer
(xa_key_file,PACKAGE,"preferred_viewer",gtk_combo_box_get_active
(GTK_COMBO_BOX(prefs_data->combo_prefered_viewer)));
g_key_file_set_integer
(xa_key_file,PACKAGE,"preferred_temp_dir",gtk_combo_box_get_active
(GTK_COMBO_BOX(prefs_data->combo_prefered_temp_dir)));
if
(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_data->check_save_geometry))
)
{
@@ -380,6 +393,7 @@
gtk_combo_box_set_active
(GTK_COMBO_BOX(prefs_data->combo_prefered_web_browser),g_key_file_get_integer(xa_key_file,PACKAGE,"preferred_web_browser",NULL));
gtk_combo_box_set_active
(GTK_COMBO_BOX(prefs_data->combo_prefered_editor),g_key_file_get_integer(xa_key_file,PACKAGE,"preferred_editor",NULL));
+ gtk_combo_box_set_active
(GTK_COMBO_BOX(prefs_data->combo_prefered_viewer),g_key_file_get_integer(xa_key_file,PACKAGE,"preferred_viewer",NULL));
gtk_combo_box_set_active
(GTK_COMBO_BOX(prefs_data->combo_prefered_temp_dir),g_key_file_get_integer(xa_key_file,PACKAGE,"preferred_temp_dir",NULL));
coords = g_key_file_get_integer_list(xa_key_file, PACKAGE,
"geometry", &coords_len, &error);
if (error)
Modified: xarchiver/trunk/src/pref_dialog.h
===================================================================
--- xarchiver/trunk/src/pref_dialog.h 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/pref_dialog.h 2007-08-24 13:33:51 UTC (rev 26009)
@@ -25,7 +25,7 @@
GtkWidget *dialog_vbox1;
GtkWidget *combo_prefered_format, *check_save_add_dialog,
*check_save_extract_dialog;
GtkWidget *allow_dir_extract_with_dnd, *confirm_deletion,
*combo_archive_view,*combo_icon_size;
- GtkWidget *check_show_comment,
*check_sort_filename_column,*show_location_bar;
+ GtkWidget *check_show_comment,
*check_sort_filename_column,*show_location_bar,*combo_prefered_viewer;
GtkWidget *combo_prefered_web_browser, *combo_prefered_editor,
*combo_prefered_temp_dir, *check_save_geometry,*prefs_notebook;
GtkListStore *prefs_liststore;
GtkTooltips *tooltips;
Modified: xarchiver/trunk/src/rpm.c
===================================================================
--- xarchiver/trunk/src/rpm.c 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/rpm.c 2007-08-24 13:33:51 UTC (rev 26009)
@@ -111,7 +111,7 @@
//Now I run dd to have the bzip2 / gzip compressed cpio archive in /tmp
gchar *command = g_strconcat ( "dd if=" , archive->escaped_path, "
ibs=" , ibs , " skip=1 of=" , gzip_tmp , NULL );
g_free (ibs);
- result = xa_run_command ( command , 0);
+ result = xa_run_command (archive,command,0);
g_free (command);
if (result == FALSE)
{
Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c 2007-08-24 07:41:59 UTC (rev 26008)
+++ xarchiver/trunk/src/window.c 2007-08-24 13:33:51 UTC (rev 26009)
@@ -133,7 +133,7 @@
break;
case XARCHIVETYPE_TAR_LZMA:
- OpenLzma (archive);
+ xa_open_lzma (archive);
break;
case XARCHIVETYPE_ZIP:
@@ -345,7 +345,7 @@
break;
case XARCHIVETYPE_LZMA:
- OpenLzma ( archive[current_page] );
+ xa_open_lzma ( archive[current_page] );
break;
case XARCHIVETYPE_RAR:
@@ -442,7 +442,7 @@
command = NULL;
}
archive[id]->status = XA_ARCHIVESTATUS_TEST;
- xa_run_command ( command , 1);
+ xa_run_command (archive[id],command,1);
g_free (command);
}
@@ -591,7 +591,7 @@
{
xa_set_button_state (0,0,0,0,0,0,0,0);
gtk_widget_set_sensitive (Stop_button,TRUE);
- xa_run_command ( command , 1);
+ xa_run_command (archive[id],command,1);
g_free (command);
}
g_string_free (names , TRUE );
@@ -612,7 +612,7 @@
gtk_widget_destroy ( add_window->dialog1 );
if (command != NULL)
{
- xa_run_command (command , 1);
+ xa_run_command (archive[idx],command,1);
g_free (command);
}
g_free ( add_window );
@@ -647,7 +647,7 @@
gtk_widget_set_sensitive ( check_menu , FALSE);
gtk_widget_set_sensitive ( properties , FALSE);
xa_set_button_state (0,0,0,0,0,0,0,0);
- xa_run_command (command , 1);
+ xa_run_command (archive[idx],command,1);
g_free (command);
}
g_free (extract_window);
@@ -764,11 +764,11 @@
fclose (sfx_archive);
command = g_strconcat ("chmod 755 ",
archive_name_escaped , NULL);
- result = xa_run_command (command , 0);
+ result = xa_run_command
(archive[idx],command,0);
g_free (command);
command = g_strconcat ("zip -A
",archive_name_escaped,NULL);
- result = xa_run_command (command , 1);
+ result = xa_run_command
(archive[idx],command,1);
g_free (command);
command = NULL;
}
@@ -874,7 +874,7 @@
fclose (sfx_archive);
command = g_strconcat ("chmod 755 ",
archive_name_escaped , NULL);
- result = xa_run_command (command , 1);
+ result = xa_run_command
(archive[idx],command,1);
g_free (command);
command = NULL;
}
@@ -892,7 +892,7 @@
}
if (command != NULL)
{
- xa_run_command ( command , 1);
+ xa_run_command (archive[idx],command,1);
g_free (command);
}
}
@@ -1342,7 +1342,7 @@
archive[idx]->overwrite = overwrite;
if (command != NULL)
{
- result = xa_run_command (command , 0);
+ result = xa_run_command (archive[idx],command,0);
g_free (command);
if ( result == 0 )
{
@@ -1760,7 +1760,7 @@
if ( command != NULL )
{
archive[idx]->status = XA_ARCHIVESTATUS_EXTRACT;
- xa_run_command ( command , 1);
+ xa_run_command (archive[idx],command,1);
g_free (command);
}
archive[idx]->full_path = full_path;
@@ -1882,7 +1882,7 @@
gtk_widget_set_sensitive ( check_menu , FALSE);
gtk_widget_set_sensitive ( properties , FALSE);
xa_set_button_state (0,0,0,0,0,0,0,0);
- xa_run_command (command , 1);
+ xa_run_command (archive[idx],command,1);
g_free (command);
}
g_string_free (names, TRUE);
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits