evolution r36570 - branches/gnome-2-24/filter



Author: lucilanga
Date: Mon Oct  6 10:08:43 2008
New Revision: 36570
URL: http://svn.gnome.org/viewvc/evolution?rev=36570&view=rev

Log:
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

Modified:
   branches/gnome-2-24/filter/ChangeLog
   branches/gnome-2-24/filter/rule-editor.c

Modified: branches/gnome-2-24/filter/rule-editor.c
==============================================================================
--- branches/gnome-2-24/filter/rule-editor.c	(original)
+++ branches/gnome-2-24/filter/rule-editor.c	Mon Oct  6 10:08:43 2008
@@ -43,6 +43,7 @@
 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 @@
 {
 	GtkWidget *rules;
 
+	update_selected_rule(re);
+
 	if (re->current == NULL || re->edit != NULL)
 		return;
 
@@ -483,6 +486,8 @@
 	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 @@
 {
 	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 @@
 {
 	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 @@
 {
 	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 @@
 	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 @@
 	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 @@
 	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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]