[nautilus-actions] Require rather a command than a label for a profile



commit 4a6358cab59b17f21b74f266a71d25cdba43e42d
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Oct 9 13:19:54 2009 +0200

    Require rather a command than a label for a profile

 ChangeLog                       |    3 +++
 src/runtime/na-object-profile.c |   18 ++++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c537379..9ce5326 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,9 @@
 
 	* src/nact/Makefile.am: Updated accordingly.
 
+	* src/runtime/na-object-profile.c (object_is_valid):
+	A profile requires rather a command to be valid that a label.
+
 2009-10-08 Pierre Wieser <pwieser trychlos org>
 
 	* src/common/na-object-api.h (na_object_remove_item):
diff --git a/src/runtime/na-object-profile.c b/src/runtime/na-object-profile.c
index 8935877..deceddd 100644
--- a/src/runtime/na-object-profile.c
+++ b/src/runtime/na-object-profile.c
@@ -1472,13 +1472,14 @@ object_are_equal( const NAObject *a, const NAObject *b )
 }
 
 /*
- * a valid NAObjectProfile requires a not null, not empty label
- * this is checked here as NAObject doesn't have this condition
+ * a valid NAObjectProfile requires rather a not empty command to be a
+ * valid candidate to execution ; as the distinction path vs.parameters
+ * is somewhat arbitrary, we check for at least one of these
  */
 gboolean
 object_is_valid( const NAObject *profile )
 {
-	gchar *label;
+	gchar *path, *parameters;
 	gboolean is_valid = TRUE;
 
 	g_return_val_if_fail( NA_IS_OBJECT_PROFILE( profile ), FALSE );
@@ -1486,9 +1487,14 @@ object_is_valid( const NAObject *profile )
 	if( !NA_OBJECT_PROFILE( profile )->private->dispose_has_run ){
 
 		if( is_valid ){
-			label = na_object_get_label( profile );
-			is_valid = ( label && g_utf8_strlen( label, -1 ) > 0 );
-			g_free( label );
+			path = na_object_get_path( profile );
+			parameters = na_object_get_parameters( profile );
+
+			is_valid = ( path && g_utf8_strlen( path, -1 ) > 0 ) ||
+						( parameters && g_utf8_strlen( parameters, -1 ) > 0 );
+
+			g_free( parameters );
+			g_free( path );
 		}
 	}
 



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