Author: colossus
Date: 2008-06-01 18:03:37 +0000 (Sun, 01 Jun 2008)
New Revision: 27006
Modified:
xarchiver/trunk/src/archive.c
xarchiver/trunk/src/bzip2.c
xarchiver/trunk/src/interface.c
xarchiver/trunk/src/main.c
xarchiver/trunk/src/window.c
Log:
Fixed bug #4102.
Applied patch from Bruno Jesus to avoid gtk-warning when using switch from
console.
Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c 2008-06-01 10:45:42 UTC (rev 27005)
+++ xarchiver/trunk/src/archive.c 2008-06-01 18:03:37 UTC (rev 27006)
@@ -237,7 +237,8 @@
if (archive->tmp != NULL)
{
xa_delete_temp_directory (archive,0);
- gtk_widget_hide(viewport2);
+ if(MainWindow)
+ gtk_widget_hide(viewport2);
g_free (archive->tmp);
archive->tmp = NULL;
}
@@ -283,8 +284,11 @@
if (mkdtemp (tmp_dir) == 0)
{
response = xa_show_message_dialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't create
temporary directory in /tmp:"),g_strerror(errno) );
- gtk_widget_set_sensitive (Stop_button, FALSE);
- Update_StatusBar (_("Operation failed."));
+ if(MainWindow) //avoid if we're on console
+ {
+ gtk_widget_set_sensitive (Stop_button, FALSE);
+ Update_StatusBar (_("Operation failed."));
+ }
return FALSE;
}
archive->tmp = strdup(tmp_dir);
@@ -300,7 +304,8 @@
GSList *_commands = commands;
archive->parse_output = 0;
- gtk_widget_show (viewport2);
+ if(MainWindow)
+ gtk_widget_show (viewport2);
while (_commands)
{
g_print ("%s\n",(gchar*)_commands->data);
@@ -314,6 +319,8 @@
break;
else if(MainWindow) //avoid if we are on console
gtk_main_iteration_do (FALSE);
+
+ usleep(1000); //give the processor time to rest (0.1
sec)
}
result = xa_check_child_for_error_on_exit(archive,status);
if (result == FALSE)
Modified: xarchiver/trunk/src/bzip2.c
===================================================================
--- xarchiver/trunk/src/bzip2.c 2008-06-01 10:45:42 UTC (rev 27005)
+++ xarchiver/trunk/src/bzip2.c 2008-06-01 18:03:37 UTC (rev 27006)
@@ -170,7 +170,7 @@
void lzma_gzip_bzip2_extract (XArchive *archive)
{
GSList *list = NULL;
- gchar *command,*executable = NULL,*filename = NULL;
+ gchar *command,*executable = NULL,*filename = NULL, *dot = NULL,
*filename_noext = NULL;
gchar tmp_dir[14] = "";
gboolean result = FALSE;
@@ -178,15 +178,15 @@
{
case XARCHIVETYPE_BZIP2:
executable = "bzip2 -f -d ";
- filename = "dummy.bz2";
+ filename = archive->escaped_path;
break;
case XARCHIVETYPE_GZIP:
executable = "gzip -f -d -n ";
- filename = "dummy.gz";
+ filename = archive->escaped_path;
break;
case XARCHIVETYPE_LZMA:
executable = "lzma -f -d ";
- filename = "dummy.lzma";
+ filename = archive->escaped_path;
break;
default:
@@ -197,7 +197,7 @@
if (result == 0)
return;
//TODO: fix the crash when viewing a bzip2 compressed file
- if (MainWindow && extract_window)
+ if (extract_window)
{
archive->extraction_path = g_strdup (gtk_entry_get_text
(GTK_ENTRY (extract_window->destination_path_entry)));
@@ -207,7 +207,17 @@
command =
g_strconcat(executable,archive->tmp,"/",filename,NULL);
list = g_slist_append(list,command);
- command = g_strconcat("mv -f ",archive->tmp,"/dummy
",archive->extraction_path,"/",archive->root_entry->child->filename,NULL);
+ if (MainWindow)
+ command = g_strconcat("mv -f ",archive->tmp,"
",archive->extraction_path,"/",archive->root_entry->child->filename,NULL);
+ else
+ {
+ 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);
+ g_free(filename_noext);
+ }
+
list = g_slist_append(list,command);
result = xa_run_command (archive,list);
}
Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c 2008-06-01 10:45:42 UTC (rev 27005)
+++ xarchiver/trunk/src/interface.c 2008-06-01 18:03:37 UTC (rev 27006)
@@ -458,6 +458,8 @@
int xa_progressbar_pulse (gpointer data)
{
+ if ( ! MainWindow)
+ return;
if ( ! GTK_WIDGET_VISIBLE(viewport2) )
return FALSE;
Modified: xarchiver/trunk/src/main.c
===================================================================
--- xarchiver/trunk/src/main.c 2008-06-01 10:45:42 UTC (rev 27005)
+++ xarchiver/trunk/src/main.c 2008-06-01 18:03:37 UTC (rev 27006)
@@ -420,7 +420,7 @@
XArchiveType type;
type = xa_detect_archive_type (filename);
- if (type == -2)
+ if (type == -1 || type == -2)
return NULL;
archive = xa_init_archive_structure ();
Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c 2008-06-01 10:45:42 UTC (rev 27005)
+++ xarchiver/trunk/src/window.c 2008-06-01 18:03:37 UTC (rev 27006)
@@ -131,36 +131,50 @@
void xa_archive_operation_finished(XArchive *archive,gboolean error)
{
- gtk_widget_set_sensitive(Stop_button,FALSE);
- gtk_widget_hide(viewport2);
+ if(MainWindow)
+ {
+ gtk_widget_set_sensitive(Stop_button,FALSE);
+ gtk_widget_hide(viewport2);
+ }
+
if (archive->status == XA_ARCHIVESTATUS_ADD || archive->status ==
XA_ARCHIVESTATUS_DELETE)
{
xa_reload_archive_content(archive);
return;
}
- if (archive->has_comment)
- gtk_widget_set_sensitive (comment_menu,TRUE);
- else
- gtk_widget_set_sensitive (comment_menu,FALSE);
- 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);
+ if(MainWindow)
+ {
+ if (archive->has_comment)
+ gtk_widget_set_sensitive (comment_menu,TRUE);
+ else
+ gtk_widget_set_sensitive (comment_menu,FALSE);
+ 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);
+ }
+
if (archive->status == XA_ARCHIVESTATUS_SFX && archive->type ==
XARCHIVETYPE_RAR)
{
- gtk_widget_set_sensitive ( exe_menu, FALSE);
+ if(MainWindow)
+ gtk_widget_set_sensitive ( exe_menu, FALSE);
response = xa_show_message_dialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_INFO,GTK_BUTTONS_OK,_("The sfx
archive was saved as:"),archive->tmp );
}
- xa_set_button_state
(1,1,1,archive->can_add,archive->can_extract,archive->has_sfx,archive->has_test,archive->has_properties);
- if (error)
- Update_StatusBar ( _("Operation completed."));
- else
- Update_StatusBar ( _("Operation failed!"));
+ if(MainWindow)
+ {
+ xa_set_button_state
(1,1,1,archive->can_add,archive->can_extract,archive->has_sfx,archive->has_test,archive->has_properties);
+ if (error)
+ Update_StatusBar ( _("Operation completed."));
+ else
+ Update_StatusBar ( _("Operation failed!"));
+ }
+
if (archive->status == XA_ARCHIVESTATUS_TEST)
xa_show_cmd_line_output (NULL);
- gtk_widget_grab_focus (GTK_WIDGET(archive->treeview));
+ if(MainWindow)
+ gtk_widget_grab_focus (GTK_WIDGET(archive->treeview));
archive->status = XA_ARCHIVESTATUS_IDLE;
}
@@ -934,7 +948,7 @@
void xa_about (GtkMenuItem *menuitem, gpointer user_data)
{
static GtkWidget *about = NULL;
- const char *authors[] = {"\nMain developer:\nGiuseppe Torelli <[EMAIL
PROTECTED]>\n\nArchive navigation code:\nJohn Berthels\n\nLHA and DEB
support:\nŁukasz Zemczak <[EMAIL PROTECTED]>\n\nLZMA support:\nThomas Dy
<[EMAIL PROTECTED]>\n",NULL};
+ const char *authors[] = {"\nMain developer:\nGiuseppe Torelli <[EMAIL
PROTECTED]>\n\nArchive navigation code:\nJohn Berthels\n\nCode fixing:\nBruno
Jesus <[EMAIL PROTECTED]>\n\nLHA and DEB support:\nŁukasz Zemczak <[EMAIL
PROTECTED]>\n\nLZMA support:\nThomas Dy <[EMAIL PROTECTED]>\n",NULL};
const char *documenters[] = {"\nSpecial thanks to Bjoern Martensen
for\nbugs hunting and Xarchiver Tango logo.\n\nThanks to:\nBenedikt
Meurer\nStephan Arts\nEnrico Tröger\nUracile for the stunning logo\n", NULL};
if (about == NULL)
@@ -1077,7 +1091,7 @@
{
FILE *dummy_ptr = NULL;
int xx = -1;
- unsigned char magic[14];
+ unsigned char magic[14]={0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* avoid
problems with garbage */
if (filename != NULL)
dummy_ptr = fopen (filename,"r");
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits