[gdm-list] gconf lockdown
- From: "Matthias Clasen" <matthias clasen gmail com>
- To: gdm-list gnome org
- Cc: Richard Hughes <hughsient gmail com>
- Subject: [gdm-list] gconf lockdown
- Date: Wed, 14 Nov 2007 00:03:44 -0500
Here is a gnome-power-manager patch that adds a show_context_menu gconf key.
If we turn that off in the gdm session, we not only get rid of the
preferences ui,
but also the possibly unwanted help (brings up yelp, and may offer
ways to bring
up a browser) and about (has a link).
Matthias
diff -up gnome-power-manager-2.20.1/src/gpm-conf.h.context-menu gnome-power-manager-2.20.1/src/gpm-conf.h
--- gnome-power-manager-2.20.1/src/gpm-conf.h.context-menu 2007-11-02 13:31:05.000000000 -0400
+++ gnome-power-manager-2.20.1/src/gpm-conf.h 2007-11-13 23:48:54.000000000 -0500
@@ -146,6 +146,7 @@ G_BEGIN_DECLS
#define GPM_CONF_UI_SHOW_CPUFREQ GPM_CONF_DIR "/ui/cpufreq_show"
#define GPM_CONF_UI_SHOW_ACTIONS_IN_MENU GPM_CONF_DIR "/ui/show_actions_in_menu"
#define GPM_CONF_UI_ENABLE_BEEPING GPM_CONF_DIR "/ui/enable_sound"
+#define GPM_CONF_UI_SHOW_CONTEXT_MENU GPM_CONF_DIR "/ui/show_context_menu"
/* we use the gnome-session key now */
#define GPM_CONF_SESSION_REQUEST_SAVE "/apps/gnome-session/options/auto_save_session"
diff -up gnome-power-manager-2.20.1/src/gpm-tray-icon.c.context-menu gnome-power-manager-2.20.1/src/gpm-tray-icon.c
--- gnome-power-manager-2.20.1/src/gpm-tray-icon.c.context-menu 2007-11-02 13:31:05.000000000 -0400
+++ gnome-power-manager-2.20.1/src/gpm-tray-icon.c 2007-11-13 23:48:54.000000000 -0500
@@ -68,6 +68,7 @@ struct GpmTrayIconPrivate
gboolean is_visible;
gboolean show_suspend;
gboolean show_hibernate;
+ gboolean show_context_menu;
};
enum {
@@ -124,6 +125,14 @@ gpm_tray_icon_enable_hibernate (GpmTrayI
icon->priv->show_hibernate = enabled;
}
+static void
+gpm_tray_icon_enable_context_menu (GpmTrayIcon *icon,
+ gboolean enabled)
+{
+ g_return_if_fail (GPM_IS_TRAY_ICON (icon));
+ icon->priv->show_context_menu = enabled;
+}
+
/**
* gpm_tray_icon_show:
* @icon: This TrayIcon class instance
@@ -429,6 +438,9 @@ gpm_tray_icon_popup_menu_cb (GtkStatusIc
gpm_debug ("icon right clicked");
+ if (!icon->priv->show_context_menu)
+ return;
+
/* Preferences */
item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences"));
image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
@@ -629,6 +641,9 @@ conf_key_changed_cb (GpmConf *conf,
gpm_tray_icon_enable_suspend (icon, allowed_in_menu && enabled);
gpm_control_allowed_hibernate (icon->priv->control, &enabled, NULL);
gpm_tray_icon_enable_hibernate (icon, allowed_in_menu && enabled);
+ } else if (strcmp (key, GPM_CONF_UI_SHOW_CONTEXT_MENU) == 0) {
+ gpm_conf_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_CONTEXT_MENU, &allowed_in_menu);
+ gpm_tray_icon_enable_context_menu (icon, allowed_in_menu);
}
}
@@ -677,6 +692,9 @@ gpm_tray_icon_init (GpmTrayIcon *icon)
gpm_control_allowed_hibernate (icon->priv->control, &enabled, NULL);
gpm_tray_icon_enable_hibernate (icon, enabled && allowed_in_menu);
+ gpm_conf_get_bool (icon->priv->conf, GPM_CONF_UI_SHOW_CONTEXT_MENU, &allowed_in_menu);
+ gpm_tray_icon_enable_context_menu (icon, allowed_in_menu);
+
gpm_tray_icon_show (GPM_TRAY_ICON (icon), FALSE);
}
diff -up gnome-power-manager-2.20.1/data/gnome-power-manager.schemas.in.context-menu gnome-power-manager-2.20.1/data/gnome-power-manager.schemas.in
--- gnome-power-manager-2.20.1/data/gnome-power-manager.schemas.in.context-menu 2007-11-13 23:49:47.000000000 -0500
+++ gnome-power-manager-2.20.1/data/gnome-power-manager.schemas.in 2007-11-13 23:51:55.000000000 -0500
@@ -917,6 +917,18 @@
</schema>
<schema>
+ <key>/schemas/apps/gnome-power-manager/ui/show_context_menu</key>
+ <applyto>/apps/gnome-power-manager/ui/show_context_menu</applyto>
+ <owner>gnome-power-manager</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>If preferences should be shown</short>
+ <long></long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gnome-power-manager/ui/show_actions_in_menu</key>
<applyto>/apps/gnome-power-manager/ui/show_actions_in_menu</applyto>
<owner>gnome-power-manager</owner>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]