[Xfce4-commits] r26143 - xarchiver/trunk/src

Giuseppe Torelli colossus at xfce.org
Wed Oct 17 22:15:58 CEST 2007


Author: colossus
Date: 2007-10-17 20:15:58 +0000 (Wed, 17 Oct 2007)
New Revision: 26143

Modified:
   xarchiver/trunk/src/7zip.c
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/archive.h
   xarchiver/trunk/src/arj.c
   xarchiver/trunk/src/bzip2.c
   xarchiver/trunk/src/extract_dialog.c
   xarchiver/trunk/src/gzip.c
   xarchiver/trunk/src/rar.c
   xarchiver/trunk/src/tar.c
   xarchiver/trunk/src/window.c
   xarchiver/trunk/src/zip.c
Log:
Fixed archive navigation code to display directory with same names. 


Modified: xarchiver/trunk/src/7zip.c
===================================================================
--- xarchiver/trunk/src/7zip.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/7zip.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -41,19 +41,19 @@
 	archive->nr_of_files = 0;
 	archive->nr_of_dirs = 0;
 	archive->format ="7-ZIP";
-	archive->nc = 5;
+	archive->nc = 6;
 	archive->parse_output = xa_get_7zip_line_content;
 	xa_spawn_async_process (archive,command,0);
 	g_free ( command );
 	if ( archive->child_pid == 0 )
 		return;
 
-	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING};
+	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER};
 	archive->column_types = g_malloc0(sizeof(types));
-	for (i = 0; i < 7; i++)
+	for (i = 0; i < 8; i++)
 		archive->column_types[i] = types[i];
 
-	char *names[]= {(_("Original")),(_("Compressed")),(_("Attr")),(_("Time")),(_("Date"))};
+	char *names[]= {(_("Original")),(_("Compressed")),(_("Attr")),(_("Time")),(_("Date")),NULL};
 	xa_create_liststore (archive,names);
 }
 

Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/archive.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -28,8 +28,13 @@
 
 XArchive *xa_init_archive_structure ()
 {
+	XEntry *entry = NULL;
 	XArchive *archive = NULL;
+
 	archive = g_new0(XArchive,1);
+	entry = g_new0(XEntry,1);
+	entry->filename = "";
+	archive->root_entry = entry;
 	return archive;
 }
 
@@ -164,18 +169,13 @@
 
 void xa_clean_archive_structure (XArchive *archive)
 {
-	GSList *s = NULL;
 	XEntry *entry;
 
 	if (archive == NULL)
 		return;
 
-	s = archive->entries;
-	for (; s; s = s->next)
-	{
-		entry = s->data;
-		xa_free_entry (archive,entry);
-	}
+	entry = archive->root_entry;
+	xa_free_entry (archive,entry);
 	
 	if (archive->column_types != NULL)
 		g_free(archive->column_types);
@@ -213,7 +213,7 @@
 	}
 
 	if (archive->extraction_path != NULL)
-			g_free (archive->extraction_path);
+		g_free (archive->extraction_path);
 
 	if (archive->has_comment)
 	{
@@ -223,7 +223,6 @@
 			archive->comment = NULL;
 		}
 	}
-	g_slist_free (archive->entries);
 	g_free (archive);
 }
 
@@ -348,30 +347,43 @@
 
 	current_column = entry->columns;
 
-	for (i = 0; i < archive->nc; i++)
+	if (strlen(entry->filename) > 0)
 	{
-		switch(archive->column_types[i+2])
+		for (i = 0; i < archive->nc; i++)
 		{
-			case G_TYPE_STRING:
-				g_free (*((gchar **)current_column));
-				current_column += sizeof(gchar *);
-			break;
+			switch(archive->column_types[i+2])
+			{
+				case G_TYPE_STRING:
+					g_free (*((gchar **)current_column));
+					current_column += sizeof(gchar *);
+				break;
 
-			case G_TYPE_UINT64:
-				current_column += sizeof(guint64);
-			break;
+				case G_TYPE_UINT64:
+					current_column += sizeof(guint64);
+				break;
+			}
 		}
+		g_free(entry->columns);
+		g_free(entry->filename);
 	}
