Author: colossus
Date: 2008-10-15 10:54:13 +0000 (Wed, 15 Oct 2008)
New Revision: 28260

Modified:
   xarchiver/trunk/src/7zip.c
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/arj.c
   xarchiver/trunk/src/extract_dialog.c
   xarchiver/trunk/src/interface.c
   xarchiver/trunk/src/interface.h
   xarchiver/trunk/src/lha.c
   xarchiver/trunk/src/rar.c
   xarchiver/trunk/src/tar.c
   xarchiver/trunk/src/window.c
   xarchiver/trunk/src/zip.c
Log:
Code cleanup in xa_page_has_changed() in interface.c:588
Fixed crash when renaming entries in the archive.
Fixed gtk_widget_set_sensitive console messages when using switches from 
cmd-line.


Modified: xarchiver/trunk/src/7zip.c
===================================================================
--- xarchiver/trunk/src/7zip.c  2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/7zip.c  2008-10-15 10:54:13 UTC (rev 28260)
@@ -165,7 +165,7 @@
 void xa_7zip_delete (XArchive *archive,GSList *names)
 {
        gchar *command,*exe,*e_filename = NULL;
-       GSList *list = NULL;
+       GSList *list = NULL,*_names;
        GString *files = g_string_new("");
 
        if (sevenzr)
@@ -173,10 +173,6 @@
        if (sevenza)
                exe = "7za d ";
 
-       if (archive->status != XA_ARCHIVESTATUS_RENAME)
-               archive->status = XA_ARCHIVESTATUS_DELETE;
-       GSList *_names;
-       
        _names = names;
        while (_names)
        {
@@ -192,7 +188,8 @@
        list = g_slist_append(list,command);
 
        xa_run_command (archive,list);
-       xa_reload_archive_content(archive);
+       if (archive->status == XA_ARCHIVESTATUS_DELETE)
+               xa_reload_archive_content(archive);
 }
 
 void xa_7zip_add (XArchive *archive,GString *files,gchar *compression_string)

Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c       2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/archive.c       2008-10-15 10:54:13 UTC (rev 28260)
@@ -388,11 +388,11 @@
                        _commands = _commands->next;
                }
                xa_watch_child (archive->child_pid, status, archive);
+               xa_set_button_state 
(1,1,1,1,archive->can_add,archive->can_extract,archive->has_sfx,archive->has_test,archive->has_properties,1,1);
 here:
                g_slist_foreach (commands,(GFunc) g_free,NULL);
                g_slist_free(commands);
        }
-       xa_set_button_state 
(1,1,1,1,archive->can_add,archive->can_extract,archive->has_sfx,archive->has_test,archive->has_properties,1,1);
        return result;
 }
 

Modified: xarchiver/trunk/src/arj.c
===================================================================
--- xarchiver/trunk/src/arj.c   2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/arj.c   2008-10-15 10:54:13 UTC (rev 28260)
@@ -158,8 +158,6 @@
        GSList *_names;
        GString *files = g_string_new("");
 
-       if (archive->status != XA_ARCHIVESTATUS_RENAME)
-               archive->status = XA_ARCHIVESTATUS_DELETE;
        _names = names;
        while (_names)
        {
@@ -176,7 +174,8 @@
        list = g_slist_append(list,command);
 
        xa_run_command (archive,list);
-       xa_reload_archive_content(archive);
+       if (archive->status == XA_ARCHIVESTATUS_DELETE)
+               xa_reload_archive_content(archive);
 }
 
 void xa_arj_add (XArchive *archive,GString *files,gchar *compression_string)

Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c        2008-10-15 06:49:36 UTC (rev 
28259)
+++ xarchiver/trunk/src/extract_dialog.c        2008-10-15 10:54:13 UTC (rev 
28260)
@@ -306,7 +306,6 @@
                        {
                                gtk_widget_set_sensitive (Stop_button,FALSE);
                                xa_set_button_state 
(1,1,GTK_WIDGET_IS_SENSITIVE(save1),GTK_WIDGET_IS_SENSITIVE(close1),0,0,0,0,0,0,0);
-                               archive->status = XA_ARCHIVESTATUS_IDLE;
                        }
                        break;
 
