diff options
author | Milan Crha <mcrha@redhat.com> | 2008-06-20 00:38:18 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-06-20 00:38:18 +0800 |
commit | 4813d6259ff1b9b88e127bb171b3fe5c412a9585 (patch) | |
tree | 445b38bb913517b2879696ecd92b2003b170ea37 /mail | |
parent | 8b47322170aaa87bd4a60a41027885c7ee7d1d69 (diff) | |
download | gsoc2013-evolution-4813d6259ff1b9b88e127bb171b3fe5c412a9585.tar gsoc2013-evolution-4813d6259ff1b9b88e127bb171b3fe5c412a9585.tar.gz gsoc2013-evolution-4813d6259ff1b9b88e127bb171b3fe5c412a9585.tar.bz2 gsoc2013-evolution-4813d6259ff1b9b88e127bb171b3fe5c412a9585.tar.lz gsoc2013-evolution-4813d6259ff1b9b88e127bb171b3fe5c412a9585.tar.xz gsoc2013-evolution-4813d6259ff1b9b88e127bb171b3fe5c412a9585.tar.zst gsoc2013-evolution-4813d6259ff1b9b88e127bb171b3fe5c412a9585.zip |
** Fix for bug #382783
2008-06-19 Milan Crha <mcrha@redhat.com>
** Fix for bug #382783
* filter/filter-rule.c: (do_grab_focus_cb), (more_parts), (get_widget):
* mail/em-filter-rule.c: (do_grab_focus_cb), (more_parts), (get_widget):
Grab focus of new rule part on adding and scroll to the bottom too.
svn path=/trunk/; revision=35654
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 7 | ||||
-rw-r--r-- | mail/em-filter-rule.c | 34 |
2 files changed, 41 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 37c746db00..33232d1008 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2008-06-19 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #382783 + + * em-filter-rule.c: (do_grab_focus_cb), (more_parts), (get_widget): + Grab focus of new rule part on adding and scroll to the bottom too. + 2008-06-18 Milan Crha <mcrha@redhat.com> ** Fix for bug #423395 diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c index aaec41ba3b..6f9a9e2c28 100644 --- a/mail/em-filter-rule.c +++ b/mail/em-filter-rule.c @@ -449,6 +449,20 @@ attach_rule(GtkWidget *rule, struct _rule_data *data, FilterPart *part, int row) } static void +do_grab_focus_cb (GtkWidget *widget, gpointer data) +{ + gboolean *done = (gboolean *) data; + + if (*done) + return; + + if (widget && GTK_WIDGET_CAN_FOCUS (widget)) { + *done = TRUE; + gtk_widget_grab_focus (widget); + } +} + +static void more_parts(GtkWidget *button, struct _rule_data *data) { FilterPart *new; @@ -466,6 +480,24 @@ more_parts(GtkWidget *button, struct _rule_data *data) rows = GTK_TABLE(data->parts)->nrows; gtk_table_resize(GTK_TABLE(data->parts), rows + 1, 2); attach_rule(w, data, new, rows); + + if (GTK_IS_CONTAINER (w)) { + gboolean done = FALSE; + + gtk_container_foreach (GTK_CONTAINER (w), do_grab_focus_cb, &done); + } else + gtk_widget_grab_focus (w); + + /* also scroll down to see new part */ + w = (GtkWidget*) g_object_get_data (G_OBJECT (button), "scrolled-window"); + if (w) { + GtkAdjustment *adjustment; + + adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (w)); + if (adjustment) + gtk_adjustment_set_value (adjustment, adjustment->upper); + + } } } @@ -543,6 +575,8 @@ get_widget(FilterRule *fr, RuleContext *rc) /*gtk_box_pack_start(GTK_BOX(inframe), parts, FALSE, FALSE, 3);*/ + g_object_set_data (G_OBJECT (add), "scrolled-window", scrolledwindow); + gtk_widget_show_all(widget); return widget; |