[gnome-shell] Add a sidebar show/hide menu item to the status menu



commit 70c51beeeb9d786bf3b3f2da5994d5ab4be47bf9
Author: Dan Winship <danw gnome org>
Date:   Tue Jun 30 15:00:06 2009 -0400

    Add a sidebar show/hide menu item to the status menu
    
    This is how it is in the mockups, but we may want to revisit it

 src/shell-status-menu.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-status-menu.c b/src/shell-status-menu.c
index 8293ac2..fa0be00 100644
--- a/src/shell-status-menu.c
+++ b/src/shell-status-menu.c
@@ -39,10 +39,13 @@
 #include <gdmuser/gdm-user-manager.h>
 
 #include "shell-global.h"
+#include "shell-gconf.h"
 
 #define LOCKDOWN_DIR    "/desktop/gnome/lockdown"
 #define LOCKDOWN_KEY    LOCKDOWN_DIR "/disable_user_switching"
 
+#define SIDEBAR_VISIBLE_KEY SHELL_GCONF_DIR "/sidebar/visible"
+
 struct _ShellStatusMenuPrivate {
   GConfClient    *client;
   GdmUserManager *manager;
@@ -54,6 +57,7 @@ struct _ShellStatusMenuPrivate {
 
   GtkWidget      *menu;
   GtkWidget      *account_item;
+  GtkWidget      *sidebar_item;
   GtkWidget      *control_panel_item;
   GtkWidget      *lock_screen_item;
   GtkWidget      *login_screen_item;
@@ -314,6 +318,14 @@ on_account_activate (GtkMenuItem   *item,
   spawn_external (status, "gnome-about-me");
 }
 
+static void
+on_sidebar_toggled (GtkCheckMenuItem *item,
+                    ShellStatusMenu  *status)
+{
+  gconf_client_set_bool (status->priv->client, SIDEBAR_VISIBLE_KEY,
+                         gtk_check_menu_item_get_active (item), NULL);
+}
+
 
 static void
 on_quit_session_activate (GtkMenuItem   *item,
@@ -472,6 +484,14 @@ create_sub_menu (ShellStatusMenu *status)
       G_CALLBACK (on_account_activate), status);
   gtk_widget_show (priv->account_item);
 
+  priv->sidebar_item = gtk_check_menu_item_new_with_label (_("Sidebar"));
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (priv->sidebar_item),
+      gconf_client_get_bool (priv->client, SIDEBAR_VISIBLE_KEY, NULL));
+  gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), priv->sidebar_item);
+  g_signal_connect (priv->sidebar_item, "toggled",
+      G_CALLBACK (on_sidebar_toggled), status);
+  gtk_widget_show (priv->sidebar_item);
+
   priv->control_panel_item = gtk_image_menu_item_new_with_label (_("System Preferences..."));
   gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (priv->control_panel_item),
       gtk_image_new ());



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