[Xfce4-commits] r26075 - in xarchiver/trunk: doc src

Giuseppe Torelli colossus at xfce.org
Thu Sep 13 08:22:19 CEST 2007


Author: colossus
Date: 2007-09-13 06:22:19 +0000 (Thu, 13 Sep 2007)
New Revision: 26075

Modified:
   xarchiver/trunk/doc/Makefile.am
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/archive.h
   xarchiver/trunk/src/extract_dialog.c
   xarchiver/trunk/src/mime.c
   xarchiver/trunk/src/window.c
Log:
Completed extraction of tar archives without the path;many thanks to John Berthels for helping me.
Added flv mime type icon.
Fixed problem with make dist.
Fixed a memory leak in extract_dialog.c


Modified: xarchiver/trunk/doc/Makefile.am
===================================================================
--- xarchiver/trunk/doc/Makefile.am	2007-09-12 20:19:26 UTC (rev 26074)
+++ xarchiver/trunk/doc/Makefile.am	2007-09-13 06:22:19 UTC (rev 26075)
@@ -28,7 +28,6 @@
 	images/add_dialog.png \
 	images/archive_properties.png \
 	images/extract_dialog.png \
-	images/iso_properties.png \
 	images/new_dialog.png
 
 EXTRA_DIST = xarchiver.css xarchiver.xsl \

Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c	2007-09-12 20:19:26 UTC (rev 26074)
+++ xarchiver/trunk/src/archive.c	2007-09-13 06:22:19 UTC (rev 26075)
@@ -369,17 +369,6 @@
 	g_free(entry);
 }
 
-void xa_store_entries_in_gslist (XEntry *entry, GSList **list)
-{
-	if (entry == NULL)
-		return;
-		
-	*list = g_slist_prepend (*list,entry->filename);
-
-	xa_store_entries_in_gslist(entry->child, list);
-	xa_store_entries_in_gslist(entry->next, list);
-}
-
 XEntry *xa_find_archive_entry(XEntry *entry, gchar *string)
 {
 	if (entry == NULL)
@@ -423,7 +412,6 @@
 			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->prev = NULL;
 			last_entry->is_dir = TRUE;
 			archive->entries = g_slist_prepend (archive->entries,last_entry);
 			archive->nr_of_dirs++;
@@ -439,7 +427,6 @@
 				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->prev = last_entry;
 				child_entry->is_dir = TRUE;
 
 				child_entry->next = last_entry->child;
@@ -464,7 +451,6 @@
 
 			child_entry->next = last_entry->child;
 			last_entry->child = child_entry;
-			child_entry->prev = last_entry;
 		}
 	}
 	else
@@ -644,13 +630,34 @@
 	}
 }
 
-gchar *xa_build_pathname_from_entries (XArchive *archive,XEntry *entry)
+void xa_entries_to_filelist(XEntry *entry,GSList **p_file_list,gchar *current_path)
 {
-	while (entry)
-	{
-		g_print ("%s\n",entry->filename);
-		entry = entry->prev;
-	}
-	g_print ("\n");
-	return NULL;
+    if (entry == NULL)
+        return;
+
+    /* Recurse to siblings with the same path */
+    xa_entries_to_filelist(entry->next, p_file_list, current_path);
+
+    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);
+    }
+    else
+    {
+        /* This is a file, add this entry with a full pathname */
+        gchar *full_path = g_strconcat(current_path,"/",entry->filename,NULL);
+        *p_file_list = g_slist_append(*p_file_list, full_path);
+    }
+
+    return;
 }
+
+void xa_destroy_filelist(GSList *file_list)
+{
+	g_slist_foreach (file_list,(GFunc)g_free, NULL);
+	g_slist_free (file_list);
+}
+

Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h	2007-09-12 20:19:26 UTC (rev 26074)
+++ xarchiver/trunk/src/archive.h	2007-09-13 06:22:19 UTC (rev 26075)
@@ -59,7 +59,6 @@
 	gboolean is_encrypted;
 	XEntry *child;
 	XEntry *next;
-	XEntry *prev;
 };
 
 typedef struct _XArchive XArchive;
@@ -127,12 +126,12 @@
 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);
-void xa_store_entries_in_gslist (XEntry *entry,GSList **);
 XEntry *xa_find_archive_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);
-gchar *xa_build_pathname_from_entries (XArchive *archive,XEntry *entry);
+void xa_entries_to_filelist(XEntry *, GSList **, gchar *);
+void xa_destroy_filelist(GSList *file_list);
 XArchive *archive[100];
 XArchive *archive_cmd;
 #endif

Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c	2007-09-12 20:19:26 UTC (rev 26074)
+++ xarchiver/trunk/src/extract_dialog.c	2007-09-13 06:22:19 UTC (rev 26075)
@@ -83,7 +83,7 @@
 			strncpy ( extraction_string, archive->path, x - 5);
 			extraction_string[x-5] = '\0';
 		}
-		gtk_entry_set_text (GTK_ENTRY(dialog_data->destination_path_entry), g_strdup(extraction_string));
+		gtk_entry_set_text (GTK_ENTRY(dialog_data->destination_path_entry), extraction_string);
 		g_free (extraction_string);
 	}
 	else
