gnome-control-center r9120 - trunk/capplets/keyboard



Author: jensg
Date: Sun Oct 26 13:45:17 2008
New Revision: 9120
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=9120&view=rev

Log:
2008-10-26  Jens Granseuer  <jensgr gmx net>

	* gnome-keyboard-properties-xkbot.c: (option_focused_cb),
	(xkb_options_add_option), (xkb_options_add_group):
	* gnome-keyboard-properties.glade: scroll the options window when the
	keyboard focus moves out of the visible part (bug #557944)


Modified:
   trunk/capplets/keyboard/ChangeLog
   trunk/capplets/keyboard/gnome-keyboard-properties-xkbot.c
   trunk/capplets/keyboard/gnome-keyboard-properties.glade

Modified: trunk/capplets/keyboard/gnome-keyboard-properties-xkbot.c
==============================================================================
--- trunk/capplets/keyboard/gnome-keyboard-properties-xkbot.c	(original)
+++ trunk/capplets/keyboard/gnome-keyboard-properties-xkbot.c	Sun Oct 26 13:45:17 2008
@@ -179,6 +179,20 @@
 	return retval;
 }
 
+/* Make sure selected options stay visible when navigating with the keyboard */
+static gboolean
+option_focused_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
+{
+	GtkScrolledWindow *win = GTK_SCROLLED_WINDOW (data);
+	GtkAllocation *alloc = &widget->allocation;
+	GtkAdjustment *adj;
+
+	adj = gtk_scrolled_window_get_vadjustment (win);
+	gtk_adjustment_clamp_page (adj, alloc->y, alloc->y + alloc->height);
+
+	return FALSE;
+}
+
 /* Update xkb backend to reflect the new UI state */
 static void
 option_toggled_cb (GtkWidget * checkbutton, gpointer data)
@@ -228,6 +242,10 @@
 			    gtk_radio_button_get_group (GTK_RADIO_BUTTON
 							(option_check));
 			current_none_radio = option_check;
+
+			g_signal_connect (option_check, "focus-in-event",
+					  G_CALLBACK (option_focused_cb),
+					  WID ("options_scroll"));
 		}
 		option_check =
 		    gtk_radio_button_new_with_label (current_radio_group,
@@ -248,9 +266,13 @@
 	g_object_set_data_full (G_OBJECT (option_check), OPTION_ID_PROP,
 				full_option_name, g_free);
 
-	g_signal_connect (G_OBJECT (option_check), "toggled",
+	g_signal_connect (option_check, "toggled",
 			  G_CALLBACK (option_toggled_cb), NULL);
 
+	g_signal_connect (option_check, "focus-in-event",
+			  G_CALLBACK (option_focused_cb),
+			  WID ("options_scroll"));
+
 	gtk_box_pack_start_defaults (GTK_BOX (current_vbox), option_check);
 
 	xkb_options_expander_selcounter_add (xkb_options_get_expander
@@ -308,6 +330,10 @@
 	expanders_list = g_slist_append (expanders_list, expander);
 	g_object_set_data (G_OBJECT (dialog), EXPANDERS_PROP,
 			   expanders_list);
+
+	g_signal_connect (expander, "focus-in-event",
+			  G_CALLBACK (option_focused_cb),
+			  WID ("options_scroll"));
 }
 
 static gint

Modified: trunk/capplets/keyboard/gnome-keyboard-properties.glade
==============================================================================
--- trunk/capplets/keyboard/gnome-keyboard-properties.glade	(original)
+++ trunk/capplets/keyboard/gnome-keyboard-properties.glade	Sun Oct 26 13:45:17 2008
@@ -2003,7 +2003,7 @@
         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
         <property name="spacing">2</property>
         <child>
-          <widget class="GtkScrolledWindow" id="scrolledwindow7">
+          <widget class="GtkScrolledWindow" id="options_scroll">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="border_width">5</property>



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