aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-10-13 06:47:14 +0800
committerChris Lahey <clahey@src.gnome.org>2000-10-13 06:47:14 +0800
commit15349adfcccbe182940e5cb8cd69670a22fa784a (patch)
tree02818a17146ea4357b06b4582e1576cc0703cd03 /widgets/misc
parentace63b07fa1671e89a1f77c3b0738cf6be7428b7 (diff)
downloadgsoc2013-evolution-15349adfcccbe182940e5cb8cd69670a22fa784a.tar
gsoc2013-evolution-15349adfcccbe182940e5cb8cd69670a22fa784a.tar.gz
gsoc2013-evolution-15349adfcccbe182940e5cb8cd69670a22fa784a.tar.bz2
gsoc2013-evolution-15349adfcccbe182940e5cb8cd69670a22fa784a.tar.lz
gsoc2013-evolution-15349adfcccbe182940e5cb8cd69670a22fa784a.tar.xz
gsoc2013-evolution-15349adfcccbe182940e5cb8cd69670a22fa784a.tar.zst
gsoc2013-evolution-15349adfcccbe182940e5cb8cd69670a22fa784a.zip
Added e_container_focus_nth_entry.
2000-10-12 Christopher James Lahey <clahey@helixcode.com> * gal/widgets/e-gui-utils.c, gal/widgets/e-gui-utils.h: Added e_container_focus_nth_entry. svn path=/trunk/; revision=5893
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-gui-utils.c31
-rw-r--r--widgets/misc/e-gui-utils.h2
2 files changed, 33 insertions, 0 deletions
diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c
index 14ab11c565..86cb3c3b5c 100644
--- a/widgets/misc/e-gui-utils.c
+++ b/widgets/misc/e-gui-utils.c
@@ -171,3 +171,34 @@ e_container_change_tab_order(GtkContainer *container, GList *widgets)
e_container_change_tab_order_destroy_notify,
FALSE, FALSE);
}
+
+struct widgetandint {
+ GtkWidget *widget;
+ int count;
+};
+
+static void
+nth_entry_callback(GtkWidget *widget, struct widgetandint *data)
+{
+ if (GTK_IS_ENTRY(widget)) {
+ if (data->count > 1) {
+ data->count --;
+ data->widget = widget;
+ } else if (data->count == 1) {
+ data->count --;
+ data->widget = NULL;
+ gtk_widget_grab_focus(widget);
+ }
+ }
+}
+
+void
+e_container_focus_nth_entry(GtkContainer *container, int n)
+{
+ struct widgetandint data;
+ data.widget = NULL;
+ data.count = n;
+ e_container_foreach_leaf(container, (GtkCallback) nth_entry_callback, &data);
+ if (data.widget)
+ gtk_widget_grab_focus(data.widget);
+}
diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h
index 215544e942..b6785aecdd 100644
--- a/widgets/misc/e-gui-utils.h
+++ b/widgets/misc/e-gui-utils.h
@@ -12,6 +12,8 @@ void e_notice (GtkWindow *window, const char *type, const
void e_container_foreach_leaf (GtkContainer *container,
GtkCallback callback,
gpointer closure);
+void e_container_focus_nth_entry (GtkContainer *container,
+ int n);
gint e_container_change_tab_order (GtkContainer *container,
GList *widgets);