From 2885452639d3eb70aac6392e63526babe9c0766a Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 21 Nov 2008 16:18:01 +0000 Subject: Removed account property of EmpathyTpFile as it's only actually used once and easy obtainable. (Jonny Lamb) Signed-off-by: Jonny Lamb svn path=/trunk/; revision=1803 --- libempathy/empathy-tp-file.c | 33 ++++++--------------------------- libempathy/empathy-tp-file.h | 2 +- libempathy/empathy-utils.c | 2 +- 3 files changed, 8 insertions(+), 29 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c index ee9f01e9b..c9e4c5d4d 100644 --- a/libempathy/empathy-tp-file.c +++ b/libempathy/empathy-tp-file.c @@ -274,7 +274,6 @@ copy_stream (GInputStream *in, struct _EmpathyTpFilePriv { EmpathyContactFactory *factory; - McAccount *account; gchar *id; MissionControl *mc; TpChannel *channel; @@ -300,7 +299,6 @@ struct _EmpathyTpFilePriv { enum { PROP_0, - PROP_ACCOUNT, PROP_CHANNEL, PROP_STATE, PROP_INCOMING, @@ -358,10 +356,6 @@ tp_file_finalize (GObject *object) { g_object_unref (tp_file->priv->factory); } - if (tp_file->priv->account) - { - g_object_unref (tp_file->priv->account); - } if (tp_file->priv->mc) { g_object_unref (tp_file->priv->mc); @@ -542,6 +536,7 @@ tp_file_constructor (GType type, EmpathyTpFile *tp_file; TpHandle handle; GHashTable *properties; + McAccount *account; file_obj = G_OBJECT_CLASS (empathy_tp_file_parent_class)->constructor (type, n_props, props); @@ -570,9 +565,11 @@ tp_file_constructor (GType type, tp_file, NULL, NULL, NULL); + account = empathy_channel_get_account (tp_file->priv->channel); + handle = tp_channel_get_handle (tp_file->priv->channel, NULL); tp_file->priv->contact = empathy_contact_factory_get_from_handle ( - tp_file->priv->factory, tp_file->priv->account, (guint) handle); + tp_file->priv->factory, account, (guint) handle); tp_cli_dbus_properties_run_get_all (tp_file->priv->channel, -1, EMP_IFACE_CHANNEL_TYPE_FILE, &properties, NULL, NULL); @@ -603,6 +600,7 @@ tp_file_constructor (GType type, tp_file->priv->incoming = TRUE; g_hash_table_destroy (properties); + g_object_unref (account); return file_obj; } @@ -619,9 +617,6 @@ tp_file_get_property (GObject *object, switch (param_id) { - case PROP_ACCOUNT: - g_value_set_object (value, tp_file->priv->account); - break; case PROP_CHANNEL: g_value_set_object (value, tp_file->priv->channel); break; @@ -652,9 +647,6 @@ tp_file_set_property (GObject *object, EmpathyTpFile *tp_file = (EmpathyTpFile *) object; switch (param_id) { - case PROP_ACCOUNT: - tp_file->priv->account = g_object_ref (g_value_get_object (value)); - break; case PROP_CHANNEL: tp_file->priv->channel = g_object_ref (g_value_get_object (value)); break; @@ -700,7 +692,6 @@ tp_file_set_property (GObject *object, /** * empathy_tp_file_new: - * @account: the #McAccount for the channel * @channel: a Telepathy channel * * Creates a new #EmpathyTpFile wrapping @channel. @@ -708,14 +699,11 @@ tp_file_set_property (GObject *object, * Returns: a new #EmpathyTpFile */ EmpathyTpFile * -empathy_tp_file_new (McAccount *account, - TpChannel *channel) +empathy_tp_file_new (TpChannel *channel) { - g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL); return g_object_new (EMPATHY_TYPE_TP_FILE, - "account", account, "channel", channel, NULL); } @@ -1006,15 +994,6 @@ empathy_tp_file_class_init (EmpathyTpFileClass *klass) object_class->set_property = tp_file_set_property; /* Construct-only properties */ - g_object_class_install_property (object_class, - PROP_ACCOUNT, - g_param_spec_object ("account", - "channel Account", - "The account associated with the channel", - MC_TYPE_ACCOUNT, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (object_class, PROP_CHANNEL, g_param_spec_object ("channel", diff --git a/libempathy/empathy-tp-file.h b/libempathy/empathy-tp-file.h index 21007291d..c8565033f 100644 --- a/libempathy/empathy-tp-file.h +++ b/libempathy/empathy-tp-file.h @@ -67,7 +67,7 @@ struct _EmpathyTpFileClass GType empathy_tp_file_get_type (void) G_GNUC_CONST; -EmpathyTpFile *empathy_tp_file_new (McAccount *account, TpChannel *channel); +EmpathyTpFile *empathy_tp_file_new (TpChannel *channel); TpChannel *empathy_tp_file_get_channel (EmpathyTpFile *tp_file); void empathy_tp_file_accept (EmpathyTpFile *tp_file, guint64 offset); diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index dd0ca1987..ede7cc305 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -862,7 +862,7 @@ empathy_send_file (EmpathyContact *contact, &value, NULL, NULL, NULL, NULL); g_value_unset (&value); - tp_file = empathy_tp_file_new (account, channel); + tp_file = empathy_tp_file_new (channel); if (tp_file) { empathy_tp_file_set_input_stream (tp_file, in_stream); -- cgit v1.2.3