-	g_free(entry->columns);
-	g_free(entry->filename);
 	g_free(entry);
 }
 
-XEntry *xa_find_archive_entry(XEntry *entry, gchar *string)
+XEntry *xa_find_child_entry(XEntry *entry, gchar *string)
 {
 	if (entry == NULL)
 		return NULL;
+	if (strcmp(entry->filename, string) == 0)
+		return entry;
 
+  return xa_find_child_entry(entry->next, string);
+}
+
+/*XEntry *xa_find_archive_entry(XEntry *entry, gchar *string)
+{
+	if (entry == NULL)
+		return NULL;
+
 	if (strcmp(entry->filename, string) == 0)
 		return entry;
 
@@ -385,86 +397,38 @@
 	found_entry = xa_find_archive_entry(entry->next, string);
 
 	return found_entry;
-}
+}*/
 
 XEntry *xa_set_archive_entries_for_each_row (XArchive *archive,gchar *filename,gboolean encrypted,gpointer *items)
 {
-	XEntry *child_entry= NULL;
-	XEntry *last_entry = NULL;
+	XEntry *new_entry= NULL;
+	XEntry *last_entry = archive->root_entry;
+	gchar **components = NULL;
+	unsigned short int x = 0;
 
-	gchar *full_path_name = NULL;
-	gchar *filename_only = NULL;
-	gchar *p = NULL;
+	components = g_strsplit(filename,"/",-1);
 
-	p = strchr(filename,'/');
-	if (p != NULL)
+	while (components[x] && strlen(components[x]) > 0)
 	{
-		full_path_name = g_strndup(filename,(p-filename));
-
-		if (archive->entries != NULL)
-			last_entry = xa_find_archive_entry(archive->entries->data,full_path_name);
-		else
-			last_entry = xa_find_archive_entry(NULL,full_path_name);
-		if (last_entry == NULL)
+		new_entry = xa_find_child_entry(last_entry->child,components[x]);
+		if (new_entry == NULL)
 		{
-			//g_print ("prendo %s da %s\n",full_path_name,filename);
-			last_entry = xa_alloc_memory_for_each_row(archive->nc,archive->column_types);
-			last_entry->filename = g_strdup(full_path_name);
-			last_entry->columns = xa_fill_archive_entry_columns_for_each_row(archive,last_entry,items);
-			last_entry->is_dir = TRUE;
-			archive->entries = g_slist_prepend (archive->entries,last_entry);
-			archive->nr_of_dirs++;
-		}
-		p++;
-		g_free(full_path_name);
-		while ( (p = strchr(p,'/')) )
-		{
-			full_path_name = g_strndup(filename,(p-filename));
-
-			child_entry = xa_find_archive_entry(last_entry,full_path_name);
-			if (child_entry == NULL)
+			new_entry = xa_alloc_memory_for_each_row(archive->nc,archive->column_types);
+			new_entry->filename = g_strdup(components[x]);
+			new_entry->columns = xa_fill_archive_entry_columns_for_each_row(archive,new_entry,items);
+			if (components[x+1] != NULL)
 			{
-				//g_print ("w: prendo %s da %s\n",full_path_name,p);
-				child_entry = xa_alloc_memory_for_each_row (archive->nc,archive->column_types);
-				child_entry->filename = g_strdup(full_path_name);
-				child_entry->columns = xa_fill_archive_entry_columns_for_each_row(archive,child_entry,items);
-				child_entry->is_dir = TRUE;
-
-				child_entry->next = last_entry->child;
-				last_entry->child = child_entry;
+				new_entry->is_dir = TRUE;
 				archive->nr_of_dirs++;
 			}
-			g_free(full_path_name);
-			last_entry = child_entry;
-			p++;
+			new_entry->next = last_entry->child;
+			last_entry->child = new_entry;
 		}
-		p = strrchr(filename,'/');
-		if (strlen(p) > 1)
-		{
-			p++;
-			filename_only = g_strndup(p,strlen(p));
-			child_entry = xa_alloc_memory_for_each_row (archive->nc,archive->column_types);
-			child_entry->filename = filename_only;
-			child_entry->columns = xa_fill_archive_entry_columns_for_each_row(archive,child_entry,items);
-			
-			if (encrypted)
-				child_entry->is_encrypted = TRUE;
-
-			child_entry->next = last_entry->child;
-			last_entry->child = child_entry;
-		}
+		last_entry = new_entry;
+		x++;
 	}
-	else
-	{
-		last_entry = xa_alloc_memory_for_each_row (archive->nc,archive->column_types);
-		if (last_entry == NULL)
-			return NULL;
-
-		last_entry->filename = g_strdup(filename);
-		last_entry->columns = xa_fill_archive_entry_columns_for_each_row(archive,last_entry,items);
-		archive->entries = g_slist_prepend (archive->entries,last_entry);
-	}
-	return last_entry;
+	g_strfreev(components);
+	return new_entry;
 }
 
 gpointer *xa_fill_archive_entry_columns_for_each_row (XArchive *archive,XEntry *entry,gpointer *items)
@@ -494,23 +458,23 @@
 	return entry->columns;
 }
 
-void xa_update_window_with_archive_entries (XArchive *archive,gchar *path)
+void xa_update_window_with_archive_entries (XArchive *archive,XEntry *entry)
 {
 	GdkPixbuf *pixbuf = NULL;
-	GSList *s = NULL;
-	XEntry *entry  = NULL;
-
 	GtkTreeIter iter;
 	unsigned short int i;
 	gpointer current_column;
 
-	s = archive->entries;
-	if (path == NULL)
-	{
+	if (entry == NULL)
+		entry = archive->root_entry->child;
+	else if (entry->child == NULL)
+		return;
+	else
+		entry = entry->child;
+
 		gtk_list_store_clear(archive->liststore);
-		for (; s; s = s->next)
+		while (entry)
 		{
-			entry = s->data;
 			current_column = entry->columns;
 			gtk_list_store_append (archive->liststore, &iter);
 
@@ -527,6 +491,7 @@
 			else
 				pixbuf = xa_get_pixbuf_icon_from_cache(entry->filename);
 
+			gtk_list_store_set (archive->liststore,&iter,archive->nc+1, entry,-1);
 			gtk_list_store_set (archive->liststore,&iter,0,pixbuf,1,entry->filename,-1);
 
 			for (i = 0; i < archive->nc; i++)
@@ -548,86 +513,10 @@
 			}
 			entry = entry->next;
 		}
-		gtk_widget_set_sensitive(up_button,FALSE);
+		/*gtk_widget_set_sensitive(up_button,FALSE);
 		gtk_widget_set_sensitive(home_button,FALSE);
 		gtk_entry_set_text(GTK_ENTRY(location_entry),"");
-		return;
-	}
-	else
-	{
-		for (; s; s = s->next)
-		{
-			entry = xa_find_archive_entry(s->data,path);
-			if (entry == NULL || entry->child == NULL)
-				continue;			
-			else
-				break;
-		}
-		if (entry == NULL || entry->child == NULL)
-			return;
-
-		gtk_widget_set_sensitive(up_button,TRUE);
-		gtk_widget_set_sensitive(home_button,TRUE);
-		if (archive->location_entry_path == NULL)
-			archive->location_entry_path = g_strconcat (gtk_entry_get_text(GTK_ENTRY(location_entry)), entry->filename, "/", NULL);
-
-		gtk_entry_set_text(GTK_ENTRY(location_entry),archive->location_entry_path);
-		g_free (archive->location_entry_path);
-		archive->location_entry_path = NULL;
-
-		entry = entry->child;
-	}
-	gtk_list_store_clear(archive->liststore);
-	
-	while (entry)
-	{
-		if(!g_utf8_validate(entry->filename, -1, NULL) )
-		{
-			gchar *dummy = g_convert(entry->filename, -1, "UTF-8", "WINDOWS-1252", NULL, NULL, NULL);
-			g_free (entry->filename);
-			entry->filename = dummy;
-		}
-		/* Remove the path from the filename */
-		gchar *slash = strrchr(entry->filename,'/');
-		if (slash != NULL)
-		{
-			slash++;
-			gchar *dummy = g_strdup(slash);
-			g_free (entry->filename);
-			entry->filename = dummy;
-		}
-
-		current_column = entry->columns;
-		gtk_list_store_append (archive->liststore, &iter);
-
-		if (entry->is_dir)
-			pixbuf = xa_get_pixbuf_icon_from_cache("folder");
-		else if (entry->is_encrypted)
-			pixbuf = xa_get_pixbuf_icon_from_cache("lock");
-		else
-			pixbuf = xa_get_pixbuf_icon_from_cache(entry->filename);
-
-		gtk_list_store_set (archive->liststore,&iter,0,pixbuf,1,entry->filename,-1);
-
-		for (i = 0; i < archive->nc; i++)
-		{
-			switch(archive->column_types[i+2])
-			{
-				case G_TYPE_STRING:
-					//g_message ("%d - %s",i,(*((gchar **)current_column)));
-					gtk_list_store_set (archive->liststore,&iter,i+2,(*((gchar **)current_column)),-1);
-					current_column += sizeof(gchar *);
-				break;
-
-				case G_TYPE_UINT64:
-					//g_message ("*%d - %lu",i,(*((guint64 *)current_column)));
-					gtk_list_store_set (archive->liststore,&iter,i+2,(*((guint64 *)current_column)),-1);
-					current_column += sizeof(guint64);
-				break;
-			}
-		}
-		entry = entry->next;
-	}
+		return;*/
 }
 
 void xa_entries_to_filelist(XEntry *entry,GSList **p_file_list,gchar *current_path)
