[nautilus-actions] NAIContext: na_icontext_is_all_mimetypes() is renamed as na_object_check_mimetypes()
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] NAIContext: na_icontext_is_all_mimetypes() is renamed as na_object_check_mimetypes()
- Date: Mon, 21 Feb 2011 21:38:12 +0000 (UTC)
commit 7979c643d448c4b5d99e52e2f699469bb4dd787e
Author: Pierre Wieser <pwieser trychlos org>
Date: Mon Feb 21 18:14:52 2011 +0100
NAIContext: na_icontext_is_all_mimetypes() is renamed as na_object_check_mimetypes()
This is consistent with other check functions which internally set the relevant
indicator, while not returning any value.
ChangeLog | 9 +++++++++
src/api/na-icontext.h | 3 ++-
src/api/na-ifactory-object-data.h | 2 +-
src/api/na-object-api.h | 6 ++++--
src/core/na-icontext-factory.c | 12 +++++++-----
src/core/na-icontext.c | 22 +++++++++-------------
src/core/na-object-profile.c | 8 ++++++--
7 files changed, 38 insertions(+), 24 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 529758e..cede9e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2011-02-21 Pierre Wieser <pwieser trychlos org>
+ * src/api/na-icontext.h:
+ * src/core/na-icontext.c (na_icontext_is_all_mimetypes):
+ Renamed as na_icontext_check_mimetypes().
+
+ * src/api/na-ifactory-object-data.h:
+ * src/api/na-object-api.h:
+ * src/core/na-icontext-factory.c:
+ * src/core/na-object-profile.c: Updated accordingly.
+
* src/core/na-icontext.c (is_valid_isfiledir): Deprecated function.
* src/core/na-icontext.c (na_icontext_get_running_environment):
diff --git a/src/api/na-icontext.h b/src/api/na-icontext.h
index 930e7d6..6f08cc6 100644
--- a/src/api/na-icontext.h
+++ b/src/api/na-icontext.h
@@ -97,7 +97,8 @@ GType na_icontext_get_type( void );
gboolean na_icontext_is_candidate ( const NAIContext *context, guint target, GList *selection );
gboolean na_icontext_is_valid ( const NAIContext *context );
-gboolean na_icontext_is_all_mimetypes( const NAIContext *context );
+
+void na_icontext_check_mimetypes ( const NAIContext *context );
void na_icontext_read_done ( NAIContext *context );
diff --git a/src/api/na-ifactory-object-data.h b/src/api/na-ifactory-object-data.h
index 946f6a6..becd043 100644
--- a/src/api/na-ifactory-object-data.h
+++ b/src/api/na-ifactory-object-data.h
@@ -137,7 +137,7 @@ G_BEGIN_DECLS
#define NAFO_DATA_BASENAMES "na-factory-data-basenames"
#define NAFO_DATA_MATCHCASE "na-factory-data-matchcase"
#define NAFO_DATA_MIMETYPES "na-factory-data-mimetypes"
-#define NAFO_DATA_ALL_MIMETYPES "na-factory-data-all-mimetypes"
+#define NAFO_DATA_MIMETYPES_IS_ALL "na-factory-data-all-mimetypes"
#define NAFO_DATA_ISFILE "na-factory-data-isfile"
#define NAFO_DATA_ISDIR "na-factory-data-isdir"
#define NAFO_DATA_MULTIPLE "na-factory-data-multiple"
diff --git a/src/api/na-object-api.h b/src/api/na-object-api.h
index 1719324..e2e74fe 100644
--- a/src/api/na-object-api.h
+++ b/src/api/na-object-api.h
@@ -182,10 +182,12 @@ G_BEGIN_DECLS
/* NAIContext
*/
+#define na_object_check_mimetypes( obj ) na_icontext_check_mimetypes( NA_ICONTEXT( obj ))
+
#define na_object_get_basenames( obj ) (( GSList * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_BASENAMES ))
#define na_object_get_matchcase( obj ) (( gboolean ) GPOINTER_TO_UINT( na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_MATCHCASE )))
#define na_object_get_mimetypes( obj ) (( GSList * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_MIMETYPES ))
-#define na_object_get_all_mimetypes( obj ) (( gboolean ) GPOINTER_TO_UINT( na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ALL_MIMETYPES )))
+#define na_object_get_all_mimetypes( obj ) (( gboolean ) GPOINTER_TO_UINT( na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_MIMETYPES_IS_ALL )))
#define na_object_get_folders( obj ) (( GSList * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_FOLDERS ))
#define na_object_get_schemes( obj ) (( GSList * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_SCHEMES ))
#define na_object_get_only_show_in( obj ) (( GSList * ) na_ifactory_object_get_as_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ONLY_SHOW ))
@@ -200,7 +202,7 @@ G_BEGIN_DECLS
#define na_object_set_basenames( obj, bnames ) na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_BASENAMES, ( const void * )( bnames ))
#define na_object_set_matchcase( obj, match ) na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_MATCHCASE, ( const void * ) GUINT_TO_POINTER( match ))
#define na_object_set_mimetypes( obj, types ) na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_MIMETYPES, ( const void * )( types ))
-#define na_object_set_all_mimetypes( obj, all ) na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_ALL_MIMETYPES, ( const void * ) GUINT_TO_POINTER( all ))
+#define na_object_set_all_mimetypes( obj, all ) na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_MIMETYPES_IS_ALL, ( const void * ) GUINT_TO_POINTER( all ))
#define na_object_set_folders( obj, folders ) na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_FOLDERS, ( const void * )( folders ))
#define na_object_replace_folder( obj, old, new ) na_icontext_replace_folder( NA_ICONTEXT( obj ), ( const gchar * )( old ), ( const gchar * )( new ))
#define na_object_set_scheme( obj, scheme, add ) na_icontext_set_scheme( NA_ICONTEXT( obj ), ( const gchar * )( scheme ), ( add ))
diff --git a/src/core/na-icontext-factory.c b/src/core/na-icontext-factory.c
index 7776ff5..2ba3a0d 100644
--- a/src/core/na-icontext-factory.c
+++ b/src/core/na-icontext-factory.c
@@ -134,12 +134,14 @@ NADataDef data_def_conditions [] = {
/* i18n: "<EXPR>" is just an abbreviation for "an expression", so is tranlatable */
N_( "<EXPR>" ) },
- /* a runtime boolean set to TRUE if we detect that the previous string list
- * just cover all mimetypes - this let us optimize the check for candidate
- * in the menu plugin
- * when FALSE, than we have to check each and every mimetype :(
+ /* A runtime boolean set to TRUE if we detect that the previous string list
+ * just cover all mimetypes: this let us optimize the check for candidates
+ * in the menu plugin.
+ * When FALSE, than we have to check each and every mimetype :(
+ * This value is set when loading a pre-v3 profile, and then reset each time
+ * we update the list of mimetypes.
*/
- { NAFO_DATA_ALL_MIMETYPES,
+ { NAFO_DATA_MIMETYPES_IS_ALL,
FALSE,
FALSE,
TRUE,
diff --git a/src/core/na-icontext.c b/src/core/na-icontext.c
index 102ce11..877abfd 100644
--- a/src/core/na-icontext.c
+++ b/src/core/na-icontext.c
@@ -251,17 +251,18 @@ na_icontext_is_valid( const NAIContext *context )
}
/**
- * na_icontext_is_all_mimetypes:
+ * na_icontext_check_mimetypes:
* @context: the #NAIContext object to be checked.
*
- * Returns: %TRUE if this @context is valid for all mimetypes, %FALSE else.
+ * Check the current list of mimetypes to see if it covers all mimetypes,
+ * or all regular files, or something else.
*
* Since: 2.30
*/
-gboolean
-na_icontext_is_all_mimetypes( const NAIContext *context )
+void
+na_icontext_check_mimetypes( const NAIContext *context )
{
- static const gchar *thisfn = "na_icontext_is_all_mimetypes";
+ static const gchar *thisfn = "na_icontext_check_mimetypes";
gboolean is_all;
GSList *mimetypes, *im;
@@ -288,9 +289,9 @@ na_icontext_is_all_mimetypes( const NAIContext *context )
/* do not break here so that we are able to check all mimetypes */
}
- na_core_utils_slist_free( mimetypes );
+ na_object_set_all_mimetypes( context, is_all );
- return( is_all );
+ na_core_utils_slist_free( mimetypes );
}
/**
@@ -302,11 +303,6 @@ na_icontext_is_all_mimetypes( const NAIContext *context )
* <itemizedlist>
* <listitem>
* <para>
- * This converts a 'all/allfiles' mimetype to 'all/all' + 'file' scheme.
- * </para>
- * </listitem>
- * <listitem>
- * <para>
* This setup an internal flag when mimetypes is like 'all/all'
* in order to optimize computation time;
* </para>
@@ -318,7 +314,7 @@ na_icontext_is_all_mimetypes( const NAIContext *context )
void
na_icontext_read_done( NAIContext *context )
{
- na_object_set_all_mimetypes( context, na_icontext_is_all_mimetypes( context ));
+ na_object_check_mimetypes( context );
}
/**
diff --git a/src/core/na-object-profile.c b/src/core/na-object-profile.c
index e826f34..ce20ec9 100644
--- a/src/core/na-object-profile.c
+++ b/src/core/na-object-profile.c
@@ -567,7 +567,10 @@ convert_pre_v3_multiple( NAObjectProfile *profile )
* file=true and dir=true -> both files and dirs -> all/all
*
* we try to replace this with the corresponding mimetype, but only if
- * current mimetype is '*' (or * / * or all/all)
+ * current mimetype is '*' (or * / * or all/all).
+ *
+ * note that inode/directory is actually the mimetype provided by Nautilus;
+ * contrarily all/allfiles mimetype has to be checked separately.
*/
static gboolean
convert_pre_v3_isfiledir( NAObjectProfile *profile )
@@ -582,7 +585,8 @@ convert_pre_v3_isfiledir( NAObjectProfile *profile )
converted = FALSE;
- is_all_mimetypes = na_icontext_is_all_mimetypes( NA_ICONTEXT( profile ));
+ na_object_check_mimetypes( profile );
+ is_all_mimetypes = na_object_get_all_mimetypes( profile );
g_debug( "%s: is_all_mimetypes=%s", thisfn, is_all_mimetypes ? "True":"False" );
if( is_all_mimetypes ){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]