aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucian Langa <lucilanga@gnome.org>2008-10-06 17:59:41 +0800
committerLucian Langa <lucilanga@src.gnome.org>2008-10-06 17:59:41 +0800
commite1ed13a4b36ba23bb2b7a8f762d8b23eda4dcce0 (patch)
tree7f2f1d0bac74ff84a8402115baa1a099b7f576ff
parent994707897e322dbb2b6ce63637c122d8249602a9 (diff)
downloadgsoc2013-evolution-e1ed13a4b36ba23bb2b7a8f762d8b23eda4dcce0.tar
gsoc2013-evolution-e1ed13a4b36ba23bb2b7a8f762d8b23eda4dcce0.tar.gz
gsoc2013-evolution-e1ed13a4b36ba23bb2b7a8f762d8b23eda4dcce0.tar.bz2
gsoc2013-evolution-e1ed13a4b36ba23bb2b7a8f762d8b23eda4dcce0.tar.lz
gsoc2013-evolution-e1ed13a4b36ba23bb2b7a8f762d8b23eda4dcce0.tar.xz
gsoc2013-evolution-e1ed13a4b36ba23bb2b7a8f762d8b23eda4dcce0.tar.zst
gsoc2013-evolution-e1ed13a4b36ba23bb2b7a8f762d8b23eda4dcce0.zip
** Fix for bug #554566
2008-10-06 Lucian Langa <lucilanga@gnome.org> ** Fix for bug #554566 * rule-editor.c: (rule_editor_class_init), (rule_edit), (rule_top), (rule_up), (rule_down), (rule_bottom), (cursor_changed) (update_selected_rule): new function to update current selected rule svn path=/trunk/; revision=36569
-rw-r--r--filter/ChangeLog10
-rw-r--r--filter/rule-editor.c26
2 files changed, 34 insertions, 2 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 12ee719755..b66dbb7ff6 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,13 @@
+2008-10-06 Lucian Langa <lucilanga@gnome.org>
+
+ ** Fix for bug #554566
+
+ * rule-editor.c: (rule_editor_class_init), (rule_edit),
+ (rule_top), (rule_up), (rule_down), (rule_bottom),
+ (cursor_changed)
+ (update_selected_rule): new function to update
+ current selected rule
+
2008-10-01 Sankar P <psankar@novell.com>
License Changes
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);