[nautilus-actions] Fully deprecate NAIPivotConsumer interface



commit 0db0a2d303f8729ebffad46fc49677894c3f599e
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Feb 2 23:12:50 2011 +0100

    Fully deprecate NAIPivotConsumer interface

 ChangeLog                         |   13 ++
 src/core/Makefile.am              |    2 -
 src/core/na-ipivot-consumer.c     |  372 -------------------------------------
 src/core/na-ipivot-consumer.h     |  152 ---------------
 src/core/na-pivot.c               |  206 --------------------
 src/core/na-pivot.h               |   12 +-
 src/nact/nact-application.c       |    5 -
 src/nact/nact-main-menubar-file.c |    8 -
 src/nact/nact-main-window.c       |   54 ------
 src/nact/nact-menubar.c           |    1 -
 10 files changed, 15 insertions(+), 810 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 43ff2ad..78e25a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2011-02-02 Pierre Wieser <pwieser trychlos org>
 
+	Deprecate NAIPivotConsumer interface
+
+	* src/core/na-ipivot-consumer.c:
+	* src/core/na-ipivot-consumer.h: Removed files.
+
+	* src/core/Makefile.am:
+	* src/core/na-pivot.c:
+	* src/core/na-pivot.h:
+	* src/nact/nact-application.c:
+	* src/nact/nact-main-menubar-file.c:
+	* src/nact/nact-main-window.c:
+	* src/nact/nact-menubar.c: Updated accordingly.
+
 	* src/core/na-pivot.c:
 	* src/core/na-pivot.h
 	(na_pivot_set_automatic_reload): Remove unused function.
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 95c9730..dd1515f 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -83,8 +83,6 @@ libna_core_la_SOURCES = \
 	na-importer.h										\
 	na-importer-ask.c									\
 	na-importer-ask.h									\
-	na-ipivot-consumer.c								\
-	na-ipivot-consumer.h								\
 	na-iprefs.c											\
 	na-iprefs.h											\
 	na-module.c											\
diff --git a/src/core/na-pivot.c b/src/core/na-pivot.c
index 69360f2..64f4685 100644
--- a/src/core/na-pivot.c
+++ b/src/core/na-pivot.c
@@ -59,12 +59,6 @@ struct _NAPivotPrivate {
 	 */
 	GList      *modules;
 
-	/* list of instances to be notified of configuration updates
-	 * these are called 'consumers' of NAPivot
-	 * to be deprecated
-	 */
-	GList      *consumers;
-
 	/* configuration tree of actions and menus
 	 */
 	GList      *tree;
@@ -106,9 +100,6 @@ static void          instance_finalize( GObject *object );
 
 static NAObjectItem *get_item_from_tree( const NAPivot *pivot, GList *tree, const gchar *id );
 
-/* NAIPivotConsumer management */
-static void          free_consumers( GList *list );
-
 /* NAIIOProvider management */
 static void          on_items_changed_timeout( NAPivot *pivot );
 
@@ -214,7 +205,6 @@ instance_init( GTypeInstance *instance, gpointer klass )
 	self->private->dispose_has_run = FALSE;
 	self->private->loadable_set = PIVOT_LOAD_NONE;
 	self->private->modules = NULL;
-	self->private->consumers = NULL;
 	self->private->tree = NULL;
 
 	/* initialize timeout parameters for 'item-changed' handler
@@ -317,10 +307,6 @@ instance_dispose( GObject *object )
 		na_module_release_modules( self->private->modules );
 		self->private->modules = NULL;
 
-		/* release list of NAIPivotConsumers */
-		free_consumers( self->private->consumers );
-		self->private->consumers = NULL;
-
 		/* release item tree */
 		g_debug( "%s: tree=%p, count=%u", thisfn, ( void * ) self->private->tree, g_list_length( self->private->tree ));
 		na_object_unref_items( self->private->tree );
@@ -410,7 +396,6 @@ na_pivot_dump( const NAPivot *pivot )
 
 		g_debug( "%s: loadable_set=%d", thisfn, pivot->private->loadable_set );
 		g_debug( "%s:      modules=%p (%d elts)", thisfn, ( void * ) pivot->private->modules, g_list_length( pivot->private->modules ));
-		g_debug( "%s:    consumers=%p (%d elts)", thisfn, ( void * ) pivot->private->consumers, g_list_length( pivot->private->consumers ));
 		g_debug( "%s:         tree=%p (%d elts)", thisfn, ( void * ) pivot->private->tree, g_list_length( pivot->private->tree ));
 		/*g_debug( "%s:     monitors=%p (%d elts)", thisfn, ( void * ) pivot->private->monitors, g_list_length( pivot->private->monitors ));*/
 
@@ -648,48 +633,6 @@ on_items_changed_timeout( NAPivot *pivot )
 
 	g_debug( "%s: emitting %s signal", thisfn, PIVOT_SIGNAL_ITEMS_CHANGED );
 	g_signal_emit_by_name(( gpointer ) pivot, PIVOT_SIGNAL_ITEMS_CHANGED );
-
-#if 0
-	GList *ic;
-
-	/* this has to be deprecated.. or not ?? */
-	g_debug( "%s: triggering NAIPivotConsumer interfaces", thisfn );
-	for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
-		na_ipivot_consumer_notify_of_items_changed( NA_IPIVOT_CONSUMER( ic->data ));
-	}
-#endif
-}
-
-/*
- * na_pivot_register_consumer:
- * @pivot: this #NAPivot instance.
- * @consumer: a #NAIPivotConsumer which wishes be notified of any
- * modification of an action or a menu in any of the underlying I/O
- * storage subsystems.
- *
- * Registers a new consumer to be notified of configuration modification.
- */
-void
-na_pivot_register_consumer( NAPivot *pivot, const NAIPivotConsumer *consumer )
-{
-	static const gchar *thisfn = "na_pivot_register_consumer";
-
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-	g_return_if_fail( NA_IS_IPIVOT_CONSUMER( consumer ));
-
-	if( !pivot->private->dispose_has_run ){
-
-		g_debug( "%s: pivot=%p, consumer=%p", thisfn, ( void * ) pivot, ( void * ) consumer );
-
-		pivot->private->consumers = g_list_prepend( pivot->private->consumers, ( gpointer ) consumer );
-	}
-}
-
-static void
-free_consumers( GList *consumers )
-{
-	/*g_list_foreach( consumers, ( GFunc ) g_object_unref, NULL );*/
-	g_list_free( consumers );
 }
 
 /*
@@ -735,152 +678,3 @@ na_pivot_set_loadable( NAPivot *pivot, guint loadable )
 		pivot->private->loadable_set = loadable;
 	}
 }
-
-#if 0
-static void
-on_io_provider_prefs_changed( GConfClient *client, guint cnxn_id, GConfEntry *entry, NAPivot *pivot )
-{
-	GList *ic;
-
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-
-	if( !pivot->private->dispose_has_run ){
-
-		for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
-			na_ipivot_consumer_notify_of_io_provider_prefs_changed( NA_IPIVOT_CONSUMER( ic->data ));
-		}
-	}
-}
-
-static void
-on_mandatory_prefs_changed( GConfClient *client, guint cnxn_id, GConfEntry *entry, NAPivot *pivot )
-{
-	GList *ic;
-
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-
-	if( !pivot->private->dispose_has_run ){
-
-		for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
-			na_ipivot_consumer_notify_of_mandatory_prefs_changed( NA_IPIVOT_CONSUMER( ic->data ));
-		}
-	}
-}
-
-static void
-on_preferences_change( GConfClient *client, guint cnxn_id, GConfEntry *entry, NAPivot *pivot )
-{
-	/*static const gchar *thisfn = "na_pivot_on_preferences_change";*/
-	const gchar *key;
-	gchar *key_entry;
-
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-
-	key = gconf_entry_get_key( entry );
-	key_entry = g_path_get_basename( key );
-	/*g_debug( "%s: key=%s", thisfn, key_entry );*/
-
-	if( !g_ascii_strcasecmp( key_entry, NA_IPREFS_ITEMS_CREATE_ROOT_MENU )){
-		create_root_menu_changed( pivot );
-	}
-
-	if( !g_ascii_strcasecmp( key_entry, NA_IPREFS_ITEMS_ADD_ABOUT_ITEM )){
-		display_about_changed( pivot );
-	}
-
-	if( !g_ascii_strcasecmp( key_entry, NA_IPREFS_ITEMS_LIST_ORDER_MODE )){
-		display_order_changed( pivot );
-	}
-
-	if( !g_ascii_strcasecmp( key_entry, NA_IPREFS_MAIN_SAVE_AUTO ) || !g_ascii_strcasecmp( key_entry, NA_IPREFS_MAIN_SAVE_PERIOD )){
-		autosave_changed( pivot );
-	}
-
-	g_free( key_entry );
-}
-
-static void
-display_order_changed( NAPivot *pivot )
-{
-	static const gchar *thisfn = "na_pivot_display_order_changed";
-	GList *ic;
-	gint order_mode;
-
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-
-	if( !pivot->private->dispose_has_run ){
-
-		g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
-
-		order_mode = na_iprefs_get_order_mode( NA_IPREFS( pivot ));
-
-		for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
-			na_ipivot_consumer_notify_of_display_order_changed( NA_IPIVOT_CONSUMER( ic->data ), order_mode );
-		}
-	}
-}
-
-static void
-create_root_menu_changed( NAPivot *pivot )
-{
-	static const gchar *thisfn = "na_pivot_create_root_menu_changed";
-	GList *ic;
-	gboolean should_create;
-
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-
-	if( !pivot->private->dispose_has_run ){
-
-		g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
-
-		should_create = na_iprefs_read_bool( NA_IPREFS( pivot ), NA_IPREFS_ITEMS_CREATE_ROOT_MENU, FALSE );
-		for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
-			na_ipivot_consumer_notify_of_create_root_menu_changed( NA_IPIVOT_CONSUMER( ic->data ), should_create );
-		}
-	}
-}
-
-static void
-display_about_changed( NAPivot *pivot )
-{
-	static const gchar *thisfn = "na_pivot_display_about_changed";
-	GList *ic;
-	gboolean display_about;
-
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-
-	if( !pivot->private->dispose_has_run ){
-
-		g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
-
-		display_about = na_iprefs_read_bool( NA_IPREFS( pivot ), NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, TRUE );
-
-		for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
-			na_ipivot_consumer_notify_of_display_about_changed( NA_IPIVOT_CONSUMER( ic->data ), display_about );
-		}
-	}
-}
-
-static void
-autosave_changed( NAPivot *pivot )
-{
-	static const gchar *thisfn = "na_pivot_autosave_changed";
-	GList *ic;
-	gboolean autosave_on;
-	guint autosave_period;
-
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-
-	if( !pivot->private->dispose_has_run ){
-
-		g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
-
-		autosave_on = na_iprefs_read_bool( NA_IPREFS( pivot ), NA_IPREFS_MAIN_SAVE_AUTO, FALSE );
-		autosave_period = na_iprefs_read_uint( NA_IPREFS( pivot ), NA_IPREFS_MAIN_SAVE_PERIOD, 5 );
-
-		for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
-			na_ipivot_consumer_notify_of_autosave_changed( NA_IPIVOT_CONSUMER( ic->data ), autosave_on, autosave_period );
-		}
-	}
-}
-#endif
diff --git a/src/core/na-pivot.h b/src/core/na-pivot.h
index dc3665b..de97fcc 100644
--- a/src/core/na-pivot.h
+++ b/src/core/na-pivot.h
@@ -76,7 +76,6 @@
 #include <api/na-iio-provider.h>
 #include <api/na-object-api.h>
 
-#include "na-ipivot-consumer.h"
 #include "na-settings.h"
 
 G_BEGIN_DECLS
@@ -139,7 +138,7 @@ NAPivot      *na_pivot_new ( void );
 void          na_pivot_dump( const NAPivot *pivot );
 
 /* Management of the plugins which claim to implement a Nautilus-Actions interface.
- * As of 2.30, these are NAIIOProvider, NAIImporter, NAIExporter
+ * As of 2.30, these may be NAIIOProvider, NAIImporter or NAIExporter
  */
 GList        *na_pivot_get_providers ( const NAPivot *pivot, GType type );
 void          na_pivot_free_providers( GList *providers );
@@ -153,15 +152,8 @@ void          na_pivot_set_new_items( NAPivot *pivot, GList *tree );
 
 void          na_pivot_on_item_changed_handler( NAIIOProvider *provider, NAPivot *pivot  );
 
-/* NAIPivotConsumer interface management
- * to be deprecated
+/* Monitoring and preferences management
  */
-void          na_pivot_register_consumer( NAPivot *pivot, const NAIPivotConsumer *consumer );
-
-/*
- * Monitoring and preferences management
- */
-
 NASettings   *na_pivot_get_settings     ( const NAPivot *pivot );
 
 /* NAPivot properties and configuration
diff --git a/src/nact/nact-application.c b/src/nact/nact-application.c
index 15bf835..696872e 100644
--- a/src/nact/nact-application.c
+++ b/src/nact/nact-application.c
@@ -38,7 +38,6 @@
 #include <api/na-core-utils.h>
 
 #include <core/na-iabout.h>
-#include <core/na-ipivot-consumer.h>
 
 #include "nact-application.h"
 #include "nact-main-window.h"
@@ -352,10 +351,6 @@ appli_main_window_new( const BaseApplication *application, int *code )
 
 	main_window = nact_main_window_new( appli );
 
-	na_pivot_register_consumer(
-			NA_PIVOT( appli->private->updater ),
-			NA_IPIVOT_CONSUMER( main_window ));
-
 	return( G_OBJECT( main_window ));
 }
 
diff --git a/src/nact/nact-main-menubar-file.c b/src/nact/nact-main-menubar-file.c
index 0d0c850..dab2257 100644
--- a/src/nact/nact-main-menubar-file.c
+++ b/src/nact/nact-main-menubar-file.c
@@ -262,10 +262,6 @@ nact_main_menubar_file_save_items( NactMainWindow *window )
 
 	g_debug( "%s: window=%p", thisfn, ( void * ) window );
 
-	/* get ride of notification messages of I/O providers
-	 */
-	na_ipivot_consumer_allow_notify( NA_IPIVOT_CONSUMER( window ), FALSE, 0 );
-
 	/* always write the level zero list of items as the first save phase
 	 * and reset the corresponding modification flag
 	 */