@@ -640,26 +529,23 @@
     /* Recurse to siblings with the same path */
     xa_entries_to_filelist(entry->next, p_file_list, current_path);
 
+ 	/* This in case the files are in the root directory */
+	if (strlen(current_path) == 0)
+		full_path = g_strdup(entry->filename);
+	else
+		full_path = g_strconcat(current_path,"/",entry->filename,NULL);
+        	
     if (entry->child)
-    {
-        /* This is a directory, recurse to children, with new path */
-        gchar *extended_path = g_strdup(entry->filename);
-        xa_entries_to_filelist(entry->child, p_file_list, extended_path);
-        g_free(extended_path);
-    }
-    /* This is a file, add this entry with a full pathname */
-    else
-    {
-        /* This in case the files are in the root directory */
-        if (strlen(current_path) == 0)
-        	full_path = g_strdup(entry->filename);
-        else
-        	full_path = g_strconcat(current_path,"/",entry->filename,NULL);
+	{
+		/* This is a directory, recurse to children, with new path */
+        xa_entries_to_filelist(entry->child, p_file_list, full_path);
+        g_free(full_path);
+	}
+		/* This is a file, add this entry with a full pathname */
+	else
+		*p_file_list = g_slist_append(*p_file_list, full_path);
 
-        *p_file_list = g_slist_append(*p_file_list, full_path);
-    }
-
-    return;
+	return;
 }
 
 void xa_destroy_filelist(GSList *file_list)

Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/archive.h	2007-10-17 20:15:58 UTC (rev 26143)
@@ -67,6 +67,7 @@
 {
 	XArchiveType type;
 	XArchiveStatus status;
+	XEntry *root_entry;
 	XEntry *entry;
 	gchar *path;
 	gchar *escaped_path;
@@ -91,7 +92,6 @@
 	//TODO: remove this once you fix the various arj,rar,etc
 	GList *cmd_line_output;
 	GSList *error_output;
-	GSList *entries;
 	GType *column_types;
 	gboolean add_recurse;
 	gboolean overwrite;
@@ -125,10 +125,11 @@
 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);
