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

Giuseppe Torelli colossus at xfce.org
Fri Oct 19 23:16:25 CEST 2007


Author: colossus
Date: 2007-10-19 21:16:25 +0000 (Fri, 19 Oct 2007)
New Revision: 26147

Modified:
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/archive.h
   xarchiver/trunk/src/deb.c
   xarchiver/trunk/src/interface.c
   xarchiver/trunk/src/rar.c
   xarchiver/trunk/src/rpm.c
Log:
Fixed wrong content of location bar when switching to another tab.
Fixed archive navigation for rar,rpm and deb.


Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c	2007-10-19 05:23:00 UTC (rev 26146)
+++ xarchiver/trunk/src/archive.c	2007-10-19 21:16:25 UTC (rev 26147)
@@ -379,26 +379,6 @@
   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;
-
-    XEntry *found_entry;
-
-	found_entry = xa_find_archive_entry(entry->child, string);
-
-	if (found_entry != NULL)
-		return found_entry;
-
-	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 *new_entry= NULL;
@@ -423,6 +403,7 @@
 			}
 			new_entry->next = last_entry->child;
 			last_entry->child = new_entry;
+			new_entry->prev = last_entry;
 		}
 		last_entry = new_entry;
 		x++;
@@ -474,12 +455,17 @@
 		return;
 	else
 	{
-		archive->location_entry_path = g_strconcat(gtk_entry_get_text(GTK_ENTRY(location_entry)),"/",entry->filename,NULL);
+		if (archive->location_entry_path != NULL)
+		{
+			g_free(archive->location_entry_path);
+			archive->location_entry_path = NULL;
+		}
+		archive->location_entry_path = xa_build_full_path_name_from_entry(entry);
 		gtk_entry_set_text(GTK_ENTRY(location_entry),archive->location_entry_path);
-		g_free(archive->location_entry_path);
 		entry = entry->child;
 	}
 	gtk_list_store_clear(archive->liststore);
+
 	while (entry)
 	{
 		current_column = entry->columns;
@@ -522,6 +508,23 @@
 	}
 }
 
+gchar *xa_build_full_path_name_from_entry(XEntry *entry)
+{
+	GString *dummy = g_string_new('\0');
+	gchar *fullpathname = NULL;
+	
+	while (entry)
+	{
+		dummy = g_string_prepend_c(dummy,'/');
+		dummy = g_string_prepend(dummy,entry->filename);
+		entry = entry->prev;
+	}
+	fullpathname = g_strdup(dummy->str);
+	g_string_free(dummy,TRUE);
+	g_print ("%s\n",fullpathname);
+	return fullpathname;
+}
+
 void xa_entries_to_filelist(XEntry *entry,GSList **p_file_list,gchar *current_path)
 {
 	gchar *full_path = NULL;

Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h	2007-10-19 05:23:00 UTC (rev 26146)
+++ xarchiver/trunk/src/archive.h	2007-10-19 21:16:25 UTC (rev 26147)
@@ -58,6 +58,7 @@
 	gboolean is_dir;
 	gboolean is_encrypted;
 	XEntry *child;
+	XEntry *prev;
 	XEntry *next;
 };
 
@@ -125,11 +126,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_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,XEntry *entry);
+gchar *xa_build_full_path_name_from_entry(XEntry *entry);
 void xa_entries_to_filelist(XEntry *, GSList **, gchar *);
 void xa_destroy_filelist(GSList *file_list);
 XArchive *archive[100];

Modified: xarchiver/trunk/src/deb.c
===================================================================
--- xarchiver/trunk/src/deb.c	2007-10-19 05:23:00 UTC (rev 26146)
+++ xarchiver/trunk/src/deb.c	2007-10-19 21:16:25 UTC (rev 26147)
@@ -79,7 +79,7 @@
 	archive->dummy_size = 0;
 	archive->nr_of_files = 0;
 	archive->nr_of_dirs = 0;
-	archive->nc = 6;
+	archive->nc = 7;
 	archive->format = "DEB";
 	archive->parse_output = xa_get_tar_line_content;
 	xa_spawn_async_process (archive,command,0);
@@ -88,10 +88,10 @@
 	if (archive->child_pid == 0)
 		return;
 
-	char *names[]= {(_("Points to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"))};
-	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};
+	char *names[]= {(_("Points to")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time")),NULL};
+	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];
 	xa_create_liststore (archive,names);
 }

Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c	2007-10-19 05:23:00 UTC (rev 26146)
+++ xarchiver/trunk/src/interface.c	2007-10-19 21:16:25 UTC (rev 26147)
@@ -515,10 +515,12 @@
 				gtk_widget_set_sensitive ( view_menu, TRUE );
 			}
 		}
-		/* Let's set the location entry */
+		/* Let's set the location bar */
 		if (archive[id]->location_entry_path != NULL)
 			gtk_entry_set_text(GTK_ENTRY(location_entry),archive[id]->location_entry_path);
-		
+		else
+			gtk_entry_set_text(GTK_ENTRY(location_entry),"\0");
+
 		gtk_widget_grab_focus (GTK_WIDGET(archive[id]->treeview));
 	}
 }
@@ -910,6 +912,11 @@
 	{
 		/* Root */
 		case 0:
+			if (archive[idx]->location_entry_path != NULL)
+			{
+				g_free(archive[idx]->location_entry_path);
+				archive[idx]->location_entry_path = NULL;
+			}
 			archive[idx]->location_entry_path = NULL;
 			xa_update_window_with_archive_entries(archive[idx],NULL);
 		break;

Modified: xarchiver/trunk/src/rar.c
===================================================================
--- xarchiver/trunk/src/rar.c	2007-10-19 05:23:00 UTC (rev 26146)
+++ xarchiver/trunk/src/rar.c	2007-10-19 21:16:25 UTC (rev 26147)
@@ -60,7 +60,7 @@
 	for (i = 0; i < 12; i++)
 		archive->column_types[i] = types[i];
 
-	char *names[]= {(_("Original")),(_("Compressed")),(_("Ratio")),(_("Date")),(_("Time")),(_("Permissions")),(_("CRC")),(_("Method")),(_("Version"),NULL)};
+	char *names[]= {(_("Original")),(_("Compressed")),(_("Ratio")),(_("Date")),(_("Time")),(_("Permissions")),(_("CRC")),(_("Method")),(_("Version")),NULL};
 	xa_create_liststore (archive,names);
 }
 

Modified: xarchiver/trunk/src/rpm.c
===================================================================
--- xarchiver/trunk/src/rpm.c	2007-10-19 05:23:00 UTC (rev 26146)
+++ xarchiver/trunk/src/rpm.c	2007-10-19 21:16:25 UTC (rev 26147)
@@ -51,13 +51,13 @@
     archive->dummy_size = 0;
     archive->nr_of_files = 0;
     archive->nr_of_dirs = 0;
-    archive->nc = 7;
+    archive->nc = 8;
 	archive->format ="RPM";
 
-	char *names[]= {(_("Points to")),(_("Size")),(_("Permission")),(_("Date")),(_("Hard Link")),(_("Owner")),(_("Group"))};
-	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING};
+	char *names[]= {(_("Points to")),(_("Size")),(_("Permission")),(_("Date")),(_("Hard Link")),(_("Owner")),(_("Group")),NULL};
+	GType types[]= {GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,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 < 9; i++)
+	for (i = 0; i < 10; i++)
 		archive->column_types[i] = types[i];
 
 	xa_create_liststore (archive,names);



More information about the Xfce4-commits mailing list