aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-ft-manager.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-11-22 00:24:28 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-11-22 00:24:28 +0800
commit892f65c9770c2397fe06f8ac8b2c4ef786afb433 (patch)
tree3dcdbe7bc94e446bf76f68bb1ab4241a7469470a /src/empathy-ft-manager.c
parent0c8c33990ca059bfc8c023ccf6f3e2e589151bec (diff)
downloadgsoc2013-empathy-892f65c9770c2397fe06f8ac8b2c4ef786afb433.tar
gsoc2013-empathy-892f65c9770c2397fe06f8ac8b2c4ef786afb433.tar.gz
gsoc2013-empathy-892f65c9770c2397fe06f8ac8b2c4ef786afb433.tar.bz2
gsoc2013-empathy-892f65c9770c2397fe06f8ac8b2c4ef786afb433.tar.lz
gsoc2013-empathy-892f65c9770c2397fe06f8ac8b2c4ef786afb433.tar.xz
gsoc2013-empathy-892f65c9770c2397fe06f8ac8b2c4ef786afb433.tar.zst
gsoc2013-empathy-892f65c9770c2397fe06f8ac8b2c4ef786afb433.zip
Update the selection of the ft manager when a ft is removed only if it's not empty.
svn path=/trunk/; revision=1902
Diffstat (limited to 'src/empathy-ft-manager.c')
-rw-r--r--src/empathy-ft-manager.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c
index 0873df361..2cb60de8e 100644
--- a/src/empathy-ft-manager.c
+++ b/src/empathy-ft-manager.c
@@ -446,6 +446,7 @@ ft_manager_remove_file_from_list (EmpathyFTManager *ft_manager,
GtkTreeSelection *selection;
GtkTreePath *path = NULL;
GtkTreeIter iter;
+ gboolean empty = FALSE;
row_ref = ft_manager_get_row_from_tp_file (ft_manager, tp_file);
g_return_if_fail (row_ref);
@@ -464,14 +465,20 @@ ft_manager_remove_file_from_list (EmpathyFTManager *ft_manager,
/* There is no last row, set iter to the last row */
n_row = gtk_tree_model_iter_n_children (ft_manager->priv->model, NULL);
- gtk_tree_model_iter_nth_child (ft_manager->priv->model, &iter, NULL,
- n_row - 1);
+ if (n_row > 0)
+ gtk_tree_model_iter_nth_child (ft_manager->priv->model, &iter, NULL,
+ n_row - 1);
+ else
+ empty = TRUE;
}
g_object_unref (tp_file);
/* Select the next row */
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ft_manager->priv->treeview));
- gtk_tree_selection_select_iter (selection, &iter);
+ if (!empty)
+ {
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ft_manager->priv->treeview));
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
}
static gboolean
@@ -875,12 +882,12 @@ empathy_ft_manager_add_tp_file (EmpathyFTManager *ft_manager,
g_return_if_fail (EMPATHY_IS_FT_MANAGER (ft_manager));
g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file));
- DEBUG ("Adding a file transfer: contact=%s, filename=%s",
- empathy_contact_get_name (empathy_tp_file_get_contact (tp_file)),
- empathy_tp_file_get_filename (tp_file));
-
state = empathy_tp_file_get_state (tp_file, NULL);
+ DEBUG ("Adding a file transfer: contact=%s, filename=%s, state=%d",
+ empathy_contact_get_name (empathy_tp_file_get_contact (tp_file)),
+ empathy_tp_file_get_filename (tp_file), state);
+
if (state == EMP_FILE_TRANSFER_STATE_PENDING &&
empathy_tp_file_is_incoming (tp_file))
ft_manager_display_accept_dialog (ft_manager, tp_file);