diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-10-25 07:52:05 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-10-25 07:52:05 +0800 |
commit | 85b2913a380c69f14ae0254ad23b10fabfb33667 (patch) | |
tree | c1cf143e37294dd9dd3667ebbe0a1d0c00b04b56 /filter/rule-editor.c | |
parent | e7a31c5035a0afeed6c1675e30487c1e2bdc139f (diff) | |
download | gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.gz gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.bz2 gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.lz gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.xz gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.zst gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.zip |
Merge revisions 36534:36684 from trunk.
svn path=/branches/kill-bonobo/; revision=36685
Diffstat (limited to 'filter/rule-editor.c')
-rw-r--r-- | filter/rule-editor.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/filter/rule-editor.c b/filter/rule-editor.c index 53c576540c..16e79f0ee3 100644 --- a/filter/rule-editor.c +++ b/filter/rule-editor.c @@ -43,6 +43,7 @@ static void set_source (RuleEditor *re, const char *source); static void set_sensitive (RuleEditor *re); static FilterRule *create_rule (RuleEditor *re); +static gboolean update_selected_rule (RuleEditor *re); static void cursor_changed (GtkTreeView *treeview, RuleEditor *re); static void rule_editor_class_init (RuleEditorClass *klass); @@ -442,6 +443,8 @@ rule_edit (GtkWidget *widget, RuleEditor *re) { GtkWidget *rules; + update_selected_rule(re); + if (re->current == NULL || re->edit != NULL) return; @@ -483,6 +486,8 @@ rule_delete (GtkWidget *widget, RuleEditor *re) GtkTreeIter iter; int pos, len; + update_selected_rule(re); + d(printf ("delete rule\n")); pos = rule_context_get_rank_rule (re->context, re->current, re->source); if (pos != -1) { @@ -576,6 +581,8 @@ rule_top (GtkWidget *widget, RuleEditor *re) { int pos; + update_selected_rule(re); + d(printf ("top rule\n")); pos = rule_context_get_rank_rule (re->context, re->current, re->source); if (pos > 0) @@ -587,6 +594,8 @@ rule_up (GtkWidget *widget, RuleEditor *re) { int pos; + update_selected_rule(re); + d(printf ("up rule\n")); pos = rule_context_get_rank_rule (re->context, re->current, re->source); if (pos > 0) @@ -598,6 +607,8 @@ rule_down (GtkWidget *widget, RuleEditor *re) { int pos; + update_selected_rule(re); + d(printf ("down rule\n")); pos = rule_context_get_rank_rule (re->context, re->current, re->source); if (pos >= 0) @@ -611,6 +622,8 @@ rule_bottom (GtkWidget *widget, RuleEditor *re) int index = -1, count = 0; FilterRule *rule = NULL; + update_selected_rule(re); + 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 */ @@ -669,8 +682,8 @@ dialog_rule_changed (FilterRule *fr, GtkWidget *dialog) gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, fr && fr->parts); } -static void -cursor_changed (GtkTreeView *treeview, RuleEditor *re) +static gboolean +update_selected_rule (RuleEditor *re) { GtkTreeSelection *selection; GtkTreeModel *model; @@ -679,7 +692,16 @@ cursor_changed (GtkTreeView *treeview, RuleEditor *re) selection = gtk_tree_view_get_selection (re->list); if (gtk_tree_selection_get_selected (selection, &model, &iter)) { gtk_tree_model_get (GTK_TREE_MODEL (re->model), &iter, 1, &re->current, -1); + return TRUE; + } + + return FALSE; +} +static void +cursor_changed (GtkTreeView *treeview, RuleEditor *re) +{ + if (update_selected_rule(re)) { g_return_if_fail (re->current); rule_editor_set_sensitive (re); |