aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-29 23:06:11 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-11 15:43:55 +0800
commit325786d466cc7a8b6eed06e52b9b5223ba5dc7fd (patch)
treeb7de4e4292e5f58cecc44583c7bda338f21ab4c9 /libempathy
parente497426234daf06bded1096fee6596b1e367a018 (diff)
downloadgsoc2013-empathy-325786d466cc7a8b6eed06e52b9b5223ba5dc7fd.tar
gsoc2013-empathy-325786d466cc7a8b6eed06e52b9b5223ba5dc7fd.tar.gz
gsoc2013-empathy-325786d466cc7a8b6eed06e52b9b5223ba5dc7fd.tar.bz2
gsoc2013-empathy-325786d466cc7a8b6eed06e52b9b5223ba5dc7fd.tar.lz
gsoc2013-empathy-325786d466cc7a8b6eed06e52b9b5223ba5dc7fd.tar.xz
gsoc2013-empathy-325786d466cc7a8b6eed06e52b9b5223ba5dc7fd.tar.zst
gsoc2013-empathy-325786d466cc7a8b6eed06e52b9b5223ba5dc7fd.zip
tp-file: no need to pass the incoming property during construction
We can infer it from the channel properties.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-file.c19
-rw-r--r--libempathy/empathy-tp-file.h3
2 files changed, 10 insertions, 12 deletions
diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c
index ed0bdb2d8..065e94f62 100644
--- a/libempathy/empathy-tp-file.c
+++ b/libempathy/empathy-tp-file.c
@@ -772,9 +772,6 @@ do_set_property (GObject *object,
case PROP_CHANNEL:
priv->channel = g_object_ref (g_value_get_object (value));
break;
- case PROP_INCOMING:
- priv->incoming = g_value_get_boolean (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -786,6 +783,7 @@ do_constructed (GObject *object)
{
EmpathyTpFile *tp_file;
EmpathyTpFilePriv *priv;
+ GHashTable *props;
tp_file = EMPATHY_TP_FILE (object);
priv = GET_PRIV (tp_file);
@@ -793,6 +791,9 @@ do_constructed (GObject *object)
g_signal_connect (priv->channel, "invalidated",
G_CALLBACK (tp_file_invalidated_cb), tp_file);
+ props = tp_channel_borrow_immutable_properties (priv->channel);
+ priv->incoming = !tp_asv_get_boolean (props, TP_PROP_CHANNEL_REQUESTED, NULL);
+
tp_cli_channel_type_file_transfer_connect_to_file_transfer_state_changed (
priv->channel, tp_file_state_changed_cb, NULL, NULL, object, NULL);
@@ -850,8 +851,7 @@ empathy_tp_file_class_init (EmpathyTpFileClass *klass)
"direction of transfer",
"The direction of the file being transferred",
FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READABLE));
g_type_class_add_private (object_class, sizeof (EmpathyTpFilePriv));
}
@@ -863,22 +863,21 @@ empathy_tp_file_class_init (EmpathyTpFileClass *klass)
* @channel: a #TpChannel
* @incoming: whether the file transfer is incoming or not
*
- * Creates a new #EmpathyTpFile wrapping @channel, with the direction
- * specified by @incoming. The returned #EmpathyTpFile should be unrefed
+ * Creates a new #EmpathyTpFile wrapping @channel.
+ * The returned #EmpathyTpFile should be unrefed
* with g_object_unref() when finished with.
*
* Return value: a new #EmpathyTpFile
*/
EmpathyTpFile *
-empathy_tp_file_new (TpChannel *channel,
- gboolean incoming)
+empathy_tp_file_new (TpChannel *channel)
{
EmpathyTpFile *tp_file;
g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
tp_file = g_object_new (EMPATHY_TYPE_TP_FILE,
- "channel", channel, "incoming", incoming,
+ "channel", channel,
NULL);
return tp_file;
diff --git a/libempathy/empathy-tp-file.h b/libempathy/empathy-tp-file.h
index b40b8c364..ad3af72ee 100644
--- a/libempathy/empathy-tp-file.h
+++ b/libempathy/empathy-tp-file.h
@@ -95,8 +95,7 @@ GType empathy_tp_file_get_type (void) G_GNUC_CONST;
/* public methods */
-EmpathyTpFile * empathy_tp_file_new (TpChannel *channel,
- gboolean incoming);
+EmpathyTpFile * empathy_tp_file_new (TpChannel *channel);
void empathy_tp_file_accept (EmpathyTpFile *tp_file,
guint64 offset,