-XEntry *xa_find_archive_entry(XEntry *entry, gchar *string);
+//XEntry *xa_find_archive_entry(XEntry *entry, gchar *string);
+XEntry *xa_find_child_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);
-void xa_update_window_with_archive_entries (XArchive *archive,gchar *path);
+void xa_update_window_with_archive_entries (XArchive *archive,XEntry *entry);
 void xa_entries_to_filelist(XEntry *, GSList **, gchar *);
 void xa_destroy_filelist(GSList *file_list);
 XArchive *archive[100];

Modified: xarchiver/trunk/src/arj.c
===================================================================
--- xarchiver/trunk/src/arj.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/arj.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -33,7 +33,7 @@
 	archive->dummy_size = 0;
 	archive->nr_of_files = 0;
 	archive->nr_of_dirs = 0;
-	archive->nc = 8;
+	archive->nc = 9;
 	archive->format ="ARJ";
 	archive->parse_output = xa_get_arj_line_content;
 	xa_spawn_async_process (archive,command,0);
@@ -41,12 +41,12 @@
 	if (archive->child_pid == 0)
 		return;
 
-	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING};
+	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER};
 	archive->column_types = g_malloc0(sizeof(types));
-	for (i = 0; i < 10; i++)
+	for (i = 0; i < 11; i++)
 		archive->column_types[i] = types[i];
 
-	char *names[]= {(_("Original")),(_("Compressed")),(_("Ratio")),(_("Date")),(_("Time")),(_("Attributes")),("GUA"),("BPMGS")};
+	char *names[]= {(_("Original")),(_("Compressed")),(_("Ratio")),(_("Date")),(_("Time")),(_("Attributes")),("GUA"),("BPMGS"),NULL};
 	xa_create_liststore (archive,names);
 }
 

Modified: xarchiver/trunk/src/bzip2.c
===================================================================
--- xarchiver/trunk/src/bzip2.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/bzip2.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -1,6 +1,5 @@
 /*
- *  Copyright (C) 2006 Giuseppe Torelli <colossus73 at gmail.com>
- *  Copyright (C) 2006 Benedikt Meurer - <benny at xfce.org>
+ *  Copyright (C) 2007 Giuseppe Torelli <colossus73 at gmail.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -58,7 +57,7 @@
 		archive->nr_of_files = 0;
 		archive->nr_of_dirs = 0;
 		archive->format = "TAR.BZIP2";
-		archive->nc = 6;
+		archive->nc = 7;
 		archive->parse_output = xa_get_tar_line_content;
 		xa_spawn_async_process (archive,command,0);
 
@@ -68,12 +67,12 @@
 		if (archive->child_pid == 0)
 			return;
 
-		GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING};
+		GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER};
 		archive->column_types = g_malloc0(sizeof(types));
-		for (i = 0; i < 8; i++)
+		for (i = 0; i < 9; i++)
 			archive->column_types[i] = types[i];
 
-		char *names[]= {(_("Points to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"))};
+		char *names[]= {(_("Points to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"),NULL)};
 		xa_create_liststore (archive,names);
 	}
 	else

Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/extract_dialog.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -820,13 +820,12 @@
 	else
 	{
 		/* *Here we need to fill a GSList with all the entries in the archive so that we can use mv on all of them */
-		XEntry *entry;
-		GSList *s = archive->entries;
+		XEntry *entry = archive->root_entry;
 
-		for (; s; s = s->next)
+		while(entry)
 		{
-			entry = s->data;
 			xa_entries_to_filelist(entry, &xxx,"");
+			entry = entry->next;
 		}
 	}
 	filenames = g_slist_reverse(xxx);

Modified: xarchiver/trunk/src/gzip.c
===================================================================
--- xarchiver/trunk/src/gzip.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/gzip.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -1,6 +1,5 @@
 /*
  *  Copyright (C) 2007 Giuseppe Torelli - <colossus73 at gmail.com>
- *  Copyright (C) 2006 Benedikt Meurer - <benny at xfce.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -43,7 +42,7 @@
 		archive->nr_of_files = 0;
 		archive->nr_of_dirs = 0;
 		archive->format ="TAR.GZIP";
-		archive->nc = 6;
+		archive->nc = 7;
 		archive->parse_output = xa_get_tar_line_content;
 		xa_spawn_async_process (archive,command,0);
 
@@ -53,12 +52,12 @@
 		if (archive->child_pid == 0)
 			return;
 
-		GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING};
+		GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER};
 		archive->column_types = g_malloc0(sizeof(types));
-		for (i = 0; i < 8; i++)
+		for (i = 0; i < 9; i++)
 			archive->column_types[i] = types[i];
 
-		char *names[]= {(_("Points to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"))};
+		char *names[]= {(_("Points to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time")),NULL};
 		xa_create_liststore (archive,names);
 	}
 	else

Modified: xarchiver/trunk/src/rar.c
===================================================================
--- xarchiver/trunk/src/rar.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/rar.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -46,7 +46,7 @@
 	archive->dummy_size = 0;
     archive->nr_of_files = 0;
     archive->nr_of_dirs = 0;
-    archive->nc = 9;
+    archive->nc = 10;
 	archive->parse_output = xa_get_rar_line_content;
 	archive->format = "RAR";
 	xa_spawn_async_process (archive,command,0);
@@ -55,12 +55,12 @@
 	if ( archive->child_pid == 0 )
 		return;
 
-	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING};
+	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER};
 	archive->column_types = g_malloc0(sizeof(types));
-	for (i = 0; i < 11; i++)
+	for (i = 0; i < 12; i++)
 		archive->column_types[i] = types[i];
 
-	char *names[]= {(_("Original")),(_("Compressed")),(_("Ratio")),(_("Date")),(_("Time")),(_("Permissions")),(_("CRC")),(_("Method")),(_("Version"))};
+	char *names[]= {(_("Original")),(_("Compressed")),(_("Ratio")),(_("Date")),(_("Time")),(_("Permissions")),(_("CRC")),(_("Method")),(_("Version"),NULL)};
 	xa_create_liststore (archive,names);
 }
 

Modified: xarchiver/trunk/src/tar.c
===================================================================
--- xarchiver/trunk/src/tar.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/tar.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -1,6 +1,5 @@
 /*
- *  Copyright (C) 2006 Giuseppe Torelli - <colossus73 at gmail.com>
- *  Copyright (C) 2006 Benedikt Meurer - <benny at xfce.org>
+ *  Copyright (C) 2007 Giuseppe Torelli - <colossus73 at gmail.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -39,7 +38,7 @@
 	archive->dummy_size = 0;
 	archive->nr_of_files = 0;
 	archive->nr_of_dirs = 0;
-	archive->nc = 6;
+	archive->nc = 7;
 	archive->parse_output = xa_get_tar_line_content;
 	archive->format ="TAR";
 	xa_spawn_async_process (archive,command,0);
@@ -50,12 +49,12 @@
 	if (archive->child_pid == 0)
 		return;
 
-	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING};
+	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER};
 	archive->column_types = g_malloc0(sizeof(types));
-	for (i = 0; i < 8; i++)
+	for (i = 0; i < 9; i++)
 		archive->column_types[i] = types[i];
 
-	char *names[]= {(_("Points to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"))};
+	char *names[]= {(_("Points to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time")),NULL};
 	xa_create_liststore (archive,names);
 }
 

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/window.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -1147,10 +1147,18 @@
 	/* All the others */
 	for (x = 0; x < archive->nc; x++)
 	{
-		renderer = gtk_cell_renderer_text_new();
-		column = gtk_tree_view_column_new_with_attributes ( columns_names[x],renderer,"text",x+2,NULL);
-		gtk_tree_view_column_set_resizable (column, TRUE);
-		gtk_tree_view_column_set_sort_column_id (column, x+2);
+		if (x+1 == archive->nc)
+		{
+			column = gtk_tree_view_column_new();
+			gtk_tree_view_column_set_visible(column,FALSE);
+		}
+		else
+		{
+			renderer = gtk_cell_renderer_text_new();
+			column = gtk_tree_view_column_new_with_attributes ( columns_names[x],renderer,"text",x+2,NULL);
+			gtk_tree_view_column_set_resizable (column, TRUE);
+			gtk_tree_view_column_set_sort_column_id (column, x+2);
+		}
 		gtk_tree_view_append_column (GTK_TREE_VIEW (archive->treeview), column);
 	}
 }