@@ -733,7 +732,7 @@
                else
                        full_path = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->full_path));
                filename = g_strconcat (path,"/",file,NULL);
-               xa_increase_progress_bar(pb_struct,filename,percent,TRUE);
+               xa_increase_progress_bar(pb_struct,filename,percent);
                g_free(file);
                g_free(path);
                message = 
xa_multi_extract_archive(dialog,filename,overwrite,full_path,dest_path);

Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c     2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/interface.c     2008-10-15 10:54:13 UTC (rev 28260)
@@ -587,33 +587,17 @@
 
 void xa_page_has_changed (GtkNotebook *notebook,GtkNotebookPage *page,guint 
page_num,gpointer user_data)
 {
-       gint id;
+       gint id,selected = 0;
        GtkTreeSelection *selection = NULL;
 
        id = xa_find_archive_index (page_num);
        if (id == -1)
                return;
 
-       if (archive[id]->treeview != NULL)
-               selection = gtk_tree_view_get_selection (GTK_TREE_VIEW 
(archive[id]->treeview));
        xa_set_window_title (xa_main_window,archive[id]->path);
-
-       if (archive[id]->child_pid)
-       {
-               if (archive[id]->status == XA_ARCHIVESTATUS_IDLE)
-               {
-                       gtk_widget_set_sensitive (Stop_button,FALSE);
-                       goto here;
-               }
-               xa_set_button_state (0,0,0,0,0,0,0,0,0,0,0);
-               gtk_widget_set_sensitive (Stop_button,TRUE);
-               return;
-       }
-       xa_set_button_state 
(1,1,1,GTK_WIDGET_IS_SENSITIVE(close1),archive[id]->can_add,archive[id]->can_extract,archive[id]->has_sfx,archive[id]->has_test,archive[id]->has_properties,archive[id]->has_passwd,1);
-
-here:
        xa_restore_navigation(id);
        xa_set_statusbar_message_for_displayed_rows(archive[id]);
+
        if (selection != NULL)
                xa_row_selected(selection,archive[id]);
 
@@ -626,9 +610,11 @@
                        gtk_widget_set_sensitive (password_entry_menu,FALSE);
                else
                        gtk_widget_set_sensitive (password_entry_menu,TRUE);
-       if (archive[id]->status != XA_ARCHIVESTATUS_OPEN && 
archive[id]->treeview != NULL)
+
+       if (archive[id]->treeview != NULL)
        {
-               gint selected = gtk_tree_selection_count_selected_rows 
(selection);
+               selection = gtk_tree_view_get_selection (GTK_TREE_VIEW 
(archive[id]->treeview));
+               selected = gtk_tree_selection_count_selected_rows (selection);
                if (selected == 0)
                {
                        xa_disable_delete_buttons (FALSE);
@@ -1555,21 +1541,16 @@
        return pb;
 }
 
-void xa_increase_progress_bar(Progress_bar_data *pb,gchar *archive_name,double 
percent,gboolean multi_extract)
+void xa_increase_progress_bar(Progress_bar_data *pb,gchar *archive_name,double 
percent)
 {
        gchar *message = NULL;
 
        gtk_label_set_text(GTK_LABEL(pb->archive_label),archive_name);
-       if (multi_extract)
-       {
-               gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR 
(pb->progressbar1),percent);
-               message = g_strdup_printf("%.0f%%",(percent*100));
-               gtk_progress_bar_set_text 
(GTK_PROGRESS_BAR(pb->progressbar1),message);
-               g_free(message);
-       }
-       else
-               //gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR 
(pb->progressbar1),0);
-               gtk_progress_bar_pulse(GTK_PROGRESS_BAR(pb->progressbar1));
+       gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR 
(pb->progressbar1),percent);
+       message = g_strdup_printf("%.0f%%",(percent*100));
+       gtk_progress_bar_set_text (GTK_PROGRESS_BAR(pb->progressbar1),message);
+       g_free(message);
+
        while (gtk_events_pending())
                gtk_main_iteration();
 }
@@ -1581,3 +1562,17 @@
         * new icon_theme. xa_get_pixbuf_icon_from_cache() is to be called as 
many
         * time as the filenames currently displayed. What of the other tabs 
then? */   
 }
