Author: colossus
Date: 2008-07-12 19:19:58 +0000 (Sat, 12 Jul 2008)
New Revision: 27264
Modified:
xarchiver/trunk/TODO
xarchiver/trunk/src/bzip2.c
xarchiver/trunk/src/bzip2.h
xarchiver/trunk/src/deb.c
xarchiver/trunk/src/deb.h
xarchiver/trunk/src/extract_dialog.c
xarchiver/trunk/src/lha.c
xarchiver/trunk/src/main.c
xarchiver/trunk/src/rpm.c
xarchiver/trunk/src/rpm.h
xarchiver/trunk/src/window.c
xarchiver/trunk/src/zip.c
Log:
Fixed warnings in main.c.
Removed unused variables from the code.
Updated TODO file.
Modified: xarchiver/trunk/TODO
===================================================================
--- xarchiver/trunk/TODO 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/TODO 2008-07-12 19:19:58 UTC (rev 27264)
@@ -1,6 +1,7 @@
- fix store output when test archives
- fix segfault in xa_launch_external_command
-- fix the directories bug with 7z
+- fill the gslist with the directories to add for the recursive bug in 7z
+- do the same as above for arj when using the switches from cmd-line
- fix the remaining bugs in bugzilla.xfce.org
- to fix the arrow buttons
- add a small progress window when using Xarchiver cmd-line switches.
Modified: xarchiver/trunk/src/bzip2.c
===================================================================
--- xarchiver/trunk/src/bzip2.c 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/bzip2.c 2008-07-12 19:19:58 UTC (rev 27264)
@@ -170,47 +170,18 @@
xa_create_liststore (archive,names);
}
-void lzma_gzip_bzip2_extract (XArchive *archive,GString *dummy)
+void lzma_gzip_bzip2_extract (XArchive *archive,GSList *dummy)
{
GSList *list = NULL;
- gchar *command,*executable = NULL,*filename = NULL, *dot = NULL,
*filename_noext = NULL;
- gboolean result = FALSE;
+ gchar *command = NULL,*filename = NULL, *dot = NULL, *filename_noext =
NULL;
filename = xa_remove_path_from_archive_name(archive->escaped_path);
- switch (archive->type)
- {
- case XARCHIVETYPE_BZIP2:
- executable = "bzip2 -f -d ";
- break;
- case XARCHIVETYPE_GZIP:
- executable = "gzip -f -d -n ";
- break;
-
- case XARCHIVETYPE_LZMA:
- executable = "lzma -f -d ";
- break;
-
- default:
- break;
- }
-
- result = xa_create_temp_directory(archive);
- if (!result)
- return;
-
-
- command = g_strconcat ("cp -f ",archive->escaped_path,"
",archive->tmp,NULL);
- list = g_slist_append(list,command);
-
- command = g_strconcat(executable,archive->tmp,"/",filename,NULL);
- list = g_slist_append(list,command);
-
dot = strchr(filename,'.');
if (G_LIKELY(dot))
{
filename_noext = g_strndup(filename, ( dot - filename ));
- command = g_strconcat("mv -f
",archive->tmp,"/",filename_noext," ",archive->extraction_path,NULL);
+ command = g_strconcat("cp -f
",archive->tmp,"/",filename_noext," ",archive->extraction_path,NULL);
g_free(filename_noext);
}
g_free(filename);
Modified: xarchiver/trunk/src/bzip2.h
===================================================================
--- xarchiver/trunk/src/bzip2.h 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/bzip2.h 2008-07-12 19:19:58 UTC (rev 27264)
@@ -25,6 +25,6 @@
#include "archive.h"
void xa_open_bzip2_lzma (XArchive *,GString *);
-void lzma_gzip_bzip2_extract (XArchive *,GString*);
+void lzma_gzip_bzip2_extract (XArchive *,GSList*);
void xa_open_tar_compressed_file(XArchive *);
#endif
Modified: xarchiver/trunk/src/deb.c
===================================================================
--- xarchiver/trunk/src/deb.c 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/deb.c 2008-07-12 19:19:58 UTC (rev 27264)
@@ -84,24 +84,36 @@
xa_create_liststore (archive,names);
}
-//TODO to remove when you have dbus integration
-void xa_deb_extract(XArchive *archive,GString *files)
+void xa_deb_extract(XArchive *archive,GSList *files)
{
- gchar *command = NULL;
- GSList *list = NULL;
+ //TODO to remove when you have xdg-open working so that control.tar.gz
is opened in another tab and the user can extract its content from that tab
+ gchar *command = NULL,*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->full_path)
{
command = g_strconcat (tar, " -xvzf " ,
archive->tmp,"/data.tar.gz ",
archive->overwrite ? " --overwrite" : " --keep-old-files",
archive->tar_touch ? " --touch" : "",
-
" -C " , archive->extraction_path , files->str, NULL );
+
" -C " , archive->extraction_path , names->str, NULL );
}
if (command != NULL)
{
- g_string_free(files,TRUE);
+ g_string_free(names,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
Modified: xarchiver/trunk/src/deb.h
===================================================================
--- xarchiver/trunk/src/deb.h 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/deb.h 2008-07-12 19:19:58 UTC (rev 27264)
@@ -28,6 +28,6 @@
#include "support.h"
#include "archive.h"
-void xa_open_deb ( XArchive *archive );
-void xa_deb_extract(XArchive *archive,GString *files);
+void xa_open_deb ( XArchive *);
+void xa_deb_extract(XArchive *,GSList *);
#endif
Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c 2008-07-12 15:47:37 UTC (rev
27263)
+++ xarchiver/trunk/src/extract_dialog.c 2008-07-12 19:19:58 UTC (rev
27264)
@@ -24,7 +24,6 @@
#include "string_utils.h"
#include "support.h"
-gboolean stop_flag;
extern gboolean unrar;
gchar *rar;
@@ -32,7 +31,6 @@
{
GSList *radiobutton1_group = NULL;
Extract_dialog_data *dialog_data;
- stop_flag = FALSE;
gboolean flag = TRUE;
home_dir = g_get_home_dir();
@@ -90,8 +88,13 @@
gtk_radio_button_set_group (GTK_RADIO_BUTTON
(dialog_data->selected_radio), radiobutton1_group);
radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON
(dialog_data->selected_radio));
- if (selected)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(dialog_data->selected_radio),TRUE);
+ if (archive->type != XARCHIVETYPE_RPM)
+ {
+ if (selected)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(dialog_data->selected_radio),TRUE);
+ else
+ gtk_widget_set_sensitive
(dialog_data->selected_radio,FALSE);
+ }
else
gtk_widget_set_sensitive (dialog_data->selected_radio,FALSE);
Modified: xarchiver/trunk/src/lha.c
===================================================================
--- xarchiver/trunk/src/lha.c 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/lha.c 2008-07-12 19:19:58 UTC (rev 27264)
@@ -118,6 +118,7 @@
filename = line + 51;
entry = xa_set_archive_entries_for_each_row (archive,filename,item);
+ g_print ("%s\n",entry->filename);
}
gboolean isLha ( FILE *ptr )
Modified: xarchiver/trunk/src/main.c
===================================================================
--- xarchiver/trunk/src/main.c 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/main.c 2008-07-12 19:19:58 UTC (rev 27264)
@@ -130,7 +130,7 @@
}
for (x = 1; x < argc; x++)
{
- GString *string = g_string_new ("");
+ GSList *string = NULL;
archive->full_path = 1;
archive->overwrite = 1;
gchar *escaped_path = xa_escape_bad_chars
(extract_path,"$\'`\"\\!?* ()[]&|@#:;");
@@ -169,26 +169,17 @@
{
_current_dir = g_path_get_dirname(archive_name);
chdir (_current_dir);
- g_free (_current_dir);
- GString *string = g_string_new ("");
+ g_free(_current_dir);
+ GSList *files = NULL;
if (g_file_test
(archive_name,G_FILE_TEST_EXISTS))
- {
- _current_dir =
g_path_get_basename(archive_name);
- xa_escape_filename(_current_dir,string);
- g_free (_current_dir);
- }
+ files =
g_slist_append(files,xa_escape_filename(archive_name,"$'`\"\\!?* ()[]&|:;<>#"));
for (x = 1; x< argc; x++)
{
_current_dir =
g_path_get_basename(argv[x]);
- xa_escape_filename(_current_dir,string);
+ files =
g_slist_append(files,xa_escape_filename(_current_dir,"$'`\"\\!?* ()[]&|:;<>#"));
g_free (_current_dir);
}
- if (archive->type == XARCHIVETYPE_7ZIP)
- archive->add_recurse = FALSE;
- else
- archive->add_recurse = TRUE;
- //TODO: the second NULL is a GSList you
must fill!
- xa_execute_add_commands(archive,NULL,NULL);
+ xa_execute_add_commands(archive,files,NULL);
}
}
/* Switch -a */
Modified: xarchiver/trunk/src/rpm.c
===================================================================
--- xarchiver/trunk/src/rpm.c 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/rpm.c 2008-07-12 19:19:58 UTC (rev 27264)
@@ -20,20 +20,16 @@
#include "rpm.h"
#include "string_utils.h"
-FILE *stream;
-gchar *cpio_tmp,*gzip_tmp = NULL;
-gchar tmp_dir[14] = "";
-gboolean result;
-GError *error = NULL;
-GIOChannel *ioc_cpio;
-
void xa_open_rpm (XArchive *archive)
{
unsigned char bytes[8];
unsigned short int i;
int dl,il,sigsize,offset;
gchar *ibs;
+ gchar *gzip_tmp = NULL;
GSList *list = NULL;
+ FILE *stream;
+ gboolean result;
signal (SIGPIPE, SIG_IGN);
stream = fopen ( archive->path , "r" );
@@ -112,11 +108,10 @@
{
fclose (stream);
g_free (gzip_tmp);
- xa_delete_temp_directory (archive,1);
return;
}
/* Let's decompress the gzip/bzip2 resulting file*/
- xa_open_temp_file ( tmp_dir,gzip_tmp );
+ xa_open_temp_file ( archive->tmp,gzip_tmp );
}
GChildWatchFunc *xa_open_cpio (GPid pid , gint exit_code , gpointer data)
@@ -138,8 +133,6 @@
response = xa_show_message_dialog (GTK_WINDOW
(xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_QUESTION,GTK_BUTTONS_OK_CANCEL,_("An
error occurred while decompressing the cpio archive."),_("Do you want to view
the command line output?") );
if (response == GTK_RESPONSE_OK)
xa_show_cmd_line_output (NULL);
- xa_delete_temp_directory (archive[idx],1);
- g_free (cpio_tmp);
xa_set_button_state
(1,1,GTK_WIDGET_IS_SENSITIVE(save1),GTK_WIDGET_IS_SENSITIVE(close1),0,0,0,0,0);
//TODO: xa_hide_progress_bar_stop_button(archive[idx]);
return FALSE;
@@ -152,11 +145,7 @@
xa_spawn_async_process ( archive[idx],command);
g_free(command);
if ( archive[idx]->child_pid == 0 )
- {
- xa_delete_temp_directory (archive[idx],1);
- g_free ( cpio_tmp );
return FALSE;
- }
return NULL;
}
@@ -255,12 +244,13 @@
gint current_page;
gint idx;
gchar *tmp = NULL;
+ FILE *stream;
current_page = gtk_notebook_get_current_page(notebook);
idx = xa_find_archive_index (current_page);
gchar *command = NULL;
- tmp = g_strconcat (tmp_dir,"/file.cpio",NULL);
+ tmp = g_strconcat (archive[idx]->tmp,"/file.cpio",NULL);
stream = fopen (tmp,"w");
if (stream == NULL)
@@ -280,19 +270,18 @@
if (archive[idx]->child_pid == 0)
{
fclose (stream);
- xa_delete_temp_directory (archive[idx],1);
g_free (tmp);
return;
}
GIOChannel *ioc = g_io_channel_unix_new (archive[idx]->output_fd);
g_io_channel_set_encoding (ioc,NULL,NULL);
g_io_channel_set_flags (ioc,G_IO_FLAG_NONBLOCK,NULL);
- g_io_add_watch
(ioc,G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL,ExtractToDifferentLocation,stream);
+ g_io_add_watch
(ioc,G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL,xa_extract_to_different_location,stream);
g_child_watch_add (archive[idx]->child_pid ,(GChildWatchFunc)
xa_open_cpio,tmp);
}
-gboolean ExtractToDifferentLocation (GIOChannel *ioc, GIOCondition cond,
gpointer data)
+gboolean xa_extract_to_different_location (GIOChannel *ioc, GIOCondition cond,
gpointer data)
{
FILE *stream = data;
gchar buffer[65536];
@@ -333,15 +322,27 @@
return TRUE;
}
-void xa_rpm_extract(XArchive *archive,GString *files)
+void xa_rpm_extract(XArchive *archive,GSList *files)
{
- gchar *command = NULL;
- GSList *list = NULL;
+ gchar *command = NULL,*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);
+
chdir (archive->extraction_path);
- command = g_strconcat ( "cpio -id" , files->str,"-F
",archive->tmp,"/file.cpio",NULL);
+ command = g_strconcat ( "cpio -id" , names->str," -F
",archive->tmp,"/file.cpio",NULL);
- g_string_free(files,TRUE);
+ g_string_free(names,TRUE);
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
Modified: xarchiver/trunk/src/rpm.h
===================================================================
--- xarchiver/trunk/src/rpm.h 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/rpm.h 2008-07-12 19:19:58 UTC (rev 27264)
@@ -24,9 +24,9 @@
#include "interface.h"
#include "archive.h"
-void xa_open_rpm ( XArchive *archive );
-gboolean ExtractToDifferentLocation (GIOChannel *ioc, GIOCondition cond ,
gpointer data);
-void xa_open_temp_file (gchar *tmp_dir,gchar *temp_path);
-void xa_rpm_extract(XArchive *archive,GString *files);
-void xa_get_cpio_line_content (gchar *line, gpointer data);
+void xa_open_rpm ( XArchive *);
+gboolean xa_extract_to_different_location (GIOChannel *, GIOCondition,gpointer
);
+void xa_open_temp_file (gchar *,gchar *);
+void xa_rpm_extract(XArchive *,GSList *);
+void xa_get_cpio_line_content (gchar *, gpointer );
#endif
Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/window.c 2008-07-12 19:19:58 UTC (rev 27264)
@@ -31,7 +31,6 @@
extern GList *ArchiveType;
extern GList *ArchiveSuffix;
-extern gboolean stop_flag;
extern gboolean unrar;
extern gboolean xdg_open;
extern Prefs_dialog_data *prefs_window;
@@ -49,7 +48,7 @@
gtk_widget_set_sensitive(Stop_button,FALSE);
gtk_widget_hide(viewport2);
}
- if ( WIFEXITED (status) )
+ if (WIFEXITED (status))
{
if (WEXITSTATUS (status))
{
@@ -88,12 +87,12 @@
gtk_widget_set_sensitive (comment_menu,TRUE);
else
gtk_widget_set_sensitive (comment_menu,FALSE);
-
+
xa_set_button_state
(1,1,1,1,archive->can_add,archive->can_extract,archive->has_sfx,archive->has_test,archive->has_properties);
if (archive->has_comment && archive->status ==
XA_ARCHIVESTATUS_OPEN &&
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_window->check_show_comment)))
xa_show_archive_comment (NULL, NULL);
-
+
gtk_widget_grab_focus (GTK_WIDGET(archive->treeview));
}
if (archive->status == XA_ARCHIVESTATUS_ADD || archive->status ==
XA_ARCHIVESTATUS_DELETE)
@@ -1272,8 +1271,7 @@
if (response == GTK_RESPONSE_CANCEL)
return;
}
- Update_StatusBar (_("Waiting for the process to abort..."));
- stop_flag = TRUE;
+ Update_StatusBar (_("Operation aborted."));
if (archive[idx]->child_pid)
{
kill (archive[idx]->child_pid,SIGABRT);
Modified: xarchiver/trunk/src/zip.c
===================================================================
--- xarchiver/trunk/src/zip.c 2008-07-12 15:47:37 UTC (rev 27263)
+++ xarchiver/trunk/src/zip.c 2008-07-12 19:19:58 UTC (rev 27264)
@@ -236,9 +236,7 @@
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 )
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits