[nautilus-actions] Profile must be valid to be candidate



commit e8f9cde3cdbd452b3262b9efea146b8eaf90559b
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat Dec 12 13:31:02 2009 +0100

    Profile must be valid to be candidate

 ChangeLog                                    |    5 +++++
 TODO                                         |    3 ---
 nautilus-actions/private/na-object-profile.c |   12 ++++++++++++
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6103342..71f7b75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-12-12 Pierre Wieser <pwieser trychlos org>
 
+	* nautilus-actions/private/na-object-profile.c
+	(na_object_profile_is_candidate,
+	na_object_profile_is_candidate_for_tracked):
+	Profile must be valid in order to be candidate.
+
 	* nautilus-actions/api/na-dbus.h: New file.
 
 	* nautilus-actions/api/Makefile.am: Updated accordingly.
diff --git a/TODO b/TODO
index 35a7f9c..b33d9d4 100644
--- a/TODO
+++ b/TODO
@@ -106,6 +106,3 @@
 - naobjectprofile: object_are_equal, object_is_valid should be static
 
 - dbus send: do we should free the strings after their emission ?
-
-- when looking to see if an action is candidate, we only look at valid action, yes ?
-  but when searching for a profile, we also should check that the profile is valid
diff --git a/nautilus-actions/private/na-object-profile.c b/nautilus-actions/private/na-object-profile.c
index 358f96e..c901095 100644
--- a/nautilus-actions/private/na-object-profile.c
+++ b/nautilus-actions/private/na-object-profile.c
@@ -1031,6 +1031,12 @@ na_object_profile_is_candidate( const NAObjectProfile *profile, gint target, GLi
 {
 	gboolean is_candidate;
 
+	g_return_val_if_fail( NA_IS_OBJECT_PROFILE( profile ), FALSE );
+
+	if( !na_object_is_valid( profile )){
+		return( FALSE );
+	}
+
 	switch( target ){
 		case ITEM_TARGET_BACKGROUND:
 			is_candidate = is_target_background_candidate( profile, ( NautilusFileInfo * ) files->data );
@@ -1118,6 +1124,12 @@ na_object_profile_is_candidate_for_tracked( const NAObjectProfile *profile, GLis
 {
 	gboolean is_candidate;
 
+	g_return_val_if_fail( NA_IS_OBJECT_PROFILE( profile ), FALSE );
+
+	if( !na_object_is_valid( profile )){
+		return( FALSE );
+	}
+
 	is_candidate = is_target_selection_candidate( profile, tracked_items, FALSE );
 
 	return( is_candidate );



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