+
+gboolean xa_progress_bar_pulse_function(Progress_bar_data *pb)
+{
+       if (pb != NULL)
+       {
+               while (gtk_events_pending())
+                       gtk_main_iteration();
+               gtk_progress_bar_pulse(GTK_PROGRESS_BAR(pb->progressbar1));
+               return TRUE;
+       }
+       else
+               return FALSE;
+               
+}

Modified: xarchiver/trunk/src/interface.h
===================================================================
--- xarchiver/trunk/src/interface.h     2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/interface.h     2008-10-15 10:54:13 UTC (rev 28260)
@@ -67,10 +67,11 @@
 void xa_restore_navigation(int idx);
 void xa_disable_delete_buttons (gboolean);
 void xa_sidepane_row_expanded(GtkTreeView *,GtkTreeIter *,GtkTreePath 
*,gpointer );
-void xa_sidepane_drag_data_received ( GtkWidget*,GdkDragContext *,int x,int 
y,GtkSelectionData *, unsigned int info,unsigned int time,gpointer );
+void xa_sidepane_drag_data_received ( GtkWidget*,GdkDragContext *, int x, int 
y, GtkSelectionData *, unsigned int, unsigned int, gpointer );
 gboolean xa_sidepane_drag_motion_expand_timeout (GtkTreePath **);
 gboolean xa_sidepane_drag_motion ( GtkWidget*,GdkDragContext *,gint x,gint 
y,guint ,gpointer );
 Progress_bar_data *xa_create_progress_bar();
-void xa_increase_progress_bar(Progress_bar_data *,gchar *,double ,gboolean );
+void xa_increase_progress_bar(Progress_bar_data *,gchar *,double);
 void xa_icon_theme_changed (GtkIconTheme *,gpointer );
+gboolean xa_progress_bar_pulse_function(Progress_bar_data *);
 #endif

Modified: xarchiver/trunk/src/lha.c
===================================================================
--- xarchiver/trunk/src/lha.c   2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/lha.c   2008-10-15 10:54:13 UTC (rev 28260)
@@ -137,13 +137,9 @@
 void xa_lha_delete (XArchive *archive,GSList *names)
 {
        gchar *command,*e_filename = NULL;
-       GSList *list = NULL;
+       GSList *list = NULL,*_names;
        GString *files = g_string_new("");
 
-       if (archive->status != XA_ARCHIVESTATUS_RENAME)
-               archive->status = XA_ARCHIVESTATUS_DELETE;
-       GSList *_names;
-
        _names = names;
        while (_names)
        {
@@ -160,7 +156,8 @@
        list = g_slist_append(list,command);
 
        xa_run_command (archive,list);
-       xa_reload_archive_content(archive);
+       if (archive->status == XA_ARCHIVESTATUS_DELETE)
+               xa_reload_archive_content(archive);
 }
 
 void xa_lha_add (XArchive *archive,GString *files,gchar *compression_string)

Modified: xarchiver/trunk/src/rar.c
===================================================================
--- xarchiver/trunk/src/rar.c   2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/rar.c   2008-10-15 10:54:13 UTC (rev 28260)
@@ -225,13 +225,9 @@
 void xa_rar_delete (XArchive *archive,GSList *names)
 {
        gchar *command,*e_filename = NULL;
-       GSList *list = NULL;
+       GSList *list = NULL,*_names;
        GString *files = g_string_new("");
 
-       if (archive->status != XA_ARCHIVESTATUS_RENAME)
-               archive->status = XA_ARCHIVESTATUS_DELETE;
-       GSList *_names;
-       
        _names = names;
        while (_names)
        {
@@ -248,7 +244,8 @@
        list = g_slist_append(list,command);
 
        xa_run_command (archive,list);
-       xa_reload_archive_content(archive);
+       if (archive->status == XA_ARCHIVESTATUS_DELETE)
+               xa_reload_archive_content(archive);
 }
 
 void xa_rar_add (XArchive *archive,GString *files,gchar *compression_string)

Modified: xarchiver/trunk/src/tar.c
===================================================================
--- xarchiver/trunk/src/tar.c   2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/tar.c   2008-10-15 10:54:13 UTC (rev 28260)
@@ -157,9 +157,7 @@
        gchar *e_filename,*command = NULL;
        GSList *_files,*list = NULL;
        GString *names = g_string_new("");
-       
-       if (archive->status != XA_ARCHIVESTATUS_RENAME)
-               archive->status = XA_ARCHIVESTATUS_DELETE;
+
        _files = files;
        while (_files)
        {
@@ -178,6 +176,8 @@
                command = g_strconcat (tar, " --delete -vf 
",archive->escaped_path," ",names->str,NULL);
                list = g_slist_append(list,command);
                xa_run_command (archive,list);
+               if (archive->status == XA_ARCHIVESTATUS_DELETE)
+                       xa_reload_archive_content(archive);
        }
 }
 
@@ -430,7 +430,8 @@
        command = g_strconcat ("mv ",archive->tmp,"/",filename," 
",archive->escaped_path,NULL);
        list = g_slist_append(list,command);
        xa_run_command (archive,list);
-       xa_reload_archive_content(archive);
+       if (archive->status == XA_ARCHIVESTATUS_DELETE || archive->status == 
XA_ARCHIVESTATUS_ADD)
+               xa_reload_archive_content(archive);
 }
 
 gboolean is_tar_compressed (gint type)

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c        2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/window.c        2008-10-15 10:54:13 UTC (rev 28260)
@@ -115,7 +115,7 @@
 
        if (archive->status == XA_ARCHIVESTATUS_OPEN)
                xa_set_button_state 
(1,1,1,1,archive->can_add,archive->can_extract,archive->has_sfx,archive->has_test,archive->has_properties,1,1);
-       archive->status = XA_ARCHIVESTATUS_IDLE;
+
        gtk_label_set_text(GTK_LABEL(total_label),"");
 }
 
@@ -731,6 +731,7 @@
                if (response == GTK_RESPONSE_CANCEL || response == 
GTK_RESPONSE_DELETE_EVENT)
                        return;
        }
