[nautilus-actions] Deprecate obsolete setters



commit fae26324d20ef7619807b04cd352b905aff26030
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Feb 20 00:08:58 2011 +0100

    Deprecate obsolete setters
    
    + na_object_set_isfile()
    + na_object_set_isdir()
    + na_object_set_multiple()

 ChangeLog                        |    8 ++++++++
 src/api/na-object-api.h          |    3 ---
 src/core/na-icontext-factory.c   |    9 ++++++---
 src/utils/nautilus-actions-new.c |   23 +++++++++++++++++------
 4 files changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2255641..865c343 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-02-19 Pierre Wieser <pwieser trychlos org>
 
+	* src/api/na-object-api.h (na_object_set_isfile, na_object_set_isdir,
+	na_object_set_multiple): Deprecated functions.
+
+	* src/core/na-icontext-factory.c (is_file, is_dir, accept_multiple):
+	Deprecated data.
+
+	* src/utils/nautilus-actions-new.c: Updated accordingly.
+
 	* src/nact/nact-providers-list.c:
 	* src/nact/nact-schemes-list.c: Does not recompute if preferences are
 	locked, but use na_updater_are_preferences_locked() function.
diff --git a/src/api/na-object-api.h b/src/api/na-object-api.h
index dc8999c..1719324 100644
--- a/src/api/na-object-api.h
+++ b/src/api/na-object-api.h
@@ -175,9 +175,6 @@ G_BEGIN_DECLS
 #define na_object_set_path( obj, path )                 na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_PATH, ( const void * )( path ))
 #define na_object_set_parameters( obj, parms )          na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_PARAMETERS, ( const void * )( parms ))
 #define na_object_set_working_dir( obj, uri )           na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_WORKING_DIR, ( const void * )( uri ))
-#define na_object_set_isfile( obj, isfile )             na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ISFILE, ( const void * ) GUINT_TO_POINTER( isfile ))
-#define na_object_set_isdir( obj, isdir )               na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ISDIR, ( const void * ) GUINT_TO_POINTER( isdir ))
-#define na_object_set_multiple( obj, multiple )         na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_MULTIPLE, ( const void * ) GUINT_TO_POINTER( multiple ))
 #define na_object_set_execution_mode( obj, mode )       na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_EXECUTION_MODE, ( const void * )( mode ))
 #define na_object_set_startup_notify( obj, notify )     na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_STARTUP_NOTIFY, ( const void * ) GUINT_TO_POINTER( notify ))
 #define na_object_set_startup_class( obj, class )       na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_STARTUP_WMCLASS, ( const void * )( class ))
diff --git a/src/core/na-icontext-factory.c b/src/core/na-icontext-factory.c
index d85f342..44d1271 100644
--- a/src/core/na-icontext-factory.c
+++ b/src/core/na-icontext-factory.c
@@ -163,11 +163,14 @@ NADataDef data_def_conditions [] = {
 				NULL,
 				NULL },
 
+	/* this is obsoleted starting with 2.30-newdata (released as 2.31.x serie)
+	 * and replaced by mimetypes
+	 */
 	{ NAFO_DATA_ISFILE,
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "Whether the profile applies to files" ),
+				N_( "Whether the profile applies to files (deprecated option, see mimetypes)" ),
 				/* i18n: 'true' and 'false' values are taken literally, and should not be translated */
 				N_( "Set to 'true' if the selection can have files, to 'false' otherwise.\n" \
 					"This setting is tied in with the 'isdir' setting. The valid combinations are: \n" \
@@ -198,7 +201,7 @@ NADataDef data_def_conditions [] = {
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "Whether the profile applies to folders" ),
+				N_( "Whether the profile applies to folders (deprecated option, see mimetypes)" ),
 				/* i18n: 'true' and 'false' values are taken literally, and should not be translated */
 				N_( "Set to 'true' if the selection can have folders, to 'false' otherwise.\n" \
 					"This setting is tied in with the 'isfile' setting. The valid combinations are: \n" \
@@ -232,7 +235,7 @@ NADataDef data_def_conditions [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				N_( "Whether the selection may be multiple" ),
+				N_( "Whether the selection may be multiple (deprecated option, see selection count)" ),
 				/* i18n: 'true' and 'false' values are taken literally, and should not be translated */
 				N_( "If you need more than one files or folders to be selected, set this " \
 					"key to 'true'. If you want just one file or folder, set it to 'false'.\n" \
diff --git a/src/utils/nautilus-actions-new.c b/src/utils/nautilus-actions-new.c
index 6372f72..d3e040c 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -367,6 +367,7 @@ get_action_from_cmdline( void )
 	GSList *schemes;
 	GSList *folders;
 	gboolean toolbar_same_label;
+	gchar *selection_count;
 
 	action = na_object_action_new_with_defaults();
 	profile = NA_OBJECT_PROFILE(( GList * ) na_object_get_items( action )->data );
@@ -406,8 +407,18 @@ get_action_from_cmdline( void )
 
 	na_object_set_matchcase( profile, matchcase );
 
-	i = 0;
 	mimetypes = NULL;
+	if( !isfile && !isdir ){
+		isfile = TRUE;
+	}
+	if( isfile && isdir ){
+		mimetypes = g_slist_prepend( mimetypes, g_strdup( "*/*" ));
+	} else if( isfile ){
+		mimetypes = g_slist_prepend( mimetypes, g_strdup( "all/allfiles" ));
+	} else {
+		mimetypes = g_slist_prepend( mimetypes, g_strdup( "inode/directory" ));
+	}
+	i = 0;
 	while( mimetypes_array != NULL && mimetypes_array[i] != NULL ){
 		mimetypes = g_slist_append( mimetypes, g_strdup( mimetypes_array[i] ));
 		i++;
@@ -417,12 +428,12 @@ get_action_from_cmdline( void )
 		na_core_utils_slist_free( mimetypes );
 	}
 
-	if( !isfile && !isdir ){
-		isfile = TRUE;
+	selection_count = g_strdup( "=1" );
+	if( accept_multiple ){
+		g_free( selection_count );
+		selection_count = g_strdup( ">0" );
 	}
-	na_object_set_isfile( profile, isfile );
-	na_object_set_isdir( profile, isdir );
-	na_object_set_multiple( profile, accept_multiple );
+	na_object_set_selection_count( profile, selection_count );
 
 	i = 0;
 	schemes = NULL;



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