aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-06-20 00:38:18 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-06-20 00:38:18 +0800
commit4813d6259ff1b9b88e127bb171b3fe5c412a9585 (patch)
tree445b38bb913517b2879696ecd92b2003b170ea37
parent8b47322170aaa87bd4a60a41027885c7ee7d1d69 (diff)
downloadgsoc2013-evolution-4813d6259ff1b9b88e127bb171b3fe5c412a9585.tar.gz
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
-rw-r--r--filter/ChangeLog7
-rw-r--r--filter/filter-rule.c34
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/em-filter-rule.c34
4 files changed, 82 insertions, 0 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 269362e0d3..5eb7224d86 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,10 @@
+2008-06-19 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #382783
+
+ * 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-09 Milan Crha <mcrha@redhat.com>
** Fix for bug #201011
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index 4d5d76505c..a200876df1 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -744,6 +744,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;
@@ -772,6 +786,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);
+
+ }
}
}
@@ -952,6 +984,8 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
gtk_widget_show_all (vbox);
+ g_object_set_data (G_OBJECT (add), "scrolled-window", scrolledwindow);
+
return vbox;
}
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;