[nautilus-actions] Only allow the 'About Nautilus-Actions...' item inside of the root Nautilus-Actions menu



commit 1f93fef9baa9152d701760e28d1845770aa4ad24
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Sep 11 21:57:53 2013 +0200

    Only allow the 'About Nautilus-Actions...' item inside of the root Nautilus-Actions menu

 ChangeLog                          |    8 ++++++++
 src/nact/nact-preferences-editor.c |   15 +++++++++++++++
 src/plugin-menu/nautilus-actions.c |    8 ++++----
 3 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a7ca185..1399c26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2013-09-11 Pierre Wieser <pwieser trychlos org>
 
+       Only allow the 'About Nautilus-Actions...' item inside of the
+       Nautilus-Actions root menu.
+
+       * src/nact/nact-preferences-editor.c (about_item_set_sensitive): New function.
+
+       * src/plugin-menu/nautilus-actions.c (build_nautilus_menu):
+       Only insert the 'About...' item inside of the root Nautilus-Actions menu.
+
        * src/plugin-menu/nautilus-actions.c (build_nautilus_menu_rec):
        Improve debug message.
 
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index f7c4281..c0357dc 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -146,6 +146,7 @@ static void       order_mode_on_toggled( NactPreferencesEditor *editor, GtkToggl
 static void       root_menu_setup( NactPreferencesEditor *editor );
 static void       root_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
 static void       about_item_setup( NactPreferencesEditor *editor );
+static void       about_item_set_sensitive( NactPreferencesEditor *editor );
 static void       about_item_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
 static void       terminal_pattern_setup( NactPreferencesEditor *editor );
 static void       terminal_pattern_on_changed( GtkEntry *entry, NactPreferencesEditor *editor );
@@ -720,6 +721,7 @@ root_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor )
 
        if( editable ){
                editor->private->root_menu = gtk_toggle_button_get_active( button );
+               about_item_set_sensitive( editor );
 
        } else {
                base_gtk_utils_toggle_reset_initial_state( button );
@@ -728,6 +730,8 @@ root_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor )
 
 /*
  * add an about item
+ *
+ * The About item is only added if the Nautilus-Actions root menu exists
  */
 static void
 about_item_setup( NactPreferencesEditor *editor )
@@ -740,6 +744,17 @@ about_item_setup( NactPreferencesEditor *editor )
        base_gtk_utils_toggle_set_initial_state( BASE_WINDOW( editor ),
                        "AddAboutButton", G_CALLBACK( about_item_on_toggled ),
                        editor->private->about_item, editable, !editor->private->preferences_locked );
+
+       about_item_set_sensitive( editor );
+}
+
+static void
+about_item_set_sensitive( NactPreferencesEditor *editor )
+{
+       GtkWidget *add_about;
+
+       add_about = base_window_get_widget( BASE_WINDOW( editor ), "AddAboutButton" );
+       gtk_widget_set_sensitive( add_about, editor->private->root_menu );
 }
 
 static void
diff --git a/src/plugin-menu/nautilus-actions.c b/src/plugin-menu/nautilus-actions.c
index 65f9f8a..fe76c61 100644
--- a/src/plugin-menu/nautilus-actions.c
+++ b/src/plugin-menu/nautilus-actions.c
@@ -513,11 +513,11 @@ build_nautilus_menu( NautilusActions *plugin, guint target, GList *selection )
                items_create_root_menu = na_settings_get_boolean( NA_IPREFS_ITEMS_CREATE_ROOT_MENU, NULL, 
NULL );
                if( items_create_root_menu ){
                        nautilus_menu = create_root_menu( plugin, nautilus_menu );
-               }
 
-               items_add_about_item = na_settings_get_boolean( NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, NULL, NULL );
-               if( items_add_about_item ){
-                       nautilus_menu = add_about_item( plugin, nautilus_menu );
+                       items_add_about_item = na_settings_get_boolean( NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, NULL, 
NULL );
+                       if( items_add_about_item ){
+                               nautilus_menu = add_about_item( plugin, nautilus_menu );
+                       }
                }
        }
 


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