Commit 069c52f4 authored by Jonh Wendell's avatar Jonh Wendell Committed by Jonh Wendell S. Santana
Browse files

Added a gconf key to disable menu shortcuts.

2008-05-29  Jonh Wendell <jwendell@gnome.org>

	Added a gconf key to disable menu shortcuts.

svn path=/trunk/; revision=344
parent 7300e949
2008-05-29 Jonh Wendell <jwendell@gnome.org>
Added a gconf key to disable menu shortcuts.
2008-05-29 Jonh Wendell <jwendell@gnome.org>
* src/vinagre-window.c,
......
......@@ -61,5 +61,17 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/vinagre/show_accels</key>
<applyto>/apps/vinagre/show_accels</applyto>
<owner>vinagre</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Whether we should show the menu accelerators (shortcut keys)</short>
<long>Set to "false" to disable menu shortcuts. Set to "true" to enable them. Note that if they are enabled, those keys will be intercepted by the menu and will not be sent to the remote host.</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>
......@@ -28,6 +28,7 @@
#define VM_TOOLBAR_VISIBLE VINAGRE_BASE_KEY "/toolbar_visible"
#define VM_STATUSBAR_VISIBLE VINAGRE_BASE_KEY "/statusbar_visible"
#define VM_SIDE_PANEL_VISIBLE VINAGRE_BASE_KEY "/side_pane_visible"
#define VM_SHOW_ACCELS VINAGRE_BASE_KEY "/show_accels"
#define VM_WINDOW_STATE VINAGRE_BASE_KEY "/window_state"
#define VM_WINDOW_WIDTH VINAGRE_BASE_KEY "/window_width"
......@@ -51,7 +52,8 @@ enum
PROP_WINDOW_STATE,
PROP_WINDOW_WIDTH,
PROP_WINDOW_HEIGHT,
PROP_SIDE_PANEL_SIZE
PROP_SIDE_PANEL_SIZE,
PROP_SHOW_ACCELS
};
G_DEFINE_TYPE (VinagrePrefs, vinagre_prefs, G_TYPE_OBJECT);
......@@ -144,6 +146,15 @@ vinagre_prefs_always_show_tabs_notify (GConfClient *client,
g_object_notify (G_OBJECT (prefs), "always-show-tabs");
}
static void
vinagre_prefs_show_accels_notify (GConfClient *client,
guint cnx_id,
GConfEntry *entry,
VinagrePrefs *prefs)
{
g_object_notify (G_OBJECT (prefs), "show-accels");
}
static void
vinagre_prefs_init (VinagrePrefs *prefs)
{
......@@ -162,6 +173,10 @@ vinagre_prefs_init (VinagrePrefs *prefs)
VM_ALWAYS_SHOW_TABS,
(GConfClientNotifyFunc) vinagre_prefs_always_show_tabs_notify,
prefs, NULL, NULL);
gconf_client_notify_add (prefs->priv->gconf_client,
VM_SHOW_ACCELS,
(GConfClientNotifyFunc) vinagre_prefs_show_accels_notify,
prefs, NULL, NULL);
}
......@@ -213,6 +228,9 @@ vinagre_prefs_set_property (GObject *object, guint prop_id, const GValue *value,
case PROP_SIDE_PANEL_SIZE:
vinagre_prefs_set_int (prefs, VM_SIDE_PANEL_SIZE, g_value_get_int (value));
break;
case PROP_SHOW_ACCELS:
vinagre_prefs_set_bool (prefs, VM_SHOW_ACCELS, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -253,6 +271,9 @@ vinagre_prefs_get_property (GObject *object, guint prop_id, GValue *value, GPara
case PROP_SIDE_PANEL_SIZE:
g_value_set_int (value, vinagre_prefs_get_int (prefs, VM_SIDE_PANEL_SIZE, 200));
break;
case PROP_SHOW_ACCELS:
g_value_set_boolean (value, vinagre_prefs_get_bool (prefs, VM_SHOW_ACCELS, TRUE));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -334,6 +355,13 @@ vinagre_prefs_class_init (VinagrePrefsClass *klass)
"The width of side panel",
100, G_MAXINT, 200,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SHOW_ACCELS,
g_param_spec_boolean ("show-accels",
"Show menu accelerators",
"Whether we should show the menu accelerators (keyboard shortcuts)",
TRUE,
G_PARAM_READWRITE));
}
/* vim: ts=8 */
......@@ -339,6 +339,19 @@ recent_manager_changed (GtkRecentManager *manager,
update_recent_connections (window);
}
static void
show_hide_accels (VinagreWindow *window)
{
gboolean show_accels;
g_object_get (vinagre_prefs_get_default (),
"show-accels", &show_accels,
NULL);
g_object_set (gtk_settings_get_default (),
"gtk-enable-accels", show_accels,
NULL);
}
static void
create_menu_bar_and_toolbar (VinagreWindow *window,
GtkWidget *main_box)
......@@ -491,6 +504,12 @@ create_menu_bar_and_toolbar (VinagreWindow *window,
"changed",
G_CALLBACK (recent_manager_changed),
window);
g_signal_connect_swapped (vinagre_prefs_get_default (),
"notify::show-accels",
G_CALLBACK (show_hide_accels),
window);
show_hide_accels (window);
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment