diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-10-13 06:47:14 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-10-13 06:47:14 +0800 |
commit | 15349adfcccbe182940e5cb8cd69670a22fa784a (patch) | |
tree | 02818a17146ea4357b06b4582e1576cc0703cd03 /widgets/misc/e-gui-utils.c | |
parent | ace63b07fa1671e89a1f77c3b0738cf6be7428b7 (diff) | |
download | gsoc2013-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/e-gui-utils.c')
-rw-r--r-- | widgets/misc/e-gui-utils.c | 31 |
1 files changed, 31 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); +} |