[nautilus-actions] Remove deprecated base_iprefs_get_int() and base_iprefs_set_int() functions



commit 32ed9ae7fc8ebeb233228d731f742ff9a270494f
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jan 14 01:57:41 2011 +0100

    Remove deprecated base_iprefs_get_int() and base_iprefs_set_int() functions

 ChangeLog                    |    8 +++++
 src/nact/base-iprefs.c       |   62 ------------------------------------------
 src/nact/base-iprefs.h       |   14 +---------
 src/nact/nact-icon-chooser.c |   18 +++++++++++-
 src/nact/nact-main-window.c  |   24 +++++++++++++---
 5 files changed, 45 insertions(+), 81 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4fd61f7..6b1167a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,14 @@
 	* src/utils/nautilus-actions-run.c:
 	* src/utils/nautilus-actions-schemas.c: Add locale.h include.
 
+	* src/nact/base-iprefs.c:
+	* src/nact/base-iprefs.h (base_iprefs_get_int, base_iprefs_set_int):
+	Remove deprecated functions.
+
+	* src/nact/nact-icon-chooser.c (instance_dispose, on_base_runtime_init_dialog):
+	* src/nact/nact-main-window.c (instance_dispose, on_base_initial_load_toplevel):
+	Updated accordingly.
+
 	* src/nact/nact-iprefs.c:
 	* src/nact/nact-iprefs.h (nact_iprefs_migrate_key): Remove deprecated function.
 
diff --git a/src/nact/base-iprefs.c b/src/nact/base-iprefs.c
index 06ab97a..0b3f8c3 100644
--- a/src/nact/base-iprefs.c
+++ b/src/nact/base-iprefs.c
@@ -55,9 +55,7 @@ static void        interface_base_finalize( BaseIPrefsInterface *klass );
 static gchar      *v_iprefs_get_window_id( const BaseWindow *window );
 
 static NASettings *get_settings( const BaseWindow *window );
-static gint        read_int( BaseWindow *window, const gchar *name );
 static GList      *read_int_list( const BaseWindow *window, const gchar *key );
-static void        write_int( BaseWindow *window, const gchar *name, gint value );
 static void        write_int_list( const BaseWindow *window, const gchar *key, GList *list );
 static void        int_list_to_position( const BaseWindow *window, GList *list, gint *x, gint *y, gint *width, gint *height );
 static GList      *position_to_int_list( const BaseWindow *window, gint x, gint y, gint width, gint height );
@@ -241,10 +239,6 @@ base_iprefs_save_window_position( const BaseWindow *window )
  * @key: the name of the window.
  *
  * Save size and position of the specified window.
- *
- * Note that the actual preference which records the size and position
- * of the window is a list of unsigned integers, named '<key>-wsp'
- * (for window size and position).
  */
 void
 base_iprefs_save_named_window_position( const BaseWindow *window, GtkWindow *toplevel, const gchar *key )
@@ -269,48 +263,6 @@ base_iprefs_save_named_window_position( const BaseWindow *window, GtkWindow *top
 		}
 	}
 }
-/**
- * base_iprefs_get_int:
- * @window: this BaseWindow-derived window.
- * @name: the entry to be readen.
- *
- * Returns: the named integer.
- */
-gint
-base_iprefs_get_int( BaseWindow *window, const gchar *name )
-{
-	gint ret = 0;
-
-	g_return_val_if_fail( BASE_IS_WINDOW( window ), 0 );
-	g_return_val_if_fail( BASE_IS_IPREFS( window ), 0 );
-
-	if( st_initialized && !st_finalized ){
-
-		ret = read_int( window, name );
-	}
-
-	return( ret );
-}
-
-/**
- * base_iprefs_set_int:
- * @window: this BaseWindow-derived window.
- * @name: the entry to be written.
- * @value: the integer to be set.
- *
- * Writes an integer in the GConf system.
- */
-void
-base_iprefs_set_int( BaseWindow *window, const gchar *name, gint value )
-{
-	g_return_if_fail( BASE_IS_WINDOW( window ));
-	g_return_if_fail( BASE_IS_IPREFS( window ));
-
-	if( st_initialized && !st_finalized ){
-
-		write_int( window, name, value );
-	}
-}
 
 static gchar *
 v_iprefs_get_window_id( const BaseWindow *window )
@@ -337,13 +289,6 @@ get_settings( const BaseWindow *window )
 	return( na_pivot_get_settings( NA_PIVOT( updater )));
 }
 
-static gint
-read_int( BaseWindow *window, const gchar *name )
-{
-	NASettings *settings = get_settings( window );
-	return( na_settings_get_uint( settings, name, NULL, NULL ));
-}
-
 /*
  * returns a list of int
  */
@@ -355,13 +300,6 @@ read_int_list( const BaseWindow *window, const gchar *key )
 }
 
 static void
-write_int( BaseWindow *window, const gchar *name, gint value )
-{
-	NASettings *settings = get_settings( window );
-	na_settings_set_uint( settings, name, value );
-}
-
-static void
 write_int_list( const BaseWindow *window, const gchar *key, GList *list )
 {
 	NASettings *settings = get_settings( window );
diff --git a/src/nact/base-iprefs.h b/src/nact/base-iprefs.h
index eae19c9..99682ee 100644
--- a/src/nact/base-iprefs.h
+++ b/src/nact/base-iprefs.h
@@ -41,8 +41,7 @@
  * restore size and position of windows on the display.
  *
  * Each #BaseWindow -derived window which want take advantage of this
- * feature may want implement this BaseIPrefs interface (but see also the
- * BaseWindow::base-wsp property which provides this same feature).
+ * feature may want implement this BaseIPrefs interface.
  */
 
 #include "base-window.h"
@@ -63,16 +62,8 @@ typedef struct {
 	BaseIPrefsInterfacePrivate *private;
 
 	/* api
-	 * deprecated: 3.1.0
 	 */
 	gchar * ( *iprefs_get_window_id )( const BaseWindow *window );
-
-	/* new api
-	 * since: 3.1.0
-	 */
-	const gchar * ( *get_wsp_id )   ( const BaseWindow *window );
-	GList       * ( *get_uint_list )( const BaseWindow *window );
-	void          ( *set_uint_list )( const BaseWindow *window, GList *list );
 }
 	BaseIPrefsInterface;
 
@@ -83,9 +74,6 @@ void  base_iprefs_position_named_window     ( const BaseWindow *window, GtkWindo
 void  base_iprefs_save_window_position      ( const BaseWindow *window );
 void  base_iprefs_save_named_window_position( const BaseWindow *window, GtkWindow *toplevel, const gchar *name );
 
-gint  base_iprefs_get_int( BaseWindow *window, const gchar *name );
-void  base_iprefs_set_int( BaseWindow *window, const gchar *name, gint value );
-
 G_END_DECLS
 
 #endif /* __BASE_IPREFS_H__ */
diff --git a/src/nact/nact-icon-chooser.c b/src/nact/nact-icon-chooser.c
index eb4e401..58024a1 100644
--- a/src/nact/nact-icon-chooser.c
+++ b/src/nact/nact-icon-chooser.c
@@ -229,6 +229,9 @@ instance_dispose( GObject *dialog )
 	NactIconChooser *self;
 	guint pos;
 	GtkWidget *paned;
+	NactApplication *application;
+	NAUpdater *updater;
+	NASettings *settings;
 
 	g_return_if_fail( NACT_IS_ICON_CHOOSER( dialog ));
 
@@ -240,9 +243,13 @@ instance_dispose( GObject *dialog )
 
 		self->private->dispose_has_run = TRUE;
 
+		application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( self )));
+		updater = nact_application_get_updater( application );
+		settings = na_pivot_get_settings( NA_PIVOT( updater ));
+
 		paned = base_window_get_widget( BASE_WINDOW( self ), "IconPaned" );
 		pos = gtk_paned_get_position( GTK_PANED( paned ));
