[nautilus-actions] Implement is_candidate_for_selection_count() function



commit 3763099620d582bea89d90585768d27e77c74187
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat Jul 31 11:02:46 2010 +0200

    Implement is_candidate_for_selection_count() function

 ChangeLog                    |    8 ++++++++
 TODO                         |    2 --
 src/core/na-icontext.c       |   19 +++++++++++++++++++
 src/io-desktop/nadp-reader.c |    1 +
 4 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ecb3f4a..3f31395 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-07-31 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-icontext.c (is_candidate_for_selection_count):
+	Implement the function.
+
+	* src/io-desktop/nadp-reader.c
+	(nadp_reader_ifactory_provider_read_start): Set minimal version number.
+
 2010-07-30 Pierre Wieser <pwieser trychlos org>
 
 	* src/core/na-icontext.c (is_candidate_for_basenames):
diff --git a/TODO b/TODO
index 15e3e3b..61fe46e 100644
--- a/TODO
+++ b/TODO
@@ -496,8 +496,6 @@ Parameter 	Description
 - 2010-07-27: enhancement: while editing a new filter, making it duplicate, try to keep editing
   instead of terminating the edition and letting the old value
 
-- 2010-07-30: TODO: is_candidate_for_selection_count
-
 - 2010-07-30: TODO: is_candidate_for_schemes
 
 - 2010-07-30: TODO: is_candidate_for_folders
diff --git a/src/core/na-icontext.c b/src/core/na-icontext.c
index e7b3412..35a9f18 100644
--- a/src/core/na-icontext.c
+++ b/src/core/na-icontext.c
@@ -33,6 +33,7 @@
 #endif
 
 #include <dbus/dbus-glib.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -804,10 +805,28 @@ is_candidate_for_selection_count( const NAIContext *object, guint target, GList
 {
 	static const gchar *thisfn = "na_icontext_is_candidate_for_selection_count";
 	gboolean ok = TRUE;
+	gint limit;
+	guint count;
 	gchar *selection_count = na_object_get_selection_count( object );
 
 	if( selection_count && strlen( selection_count )){
+		limit = atoi( selection_count+1 );
+		count = g_list_length( files );
+		ok = FALSE;
 
+		switch( selection_count[0] ){
+			case '<':
+				ok = ( count < limit );
+				break;
+			case '=':
+				ok = ( count == limit );
+				break;
+			case '>':
+				ok = ( count > limit );
+				break;
+			default:
+				break;
+		}
 	}
 
 	if( !ok ){
diff --git a/src/io-desktop/nadp-reader.c b/src/io-desktop/nadp-reader.c
index 8847193..c1ffa4b 100644
--- a/src/io-desktop/nadp-reader.c
+++ b/src/io-desktop/nadp-reader.c
@@ -429,6 +429,7 @@ nadp_reader_ifactory_provider_read_start( const NAIFactoryProvider *reader, void
 
 		if( NA_IS_OBJECT_ITEM( serializable )){
 			read_start_read_subitems_key( reader, NA_OBJECT_ITEM( serializable ), ( NadpReaderData * ) reader_data, messages );
+			na_object_set_iversion( serializable, 3 );
 		}
 
 		if( NA_IS_OBJECT_PROFILE( serializable )){



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]