+       archive[id]->status = XA_ARCHIVESTATUS_DELETE;
        (*archive[id]->delete) (archive[id],list);
 }
 
@@ -1259,7 +1260,7 @@
        archive->liststore = gtk_list_store_newv ( archive->nc+2 
,archive->column_types);
        gtk_tree_view_set_model ( GTK_TREE_VIEW 
(archive->treeview),GTK_TREE_MODEL (archive->liststore));
 
-       archive->model = 
gtk_tree_view_get_model(GTK_TREE_VIEW(archive->treeview));
+       archive->model = GTK_TREE_MODEL(archive->liststore);
        if 
(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_window->check_sort_filename_column)))
                
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(archive->model),1,GTK_SORT_ASCENDING);
        
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(archive->liststore),1,xa_sort_dirs_before_files,archive,NULL);
@@ -1349,7 +1350,6 @@
                                archive[idx]->has_passwd = FALSE;
 
                gtk_label_set_text(GTK_LABEL(total_label),"");
-               archive[idx]->status = XA_ARCHIVESTATUS_IDLE;
        }
 }
 
@@ -1741,7 +1741,6 @@
        }
        g_list_foreach (row_list,(GFunc) gtk_tree_path_free,NULL);
        g_list_free (row_list);
-       archive->status = XA_ARCHIVESTATUS_IDLE;
 }
 
 void on_drag_data_received (GtkWidget *widget,GdkDragContext *context,int 
x,int y,GtkSelectionData *data,unsigned int info,unsigned int time,gpointer 
user_data)

Modified: xarchiver/trunk/src/zip.c
===================================================================
--- xarchiver/trunk/src/zip.c   2008-10-15 06:49:36 UTC (rev 28259)
+++ xarchiver/trunk/src/zip.c   2008-10-15 10:54:13 UTC (rev 28260)
@@ -182,15 +182,14 @@
        GSList *list = NULL;
        GString *files = g_string_new("");
        
-       if (archive->status != XA_ARCHIVESTATUS_RENAME)
-               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);
-
        xa_run_command (archive,list);
-       xa_reload_archive_content(archive);
+
+       if (archive->status == XA_ARCHIVESTATUS_DELETE)
+               xa_reload_archive_content(archive);
 }
 
 void xa_zip_add (XArchive *archive,GString *files,gchar *compression_string)

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to