-		base_iprefs_set_int( BASE_WINDOW( self ), NA_IPREFS_ICON_CHOOSER_PANED, pos );
+		na_settings_set_uint( settings, NA_IPREFS_ICON_CHOOSER_PANED, pos );
 
 		/* chain up to the parent class */
 		if( G_OBJECT_CLASS( st_parent_class )->dispose ){
@@ -438,12 +445,19 @@ on_base_runtime_init_dialog( NactIconChooser *editor, gpointer user_data )
 	static const gchar *thisfn = "nact_icon_chooser_on_runtime_init_dialog";
 	guint pos;
 	GtkWidget *paned;
+	NactApplication *application;
+	NAUpdater *updater;
+	NASettings *settings;
 
 	g_return_if_fail( NACT_IS_ICON_CHOOSER( editor ));
 
 	g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
 
-	pos = base_iprefs_get_int( BASE_WINDOW( editor ), NA_IPREFS_ICON_CHOOSER_PANED );
+	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
+	updater = nact_application_get_updater( application );
+	settings = na_pivot_get_settings( NA_PIVOT( updater ));
+
+	pos = na_settings_get_uint( settings, NA_IPREFS_ICON_CHOOSER_PANED, NULL, NULL );
 	if( pos ){
 		paned = base_window_get_widget( BASE_WINDOW( editor ), "IconPaned" );
 		gtk_paned_set_position( GTK_PANED( paned ), pos );
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 1ce80f6..c687643 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -747,9 +747,14 @@ instance_dispose( GObject *window )
 	GtkWidget *pane;
 	gint pos;
 	GList *it;
+	NactApplication *application;
+	NAUpdater *updater;
+	NASettings *settings;
 
-	g_debug( "%s: window=%p (%s)", thisfn, ( void * ) window, G_OBJECT_TYPE_NAME( window ));
 	g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
+
+	g_debug( "%s: window=%p (%s)", thisfn, ( void * ) window, G_OBJECT_TYPE_NAME( window ));
+
 	self = NACT_MAIN_WINDOW( window );
 
 	if( !self->private->dispose_has_run ){
@@ -758,9 +763,13 @@ instance_dispose( GObject *window )
 
 		g_object_unref( self->private->clipboard );
 
+		application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( self )));
+		updater = nact_application_get_updater( application );
+		settings = na_pivot_get_settings( NA_PIVOT( updater ));
+
 		pane = base_window_get_widget( BASE_WINDOW( window ), "MainPaned" );
 		pos = gtk_paned_get_position( GTK_PANED( pane ));
-		base_iprefs_set_int( BASE_WINDOW( window ), NA_IPREFS_MAIN_PANED, pos );
+		na_settings_set_uint( settings, NA_IPREFS_MAIN_PANED, pos );
 
 		for( it = self->private->deleted ; it ; it = it->next ){
 			g_debug( "nact_main_window_instance_dispose: deleted=%p (%s)", ( void * ) it->data, G_OBJECT_TYPE_NAME( it->data ));
@@ -1117,13 +1126,20 @@ on_base_initial_load_toplevel( NactMainWindow *window, gpointer user_data )
 	static const gchar *thisfn = "nact_main_window_on_base_initial_load_toplevel";
 	gint pos;
 	GtkWidget *pane;
+	NactApplication *application;
+	NAUpdater *updater;
+	NASettings *settings;
 
-	g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
 	g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
 
 	if( !window->private->dispose_has_run ){
+		g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
+
+		application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+		updater = nact_application_get_updater( application );
+		settings = na_pivot_get_settings( NA_PIVOT( updater ));
 
-		pos = base_iprefs_get_int( BASE_WINDOW( window ), NA_IPREFS_MAIN_PANED );
+		pos = na_settings_get_uint( settings, NA_IPREFS_MAIN_PANED, NULL, NULL );
 		if( pos ){
 			pane = base_window_get_widget( BASE_WINDOW( window ), "MainPaned" );
 			gtk_paned_set_position( GTK_PANED( pane ), pos );



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