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

Giuseppe Torelli colossus at xfce.org
Thu Aug 2 08:44:04 CEST 2007


Author: colossus
Date: 2007-08-02 06:44:04 +0000 (Thu, 02 Aug 2007)
New Revision: 25950

Modified:
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/mime.c
   xarchiver/trunk/src/zip.c
Log:
Fixed missed icon for directories.
Added a couple more mimetype icons.


Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c	2007-08-01 13:15:29 UTC (rev 25949)
+++ xarchiver/trunk/src/archive.c	2007-08-02 06:44:04 UTC (rev 25950)
@@ -534,7 +534,6 @@
 	
 	while (entry)
 	{
-		g_print ("inserisco %s in %x is_dir è %d\n",entry->filename,entry,entry->is_dir);
 		if(!g_utf8_validate(entry->filename, -1, NULL) )
 		{
 			gchar *dummy = g_convert(entry->filename, -1, "UTF-8", "WINDOWS-1252", NULL, NULL, NULL);
@@ -555,10 +554,7 @@
 		gtk_list_store_append (archive->liststore, &iter);
 
 		if (entry->is_dir)
-		{
-			g_print ("%s è una dir\n",entry->filename);
 			icon_name = "folder";
-		}
 		else if (entry->is_encrypted)
 			icon_name = "password";
 		

Modified: xarchiver/trunk/src/mime.c
===================================================================
--- xarchiver/trunk/src/mime.c	2007-08-01 13:15:29 UTC (rev 25949)
+++ xarchiver/trunk/src/mime.c	2007-08-02 06:44:04 UTC (rev 25950)
@@ -26,7 +26,7 @@
 	const char *icon_name = "binary";
 
 	mime = xdg_mime_get_mime_type_from_file_name(filename);
-	g_print ("%s\t%s\n",filename,mime);
+	//g_print ("%s\t%s\n",filename,mime);
 	if (strstr(filename,".ogg") || strstr(filename,".flac") )
 		icon_name = "sound";
 	else if (strncmp(mime,"image/",6) == 0)
@@ -35,12 +35,15 @@
 		icon_name = "html";
 	else if (strncmp(mime,"text/",5) == 0)
 		icon_name = "txt";
-	else if (strcmp(mime,"application/rtf") == 0 || strcmp(mime,"application/pdf") == 0 || strcmp(mime,"application/msword") == 0) 
+	else if (strcmp(mime,"application/rtf") == 0 || strcmp(mime,"application/pdf") == 0 || strcmp(mime,"application/msword") == 0
+		|| strcmp (mime,"application/vnd.oasis.opendocument.text") == 0)
 		icon_name = "document";
 	else if (strcmp(mime,"audio/mpeg") == 0 || strcmp(mime,"audio/midi") == 0 )
 		icon_name = "sound";
-	else if (strcmp(mime,"application/vnd.ms-excel") == 0)
+	else if (strcmp(mime,"application/vnd.ms-excel") == 0 || strcmp(mime,"application/vnd.oasis.opendocument.spreadsheet") == 0)
 		icon_name = "gnome-mime-application-vnd.ms-excel";
+	else if (strcmp(mime,"application/vnd.ms-powerpoint") == 0 || strcmp (mime,"application/vnd.oasis.opendocument.presentation") == 0)
+		icon_name = "gnome-mime-application-vnd.ms-powerpoint";
 	else if (strcmp(mime,"application/zip") == 0 || strcmp(mime,"application/x-rar") == 0 || strcmp(mime,"application/x-tar") == 0
 		|| strcmp(mime,"application/x-7z-compressed") == 0 || strcmp(mime,"application/x-bzip-compressed-tar") == 0
 		|| strcmp (mime,"application/x-compressed-tar") == 0 )
@@ -54,8 +57,6 @@
 		icon_name = "gnome-mime-application-x-php";
 	else if (strcmp(mime,"application/x-perl") == 0 || strcmp (mime,"application/x-csh") == 0 || strcmp (mime,"application/x-shellscript") == 0)
 		icon_name = "gnome-mime-application-x-perl";
-	else if (strcmp(mime,"application/vnd.ms-powerpoint") == 0)
-		icon_name = "gnome-mime-application-vnd.ms-powerpoint";
 	return icon_name;		
 }
 

Modified: xarchiver/trunk/src/zip.c
===================================================================
--- xarchiver/trunk/src/zip.c	2007-08-01 13:15:29 UTC (rev 25949)
+++ xarchiver/trunk/src/zip.c	2007-08-02 06:44:04 UTC (rev 25950)
@@ -61,9 +61,9 @@
 	gpointer item[8];
 	unsigned short int i = 0;
 	unsigned int linesize,n,a;
-	gboolean encrypted,is_dir;
+	gboolean encrypted,dir;
 
-	encrypted = is_dir = FALSE;
+	encrypted = dir = FALSE;
 
 	if ((line[0] != 'd') && (line[0] != '-'))
 		return;
@@ -79,7 +79,7 @@
 	item[i] = line + a;
 	if ( (line+a)[0] == 'd')
 	{
-		is_dir = TRUE;
+		dir = TRUE;
 		archive->nr_of_dirs++;
 	}
 	else
@@ -175,8 +175,10 @@
 	entry = xa_set_archive_entries_for_each_row (archive,filename,item);
 	if (entry != NULL)
 	{
-		entry->is_dir = is_dir;
-		entry->is_encrypted = encrypted;
+		if (dir)
+			 entry->is_dir = TRUE;
+		if (encrypted)
+			entry->is_encrypted = TRUE;
 	}
 	else
 	{



More information about the Xfce4-commits mailing list