diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-04-05 01:47:47 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-04-05 01:47:47 +0800 |
commit | a5b5308e97368433ad9c802a8785a54d35d32fe1 (patch) | |
tree | 9c8c7bdacf143bc6d091539f4ad1793aeb81917e | |
parent | c5afac6cda867037976dc8e7808dbcafadc8808a (diff) | |
download | gsoc2013-evolution-a5b5308e97368433ad9c802a8785a54d35d32fe1.tar.gz gsoc2013-evolution-a5b5308e97368433ad9c802a8785a54d35d32fe1.tar.zst gsoc2013-evolution-a5b5308e97368433ad9c802a8785a54d35d32fe1.zip |
Update parent rows when a child row changes. (#352713) Patch by René
2007-04-04 Matthew Barnes <mbarnes@redhat.com>
* em-folder-tree.c (emft_model_row_changed):
Update parent rows when a child row changes. (#352713)
Patch by René Stadler.
svn path=/trunk/; revision=33381
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 26 |
2 files changed, 32 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 575d22d510..3a680f87d7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2007-04-04 Matthew Barnes <mbarnes@redhat.com> + + * em-folder-tree.c (emft_model_row_changed): + Update parent rows when a child row changes. (#352713) + Patch by René Stadler. + 2007-04-03 Srinivasa Ragavan <sragavan@novell.com> * em-migrate.c: (emm_setup_initial): Fix for evolution on crashing diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index c6eed2f54b..72cbf051cb 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -160,6 +160,7 @@ static void emft_queue_save_state (EMFolderTree *emft); static void emft_update_model_expanded_state (struct _EMFolderTreePrivate *priv, GtkTreeIter *iter, gboolean expanded); +static void emft_model_row_changed (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, EMFolderTree *emft); static void emft_tree_row_activated (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, EMFolderTree *emft); static gboolean emft_tree_test_collapse_row (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *path, EMFolderTree *emft); static void emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *path, EMFolderTree *emft); @@ -539,6 +540,7 @@ em_folder_tree_construct (EMFolderTree *emft, EMFolderTreeModel *model) priv->treeview = folder_tree_new (emft, model); gtk_widget_show ((GtkWidget *) priv->treeview); + g_signal_connect (priv->model, "row-changed", G_CALLBACK (emft_model_row_changed), emft); g_signal_connect (priv->treeview, "row-expanded", G_CALLBACK (emft_tree_row_expanded), emft); g_signal_connect (priv->treeview, "test-collapse-row", G_CALLBACK (emft_tree_test_collapse_row), emft); g_signal_connect (priv->treeview, "row-activated", G_CALLBACK (emft_tree_row_activated), emft); @@ -1855,6 +1857,30 @@ emft_update_model_expanded_state (struct _EMFolderTreePrivate *priv, GtkTreeIter } static void +emft_model_row_changed (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, EMFolderTree *emft) +{ + GtkTreeIter parent_iter; + GtkTreeIter child_iter = *iter; + + g_signal_handlers_block_by_func (model, emft_model_row_changed, emft); + + /* Folders are displayed with a bold weight to indicate that + they contain unread messages. We signal that parent rows + have changed here to update them. */ + + while (gtk_tree_model_iter_parent (model, &parent_iter, &child_iter)) { + GtkTreePath *parent_path; + + parent_path = gtk_tree_model_get_path (model, &parent_iter); + gtk_tree_model_row_changed (model, parent_path, &parent_iter); + gtk_tree_path_free (parent_path); + child_iter = parent_iter; + } + + g_signal_handlers_unblock_by_func (model, emft_model_row_changed, emft); +} + +static void emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *tree_path, EMFolderTree *emft) { struct _EMFolderTreePrivate *priv = emft->priv; |