aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-ft-manager.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2009-05-03 03:09:43 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2009-06-01 23:47:36 +0800
commit7d8254421a1b91516f35255c1a149c288fc92d22 (patch)
tree50323189b4582809f164b661dc2414fa8a390539 /src/empathy-ft-manager.c
parentacfdeef8ac4a6599ba3df55ab207088264ea3e8d (diff)
downloadgsoc2013-empathy-7d8254421a1b91516f35255c1a149c288fc92d22.tar
gsoc2013-empathy-7d8254421a1b91516f35255c1a149c288fc92d22.tar.gz
gsoc2013-empathy-7d8254421a1b91516f35255c1a149c288fc92d22.tar.bz2
gsoc2013-empathy-7d8254421a1b91516f35255c1a149c288fc92d22.tar.lz
gsoc2013-empathy-7d8254421a1b91516f35255c1a149c288fc92d22.tar.xz
gsoc2013-empathy-7d8254421a1b91516f35255c1a149c288fc92d22.tar.zst
gsoc2013-empathy-7d8254421a1b91516f35255c1a149c288fc92d22.zip
Use the proper TP interface instead of emp_cli
Update to use the stable TP interface for FT.
Diffstat (limited to 'src/empathy-ft-manager.c')
-rw-r--r--src/empathy-ft-manager.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c
index 638f11aff..26a242825 100644
--- a/src/empathy-ft-manager.c
+++ b/src/empathy-ft-manager.c
@@ -127,28 +127,42 @@ ft_manager_update_buttons (EmpathyFTManager *manager)
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
+<<<<<<< HEAD:src/empathy-ft-manager.c
EmpathyTpFile *tp_file;
TpFileTransferState state;
+=======
+ EmpathyFTHandler *handler;
+>>>>>>> Use the proper TP interface instead of emp_cli:src/empathy-ft-manager.c
gboolean open_enabled = FALSE;
gboolean abort_enabled = FALSE;
+ gboolean is_completed, is_cancelled;
EmpathyFTManagerPriv *priv = GET_PRIV (manager);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
- gtk_tree_model_get (model, &iter, COL_FT_OBJECT, &tp_file, -1);
- state = empathy_tp_file_get_state (tp_file, NULL);
+ gtk_tree_model_get (model, &iter, COL_FT_OBJECT, &handler, -1);
+
+ is_completed = empathy_ft_handler_is_completed (handler);
+ is_cancelled = empathy_ft_handler_is_cancelled (handler);
/* I can open the file if the transfer is completed and was incoming */
+<<<<<<< HEAD:src/empathy-ft-manager.c
open_enabled = (state == TP_FILE_TRANSFER_STATE_COMPLETED &&
empathy_tp_file_is_incoming (tp_file));
/* I can abort if the transfer is not already finished */
abort_enabled = (state != TP_FILE_TRANSFER_STATE_CANCELLED &&
state != TP_FILE_TRANSFER_STATE_COMPLETED);
+=======
+ open_enabled = (is_completed && empathy_ft_handler_is_incoming (handler));
+
+ /* I can abort if the transfer is not already finished */
+ abort_enabled = (is_cancelled == FALSE && is_completed == FALSE);
+>>>>>>> Use the proper TP interface instead of emp_cli:src/empathy-ft-manager.c
- g_object_unref (tp_file);
+ g_object_unref (handler);
}
gtk_widget_set_sensitive (priv->open_button, open_enabled);
@@ -273,9 +287,9 @@ remove_finished_transfer_foreach (gpointer key,
{
EmpathyFTHandler *handler = key;
EmpathyFTManager *manager = user_data;
- EmpathyFTManagerPriv *priv = GET_PRIV (manager);
- if (!g_hash_table_lookup (priv->cancellable_refs, handler))
+ if (empathy_ft_handler_is_completed (handler) ||
+ empathy_ft_handler_is_cancelled (handler))
{
ft_manager_remove_file_from_model (manager, handler);
return TRUE;
@@ -316,8 +330,8 @@ static char *
ft_manager_format_contact_info (EmpathyFTHandler *handler)
{
gboolean incoming;
- const char *filename, *contact_name;
- char *first_line_format, *retval;
+ const char *filename, *contact_name, *first_line_format;
+ char *retval;
incoming = empathy_ft_handler_is_incoming (handler);
contact_name = empathy_contact_get_name
@@ -333,8 +347,6 @@ ft_manager_format_contact_info (EmpathyFTHandler *handler)
retval = g_strdup_printf (first_line_format, filename, contact_name);
- g_free (first_line_format);
-
return retval;
}
@@ -426,6 +438,9 @@ ft_handler_transfer_done_cb (EmpathyFTHandler *handler,
/* remove the cancellable object */
g_hash_table_remove (priv->cancellable_refs, handler);
+ /* update buttons */
+ ft_manager_update_buttons (manager);
+
g_free (message);
g_free (first_line);
g_free (second_line);