diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-03-18 05:44:44 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-03-18 05:44:44 +0800 |
commit | 13398c9928a151d593399480b05674a5cf44abf4 (patch) | |
tree | 4d76fe924b2167cfdae0f93f195de46369448b78 | |
parent | bbba025a3f1dc7d8295ac0c0d2a294f35c7a9a0f (diff) | |
download | gsoc2013-evolution-13398c9928a151d593399480b05674a5cf44abf4.tar gsoc2013-evolution-13398c9928a151d593399480b05674a5cf44abf4.tar.gz gsoc2013-evolution-13398c9928a151d593399480b05674a5cf44abf4.tar.bz2 gsoc2013-evolution-13398c9928a151d593399480b05674a5cf44abf4.tar.lz gsoc2013-evolution-13398c9928a151d593399480b05674a5cf44abf4.tar.xz gsoc2013-evolution-13398c9928a151d593399480b05674a5cf44abf4.tar.zst gsoc2013-evolution-13398c9928a151d593399480b05674a5cf44abf4.zip |
Fixed to work properly. Fixes bug #39654.
2003-03-17 Jeffrey Stedfast <fejj@ximian.com>
* vfolder-rule.c (source_remove): Fixed to work properly. Fixes
bug #39654.
svn path=/trunk/; revision=20321
-rw-r--r-- | filter/ChangeLog | 3 | ||||
-rw-r--r-- | filter/vfolder-rule.c | 41 |
2 files changed, 27 insertions, 17 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index bdfa2d776b..aece10729b 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,5 +1,8 @@ 2003-03-17 Jeffrey Stedfast <fejj@ximian.com> + * vfolder-rule.c (source_remove): Fixed to work properly. Fixes + bug #39654. + * rule-editor.c (rule_editor_construct): Always add a Cancel button here, but if !enable_undo - make the response id GTK_RESPONSE_CANCEL rather than GTK_RESPONSE_REJECT (which does diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c index fc7e1b853a..efd58b68a9 100644 --- a/filter/vfolder-rule.c +++ b/filter/vfolder-rule.c @@ -432,36 +432,43 @@ source_remove (GtkWidget *widget, struct _source_data *data) GtkTreePath *path; GtkTreeIter iter; int index = 0; - int len; + int n; + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->list)); source = NULL; while ((source = vfolder_rule_next_source (data->vr, source))) { - if (data->current == source) { - vfolder_rule_remove_source (data->vr, source); - - path = gtk_tree_path_new (); - gtk_tree_path_append_index (path, index); + path = gtk_tree_path_new (); + gtk_tree_path_append_index (path, index); + + if (gtk_tree_selection_path_is_selected (selection, path)) { gtk_tree_model_get_iter (GTK_TREE_MODEL (data->model), &iter, path); + + vfolder_rule_remove_source (data->vr, source); gtk_list_store_remove (data->model, &iter); gtk_tree_path_free (path); - data->current = NULL; - /* now select the next rule */ - len = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (data->model), NULL); - index = index >= len ? len - 1 : index; - - path = gtk_tree_path_new (); - gtk_tree_path_append_index (path, index); - gtk_tree_model_get_iter (GTK_TREE_MODEL (data->model), &iter, path); - gtk_tree_path_free (path); + n = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (data->model), NULL); + index = index >= n ? n - 1 : index; - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->list)); - gtk_tree_selection_select_iter (selection, &iter); + if (index >= 0) { + path = gtk_tree_path_new (); + gtk_tree_path_append_index (path, index); + gtk_tree_model_get_iter (GTK_TREE_MODEL (data->model), &iter, path); + gtk_tree_path_free (path); + + gtk_tree_selection_select_iter (selection, &iter); + gtk_tree_model_get (GTK_TREE_MODEL (data->model), &iter, 0, &data->current, -1); + } else { + data->current = NULL; + } break; } + index++; + gtk_tree_path_free (path); } set_sensitive (data); |