empathy r1803 - in trunk: libempathy src



Author: xclaesse
Date: Fri Nov 21 16:18:01 2008
New Revision: 1803
URL: http://svn.gnome.org/viewvc/empathy?rev=1803&view=rev

Log:
Removed account property of EmpathyTpFile as it's only actually used once and easy obtainable. (Jonny Lamb)

Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>

Modified:
   trunk/libempathy/empathy-tp-file.c
   trunk/libempathy/empathy-tp-file.h
   trunk/libempathy/empathy-utils.c
   trunk/src/empathy-event-manager.c

Modified: trunk/libempathy/empathy-tp-file.c
==============================================================================
--- trunk/libempathy/empathy-tp-file.c	(original)
+++ trunk/libempathy/empathy-tp-file.c	Fri Nov 21 16:18:01 2008
@@ -274,7 +274,6 @@
 
 struct _EmpathyTpFilePriv {
   EmpathyContactFactory *factory;
-  McAccount *account;
   gchar *id;
   MissionControl *mc;
   TpChannel *channel;
@@ -300,7 +299,6 @@
 
 enum {
   PROP_0,
-  PROP_ACCOUNT,
   PROP_CHANNEL,
   PROP_STATE,
   PROP_INCOMING,
@@ -358,10 +356,6 @@
     {
       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 @@
   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,
       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->priv->incoming = TRUE;
 
   g_hash_table_destroy (properties);
+  g_object_unref (account);
 
   return file_obj;
 }
@@ -619,9 +617,6 @@
 
   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 @@
   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 @@
 
 /**
  * empathy_tp_file_new:
- * @account: the #McAccount for the channel
  * @channel: a Telepathy channel
  *
  * Creates a new #EmpathyTpFile wrapping @channel.
@@ -708,14 +699,11 @@
  * 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);
 }
@@ -1007,15 +995,6 @@
 
   /* 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",
           "telepathy channel",

Modified: trunk/libempathy/empathy-tp-file.h
==============================================================================
--- trunk/libempathy/empathy-tp-file.h	(original)
+++ trunk/libempathy/empathy-tp-file.h	Fri Nov 21 16:18:01 2008
@@ -67,7 +67,7 @@
 
 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);

Modified: trunk/libempathy/empathy-utils.c
==============================================================================
--- trunk/libempathy/empathy-utils.c	(original)
+++ trunk/libempathy/empathy-utils.c	Fri Nov 21 16:18:01 2008
@@ -862,7 +862,7 @@
 		&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);

Modified: trunk/src/empathy-event-manager.c
==============================================================================
--- trunk/src/empathy-event-manager.c	(original)
+++ trunk/src/empathy-event-manager.c	Fri Nov 21 16:18:01 2008
@@ -208,11 +208,9 @@
 	    EMP_FILE_TRANSFER_STATE_LOCAL_PENDING) {
 		EmpathyContact *contact;
 		gchar          *msg;
-		McAccount      *account;
 		EmpathyTpFile  *tp_file;
 
-		account = empathy_channel_get_account (channel);
-		tp_file = empathy_tp_file_new (account, channel);
+		tp_file = empathy_tp_file_new (channel);
 
 		contact = empathy_tp_file_get_contact (tp_file);
 		empathy_contact_run_until_ready (contact,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]