[nautilus-actions] Reset action to last version number after conversion from pre-v2



commit f770aba5e1fd038b4c7bae5375ec7db292bf7c70
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon May 17 06:42:48 2010 +0200

    Reset action to last version number after conversion from pre-v2

 ChangeLog                   |    8 ++++++++
 src/api/na-object-action.h  |    1 +
 src/api/na-object-api.h     |    1 +
 src/core/na-object-action.c |   18 ++++++++++++++++++
 4 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3cec298..60ee238 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-05-17 Pierre Wieser <pwieser trychlos org>
 
+	* src/api/na-object-api.h (na_object_set_last_version):
+	* src/api/na-object-action.h:
+	* src/core/na-object-action.c (na_object_action_set_last_version):
+	New functions.
+
+	* src/core/na-object-action.c (convert_pre_v2_action):
+	Reset action to last version number after conversion from pre-v2.
+
 	* src/core/na-object-profile.c (na_object_profile_parse_parameters):
 	Do not add extraneous blanks when parsing parameters.
 
diff --git a/src/api/na-object-action.h b/src/api/na-object-action.h
index 3287a54..f9e4ff7 100644
--- a/src/api/na-object-action.h
+++ b/src/api/na-object-action.h
@@ -82,6 +82,7 @@ NAObjectAction *na_object_action_new_with_defaults( void );
 gchar          *na_object_action_get_new_profile_name( const NAObjectAction *action );
 
 void            na_object_action_attach_profile( NAObjectAction *action, NAObjectProfile *profile );
+void            na_object_action_set_last_version( NAObjectAction *action );
 
 gboolean        na_object_action_is_candidate( const NAObjectAction *action, guint target, GList *selection );
 
diff --git a/src/api/na-object-api.h b/src/api/na-object-api.h
index d6fb86a..3100375 100644
--- a/src/api/na-object-api.h
+++ b/src/api/na-object-api.h
@@ -144,6 +144,7 @@ G_BEGIN_DECLS
 #define na_object_set_toolbar_same_label( obj, same )	na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_TOOLBAR_SAME_LABEL, ( const void * ) GUINT_TO_POINTER( same ))
 #define na_object_set_last_allocated( obj, last )		na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_LAST_ALLOCATED, ( const void * ) GUINT_TO_POINTER( last ))
 
+#define na_object_set_last_version( obj )				na_object_action_set_last_version( NA_OBJECT_ACTION( obj ))
 #define na_object_reset_last_allocated( obj )			na_ifactory_object_set_from_void( NA_IFACTORY_OBJECT( obj ), NAFO_DATA_LAST_ALLOCATED, ( const void * ) GUINT_TO_POINTER( 0 ))
 #define na_object_attach_profile( obj, profile )		na_object_action_attach_profile( NA_OBJECT_ACTION( obj ), NA_OBJECT_PROFILE( profile ))
 
diff --git a/src/core/na-object-action.c b/src/core/na-object-action.c
index 4a3cb1b..e0e0e5a 100644
--- a/src/core/na-object-action.c
+++ b/src/core/na-object-action.c
@@ -435,6 +435,7 @@ convert_pre_v2_action( NAIFactoryObject *instance )
 		}
 
 		na_factory_object_set_defaults( NA_IFACTORY_OBJECT( profile ));
+		na_object_set_last_version( instance );
 	}
 }
 
@@ -680,6 +681,23 @@ na_object_action_attach_profile( NAObjectAction *action, NAObjectProfile *profil
 }
 
 /**
+ * na_object_action_set_last_version:
+ * @action: the #NAObjectAction action to update.
+ *
+ * Set the version number of the @action to the last one.
+ */
+void
+na_object_action_set_last_version( NAObjectAction *action )
+{
+	g_return_if_fail( NA_IS_OBJECT_ACTION( action ));
+
+	if( !action->private->dispose_has_run ){
+
+		na_object_set_version( action, "2.0" );
+	}
+}
+
+/**
  * na_object_action_is_candidate:
  * @action: the #NAObjectAction to be tested.
  * @target: the current target.



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