[Xfce4-commits] r23528 - in xarchiver/branches/xarchiver-psybsd: libxarchiver src

Stephan Arts stephan at xfce.org
Fri Oct 27 00:16:26 CEST 2006


Author: stephan
Date: 2006-10-26 22:16:25 +0000 (Thu, 26 Oct 2006)
New Revision: 23528

Modified:
   xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
   xarchiver/branches/xarchiver-psybsd/libxarchiver/internals.h
   xarchiver/branches/xarchiver-psybsd/src/archive_store.c
   xarchiver/branches/xarchiver-psybsd/src/main_window.c
Log:
Fixed sorting



Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c	2006-10-26 20:12:50 UTC (rev 23527)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c	2006-10-26 22:16:25 UTC (rev 23528)
@@ -214,7 +214,6 @@
 {
 	LXAArchiveSupportGnuTar *support;
 
-	/**/
 	support = g_object_new(LXA_TYPE_ARCHIVE_SUPPORT_GNU_TAR, 
 	                       "view-time", TRUE, 
 												 "view-date", TRUE,
@@ -222,7 +221,7 @@
 												 "view-rights", TRUE,
 												 "view-size", TRUE,
 												 NULL);
-	/*/
+	/*
 	support = g_object_new(LXA_TYPE_ARCHIVE_SUPPORT_GNU_TAR, 
 	                       "view-time", FALSE, 
 												 "view-date", FALSE,

Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/internals.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/internals.h	2006-10-26 20:12:50 UTC (rev 23527)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/internals.h	2006-10-26 22:16:25 UTC (rev 23528)
@@ -17,7 +17,7 @@
  */
 
 #ifdef DEBUG
-#define LXA_TRACE_ALLOCATION 1
+//#define LXA_TRACE_ALLOCATION 1
 #endif /* DEBUG */
 
 #ifdef LXA_TRACE_ALLOCATION

Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c	2006-10-26 20:12:50 UTC (rev 23527)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c	2006-10-26 22:16:25 UTC (rev 23528)
@@ -643,7 +643,7 @@
 
 	if(sort_col_id)
 		*sort_col_id = store->sort_column;
-
+	
 	if(order)
 		*order = store->sort_order;
 
@@ -693,9 +693,11 @@
 static gint
 xa_archive_entry_compare(XAArchiveStore *store, LXAArchiveIter *a, LXAArchiveIter *b)
 {
-	/*
+	gint retval = 0;
 	gboolean cmp_a = 0;
 	gboolean cmp_b = 0;
+	GValue  *prop_a = g_new0(GValue, 1);
+	GValue  *prop_b = g_new0(GValue, 1);
 	if(store->props._sort_folders_first)
 	{
 		cmp_a = lxa_archive_iter_is_directory(store->archive, a);
@@ -717,25 +719,32 @@
 	LXAArchive *archive = store->archive;
 	gint column = store->sort_column;
 
-	column--;
+	lxa_archive_iter_get_prop_value(archive, a, column-1, prop_a);
+	lxa_archive_iter_get_prop_value(archive, b, column-1, prop_b);
 
-	switch(lxa_archive_get_property_type(archive, column))
+	switch(lxa_archive_get_property_type(archive, column-1))
 	{
 		case G_TYPE_STRING:
 			switch(store->props._sort_case_sensitive)
 			{
-				case 0: *//* case insensitive *//*
-					return g_ascii_strcasecmp(lxa_archive_iter_get_prop_str(archive, a, column), lxa_archive_iter_get_prop_str(archive, b, column));
-				case 1: *//* case sensitive *//*
-					return strcmp(lxa_archive_iter_get_prop_str(archive, a, column), lxa_archive_iter_get_prop_str(archive, b, column));
+				case 0: /* case insensitive */
+					retval = g_ascii_strcasecmp(g_value_get_string(prop_a), g_value_get_string(prop_b));
+				case 1: /* case sensitive */
+					retval = strcmp(g_value_get_string(prop_a), g_value_get_string(prop_b));
 			}
+			break;
 		case G_TYPE_UINT64:
-			return lxa_archive_iter_get_prop_uint64(archive, a, column) - lxa_archive_iter_get_prop_uint64(archive, b, column);
+			retval = g_value_get_uint64(prop_a) - g_value_get_uint64(prop_b);
+			break;
 		case G_TYPE_UINT:
-			return lxa_archive_iter_get_prop_uint(archive, a, column) - lxa_archive_iter_get_prop_uint(archive, b, column);
+			retval = g_value_get_uint(prop_a) - g_value_get_uint(prop_b);
+			break;
 	}
-	*/
-	g_return_val_if_reached(0);
+	g_value_unset(prop_a);
+	g_value_unset(prop_b);
+	g_free(prop_a);
+	g_free(prop_b);
+	return retval;
 }
 
 static void

Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c	2006-10-26 20:12:50 UTC (rev 23527)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c	2006-10-26 22:16:25 UTC (rev 23528)
@@ -63,8 +63,6 @@
 static void
 xa_main_window_finalize(GObject *object);
 
-gboolean
-xa_main_window_add_item(LXAArchiveIter *entry, gpointer data);
 void 
 xa_main_window_set_contents(XAMainWindow *, LXAArchive *);
 



More information about the Xfce4-commits mailing list