[nautilus-actions] Do not enable the modification of order mode if level zero is not writable
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Do not enable the modification of order mode if level zero is not writable
- Date: Wed, 24 Mar 2010 23:36:35 +0000 (UTC)
commit 9bdf1dd6c1ece0e42850522257815db49b1ea525
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Mar 25 00:37:55 2010 +0100
Do not enable the modification of order mode if level zero is not writable
ChangeLog | 4 ++++
src/nact/nact-preferences-editor.c | 23 +++++++++++++++++++++++
src/nact/nact-sort-buttons.c | 25 +++++++++++++++++++++++++
3 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3ca50a6..1fb1fcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-03-24 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-preferences-editor.c (on_base_runtime_init_dialog):
+ * src/nact/nact-sort-buttons.c (nact_sort_buttons_runtime_init):
+ Forbid the modification of order mode is level zero is not writable.
+
* src/core/na-pivot.c (na_pivot_is_level_zero_writable):
Writable if not all not GConf are locked by admin.
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 52d7b5f..a05cc85 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -334,6 +334,7 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
break;
}
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
+ enable_order_mode_buttons( editor );
create_root_menu = na_iprefs_read_bool( NA_IPREFS( updater ), IPREFS_CREATE_ROOT_MENU, FALSE );
button = base_window_get_widget( BASE_WINDOW( editor ), "CreateRootMenuButton" );
@@ -465,6 +466,28 @@ on_ok_clicked( GtkButton *button, NactPreferencesEditor *editor )
}
static void
+enable_order_mode_buttons( NactPreferencesEditor *editor )
+{
+ NactApplication *application;
+ NAUpdater *updater;
+ gboolean writable;
+ GtkWidget *button;
+
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
+ updater = nact_application_get_updater( application );
+ writable = na_pivot_is_level_zero_writable( NA_PIVOT( updater ));
+
+ button = base_window_get_widget( BASE_WINDOW( editor ), "OrderAlphaAscButton" );
+ gtk_widget_set_sensitive( button, writable );
+
+ button = base_window_get_widget( BASE_WINDOW( editor ), "OrderAlphaDescButton" );
+ gtk_widget_set_sensitive( button, writable );
+
+ button = base_window_get_widget( BASE_WINDOW( editor ), "OrderManualButton" );
+ gtk_widget_set_sensitive( button, writable );
+}
+
+static void
save_preferences( NactPreferencesEditor *editor )
{
NactApplication *application;
diff --git a/src/nact/nact-sort-buttons.c b/src/nact/nact-sort-buttons.c
index 3197b06..432eacc 100644
--- a/src/nact/nact-sort-buttons.c
+++ b/src/nact/nact-sort-buttons.c
@@ -38,6 +38,7 @@
#include "nact-application.h"
#include "nact-sort-buttons.h"
+static void enable_buttons( NactMainWindow *window );
static void on_sort_down_button_toggled( GtkToggleButton *button, NactMainWindow *window );
static void on_sort_manual_button_toggled( GtkToggleButton *button, NactMainWindow *window );
static void on_sort_up_button_toggled( GtkToggleButton *button, NactMainWindow *window );
@@ -95,6 +96,8 @@ nact_sort_buttons_runtime_init( NactMainWindow *window )
G_OBJECT( button ),
"toggled",
G_CALLBACK( on_sort_manual_button_toggled ));
+
+ enable_buttons( window );
}
/**
@@ -162,6 +165,28 @@ nact_sort_buttons_display_order_change( NactMainWindow *window, guint order_mode
}
static void
+enable_buttons( NactMainWindow *window )
+{
+ NactApplication *application;
+ NAUpdater *updater;
+ gboolean writable;
+ GtkWidget *button;
+
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+ updater = nact_application_get_updater( application );
+ writable = na_pivot_is_level_zero_writable( NA_PIVOT( updater ));
+
+ button = base_window_get_widget( BASE_WINDOW( window ), "SortUpButton" );
+ gtk_widget_set_sensitive( button, writable );
+
+ button = base_window_get_widget( BASE_WINDOW( window ), "SortDownButton" );
+ gtk_widget_set_sensitive( button, writable );
+
+ button = base_window_get_widget( BASE_WINDOW( window ), "SortManualButton" );
+ gtk_widget_set_sensitive( button, writable );
+}
+
+static void
on_sort_down_button_toggled( GtkToggleButton *toggled_button, NactMainWindow *window )
{
GtkToggleButton *button;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]