[nautilus-actions] Implement NAIPivotConsumer::on_mandatory_prefs_change notification



commit 09c1524a18bd9b6d03e1c8d63080139889d5cdde
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Mar 25 19:00:03 2010 +0100

    Implement NAIPivotConsumer::on_mandatory_prefs_change notification

 ChangeLog                    |   12 ++++++++++++
 TODO                         |    3 ---
 src/nact/nact-main-window.c  |    9 ++++++++-
 src/nact/nact-sort-buttons.c |   16 ++++++++++++++++
 src/nact/nact-sort-buttons.h |   11 ++++++-----
 5 files changed, 42 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0cb61b9..b5ea77b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-03-25 Pierre Wieser <pwieser trychlos org>
+
+	* src/nact/nact-main-window.c
+	(ipivot_consumer_on_mandatory_prefs_changed):
+	Implement NAIPivotConsumer notification.
+
+	* src/nact/nact-sort-buttons.c:
+	* src/nact/nact-sort-buttons.h
+	(nact_sort_buttons_level_zero_writability_change):
+	Enable/disable the buttons depending of the level zero writability
+	status.
+
 2009-03-24 Pierre Wieser <pwieser trychlos org>
 
 	* src/core/na-ipivot-consumer.c
diff --git a/TODO b/TODO
index 7ba2d94..733def2 100644
--- a/TODO
+++ b/TODO
@@ -137,6 +137,3 @@
             properties/
             conditions/
             command/
-
-- enhancement.ui: implement on_mandatory_prefs_changed NAIPivotConsumer interface
-  to dynamically enable/disable order-mode buttons when admin changes them.
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 435fa59..ae937ee 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -180,6 +180,7 @@ static gboolean confirm_for_giveup_from_menu( NactMainWindow *window );
 static gboolean confirm_for_giveup_from_pivot( NactMainWindow *window );
 static void     ipivot_consumer_on_items_changed( NAIPivotConsumer *instance, gpointer user_data );
 static void     ipivot_consumer_on_display_order_changed( NAIPivotConsumer *instance, gint order_mode );
+static void     ipivot_consumer_on_mandatory_prefs_changed( NAIPivotConsumer *instance );
 static void     reload( NactMainWindow *window );
 
 static gchar   *iabout_get_application_name( NAIAbout *instance );
@@ -550,7 +551,7 @@ ipivot_consumer_iface_init( NAIPivotConsumerInterface *iface )
 	iface->on_create_root_menu_changed = NULL;
 	iface->on_display_about_changed = NULL;
 	iface->on_display_order_changed = ipivot_consumer_on_display_order_changed;
-	iface->on_mandatory_prefs_changed = NULL;
+	iface->on_mandatory_prefs_changed = ipivot_consumer_on_mandatory_prefs_changed;
 }
 
 static void
@@ -1459,6 +1460,12 @@ ipivot_consumer_on_display_order_changed( NAIPivotConsumer *instance, gint order
 			NACT_MAIN_WINDOW( instance ), MAIN_WINDOW_SIGNAL_LEVEL_ZERO_ORDER_CHANGED, GINT_TO_POINTER( TRUE ));
 }
 
+static void
+ipivot_consumer_on_mandatory_prefs_changed( NAIPivotConsumer *instance )
+{
+	nact_sort_buttons_level_zero_writability_change( NACT_MAIN_WINDOW( instance ));
+}
+
 static gchar *
 iabout_get_application_name( NAIAbout *instance )
 {
diff --git a/src/nact/nact-sort-buttons.c b/src/nact/nact-sort-buttons.c
index 432eacc..b07229b 100644
--- a/src/nact/nact-sort-buttons.c
+++ b/src/nact/nact-sort-buttons.c
@@ -164,6 +164,22 @@ nact_sort_buttons_display_order_change( NactMainWindow *window, guint order_mode
 	display_sort_order( window, order_mode );
 }
 
+/**
+ * nact_sort_buttons_level_zero_writability_change:
+ * @window: the #NactMainWindow.
+ *
+ * Relayed via NactMainWindow, this is a NAIPivotConsumer notification.
+ */
+void
+nact_sort_buttons_level_zero_writability_change( NactMainWindow *window )
+{
+	static const gchar *thisfn = "nact_sort_buttons_level_zero_writability_change";
+
+	g_debug( "%s: window=%p", thisfn, ( void * ) window );
+
+	enable_buttons( window );
+}
+
 static void
 enable_buttons( NactMainWindow *window )
 {
diff --git a/src/nact/nact-sort-buttons.h b/src/nact/nact-sort-buttons.h
index d102003..d810a11 100644
--- a/src/nact/nact-sort-buttons.h
+++ b/src/nact/nact-sort-buttons.h
@@ -41,11 +41,12 @@
 
 G_BEGIN_DECLS
 
-void  nact_sort_buttons_initial_load        ( NactMainWindow *window );
-void  nact_sort_buttons_runtime_init        ( NactMainWindow *window );
-void  nact_sort_buttons_all_widgets_showed  ( NactMainWindow *window );
-void  nact_sort_buttons_dispose             ( NactMainWindow *window );
-void  nact_sort_buttons_display_order_change( NactMainWindow *window, guint order_mode );
+void  nact_sort_buttons_initial_load                 ( NactMainWindow *window );
+void  nact_sort_buttons_runtime_init                 ( NactMainWindow *window );
+void  nact_sort_buttons_all_widgets_showed           ( NactMainWindow *window );
+void  nact_sort_buttons_dispose                      ( NactMainWindow *window );
+void  nact_sort_buttons_display_order_change         ( NactMainWindow *window, guint order_mode );
+void  nact_sort_buttons_level_zero_writability_change( NactMainWindow *window );
 
 G_END_DECLS
 



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