Author: colossus
Date: 2008-07-18 22:40:02 +0000 (Fri, 18 Jul 2008)
New Revision: 27346
Modified:
xarchiver/trunk/TODO
xarchiver/trunk/src/7zip.c
xarchiver/trunk/src/7zip.h
xarchiver/trunk/src/archive.c
xarchiver/trunk/src/interface.c
xarchiver/trunk/src/interface.h
xarchiver/trunk/src/window.c
xarchiver/trunk/src/window.h
Log:
Fixed the "recursing bug" when adding with 7z.
Removed the question asking whether to see the archiver error message.
Updated TODO file.
Modified: xarchiver/trunk/TODO
===================================================================
--- xarchiver/trunk/TODO 2008-07-18 19:47:39 UTC (rev 27345)
+++ xarchiver/trunk/TODO 2008-07-18 22:40:02 UTC (rev 27346)
@@ -1,7 +1,6 @@
- fix store output when test archives
- fix segfault in xa_launch_external_command
-- 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
+- recurse with opendir 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.
@@ -9,3 +8,4 @@
- support tar on *BSD.
- avoid reset of extract dialog options when loading a new archive.
- ability to create sfx archives through the Add dialog for those archives
which support it.
+- have two real status bars with displayed number of dirs.
Modified: xarchiver/trunk/src/7zip.c
===================================================================
--- xarchiver/trunk/src/7zip.c 2008-07-18 19:47:39 UTC (rev 27345)
+++ xarchiver/trunk/src/7zip.c 2008-07-18 22:40:02 UTC (rev 27346)
@@ -19,6 +19,7 @@
#include "config.h"
#include <string.h>
#include <unistd.h>
+#include <dirent.h>
#include "7zip.h"
extern gboolean sevenzr;
@@ -197,6 +198,7 @@
void xa_7zip_add (XArchive *archive,GSList *names,gchar *compression_string)
{
GSList *list = NULL;
+ GSList *dirlist;
gchar *command,*exe = NULL;
GString *files = g_string_new("");
@@ -205,7 +207,12 @@
if (sevenza)
exe = "7za ";
- xa_cat_filenames(archive,names,files);
+ while (names)
+ {
+
xa_7zip_recurse_local_directory((gchar*)names->data,&dirlist,archive->add_recurse);
+ names = names->next;
+ }
+ xa_cat_filenames(archive,dirlist,files);
g_slist_foreach(names,(GFunc)g_free,NULL);
g_slist_free(names);
@@ -219,16 +226,14 @@
archive->update
? "u " : "a ",
archive->solid_archive ? "-ms=on " : "-ms=off ",
"-p" ,
archive->passwd, " ",
-
archive->escaped_path,
-
archive->add_recurse ? " -r " : " ",
+
archive->escaped_path," ",
"-mx=",compression_string,"",
files->str,NULL);
else
command = g_strconcat ( exe,
archive->update
? "u " : "a ",
archive->solid_archive ? "-ms=on " : "-ms=off ",
-
archive->escaped_path,
-
archive->add_recurse ? " -r " : " ",
+
archive->escaped_path," ",
"-mx=",compression_string,"",
files->str,NULL);
g_string_free(files,TRUE);
@@ -285,3 +290,28 @@
list = g_slist_append(list,command);
xa_run_command (archive,list);
}
+
+void xa_7zip_recurse_local_directory(gchar *path,GSList **list,gboolean
recurse)
+{
+ DIR *dir;
+ struct dirent *dirlist;
+ gchar *fullname = NULL;
+
+ dir = opendir(path);
+
+ if (dir == NULL)
+ return;
+ *list = g_slist_append(*list,path);
+ if (recurse)
+ {
+ while ((dirlist = readdir(dir)))
+ {
+ if (dirlist->d_name[0] == '.')
+ continue;
+ fullname = g_strconcat (path,"/",dirlist->d_name,NULL);
+ if (g_file_test(fullname,G_FILE_TEST_IS_DIR))
+
xa_7zip_recurse_local_directory(fullname,list,recurse);
+ }
+ }
+ closedir(dir);
+}
Modified: xarchiver/trunk/src/7zip.h
===================================================================
--- xarchiver/trunk/src/7zip.h 2008-07-18 19:47:39 UTC (rev 27345)
+++ xarchiver/trunk/src/7zip.h 2008-07-18 22:40:02 UTC (rev 27346)
@@ -30,6 +30,7 @@
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);
+void xa_open_7zip (XArchive *);
+void xa_get_7zip_line_content (gchar *, gpointer );
+void xa_7zip_recurse_local_directory(gchar *,GSList **,gboolean);
#endif
Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c 2008-07-18 19:47:39 UTC (rev 27345)
+++ xarchiver/trunk/src/archive.c 2008-07-18 22:40:02 UTC (rev 27346)
@@ -94,10 +94,7 @@
ioc = g_io_channel_unix_new (archive->output_fd);
g_io_channel_set_encoding (ioc, NULL , NULL);
g_io_channel_set_flags ( ioc , G_IO_FLAG_NONBLOCK , NULL );
- }
- if (archive->parse_output)
- {
g_io_add_watch (ioc,
G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, xa_process_output, archive);
g_child_watch_add (archive->child_pid,
(GChildWatchFunc)xa_watch_child, archive);
}
Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c 2008-07-18 19:47:39 UTC (rev 27345)
+++ xarchiver/trunk/src/interface.c 2008-07-18 22:40:02 UTC (rev 27346)
@@ -1412,3 +1412,82 @@
gdk_drag_status (context, context->suggested_action, time);
return TRUE;
}
+
+void xa_show_cmd_line_output(GtkMenuItem *menuitem)
+{
+ GSList *output = NULL;
+ gchar *line = NULL;
+ gchar *utf8_line;
+ gsize bytes_written;
+ GtkWidget *dialog,*label,*image,*hbox,*vbox,*textview,*scrolledwindow;
+ GtkTextBuffer *textbuffer;
+ GtkTextIter iter;
+ gint current_page;
+ gint idx;
+
+ current_page = gtk_notebook_get_current_page(notebook);
+ idx = xa_find_archive_index (current_page);
+
+ dialog = gtk_dialog_new_with_buttons ("",
+
GTK_WINDOW(xa_main_window),GTK_DIALOG_MODAL,GTK_STOCK_OK, GTK_RESPONSE_OK,NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG
(dialog)->vbox), 6);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 8);
+ gtk_widget_set_size_request (dialog, 400, -1);
+
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR,
GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+
+ label = gtk_label_new (_("An error occurred while working on the
archive:"));
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+
+ scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), 4);
+ g_object_set (G_OBJECT (scrolledwindow),"hscrollbar-policy",
GTK_POLICY_AUTOMATIC,"shadow-type", GTK_SHADOW_IN,"vscrollbar-policy",
GTK_POLICY_AUTOMATIC, NULL);
+
+ textbuffer = gtk_text_buffer_new (NULL);
+ gtk_text_buffer_create_tag (textbuffer, "font","family", "monospace",
NULL);
+ gtk_text_buffer_get_iter_at_offset (textbuffer, &iter, 0);
+
+ textview = gtk_text_view_new_with_buffer (textbuffer);
+ g_object_unref (textbuffer);
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
+ gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview), FALSE);
+
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+
+ hbox = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (hbox), image,FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label,FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox,TRUE, TRUE, 0);
+ hbox = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox,TRUE, TRUE, 0);
+
+ gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
+ gtk_box_pack_start (GTK_BOX (vbox), scrolledwindow,FALSE, FALSE,0);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),vbox,FALSE,
FALSE, 0);
+
+ if ( ! archive[idx]->list_reversed)
+ {
+ archive[idx]->error_output =
g_slist_reverse(archive[idx]->error_output);
+ archive[idx]->list_reversed = TRUE;
+ }
+ output = archive[idx]->error_output;
+ while (output)
+ {
+ line = output->data;
+ utf8_line = g_locale_to_utf8 (line, -1, NULL, &bytes_written,
NULL);
+ gtk_text_buffer_insert_with_tags_by_name (textbuffer, &iter,
utf8_line, bytes_written, "font", NULL);
+ g_free (utf8_line);
+ output = output->next;
+ }
+ gtk_widget_show_all (vbox);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
Modified: xarchiver/trunk/src/interface.h
===================================================================
--- xarchiver/trunk/src/interface.h 2008-07-18 19:47:39 UTC (rev 27345)
+++ xarchiver/trunk/src/interface.h 2008-07-18 22:40:02 UTC (rev 27346)
@@ -142,4 +142,5 @@
void xa_sidepane_drag_data_received (GtkWidget *,GdkDragContext *,int x,int
y,GtkSelectionData *, unsigned int info,unsigned int time,gpointer );
gboolean xa_sidepane_drag_motion_expand_timeout (GtkTreePath **);
gboolean xa_sidepane_drag_motion (GtkWidget *,GdkDragContext *,gint x,gint
y,guint ,gpointer );
+void xa_show_cmd_line_output(GtkMenuItem *menuitem);
#endif
Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c 2008-07-18 19:47:39 UTC (rev 27345)
+++ xarchiver/trunk/src/window.c 2008-07-18 22:40:02 UTC (rev 27346)
@@ -60,9 +60,7 @@
return FALSE;
}
xa_set_button_state
(1,1,1,1,archive->can_add,archive->can_extract,0,archive->has_test,archive->has_properties);
- response =
xa_show_message_dialog(GTK_WINDOW(xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_QUESTION,GTK_BUTTONS_OK_CANCEL,_("An
error occurred while accessing the archive."),_("Do you want to view the
command line output?") );
- if (response == GTK_RESPONSE_OK)
- xa_show_cmd_line_output (NULL);
+ xa_show_cmd_line_output (NULL);
/* In case the user supplies a wrong password we reset
it so he can try again */
if ( (archive->status == XA_ARCHIVESTATUS_TEST ||
archive->status == XA_ARCHIVESTATUS_SFX) && archive->passwd != NULL)
{
@@ -1220,43 +1218,6 @@
return result;
}
-void xa_show_cmd_line_output (GtkMenuItem *menuitem)
-{
- GSList *output = NULL;
- widget_data *xa_cmd_line_output = NULL;
- gchar *line = NULL;
- gchar *utf8_line;
- gsize bytes_written;
- gint current_page;
- gint idx;
-
- current_page = gtk_notebook_get_current_page (notebook);
- idx = xa_find_archive_index (current_page);
-
- if (archive[idx] == NULL)
- return;
- xa_cmd_line_output = xa_create_output_window(_("Command line output"));
-
- if ( ! archive[idx]->list_reversed)
- {
- archive[idx]->error_output =
g_slist_reverse(archive[idx]->error_output);
- archive[idx]->list_reversed = TRUE;
- }
-
- output = archive[idx]->error_output;
- while (output)
- {
- line = output->data;
- utf8_line = g_locale_to_utf8 (line, -1, NULL, &bytes_written,
NULL);
- gtk_text_buffer_insert_with_tags_by_name
(xa_cmd_line_output->textbuffer, &xa_cmd_line_output->iter, utf8_line,
bytes_written, "font", NULL);
- g_free (utf8_line);
- output = output->next;
- }
- gtk_dialog_run (GTK_DIALOG(xa_cmd_line_output->dialog1));
- gtk_widget_destroy (xa_cmd_line_output->dialog1);
- g_free(xa_cmd_line_output);
-}
-
void xa_cancel_archive (GtkMenuItem *menuitem,gpointer data)
{
gint current_page;
Modified: xarchiver/trunk/src/window.h
===================================================================
--- xarchiver/trunk/src/window.h 2008-07-18 19:47:39 UTC (rev 27345)
+++ xarchiver/trunk/src/window.h 2008-07-18 22:40:02 UTC (rev 27346)
@@ -77,7 +77,6 @@
void xa_select_all ( GtkMenuItem *, gpointer);
void xa_deselect_all ( GtkMenuItem *, gpointer);
void xa_show_archive_comment ( GtkMenuItem *, gpointer);
-void xa_show_cmd_line_output( GtkMenuItem * );
void xa_archive_properties ( GtkMenuItem * , gpointer);
void xa_view_file_inside_archive ( GtkMenuItem * , gpointer);
void xa_cancel_archive ( GtkMenuItem * , gpointer);
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits