[telepathy-mission-control/master] McdChannel: use a struct field for the error rather than gluing on qdata

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Apr 15 05:56:58 PDT 2009


---
 src/mcd-channel.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/mcd-channel.c b/src/mcd-channel.c
index b6c9663..9cde325 100644
--- a/src/mcd-channel.c
+++ b/src/mcd-channel.c
@@ -65,6 +65,7 @@ typedef struct _McdChannelRequestData McdChannelRequestData;
 struct _McdChannelPrivate
 {
     TpChannel *tp_chan;
+    GError *error;
 
     /* boolean properties */
     guint outgoing : 1;
@@ -115,8 +116,6 @@ enum _McdChannelPropertyType
 #define DEPRECATED_PROPERTY_WARNING \
     g_warning ("%s: property %s is deprecated", G_STRFUNC, pspec->name)
 
-#define CD_ERROR    "_error"
-
 static guint mcd_channel_signals[LAST_SIGNAL] = { 0 };
 
 #define REQUEST_OBJ_BASE "/com/nokia/MissionControl/requests/r"
@@ -496,6 +495,12 @@ _mcd_channel_finalize (GObject * object)
         list = g_list_delete_link (list, list);
     }
 
+    if (priv->error != NULL)
+    {
+        g_error_free (priv->error);
+        priv->error = NULL;
+    }
+
     G_OBJECT_CLASS (mcd_channel_parent_class)->finalize (object);
 }
 
@@ -1131,8 +1136,9 @@ void
 mcd_channel_take_error (McdChannel *channel, GError *error)
 {
     g_return_if_fail (MCD_IS_CHANNEL (channel));
-    g_object_set_data_full ((GObject *)channel, CD_ERROR,
-                            error, (GDestroyNotify)g_error_free);
+
+    channel->priv->error = error;
+
     if (error)
         _mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_FAILED);
 }
@@ -1147,7 +1153,8 @@ const GError *
 mcd_channel_get_error (McdChannel *channel)
 {
     g_return_val_if_fail (MCD_IS_CHANNEL (channel), NULL);
-    return g_object_get_data ((GObject *)channel, CD_ERROR);
+
+    return channel->priv->error;
 }
 
 /**
-- 
1.5.6.5




More information about the telepathy-commits mailing list