[nautilus-actions] Toolbar label defaults to action label



commit 0ca738149a826398e984aa43df3de5ba80a418f5
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat Oct 24 17:50:49 2009 +0200

    Toolbar label defaults to action label

 data/nautilus-actions.schemas.in |    2 +-
 src/common/na-xml-writer.c       |    2 +-
 src/nact/nact-xml-reader.c       |    2 +-
 src/runtime/na-object-action.c   |    9 +++++++++
 4 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/data/nautilus-actions.schemas.in b/data/nautilus-actions.schemas.in
index b3696a8..00ddcbb 100644
--- a/data/nautilus-actions.schemas.in
+++ b/data/nautilus-actions.schemas.in
@@ -131,7 +131,7 @@ The value is case sensitive and must not be localized.</long>
         <short>Whether the labels are the sames</short>
         <long>Whether the label displayed in the Nautilus toolbar besides of the icon is the same that the main item label.</long>
       </locale>
-      <default>false</default>
+      <default>true</default>
     </schema>
 
     <schema>
diff --git a/src/common/na-xml-writer.c b/src/common/na-xml-writer.c
index 88efd49..7da33b3 100644
--- a/src/common/na-xml-writer.c
+++ b/src/common/na-xml-writer.c
@@ -998,7 +998,7 @@ create_gconf_schema( NAXMLWriter *writer )
 	create_gconf_schema_entry( writer, OBJECT_ITEM_TARGET_SELECTION_ENTRY  , doc, list_node,   "bool", ACTION_TARGET_SELECTION_DESC_SHORT  , ACTION_TARGET_SELECTION_DESC_LONG  ,  "true", FALSE );
 	create_gconf_schema_entry( writer, OBJECT_ITEM_TARGET_BACKGROUND_ENTRY , doc, list_node,   "bool", ACTION_TARGET_BACKGROUND_DESC_SHORT , ACTION_TARGET_BACKGROUND_DESC_LONG , "false", FALSE );
 	create_gconf_schema_entry( writer, OBJECT_ITEM_TARGET_TOOLBAR_ENTRY    , doc, list_node,   "bool", ACTION_TARGET_TOOLBAR_DESC_SHORT    , ACTION_TARGET_TOOLBAR_DESC_LONG    , "false", FALSE );
-	create_gconf_schema_entry( writer, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, doc, list_node,   "bool", ACTION_TOOLBAR_SAME_LABEL_DESC_SHORT, ACTION_TOOLBAR_SAME_LABEL_DESC_LONG, "false", FALSE );
+	create_gconf_schema_entry( writer, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, doc, list_node,   "bool", ACTION_TOOLBAR_SAME_LABEL_DESC_SHORT, ACTION_TOOLBAR_SAME_LABEL_DESC_LONG,  "true", FALSE );
 	create_gconf_schema_entry( writer, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY     , doc, list_node, "string", ACTION_TOOLBAR_LABEL_DESC_SHORT     , ACTION_TOOLBAR_LABEL_DESC_LONG     , "", TRUE );
 	create_gconf_schema_entry( writer, ACTION_PROFILE_LABEL_ENTRY , doc, list_node, "string", ACTION_PROFILE_NAME_DESC_SHORT, ACTION_PROFILE_NAME_DESC_LONG, NA_OBJECT_PROFILE_DEFAULT_LABEL, TRUE );
 	create_gconf_schema_entry( writer, ACTION_PATH_ENTRY          , doc, list_node, "string", ACTION_PATH_DESC_SHORT        , ACTION_PATH_DESC_LONG        , "", FALSE );
diff --git a/src/nact/nact-xml-reader.c b/src/nact/nact-xml-reader.c
index c5d538d..91f1bc6 100644
--- a/src/nact/nact-xml-reader.c
+++ b/src/nact/nact-xml-reader.c
@@ -1162,7 +1162,7 @@ apply_values( NactXMLReader *reader )
 			na_object_action_set_target_toolbar( reader->private->action, na_utils_schema_to_boolean( reader->private->value, FALSE ));
 
 		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY )){
-			na_object_action_toolbar_set_same_label( reader->private->action, na_utils_schema_to_boolean( reader->private->value, FALSE ));
+			na_object_action_toolbar_set_same_label( reader->private->action, na_utils_schema_to_boolean( reader->private->value, TRUE ));
 
 		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY )){
 			na_object_action_toolbar_set_label( reader->private->action, reader->private->value );
diff --git a/src/runtime/na-object-action.c b/src/runtime/na-object-action.c
index 04fe2d6..eb4a20e 100644
--- a/src/runtime/na-object-action.c
+++ b/src/runtime/na-object-action.c
@@ -381,6 +381,7 @@ NAObjectAction *
 na_object_action_new( void )
 {
 	NAObjectAction *action;
+	gchar *label;
 
 	action = g_object_new( NA_OBJECT_ACTION_TYPE, NULL );
 
@@ -389,6 +390,14 @@ na_object_action_new( void )
 	/* i18n: default label for a new action */
 	na_object_set_label( action, NA_OBJECT_ACTION_DEFAULT_LABEL );
 
+	/* when flag is set, forces toolbar label to be the same that action label
+	 */
+	if( action->private->use_same_label ){
+		label = na_object_get_label( action );
+		na_object_action_toolbar_set_label( action, label );
+		g_free( label );
+	}
+
 	return( action );
 }
 



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