[nautilus-actions] Refactoring: update toolbar management



commit 8352a85e211d8fcebbdb7926808ed542a0f77174
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Feb 17 19:49:41 2010 +0100

    Refactoring: update toolbar management

 ChangeLog                    |   11 +++++++++++
 src/core/na-iprefs.c         |   22 +---------------------
 src/core/na-iprefs.h         |    1 -
 src/nact/nact-iprefs.c       |   24 ++++++++++++++++++++++++
 src/nact/nact-iprefs.h       |    1 +
 src/nact/nact-main-toolbar.c |   15 +++++----------
 6 files changed, 42 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d3985ff..cd33391 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2009-02-17 Pierre Wieser <pwieser trychlos org>
 
+	* src/core/na-iprefs.c:
+	* src/core/na-iprefs.h:
+	* src/nact/nact-iprefs.c:
+	* src/nact/nact-iprefs.h:
+	* src/nact/nact-main-toolbar.c: Update toolbar.
+
+	* src/api/na-iio-provider.h:
+	* src/core/na-io-provider.c:
+	* src/core/na-io-provider.h:
+	* src/nact/nact-main-statusbar.c: Update status bar.
+
 	* src/api/na-object-action.h:
 	* src/api/na-object-api.h:
 	* src/api/na-object-id.h:
diff --git a/src/core/na-iprefs.c b/src/core/na-iprefs.c
index 2ed7a1b..63f558d 100644
--- a/src/core/na-iprefs.c
+++ b/src/core/na-iprefs.c
@@ -460,27 +460,7 @@ na_iprefs_read_string_list( const NAIPrefs *instance, const gchar *name, const g
 	return( list );
 }
 
-/**
- * na_iprefs_write_bool:
- * @instance: this #NAIPrefs interface instance.
- * @name: the preference entry.
- * @value: the value to be written.
- *
- * Writes the given boolean value.
- */
-#if 0
-void
-na_iprefs_write_bool( NAIPrefs *instance, const gchar *name, gboolean value )
-{
-	gchar *path;
-
-	g_return_if_fail( NA_IS_IPREFS( instance ));
-
-	path = gconf_concat_dir_and_key( NA_GCONF_PREFS_PATH, name );
-	na_gconf_utils_write_bool( na_iprefs_get_gconf_client( instance ), path, value, NULL );
-	g_free( path );
-}
-
+#if O
 /**
  * na_iprefs_write_string:
  * @instance: this #NAIPrefs interface instance.
diff --git a/src/core/na-iprefs.h b/src/core/na-iprefs.h
index d03b30d..cd9c2df 100644
--- a/src/core/na-iprefs.h
+++ b/src/core/na-iprefs.h
@@ -136,7 +136,6 @@ gboolean     na_iprefs_read_bool        ( const NAIPrefs *instance, const gchar
 gchar       *na_iprefs_read_string      ( const NAIPrefs *instance, const gchar *key, const gchar *default_value );
 GSList      *na_iprefs_read_string_list ( const NAIPrefs *instance, const gchar *key, const gchar *default_value );
 
-/*void         na_iprefs_write_bool( NAIPrefs *instance, const gchar *key, gboolean value );*/
 void         na_iprefs_write_string_list( const NAIPrefs *instance, const gchar *key, GSList *value );
 
 G_END_DECLS
diff --git a/src/nact/nact-iprefs.c b/src/nact/nact-iprefs.c
index 439a2d3..611b211 100644
--- a/src/nact/nact-iprefs.c
+++ b/src/nact/nact-iprefs.c
@@ -309,6 +309,30 @@ nact_iprefs_migrate_key( const BaseWindow *window, const gchar *old_key, const g
 }
 
 /**
+ * nact_iprefs_write_bool:
+ * @window: this #BaseWindow-derived window.
+ * @name: the preference entry.
+ * @value: the value to be written.
+ *
+ * Writes the given boolean value.
+ */
+void
+nact_iprefs_write_bool( const BaseWindow *window, const gchar *name, gboolean value )
+{
+	gchar *path;
+
+	g_return_if_fail( BASE_IS_WINDOW( window ));
+	g_return_if_fail( NACT_IS_IPREFS( window ));
+
+	if( st_initialized && !st_finalized ){
+
+		path = gconf_concat_dir_and_key( IPREFS_GCONF_PREFS_PATH, name );
+		na_gconf_utils_write_bool( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, value, NULL );
+		g_free( path );
+	}
+}
+
+/**
  * nact_iprefs_write_string:
  * @window: this #BaseWindow-derived window.
  * @name: the preference key.
diff --git a/src/nact/nact-iprefs.h b/src/nact/nact-iprefs.h
index 5170751..30e524e 100644
--- a/src/nact/nact-iprefs.h
+++ b/src/nact/nact-iprefs.h
@@ -91,6 +91,7 @@ void  nact_iprefs_set_import_mode   ( const BaseWindow *window, const gchar *pre
 
 void  nact_iprefs_migrate_key       ( const BaseWindow *window, const gchar *old_key, const gchar *new_key );
 
+void  nact_iprefs_write_bool        ( const BaseWindow *window, const gchar *key, gboolean value );
 void  nact_iprefs_write_string      ( const BaseWindow *window, const gchar *name, const gchar *value );
 
 G_END_DECLS
diff --git a/src/nact/nact-main-toolbar.c b/src/nact/nact-main-toolbar.c
index 00062a5..56d8400 100644
--- a/src/nact/nact-main-toolbar.c
+++ b/src/nact/nact-main-toolbar.c
@@ -32,9 +32,8 @@
 #include <config.h>
 #endif
 
-#include <runtime/na-iprefs.h>
-
 #include "nact-application.h"
+#include "nact-iprefs.h"
 #include "nact-main-toolbar.h"
 
 typedef struct {
@@ -98,16 +97,16 @@ static void
 init_toolbar( NactMainWindow *window, GtkActionGroup *group, int toolbar_id )
 {
 	NactApplication *application;
-	NAPivot *pivot;
+	NAUpdater *updater;
 	ToolbarProps *props;
 	gboolean is_active;
 	GtkToggleAction *action;
 
 	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
-	pivot = nact_application_get_pivot( application );
+	updater = nact_application_get_updater( application );
 	props = get_toolbar_properties( toolbar_id );
 	if( props ){
-		is_active = na_iprefs_read_bool( NA_IPREFS( pivot ), props->prefs_key, props->displayed_per_default );
+		is_active = na_iprefs_read_bool( NA_IPREFS( updater ), props->prefs_key, props->displayed_per_default );
 		if( is_active ){
 			action = GTK_TOGGLE_ACTION( gtk_action_group_get_action( group, props->ui_item ));
 			gtk_toggle_action_set_active( action, TRUE );
@@ -131,8 +130,6 @@ nact_main_toolbar_activate( NactMainWindow *window, int toolbar_id, GtkUIManager
 	ToolbarProps *props;
 	GtkWidget *toolbar, *hbox, *handle;
 	gulong attach_id, detach_id;
-	NactApplication *application;
-	NAPivot *pivot;
 
 	props = get_toolbar_properties( toolbar_id );
 	if( !props ){
@@ -169,9 +166,7 @@ nact_main_toolbar_activate( NactMainWindow *window, int toolbar_id, GtkUIManager
 		g_debug( "%s: ref=%d", thisfn, G_OBJECT( toolbar )->ref_count );
 	}
 
-	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
-	pivot = nact_application_get_pivot( application );
-	na_iprefs_write_bool( NA_IPREFS( pivot ), props->prefs_key, is_active );
+	nact_iprefs_write_bool( BASE_WINDOW( window ), props->prefs_key, is_active );
 }
 
 /*



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