diff options
author | Matthew Hall <matt@castleinthesky.org> | 2005-12-21 02:21:51 +0800 |
---|---|---|
committer | Andre Klapper <aklapper@src.gnome.org> | 2005-12-21 02:21:51 +0800 |
commit | 0a197d13a3f7a9da34db502b0447a39d30fe48a4 (patch) | |
tree | d4258645f76439e5ae475473717a939451970c31 | |
parent | 2e5070b5672eb705f83ccee85d8e95ea19240bdd (diff) | |
download | gsoc2013-evolution-0a197d13a3f7a9da34db502b0447a39d30fe48a4.tar gsoc2013-evolution-0a197d13a3f7a9da34db502b0447a39d30fe48a4.tar.gz gsoc2013-evolution-0a197d13a3f7a9da34db502b0447a39d30fe48a4.tar.bz2 gsoc2013-evolution-0a197d13a3f7a9da34db502b0447a39d30fe48a4.tar.lz gsoc2013-evolution-0a197d13a3f7a9da34db502b0447a39d30fe48a4.tar.xz gsoc2013-evolution-0a197d13a3f7a9da34db502b0447a39d30fe48a4.tar.zst gsoc2013-evolution-0a197d13a3f7a9da34db502b0447a39d30fe48a4.zip |
adding top/bottom buttons for filter manager dialog (#205616) (committing
2005-12-20 Matthew Hall <matt@castleinthesky.org>
* filter.glade; rule-editor.c: adding top/bottom buttons for
filter manager dialog (#205616)
(committing this on behalf of Matthew and as discussed with srag)
svn path=/trunk/; revision=30908
-rw-r--r-- | filter/filter.glade | 22 | ||||
-rw-r--r-- | filter/rule-editor.c | 37 |
2 files changed, 59 insertions, 0 deletions
diff --git a/filter/filter.glade b/filter/filter.glade index 34cd5855a3..24e0f3f7a7 100644 --- a/filter/filter.glade +++ b/filter/filter.glade @@ -188,6 +188,17 @@ </child> <child> + <widget class="GtkButton" id="rule_top"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-goto-top</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + </widget> + </child> + + <child> <widget class="GtkButton" id="rule_up"> <property name="visible">True</property> <property name="can_default">True</property> @@ -208,6 +219,17 @@ <property name="relief">GTK_RELIEF_NORMAL</property> </widget> </child> + + <child> + <widget class="GtkButton" id="rule_bottom"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-goto-bottom</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + </widget> + </child> </widget> <packing> <property name="padding">0</property> diff --git a/filter/rule-editor.c b/filter/rule-editor.c index ad45ab8672..bc356b1024 100644 --- a/filter/rule-editor.c +++ b/filter/rule-editor.c @@ -59,8 +59,10 @@ enum { BUTTON_ADD, BUTTON_EDIT, BUTTON_DELETE, + BUTTON_TOP, BUTTON_UP, BUTTON_DOWN, + BUTTON_BOTTOM, BUTTON_LAST }; @@ -476,6 +478,17 @@ rule_move (RuleEditor *re, int from, int to) } static void +rule_top (GtkWidget *widget, RuleEditor *re) +{ + int pos; + + d(printf ("top rule\n")); + pos = rule_context_get_rank_rule (re->context, re->current, re->source); + if (pos > 0) + rule_move (re, pos, 0); +} + +static void rule_up (GtkWidget *widget, RuleEditor *re) { int pos; @@ -497,6 +510,26 @@ rule_down (GtkWidget *widget, RuleEditor *re) rule_move (re, pos, pos + 1); } +static void +rule_bottom (GtkWidget *widget, RuleEditor *re) +{ + int pos; + int index = -1, count = 0; + FilterRule *rule = NULL; + + d(printf ("bottom rule\n")); + pos = rule_context_get_rank_rule (re->context, re->current, re->source); + /* There's probably a better/faster way to get the count of the list here */ + while ((rule = rule_context_next_rule (re->context, rule, re->source))) { + if (rule == re->current) + index = count; + count++; + } + count--; + if (pos >= 0) + rule_move (re, pos, count); +} + static struct { char *name; GtkSignalFunc func; @@ -504,8 +537,10 @@ static struct { { "rule_add", G_CALLBACK (rule_add) }, { "rule_edit", G_CALLBACK (rule_edit) }, { "rule_delete", G_CALLBACK (rule_delete) }, + { "rule_top", G_CALLBACK (rule_top) }, { "rule_up", G_CALLBACK (rule_up) }, { "rule_down", G_CALLBACK (rule_down) }, + { "rule_bottom", G_CALLBACK (rule_bottom) }, }; static void @@ -526,8 +561,10 @@ set_sensitive (RuleEditor *re) gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_EDIT]), index != -1); gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_DELETE]), index != -1); + gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_TOP]), index > 0); gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_UP]), index > 0); gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_DOWN]), index >= 0 && index < count); + gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_BOTTOM]), index >= 0 && index < count); } |