@@ -1292,7 +1300,7 @@
 	g_list_free (row_list);
 
 	gtk_tree_model_get (model, &iter, 1, &name, -1);
-	entry = xa_find_archive_entry(archive[idx]->entries->data,name);
+	entry = xa_find_child_entry(archive[idx]->root_entry,name);
 	g_print ("Cerco %s\n",name);
 
 	if (entry == NULL || entry->is_dir)
@@ -2028,7 +2036,7 @@
 {
 	gint current_page;
 	gint idx;
-	gchar *name;
+	XEntry *entry;
 	GtkTreeIter iter;
 
 	current_page = gtk_notebook_get_current_page(notebook);
@@ -2037,7 +2045,6 @@
 	if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (archive[idx]->liststore),&iter,path))
 		return;
 
-	gtk_tree_model_get (GTK_TREE_MODEL (archive[idx]->liststore),&iter,1, &name,-1);
-	xa_update_window_with_archive_entries(archive[idx],name);
-	g_free(name);
+	gtk_tree_model_get (GTK_TREE_MODEL (archive[idx]->liststore),&iter,archive[idx]->nc+1,&entry, -1);
+	xa_update_window_with_archive_entries(archive[idx],entry);
 }

Modified: xarchiver/trunk/src/zip.c
===================================================================
--- xarchiver/trunk/src/zip.c	2007-10-17 18:53:22 UTC (rev 26142)
+++ xarchiver/trunk/src/zip.c	2007-10-17 20:15:58 UTC (rev 26143)
@@ -1,6 +1,5 @@
 /*
  *  Copyright (C) 2007 Giuseppe Torelli - <colossus73 at gmail.com>
- *  Copyright (C) 2006 Benedikt Meurer - <benny at xfce.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -34,7 +33,7 @@
 	archive->dummy_size  = 0;
     archive->nr_of_files = 0;
     archive->nr_of_dirs  = 0;
-    archive->nc = 8;
+    archive->nc = 9;
 	archive->parse_output = xa_get_zip_line_content;
 	archive->format ="ZIP";
 	xa_spawn_async_process (archive,command,0);
@@ -43,12 +42,12 @@
 	if (archive->child_pid == 0)
 		return;
 
-	GType types[] = {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING};
+	GType types[] = {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER};
 	archive->column_types = g_malloc0(sizeof(types));
-	for (i = 0; i < 10; i++)
+	for (i = 0; i < 11; i++)
 		archive->column_types[i] = types[i];
 
-	char *names[]= {(_("Permissions")),(_("Version")),(_("OS")),(_("Size")),(_("Compressed")),(_("Method")),(_("Date")),(_("Time"))};
+	char *names[]= {(_("Permissions")),(_("Version")),(_("OS")),(_("Size")),(_("Compressed")),(_("Method")),(_("Date")),(_("Time")),NULL};
 	xa_create_liststore (archive,names);
 }
 
@@ -162,7 +161,6 @@
 
 	line[n]='\0';
 	item[i] = line + a;
-	i++;
 	n++;
 
 	/* filename */
@@ -177,9 +175,4 @@
 		if (encrypted)
 			entry->is_encrypted = TRUE;
 	}
-	else
-	{
-		//TODO: found a way to stop calling this function over and over again; i.e. kill (archive->child_pid,SIGABRT) ??
-		g_message ("*** Can't allocate memory for the archive data!");
-	}
 }



More information about the Xfce4-commits mailing list