diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2008-11-22 00:16:44 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:16:44 +0800 |
commit | 8bc264cf4de4ef01d6bf62fa85b7497279f7dac2 (patch) | |
tree | deede81ad9c06e7dc827281d668f48f7a96e426c | |
parent | 653e7b22a6962f8d7407de5165404b935f0be511 (diff) | |
download | gsoc2013-empathy-8bc264cf4de4ef01d6bf62fa85b7497279f7dac2.tar gsoc2013-empathy-8bc264cf4de4ef01d6bf62fa85b7497279f7dac2.tar.gz gsoc2013-empathy-8bc264cf4de4ef01d6bf62fa85b7497279f7dac2.tar.bz2 gsoc2013-empathy-8bc264cf4de4ef01d6bf62fa85b7497279f7dac2.tar.lz gsoc2013-empathy-8bc264cf4de4ef01d6bf62fa85b7497279f7dac2.tar.xz gsoc2013-empathy-8bc264cf4de4ef01d6bf62fa85b7497279f7dac2.tar.zst gsoc2013-empathy-8bc264cf4de4ef01d6bf62fa85b7497279f7dac2.zip |
Replaced the Direction channel property a more-private GObject incoming property. (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=1783
-rw-r--r-- | libempathy-gtk/empathy-ft-manager.c | 16 | ||||
-rw-r--r-- | libempathy/empathy-tp-file.c | 40 | ||||
-rw-r--r-- | libempathy/empathy-tp-file.h | 2 |
3 files changed, 26 insertions, 32 deletions
diff --git a/libempathy-gtk/empathy-ft-manager.c b/libempathy-gtk/empathy-ft-manager.c index 38d5cd79e..2be9e005c 100644 --- a/libempathy-gtk/empathy-ft-manager.c +++ b/libempathy-gtk/empathy-ft-manager.c @@ -276,8 +276,7 @@ update_buttons (EmpathyFTManager *ft_manager) if (empathy_tp_file_get_state (tp_file) == EMP_FILE_TRANSFER_STATE_COMPLETED) { - if (empathy_tp_file_get_direction (tp_file) == - EMP_FILE_TRANSFER_DIRECTION_INCOMING) + if (empathy_tp_file_get_incoming (tp_file)) open_enabled = TRUE; else open_enabled = FALSE; @@ -399,15 +398,16 @@ update_ft_row (EmpathyFTManager *ft_manager, g_free (total_size_str); } + else if (state == EMP_FILE_TRANSFER_STATE_NOT_OFFERED) + second_line = g_strdup (_("File not yet offered")); else - second_line = g_strdup (_("Wating the other participant's response")); + second_line = g_strdup (_("Waiting the other participant's response")); remaining = empathy_tp_file_get_remaining_time (tp_file); break; case EMP_FILE_TRANSFER_STATE_COMPLETED: - if (empathy_tp_file_get_direction (tp_file) == - EMP_FILE_TRANSFER_DIRECTION_INCOMING) + if (empathy_tp_file_get_incoming (tp_file)) /* translators: first %s is filename, second %s * is the contact name */ first_line = g_strdup_printf ( @@ -425,8 +425,7 @@ update_ft_row (EmpathyFTManager *ft_manager, break; case EMP_FILE_TRANSFER_STATE_CANCELED: - if (empathy_tp_file_get_direction (tp_file) == - EMP_FILE_TRANSFER_DIRECTION_INCOMING) + if (empathy_tp_file_get_incoming (tp_file)) /* translators: first %s is filename, second %s * is the contact name */ first_line = g_strdup_printf ( @@ -510,8 +509,7 @@ state_changed_cb (EmpathyTpFile *tp_file, switch (empathy_tp_file_get_state (tp_file)) { case EMP_FILE_TRANSFER_STATE_COMPLETED: - if (empathy_tp_file_get_direction (tp_file) == - EMP_FILE_TRANSFER_DIRECTION_INCOMING) + if (empathy_tp_file_get_incoming (tp_file)) { GtkRecentManager *manager; const gchar *uri; diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c index ff3eff621..61f4e26da 100644 --- a/libempathy/empathy-tp-file.c +++ b/libempathy/empathy-tp-file.c @@ -101,8 +101,8 @@ struct _EmpathyTpFilePriv { EmpathyContact *contact; GInputStream *in_stream; GOutputStream *out_stream; + gboolean incoming; gchar *filename; - EmpFileTransferDirection direction; EmpFileTransferState state; EmpFileTransferStateChangeReason state_change_reason; guint64 size; @@ -120,7 +120,7 @@ enum { PROP_ACCOUNT, PROP_CHANNEL, PROP_STATE, - PROP_DIRECTION, + PROP_INCOMING, PROP_FILENAME, PROP_SIZE, PROP_CONTENT_TYPE, @@ -172,13 +172,11 @@ empathy_tp_file_class_init (EmpathyTpFileClass *klass) G_PARAM_CONSTRUCT)); g_object_class_install_property (object_class, - PROP_DIRECTION, - g_param_spec_uint ("direction", - "direction of the transfer", - "The file transfer direction", - 0, - G_MAXUINT, - G_MAXUINT, + PROP_INCOMING, + g_param_spec_boolean ("incoming", + "incoming", + "Whether the transfer is incoming", + FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); @@ -443,8 +441,8 @@ tp_file_set_property (GObject *object, case PROP_STATE: priv->state = g_value_get_uint (value); break; - case PROP_DIRECTION: - priv->direction = g_value_get_uint (value); + case PROP_INCOMING: + priv->incoming = g_value_get_boolean (value); break; case PROP_FILENAME: g_free (priv->filename); @@ -737,17 +735,15 @@ tp_file_state_changed_cb (DBusGProxy *tp_file_iface, if (state == EMP_FILE_TRANSFER_STATE_OPEN) priv->start_time = get_time_msec (); - DEBUG ("state = %u, direction = %u, in_stream = %s, out_stream = %s", - state, priv->direction, + DEBUG ("state = %u, incoming = %s, in_stream = %s, out_stream = %s", + state, priv->incoming ? "yes" : "no", priv->in_stream ? "present" : "not present", priv->out_stream ? "present" : "not present"); - if (state == EMP_FILE_TRANSFER_STATE_OPEN && - priv->direction == EMP_FILE_TRANSFER_DIRECTION_OUTGOING && + if (state == EMP_FILE_TRANSFER_STATE_OPEN && !priv->incoming && priv->in_stream) send_tp_file (tp_file); - else if (state == EMP_FILE_TRANSFER_STATE_OPEN && - priv->direction == EMP_FILE_TRANSFER_DIRECTION_INCOMING && + else if (state == EMP_FILE_TRANSFER_STATE_OPEN && priv->incoming && priv->out_stream) receive_tp_file (tp_file); @@ -815,14 +811,14 @@ empathy_tp_file_get_filename (EmpathyTpFile *tp_file) return priv->filename; } -EmpFileTransferDirection -empathy_tp_file_get_direction (EmpathyTpFile *tp_file) +gboolean +empathy_tp_file_get_incoming (EmpathyTpFile *tp_file) { EmpathyTpFilePriv *priv; priv = GET_PRIV (tp_file); - return priv->direction; + return priv->incoming; } EmpFileTransferState @@ -915,7 +911,7 @@ empathy_tp_file_set_input_stream (EmpathyTpFile *tp_file, if (priv->in_stream == in_stream) return; - if (priv->direction == EMP_FILE_TRANSFER_DIRECTION_INCOMING) + if (priv->incoming) g_warning ("Setting an input stream for incoming file " "transfers is useless"); @@ -941,7 +937,7 @@ empathy_tp_file_set_output_stream (EmpathyTpFile *tp_file, if (priv->out_stream == out_stream) return; - if (priv->direction == EMP_FILE_TRANSFER_DIRECTION_OUTGOING) + if (!priv->incoming) g_warning ("Setting an output stream for outgoing file " "transfers is useless"); diff --git a/libempathy/empathy-tp-file.h b/libempathy/empathy-tp-file.h index 008f3a95d..213948c93 100644 --- a/libempathy/empathy-tp-file.h +++ b/libempathy/empathy-tp-file.h @@ -74,7 +74,7 @@ EmpathyContact *empathy_tp_file_get_contact (EmpathyTpFile *tp_file); GInputStream *empathy_tp_file_get_input_stream (EmpathyTpFile *tp_file); GOutputStream *empathy_tp_file_get_output_stream (EmpathyTpFile *tp_file); const gchar *empathy_tp_file_get_filename (EmpathyTpFile *tp_file); -EmpFileTransferDirection empathy_tp_file_get_direction (EmpathyTpFile *tp_file); +gboolean empathy_tp_file_get_incoming (EmpathyTpFile *tp_file); EmpFileTransferState empathy_tp_file_get_state (EmpathyTpFile *tp_file); EmpFileTransferStateChangeReason empathy_tp_file_get_state_change_reason (EmpathyTpFile *tp_file); guint64 empathy_tp_file_get_size (EmpathyTpFile *tp_file); |