@@ -344,10 +340,6 @@ nact_main_menubar_file_save_items( NactMainWindow *window )
 	if( !new_pivot ){
 		g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_UPDATE_ACTION_SENSITIVITIES, NULL );
 	}
-
-	/* restore NAPivot notifications
-	 */
-	na_ipivot_consumer_allow_notify( NA_IPIVOT_CONSUMER( window ), TRUE, 2000 );
 }
 
 /*
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 5c05b61..93f61d5 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -38,7 +38,6 @@
 #include <api/na-object-api.h>
 
 #include <core/na-iabout.h>
-#include <core/na-ipivot-consumer.h>
 #include <core/na-iprefs.h>
 #include <core/na-pivot.h>
 
@@ -159,7 +158,6 @@ static void     ienvironment_tab_iface_init( NactIEnvironmentTabInterface *iface
 static void     iexecution_tab_iface_init( NactIExecutionTabInterface *iface );
 static void     iproperties_tab_iface_init( NactIPropertiesTabInterface *iface );
 static void     iabout_iface_init( NAIAboutInterface *iface );
-static void     ipivot_consumer_iface_init( NAIPivotConsumerInterface *iface );
 static void     instance_init( GTypeInstance *instance, gpointer klass );
 static void     instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
 static void     instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );
@@ -193,9 +191,6 @@ static gchar   *iactions_list_get_treeview_name( NactIActionsList *instance );
 static void     on_tab_updatable_item_updated( NactMainWindow *window, gpointer user_data, gboolean force_display );
 
 static void     on_settings_order_mode_changed( const gchar *group, const gchar *key, gconstpointer new_value, gboolean mandatory, NactMainWindow *window );
-static void     ipivot_consumer_on_io_provider_prefs_changed( NAIPivotConsumer *instance );
-static void     ipivot_consumer_on_mandatory_prefs_changed( NAIPivotConsumer *instance );
-static void     update_ui_after_provider_change( NactMainWindow *window );
 
 static gchar     *iabout_get_application_name( NAIAbout *instance );
 static GtkWindow *iabout_get_toplevel( NAIAbout *instance );
@@ -303,12 +298,6 @@ register_type( void )
 		NULL
 	};
 
-	static const GInterfaceInfo ipivot_consumer_iface_info = {
-		( GInterfaceInitFunc ) ipivot_consumer_iface_init,
-		NULL,
-		NULL
-	};
-
 	g_debug( "%s", thisfn );
 
 	type = g_type_register_static( NACT_WINDOW_TYPE, "NactMainWindow", &info, 0 );
@@ -337,8 +326,6 @@ register_type( void )
 
 	g_type_add_interface_static( type, NA_IABOUT_TYPE, &iabout_iface_info );
 
-	g_type_add_interface_static( type, NA_IPIVOT_CONSUMER_TYPE, &ipivot_consumer_iface_info );
-
 	return( type );
 }
 
@@ -603,22 +590,6 @@ iabout_iface_init( NAIAboutInterface *iface )
 }
 
 static void
-ipivot_consumer_iface_init( NAIPivotConsumerInterface *iface )
-{
-	static const gchar *thisfn = "nact_main_window_ipivot_consumer_iface_init";
-
-	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
-
-	iface->on_autosave_changed = NULL;
-	iface->on_create_root_menu_changed = NULL;
-	iface->on_display_about_changed = NULL;
-	iface->on_display_order_changed = NULL;
-	iface->on_io_provider_prefs_changed = ipivot_consumer_on_io_provider_prefs_changed;
-	iface->on_items_changed = NULL;
-	iface->on_mandatory_prefs_changed = ipivot_consumer_on_mandatory_prefs_changed;
-}
-
-static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
 	static const gchar *thisfn = "nact_main_window_instance_init";
@@ -634,8 +605,6 @@ instance_init( GTypeInstance *instance, gpointer klass )
 	self->private = g_new0( NactMainWindowPrivate, 1 );
 
 	self->private->dispose_has_run = FALSE;
-
-	na_ipivot_consumer_allow_notify( NA_IPIVOT_CONSUMER( instance ), TRUE, 0 );
 }
 
 static void
@@ -1601,29 +1570,6 @@ on_settings_order_mode_changed( const gchar *group, const gchar *key, gconstpoin
 	}
 }
 
-static void
-ipivot_consumer_on_io_provider_prefs_changed( NAIPivotConsumer *instance )
-{
-	update_ui_after_provider_change( NACT_MAIN_WINDOW( instance ));
-}
-
-static void
-ipivot_consumer_on_mandatory_prefs_changed( NAIPivotConsumer *instance )
-{
-	update_ui_after_provider_change( NACT_MAIN_WINDOW( instance ));
-}
-
-static void
-update_ui_after_provider_change( NactMainWindow *window )
-{
-	nact_sort_buttons_level_zero_writability_change( window );
-
-	if( window->private->selected_item ){
-		setup_writability_status( window );
-		g_signal_emit_by_name( window, MAIN_WINDOW_SIGNAL_SELECTION_CHANGED, GINT_TO_POINTER( 1 ));
-	}
-}
-
 static gchar *
 iabout_get_application_name( NAIAbout *instance )
 {
diff --git a/src/nact/nact-menubar.c b/src/nact/nact-menubar.c
index 31d5acc..f94f348 100644
--- a/src/nact/nact-menubar.c
+++ b/src/nact/nact-menubar.c
@@ -45,7 +45,6 @@
 
 #include <core/na-factory-object.h>
 #include <core/na-iprefs.h>
-#include <core/na-ipivot-consumer.h>
 #include <core/na-io-provider.h>
 
 #include "nact-iactions-list.h"



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