@@ -821,17 +821,14 @@
 	}
 	else
 	{
-		/* *Here we have to fill a GSList with all the filenames in the archive so that we can use mv on all of them */
+		/* *Here we have 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;
 		//g_print ("%s\n",gtk_entry_get_text(GTK_ENTRY(location_entry)));
 		for (; s; s = s->next)
 		{
 			entry = s->data;
-			XEntry *p = xa_find_archive_entry(s->data,entry->filename);
-			g_print ("Ho trovato: %s\n",p->filename);
-			xa_build_pathname_from_entries (archive,p);
-			//xa_store_entries_in_gslist(entry,&xxx);
+			xa_entries_to_filelist(entry, &xxx,"");
 		}
 	}
 	filenames = g_slist_reverse(xxx);
@@ -862,7 +859,6 @@
 		return FALSE;
 	}
 	chdir (tmp_dir);
-	
 	while (filenames)
 	{
 		gchar *unescaped = EscapeBadChars ( (gchar*)filenames->data , "$\'`\"\\!?* ()[]&|@#:;");
@@ -871,8 +867,8 @@
 		g_free (unescaped);
 		filenames = filenames->next;
 	}
+	xa_destroy_filelist (filenames);
 	command = g_strconcat ( "mv -f ", unescaped_names->str, " " , extract_path , NULL );
-	g_print ("%s\n",command);
 	result = xa_run_command (archive,command,0);
 	g_free (command);
 	g_slist_free (filenames);

Modified: xarchiver/trunk/src/mime.c
===================================================================
--- xarchiver/trunk/src/mime.c	2007-09-12 20:19:26 UTC (rev 26074)
+++ xarchiver/trunk/src/mime.c	2007-09-13 06:22:19 UTC (rev 26075)
@@ -50,7 +50,7 @@
 		|| strcmp (mime,"application/x-rpm") == 0 || strcmp (mime,"application/x-deb") == 0 )
 		icon_name = "package";
 	else if (strcmp(mime,"application/x-shockwave-flash") == 0 || strcmp(mime,"video/mpeg") == 0 || strcmp(mime,"video/quicktime") == 0
-		|| strcmp(mime,"video/x-msvideo") == 0)
+		|| strcmp(mime,"video/x-msvideo") == 0 || strcmp(mime,"application/x-flash-video") == 0)
 		icon_name = "video";
 	else if (strcmp(mime,"application/x-cd-image") == 0)
 		icon_name = "application-x-cd-image";

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c	2007-09-12 20:19:26 UTC (rev 26074)
+++ xarchiver/trunk/src/window.c	2007-09-13 06:22:19 UTC (rev 26075)
@@ -905,8 +905,8 @@
 void xa_about (GtkMenuItem *menuitem, gpointer user_data)
 {
     static GtkWidget *about = NULL;
-    const char *authors[] = {"\nMain developer:\nGiuseppe Torelli <colossus73 at gmail.com>\n\nLHA and DEB support:\nŁukasz Zemczak <sil2100 at vexillium.org>\n\nLZMA support:\nThomas Dy <dysprosium66 at gmail.com>",NULL};
-    const char *documenters[] = {"\nVery special thanks to John Berthels for\nhelping me in fixing archive navigation code.\n\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};
+    const char *authors[] = {"\nMain developer:\nGiuseppe Torelli <colossus73 at gmail.com>\n\nArchive navigation code:\nJohn Berthels\n\nLHA and DEB support:\nŁukasz Zemczak <sil2100 at vexillium.org>\n\nLZMA support:\nThomas Dy <dysprosium66 at gmail.com>\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)
 	{
@@ -915,17 +915,17 @@
 		gtk_about_dialog_set_url_hook (xa_activate_link, NULL, NULL);
 		gtk_window_set_destroy_with_parent (GTK_WINDOW (about) , TRUE);
 		g_object_set (about,
-				"name",  "Xarchiver",
-				"version", PACKAGE_VERSION,
-				"copyright", "Copyright \xC2\xA9 2005-2007 Giuseppe Torelli",
-				"comments", "A lightweight GTK+2 archive manager",
-				"authors", authors,
-				"documenters",documenters,
-				"translator_credits", _("translator-credits"),
-				"logo_icon_name", "xarchiver",
-				"website", "http://xarchiver.xfce.org",
-				"license",    "Copyright \xC2\xA9 2005-2007 Giuseppe Torelli - Colossus <colossus73 at gmail.com>\n\n"
-		      			"This is free software; you can redistribute it and/or\n"
+			"name",  "Xarchiver",
+			"version", PACKAGE_VERSION,
+			"copyright", "Copyright \xC2\xA9 2005-2007 Giuseppe Torelli",
+			"comments", "A lightweight GTK+2 archive manager",
+			"authors", authors,
+			"documenters",documenters,
+			"translator_credits", _("translator-credits"),
+			"logo_icon_name", "xarchiver",
+			"website", "http://xarchiver.xfce.org",
+			"license",    "Copyright \xC2\xA9 2005-2007 Giuseppe Torelli - Colossus <colossus73 at gmail.com>\n\n"
+		    			"This is free software; you can redistribute it and/or\n"
     					"modify it under the terms of the GNU Library General Public License as\n"
     					"published by the Free Software Foundation; either version 2 of the\n"
     					"License, or (at your option) any later version.\n"
@@ -1129,6 +1129,7 @@
 	/* First column: icon + text */
 	column = gtk_tree_view_column_new();
 	renderer = gtk_cell_renderer_pixbuf_new();
+	//TODO; have this in real time according to the user set preferences
 	g_object_set(G_OBJECT(renderer), "stock-size", (3 - gtk_combo_box_get_active(GTK_COMBO_BOX(prefs_window->combo_icon_size))), NULL);
 	gtk_tree_view_column_pack_start(column, renderer, FALSE);
 	gtk_tree_view_column_set_attributes(column, renderer, "icon-name",0,NULL);



More information about the Xfce4-commits mailing list