[nautilus] desktop-canvas: hide Change Background action when no g-c-c is found



commit 1bc7eead58c08d0768bff9f5fa86e5e1ec40e551
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Mar 19 19:40:56 2013 -0400

    desktop-canvas: hide Change Background action when no g-c-c is found
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690883

 src/nautilus-actions.h             |    1 +
 src/nautilus-desktop-canvas-view.c |   12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-actions.h b/src/nautilus-actions.h
index 0132454..61b4c2d 100644
--- a/src/nautilus-actions.h
+++ b/src/nautilus-actions.h
@@ -129,5 +129,6 @@
 #define NAUTILUS_ACTION_ZOOM_ITEMS "Zoom Items"
 #define NAUTILUS_ACTION_SORT_TRASH_TIME "Sort by Trash Time"
 #define NAUTILUS_ACTION_SORT_SEARCH_RELEVANCE "Sort by Search Relevance"
+#define NAUTILUS_ACTION_CHANGE_BACKGROUND "Change Background"
 
 #endif /* NAUTILUS_ACTIONS_H */
diff --git a/src/nautilus-desktop-canvas-view.c b/src/nautilus-desktop-canvas-view.c
index 75287ec..d17341e 100644
--- a/src/nautilus-desktop-canvas-view.c
+++ b/src/nautilus-desktop-canvas-view.c
@@ -655,7 +655,7 @@ real_update_menus (NautilusView *view)
 
 static const GtkActionEntry desktop_view_entries[] = {
        /* name, stock id */
-       { "Change Background", NULL,
+       { NAUTILUS_ACTION_CHANGE_BACKGROUND, NULL,
          /* label, accelerator */
          N_("Change Desktop _Background"), NULL,
          /* tooltip */
@@ -697,6 +697,8 @@ real_merge_menus (NautilusView *view)
        NautilusDesktopCanvasView *desktop_view;
        GtkUIManager *ui_manager;
        GtkActionGroup *action_group;
+       GtkAction *action;
+       gchar *control_center_path;
 
        NAUTILUS_VIEW_CLASS (nautilus_desktop_canvas_view_parent_class)->merge_menus (view);
 
@@ -731,6 +733,14 @@ real_merge_menus (NautilusView *view)
                               NAUTILUS_ACTION_UNSTRETCH,
                               GTK_UI_MANAGER_MENUITEM,
                               FALSE);
+
+       control_center_path = g_find_program_in_path ("gnome-control-center");
+       if (control_center_path == NULL) {
+               action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_CHANGE_BACKGROUND);
+               gtk_action_set_visible (action, FALSE);
+       }
+
+       g_free (control_center_path);
 }
 
 static NautilusView *


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