gnome-settings-daemon r596 - in trunk: . plugins/a11y-keyboard
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r596 - in trunk: . plugins/a11y-keyboard
- Date: Thu, 6 Nov 2008 19:46:56 +0000 (UTC)
Author: behdad
Date: Thu Nov 6 19:46:56 2008
New Revision: 596
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=596&view=rev
Log:
2008-11-06 Behdad Esfahbod <behdad gnome org>
* plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
(maybe_show_status_icon), (ax_slowkeys_warning_post_bubble),
(ax_stickykeys_warning_post_bubble),
(gsd_a11y_keyboard_manager_stop),
(gsd_a11y_keyboard_manager_ensure_status_icon),
(gsd_a11y_keyboard_manager_init):
Init status icon only when needed (bug #559558)
Modified:
trunk/ChangeLog
trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
Modified: trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
==============================================================================
--- trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c (original)
+++ trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c Thu Nov 6 19:46:56 2008
@@ -74,6 +74,7 @@
static void gsd_a11y_keyboard_manager_class_init (GsdA11yKeyboardManagerClass *klass);
static void gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *a11y_keyboard_manager);
static void gsd_a11y_keyboard_manager_finalize (GObject *object);
+static void gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager);
G_DEFINE_TYPE (GsdA11yKeyboardManager, gsd_a11y_keyboard_manager, G_TYPE_OBJECT)
@@ -337,7 +338,7 @@
gboolean enabled)
{
GConfClient *client;
- GdkScreen *screen;
+ GdkScreen *screen;
GError *err;
switch (response_id) {
@@ -433,6 +434,10 @@
show = gconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL);
g_object_unref (client);
+ if (!show && manager->priv->status_icon == NULL)
+ return;
+
+ gsd_a11y_keyboard_manager_ensure_status_icon (manager);
gtk_status_icon_set_visible (manager->priv->status_icon, show);
}
@@ -522,7 +527,7 @@
message = _("You just held down the Shift key for 8 seconds. This is the shortcut "
"for the Slow Keys feature, which affects the way your keyboard works.");
- if (! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
+ if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
return FALSE;
}
@@ -537,6 +542,7 @@
manager->priv->notification = NULL;
}
+ gsd_a11y_keyboard_manager_ensure_status_icon (manager);
manager->priv->notification = notify_notification_new_with_status_icon (title,
message,
"preferences-desktop-accessibility",
@@ -665,7 +671,7 @@
_("You just pressed two keys at once, or pressed the Shift key 5 times in a row. "
"This turns off the Sticky Keys feature, which affects the way your keyboard works.");
- if (! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
+ if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
return FALSE;
}
@@ -680,6 +686,7 @@
manager->priv->notification = NULL;
}
+ gsd_a11y_keyboard_manager_ensure_status_icon (manager);
manager->priv->notification = notify_notification_new_with_status_icon (title,
message,
"preferences-desktop-accessibility",
@@ -1052,7 +1059,8 @@
g_debug ("Stopping a11y_keyboard manager");
- gtk_status_icon_set_visible (manager->priv->status_icon, FALSE);
+ if (manager->priv->status_icon)
+ gtk_status_icon_set_visible (manager->priv->status_icon, FALSE);
if (p->gconf_notify != 0) {
GConfClient *client = gconf_client_get_default ();
@@ -1186,16 +1194,27 @@
}
static void
+gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager)
+{
+ gnome_settings_profile_start (NULL);
+
+ if (!manager->priv->status_icon) {
+
+ manager->priv->status_icon = gtk_status_icon_new_from_icon_name ("preferences-desktop-accessibility");
+ g_signal_connect (manager->priv->status_icon,
+ "activate",
+ G_CALLBACK (on_status_icon_activate),
+ manager);
+ }
+
+ gnome_settings_profile_end (NULL);
+}
+
+static void
gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *manager)
{
manager->priv = GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE (manager);
- manager->priv->status_icon = gtk_status_icon_new_from_icon_name ("preferences-desktop-accessibility");
- g_signal_connect (manager->priv->status_icon,
- "activate",
- G_CALLBACK (on_status_icon_activate),
- manager);
-
#ifdef HAVE_LIBNOTIFY
notify_init ("gnome-settings-daemon");
#endif /* HAVE_LIBNOTIFY */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]