[gnome-settings-daemon] keyboard: remove status icons for keyboard leds



commit 87d635355f733cafb105acdc862258dfdd5900e5
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Jan 28 16:29:57 2011 -0500

    keyboard: remove status icons for keyboard leds
    
    There is no sense maintaining code that uses obsolete status
    icons, won't be shown in GNOME 3, doesn't match designs,
    doesn't have an equivalent in GNOME Shell, is off by default, and
    has no UI to turn it on.

 ...tings-daemon.plugins.keyboard.gschema.xml.in.in |    5 -
 plugins/keyboard/gsd-keyboard-xkb.c                |  104 --------------------
 2 files changed, 0 insertions(+), 109 deletions(-)
---
diff --git a/data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in
index 00aabcb..9dbc55d 100644
--- a/data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in
@@ -15,10 +15,5 @@
       <_summary>Never show layout indicator</_summary>
       <_description>Disable the keyboard layout indicator unconditionally, do not show it even if number of layouts is more than one.</_description>
     </key>
-    <key name="show-keyboard-leds-indicator" type="b">
-      <default>false</default>
-      <_summary>Display keyboard LEDs on the panel</_summary>
-      <_description>Display pseudo-leds for keyboards that do not have physical LEDs for CapsLock, NumLock, and ScrollLock.</_description>
-    </key>
   </schema>
 </schemalist>
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index d510a48..1ef3cf9 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.c
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
@@ -43,7 +43,6 @@
 #define SETTINGS_KEYBOARD_DIR "org.gnome.settings-daemon.plugins.keyboard"
 
 #define DISABLE_INDICATOR_KEY "disable-indicator"
-#define SHOW_KEYBOARD_LEDS_INDICATOR_KEY "show-keyboard-leds-indicator"
 
 static GsdKeyboardManager *manager = NULL;
 
@@ -69,29 +68,6 @@ static GtkStatusIcon *icon = NULL;
 
 static GHashTable *preview_dialogs = NULL;
 
-static Atom caps_lock;
-static Atom num_lock;
-static Atom scroll_lock;
-
-static GtkStatusIcon *indicator_icons[3];
-static const gchar *indicator_on_icon_names[] = {
-	"kbd-scrolllock-on",
-	"kbd-numlock-on",
-	"kbd-capslock-on"
-};
-
-static const gchar *indicator_off_icon_names[] = {
-	"kbd-scrolllock-off",
-	"kbd-numlock-off",
-	"kbd-capslock-off"
-};
-
-static const gchar *indicator_icon_names[] = {
-	"kbd-scrolllock",
-	"kbd-numlock",
-	"kbd-capslock"
-};
-
 static void
 activation_error (void)
 {
@@ -130,8 +106,6 @@ activation_error (void)
 static void
 apply_desktop_settings (void)
 {
-	gboolean show_leds;
-	guint i;
 	if (!inited_ok)
 		return;
 
@@ -140,14 +114,6 @@ apply_desktop_settings (void)
 	/* again, probably it would be nice to compare things
 	   before activating them */
 	gkbd_desktop_config_activate (&current_config);
-
-	show_leds =
-	    g_settings_get_boolean (settings_plugin,
-				    SHOW_KEYBOARD_LEDS_INDICATOR_KEY);
-	for (i = 0; i < G_N_ELEMENTS (indicator_icons); i++) {
-		gtk_status_icon_set_visible (indicator_icons[i],
-					     show_leds);
-	}
 }
 
 static void
@@ -492,53 +458,9 @@ gsd_keyboard_new_device (XklEngine * engine)
 	apply_xkb_settings ();
 }
 
