[nautilus-actions: 26/30] Propagate default values to imported action
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions: 26/30] Propagate default values to imported action
- Date: Sat, 21 Nov 2009 18:03:27 +0000 (UTC)
commit 7dd96e61ba46985480382ad6ac00ba4d541ea4cc
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Nov 21 12:58:33 2009 +0100
Propagate default values to imported action
ChangeLog | 3 +++
TODO | 2 --
nautilus-actions/nact/nact-xml-reader.c | 17 +++++++++++++++++
3 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6fa8bc4..ee4eb93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
(on_tab_updatable_selection_changed):
Display empty label when item not set.
+ * nautilus-actions/nact/nact-xml-reader.c (propagate_default_values):
+ Propagate default values to the newly imported action.
+
2009-11-20 Pierre Wieser <pwieser trychlos org>
Define functions with actual type for arguments.
diff --git a/TODO b/TODO
index e07184f..361e911 100644
--- a/TODO
+++ b/TODO
@@ -92,5 +92,3 @@
see https://bugzilla.gnome.org/show_bug.cgi?id=593453
- nact: dnd an action into nact, then deleting it: the '*' is always here
-
-- nact: importing an action doesn't set toolbar label
diff --git a/nautilus-actions/nact/nact-xml-reader.c b/nautilus-actions/nact/nact-xml-reader.c
index add806e..54ffd9b 100644
--- a/nautilus-actions/nact/nact-xml-reader.c
+++ b/nautilus-actions/nact/nact-xml-reader.c
@@ -72,6 +72,7 @@ struct NactXMLReaderPrivate {
NAObjectAction *action; /* the action that we will return, or NULL */
GSList *messages;
gboolean uuid_set; /* set at first uuid, then checked against */
+ gboolean toolbar_label_set;
/* following values are reset at each schema/entry node
*/
@@ -172,6 +173,7 @@ static gboolean is_uuid_valid( const gchar *uuid );
static gchar *get_entry_from_key( const gchar *key );
static void free_reader_values( NactXMLReader *reader );
static gboolean manage_import_mode( NactXMLReader *reader );
+static void propagate_default_values( NactXMLReader *reader );
static NAObjectItem *search_in_auxiliaries( NactXMLReader *reader, const gchar *uuid );
static void relabel( NactXMLReader *reader );
@@ -249,6 +251,7 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private->locale_waited = FALSE;
self->private->entry = NULL;
self->private->value = NULL;
+ self->private->toolbar_label_set = FALSE;
}
static void
@@ -369,6 +372,7 @@ nact_xml_reader_import( BaseWindow *window, GList *items, const gchar *uri, gint
if( reader->private->action ){
g_assert( NA_IS_OBJECT_ACTION( reader->private->action ));
+ propagate_default_values( reader );
if( manage_import_mode( reader )){
action = g_object_ref( reader->private->action );
}
@@ -1166,6 +1170,7 @@ apply_values( NactXMLReader *reader )
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 )){
+ reader->private->toolbar_label_set = TRUE;
na_object_action_toolbar_set_label( reader->private->action, reader->private->value );
} else if( !strcmp( reader->private->entry, ACTION_PROFILE_LABEL_ENTRY )){
@@ -1365,6 +1370,18 @@ manage_import_mode( NactXMLReader *reader )
return( ret );
}
+static void
+propagate_default_values( NactXMLReader *reader )
+{
+ gchar *label;
+
+ if( !reader->private->toolbar_label_set ){
+ label = na_object_get_label( reader->private->action );
+ na_object_action_toolbar_set_label( reader->private->action, label );
+ g_free( label );
+ }
+}
+
static NAObjectItem *
search_in_auxiliaries( NactXMLReader *reader, const gchar *uuid )
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]