diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:24:44 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:24:44 +0800 |
commit | 08bddf0137fb9f05dae5ec3381f566c00fb757ff (patch) | |
tree | 3f43aca606a41428a9516b3c93129c9ecfa43917 /src/empathy-ft-manager.c | |
parent | 897b55ac60bca1e62869cf2f76d485bbd7db2064 (diff) | |
download | gsoc2013-empathy-08bddf0137fb9f05dae5ec3381f566c00fb757ff.tar gsoc2013-empathy-08bddf0137fb9f05dae5ec3381f566c00fb757ff.tar.gz gsoc2013-empathy-08bddf0137fb9f05dae5ec3381f566c00fb757ff.tar.bz2 gsoc2013-empathy-08bddf0137fb9f05dae5ec3381f566c00fb757ff.tar.lz gsoc2013-empathy-08bddf0137fb9f05dae5ec3381f566c00fb757ff.tar.xz gsoc2013-empathy-08bddf0137fb9f05dae5ec3381f566c00fb757ff.tar.zst gsoc2013-empathy-08bddf0137fb9f05dae5ec3381f566c00fb757ff.zip |
Update the selection only if we are removing the selected row.
svn path=/trunk/; revision=1906
Diffstat (limited to 'src/empathy-ft-manager.c')
-rw-r--r-- | src/empathy-ft-manager.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c index c89c03e5c..496e03839 100644 --- a/src/empathy-ft-manager.c +++ b/src/empathy-ft-manager.c @@ -448,7 +448,7 @@ ft_manager_remove_file_from_model (EmpathyFTManager *ft_manager, GtkTreeSelection *selection; GtkTreePath *path = NULL; GtkTreeIter iter; - gboolean empty = FALSE; + gboolean update_selection; row_ref = ft_manager_get_row_from_tp_file (ft_manager, tp_file); g_return_if_fail (row_ref); @@ -457,10 +457,16 @@ ft_manager_remove_file_from_model (EmpathyFTManager *ft_manager, empathy_contact_get_name (empathy_tp_file_get_contact (tp_file)), empathy_tp_file_get_filename (tp_file)); - /* Remove tp_file's row. After that iter points to the new row to select */ + /* Get the iter from the row_ref */ path = gtk_tree_row_reference_get_path (row_ref); gtk_tree_model_get_iter (ft_manager->priv->model, &iter, path); gtk_tree_path_free (path); + + /* We have to update the selection only if we are removing the selected row */ + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ft_manager->priv->treeview)); + update_selection = gtk_tree_selection_iter_is_selected (selection, &iter); + + /* Remove tp_file's row. After that iter points to the next row */ if (!gtk_list_store_remove (GTK_LIST_STORE (ft_manager->priv->model), &iter)) { gint n_row; @@ -471,15 +477,11 @@ ft_manager_remove_file_from_model (EmpathyFTManager *ft_manager, gtk_tree_model_iter_nth_child (ft_manager->priv->model, &iter, NULL, n_row - 1); else - empty = TRUE; + update_selection = FALSE; } - /* Select the next row */ - if (!empty) - { - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ft_manager->priv->treeview)); - gtk_tree_selection_select_iter (selection, &iter); - } + if (update_selection) + gtk_tree_selection_select_iter (selection, &iter); } static gboolean |