-static void
-gsd_keyboard_update_indicator_icons ()
-{
-	Bool state;
-	int new_state;
-	guint i;
-	Display *display =
-	    GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
-	XkbGetNamedIndicator (display, caps_lock, NULL, &state, NULL,
-			      NULL);
-	new_state = state ? 1 : 0;
-	XkbGetNamedIndicator (display, num_lock, NULL, &state, NULL, NULL);
-	new_state <<= 1;
-	new_state |= (state ? 1 : 0);
-	XkbGetNamedIndicator (display, scroll_lock, NULL, &state,
-			      NULL, NULL);
-	new_state <<= 1;
-	new_state |= (state ? 1 : 0);
-	xkl_debug (160, "Indicators state: %d\n", new_state);
-
-	for (i = 0; i < G_N_ELEMENTS (indicator_icons); i++) {
-		gtk_status_icon_set_from_icon_name (indicator_icons[i],
-						    (new_state & (1 << i))
-						    ?
-						    indicator_on_icon_names
-						    [i] :
-						    indicator_off_icon_names
-						    [i]);
-	}
-}
-
-static void
-gsd_keyboard_state_changed (XklEngine * engine, XklEngineStateChange type,
-			    gint new_group, gboolean restore)
-{
-	xkl_debug (160,
-		   "State changed: type %d, new group: %d, restore: %d.\n",
-		   type, new_group, restore);
-	if (type == INDICATORS_CHANGED) {
-		gsd_keyboard_update_indicator_icons ();
-	}
-}
-
 void
 gsd_keyboard_xkb_init (GsdKeyboardManager * kbd_manager)
 {
-	guint i;
 	Display *display =
 	    GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
 	gnome_settings_profile_start (NULL);
@@ -549,20 +471,6 @@ gsd_keyboard_xkb_init (GsdKeyboardManager * kbd_manager)
 					   DATADIR G_DIR_SEPARATOR_S
 					   "icons");
 
-	caps_lock = XInternAtom (display, "Caps Lock", False);
-	num_lock = XInternAtom (display, "Num Lock", False);
-	scroll_lock = XInternAtom (display, "Scroll Lock", False);
-
-	for (i = 0; i < G_N_ELEMENTS (indicator_icons); i++) {
-		indicator_icons[i] =
-		    gtk_status_icon_new_from_icon_name
-		    (indicator_off_icon_names[i]);
-		gtk_status_icon_set_name (indicator_icons[i], indicator_icon_names[i]);
-		gtk_status_icon_set_visible (indicator_icons[i], FALSE);
-	}
-
-	gsd_keyboard_update_indicator_icons ();
-
 	manager = kbd_manager;
 	gnome_settings_profile_start ("xkl_engine_get_instance");
 	xkl_engine = xkl_engine_get_instance (display);
@@ -592,9 +500,6 @@ gsd_keyboard_xkb_init (GsdKeyboardManager * kbd_manager)
 			g_signal_connect (xkl_engine, "X-new-device",
 					  G_CALLBACK
 					  (gsd_keyboard_new_device), NULL);
-		g_signal_connect (xkl_engine, "X-state-changed",
-				  G_CALLBACK
-				  (gsd_keyboard_state_changed), NULL);
 
 		gnome_settings_profile_start ("xkl_engine_start_listen");
 		xkl_engine_start_listen (xkl_engine,
@@ -617,8 +522,6 @@ gsd_keyboard_xkb_init (GsdKeyboardManager * kbd_manager)
 void
 gsd_keyboard_xkb_shutdown (void)
 {
-	guint i;
-
 	if (!inited_ok)
 		return;
 
@@ -626,13 +529,6 @@ gsd_keyboard_xkb_shutdown (void)
 	pa_callback_user_data = NULL;
 	manager = NULL;
 
-	for (i = 0; i < G_N_ELEMENTS (indicator_icons); i++) {
-		if (indicator_icons[i] != NULL) {
-			g_object_unref (G_OBJECT (indicator_icons[i]));
-			indicator_icons[i] = NULL;
-		}
-	}
-
 	if (preview_dialogs != NULL)
 		g_hash_table_destroy (preview_dialogs);
 



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