diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-07-09 01:33:05 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-07-09 01:33:05 +0800 |
commit | 0b0d39c19fbb638489d1de348ec05bb3daa2a760 (patch) | |
tree | 91031f9f9cb21ae72e13ad2c61f7c1b1aeaf1814 /libempathy/empathy-contact.c | |
parent | c64b8aa64504879868876ac956aa52b4d280a7bd (diff) | |
download | gsoc2013-empathy-0b0d39c19fbb638489d1de348ec05bb3daa2a760.tar gsoc2013-empathy-0b0d39c19fbb638489d1de348ec05bb3daa2a760.tar.gz gsoc2013-empathy-0b0d39c19fbb638489d1de348ec05bb3daa2a760.tar.bz2 gsoc2013-empathy-0b0d39c19fbb638489d1de348ec05bb3daa2a760.tar.lz gsoc2013-empathy-0b0d39c19fbb638489d1de348ec05bb3daa2a760.tar.xz gsoc2013-empathy-0b0d39c19fbb638489d1de348ec05bb3daa2a760.tar.zst gsoc2013-empathy-0b0d39c19fbb638489d1de348ec05bb3daa2a760.zip |
switch empathy-contact to Collabora coding style (Guillaume Desmottes)
svn path=/trunk/; revision=1214
Diffstat (limited to 'libempathy/empathy-contact.c')
-rw-r--r-- | libempathy/empathy-contact.c | 518 |
1 files changed, 264 insertions, 254 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index e0335028c..84ab27c42 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -40,32 +40,29 @@ #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContact) typedef struct { - gchar *id; - gchar *name; - EmpathyAvatar *avatar; - McAccount *account; - McPresence presence; - gchar *presence_message; - guint handle; + gchar *id; + gchar *name; + EmpathyAvatar *avatar; + McAccount *account; + McPresence presence; + gchar *presence_message; + guint handle; EmpathyCapabilities capabilities; - gboolean is_user; - guint hash; + gboolean is_user; + guint hash; EmpathyContactReady ready; } EmpathyContactPriv; -static void contact_finalize (GObject *object); -static void contact_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec); -static void contact_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec); +static void contact_finalize (GObject *object); +static void contact_get_property (GObject *object, guint param_id, + GValue *value, GParamSpec *pspec); +static void contact_set_property (GObject *object, guint param_id, + const GValue *value, GParamSpec *pspec); G_DEFINE_TYPE (EmpathyContact, empathy_contact, G_TYPE_OBJECT); -enum { +enum +{ PROP_0, PROP_ID, PROP_NAME, @@ -86,94 +83,95 @@ empathy_contact_class_init (EmpathyContactClass *class) object_class = G_OBJECT_CLASS (class); - object_class->finalize = contact_finalize; + object_class->finalize = contact_finalize; object_class->get_property = contact_get_property; object_class->set_property = contact_set_property; g_object_class_install_property (object_class, - PROP_ID, - g_param_spec_string ("id", - "Contact id", - "String identifying contact", - NULL, - G_PARAM_READWRITE)); + PROP_ID, + g_param_spec_string ("id", + "Contact id", + "String identifying contact", + NULL, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_NAME, - g_param_spec_string ("name", - "Contact Name", - "The name of the contact", - NULL, - G_PARAM_READWRITE)); + PROP_NAME, + g_param_spec_string ("name", + "Contact Name", + "The name of the contact", + NULL, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_AVATAR, - g_param_spec_boxed ("avatar", - "Avatar image", - "The avatar image", - EMPATHY_TYPE_AVATAR, - G_PARAM_READWRITE)); + PROP_AVATAR, + g_param_spec_boxed ("avatar", + "Avatar image", + "The avatar image", + EMPATHY_TYPE_AVATAR, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_ACCOUNT, - g_param_spec_object ("account", - "Contact Account", - "The account associated with the contact", - MC_TYPE_ACCOUNT, - G_PARAM_READWRITE)); + PROP_ACCOUNT, + g_param_spec_object ("account", + "Contact Account", + "The account associated with the contact", + MC_TYPE_ACCOUNT, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_PRESENCE, - g_param_spec_uint ("presence", - "Contact presence", - "Presence of contact", - MC_PRESENCE_UNSET, - LAST_MC_PRESENCE, - MC_PRESENCE_UNSET, - G_PARAM_READWRITE)); + PROP_PRESENCE, + g_param_spec_uint ("presence", + "Contact presence", + "Presence of contact", + MC_PRESENCE_UNSET, + LAST_MC_PRESENCE, + MC_PRESENCE_UNSET, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_PRESENCE_MESSAGE, - g_param_spec_string ("presence-message", - "Contact presence message", - "Presence message of contact", - NULL, - G_PARAM_READWRITE)); + PROP_PRESENCE_MESSAGE, + g_param_spec_string ("presence-message", + "Contact presence message", + "Presence message of contact", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, - PROP_HANDLE, - g_param_spec_uint ("handle", - "Contact Handle", - "The handle of the contact", - 0, - G_MAXUINT, - 0, - G_PARAM_READWRITE)); + PROP_HANDLE, + g_param_spec_uint ("handle", + "Contact Handle", + "The handle of the contact", + 0, + G_MAXUINT, + 0, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_CAPABILITIES, - g_param_spec_flags ("capabilities", - "Contact Capabilities", - "Capabilities of the contact", - EMPATHY_TYPE_CAPABILITIES, - EMPATHY_CAPABILITIES_UNKNOWN, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE)); + PROP_CAPABILITIES, + g_param_spec_flags ("capabilities", + "Contact Capabilities", + "Capabilities of the contact", + EMPATHY_TYPE_CAPABILITIES, + EMPATHY_CAPABILITIES_UNKNOWN, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_IS_USER, - g_param_spec_boolean ("is-user", - "Contact is-user", - "Is contact the user", - FALSE, - G_PARAM_READWRITE)); + PROP_IS_USER, + g_param_spec_boolean ("is-user", + "Contact is-user", + "Is contact the user", + FALSE, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_READY, - g_param_spec_flags ("ready", - "Contact ready flags", - "Flags for ready properties", - EMPATHY_TYPE_CONTACT_READY, - EMPATHY_CONTACT_READY_NONE, - G_PARAM_READABLE)); + PROP_READY, + g_param_spec_flags ("ready", + "Contact ready flags", + "Flags for ready properties", + EMPATHY_TYPE_CONTACT_READY, + EMPATHY_CONTACT_READY_NONE, + G_PARAM_READABLE)); g_type_class_add_private (object_class, sizeof (EmpathyContactPriv)); } @@ -200,22 +198,24 @@ contact_finalize (GObject *object) g_free (priv->id); g_free (priv->presence_message); - if (priv->avatar) { - empathy_avatar_unref (priv->avatar); - } + if (priv->avatar) + { + empathy_avatar_unref (priv->avatar); + } - if (priv->account) { - g_object_unref (priv->account); - } + if (priv->account) + { + g_object_unref (priv->account); + } G_OBJECT_CLASS (empathy_contact_parent_class)->finalize (object); } static void -contact_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) +contact_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec) { EmpathyContactPriv *priv; @@ -227,7 +227,7 @@ contact_get_property (GObject *object, break; case PROP_NAME: g_value_set_string (value, - empathy_contact_get_name (EMPATHY_CONTACT (object))); + empathy_contact_get_name (EMPATHY_CONTACT (object))); break; case PROP_AVATAR: g_value_set_boxed (value, priv->avatar); @@ -260,10 +260,10 @@ contact_get_property (GObject *object, } static void -contact_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec) +contact_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec) { EmpathyContactPriv *priv; @@ -272,39 +272,39 @@ contact_set_property (GObject *object, switch (param_id) { case PROP_ID: empathy_contact_set_id (EMPATHY_CONTACT (object), - g_value_get_string (value)); + g_value_get_string (value)); break; case PROP_NAME: empathy_contact_set_name (EMPATHY_CONTACT (object), - g_value_get_string (value)); + g_value_get_string (value)); break; case PROP_AVATAR: empathy_contact_set_avatar (EMPATHY_CONTACT (object), - g_value_get_boxed (value)); + g_value_get_boxed (value)); break; case PROP_ACCOUNT: empathy_contact_set_account (EMPATHY_CONTACT (object), - MC_ACCOUNT (g_value_get_object (value))); + MC_ACCOUNT (g_value_get_object (value))); break; case PROP_PRESENCE: empathy_contact_set_presence (EMPATHY_CONTACT (object), - g_value_get_uint (value)); + g_value_get_uint (value)); break; case PROP_PRESENCE_MESSAGE: empathy_contact_set_presence_message (EMPATHY_CONTACT (object), - g_value_get_string (value)); + g_value_get_string (value)); break; case PROP_HANDLE: empathy_contact_set_handle (EMPATHY_CONTACT (object), - g_value_get_uint (value)); + g_value_get_uint (value)); break; case PROP_CAPABILITIES: empathy_contact_set_capabilities (EMPATHY_CONTACT (object), - g_value_get_flags (value)); + g_value_get_flags (value)); break; case PROP_IS_USER: empathy_contact_set_is_user (EMPATHY_CONTACT (object), - g_value_get_boolean (value)); + g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); @@ -313,35 +313,36 @@ contact_set_property (GObject *object, } static void -contact_set_ready_flag (EmpathyContact *contact, - EmpathyContactReady flag) +contact_set_ready_flag (EmpathyContact *contact, + EmpathyContactReady flag) { EmpathyContactPriv *priv = GET_PRIV (contact); - if (!(priv->ready & flag)) { - priv->ready |= flag; - g_object_notify (G_OBJECT (contact), "ready"); - } + if (!(priv->ready & flag)) + { + priv->ready |= flag; + g_object_notify (G_OBJECT (contact), "ready"); + } } EmpathyContact * empathy_contact_new (McAccount *account) { return g_object_new (EMPATHY_TYPE_CONTACT, - "account", account, - NULL); + "account", account, + NULL); } EmpathyContact * -empathy_contact_new_full (McAccount *account, - const gchar *id, - const gchar *name) +empathy_contact_new_full (McAccount *account, + const gchar *id, + const gchar *name) { - return g_object_new (EMPATHY_TYPE_CONTACT, - "account", account, - "name", name, - "id", id, - NULL); + return g_object_new (EMPATHY_TYPE_CONTACT, + "account", account, + "name", name, + "id", id, + NULL); } const gchar * @@ -358,7 +359,7 @@ empathy_contact_get_id (EmpathyContact *contact) void empathy_contact_set_id (EmpathyContact *contact, - const gchar *id) + const gchar *id) { EmpathyContactPriv *priv; @@ -370,15 +371,17 @@ empathy_contact_set_id (EmpathyContact *contact, /* We temporally ref the contact because it could be destroyed * during the signal emition */ g_object_ref (contact); - if (tp_strdiff (id, priv->id)) { - g_free (priv->id); - priv->id = g_strdup (id); - - g_object_notify (G_OBJECT (contact), "id"); - if (G_STR_EMPTY (priv->name)) { - g_object_notify (G_OBJECT (contact), "name"); - } - } + if (tp_strdiff (id, priv->id)) + { + g_free (priv->id); + priv->id = g_strdup (id); + + g_object_notify (G_OBJECT (contact), "id"); + if (G_STR_EMPTY (priv->name)) + { + g_object_notify (G_OBJECT (contact), "name"); + } + } contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_ID); g_object_unref (contact); @@ -393,16 +396,17 @@ empathy_contact_get_name (EmpathyContact *contact) priv = GET_PRIV (contact); - if (G_STR_EMPTY (priv->name)) { - return empathy_contact_get_id (contact); - } + if (G_STR_EMPTY (priv->name)) + { + return empathy_contact_get_id (contact); + } return priv->name; } void empathy_contact_set_name (EmpathyContact *contact, - const gchar *name) + const gchar *name) { EmpathyContactPriv *priv; @@ -411,11 +415,12 @@ empathy_contact_set_name (EmpathyContact *contact, priv = GET_PRIV (contact); g_object_ref (contact); - if (tp_strdiff (name, priv->name)) { - g_free (priv->name); - priv->name = g_strdup (name); - g_object_notify (G_OBJECT (contact), "name"); - } + if (tp_strdiff (name, priv->name)) + { + g_free (priv->name); + priv->name = g_strdup (name); + g_object_notify (G_OBJECT (contact), "name"); + } contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_NAME); g_object_unref (contact); } @@ -434,7 +439,7 @@ empathy_contact_get_avatar (EmpathyContact *contact) void empathy_contact_set_avatar (EmpathyContact *contact, - EmpathyAvatar *avatar) + EmpathyAvatar *avatar) { EmpathyContactPriv *priv; @@ -442,18 +447,19 @@ empathy_contact_set_avatar (EmpathyContact *contact, priv = GET_PRIV (contact); - if (priv->avatar == avatar) { + if (priv->avatar == avatar) return; - } - if (priv->avatar) { - empathy_avatar_unref (priv->avatar); - priv->avatar = NULL; - } + if (priv->avatar) + { + empathy_avatar_unref (priv->avatar); + priv->avatar = NULL; + } - if (avatar) { - priv->avatar = empathy_avatar_ref (avatar); - } + if (avatar) + { + priv->avatar = empathy_avatar_ref (avatar); + } g_object_notify (G_OBJECT (contact), "avatar"); } @@ -472,7 +478,7 @@ empathy_contact_get_account (EmpathyContact *contact) void empathy_contact_set_account (EmpathyContact *contact, - McAccount *account) + McAccount *account) { EmpathyContactPriv *priv; @@ -481,13 +487,13 @@ empathy_contact_set_account (EmpathyContact *contact, priv = GET_PRIV (contact); - if (account == priv->account) { + if (account == priv->account) return; - } - if (priv->account) { - g_object_unref (priv->account); - } + if (priv->account) + { + g_object_unref (priv->account); + } priv->account = g_object_ref (account); g_object_notify (G_OBJECT (contact), "account"); @@ -507,7 +513,7 @@ empathy_contact_get_presence (EmpathyContact *contact) void empathy_contact_set_presence (EmpathyContact *contact, - McPresence presence) + McPresence presence) { EmpathyContactPriv *priv; @@ -515,9 +521,8 @@ empathy_contact_set_presence (EmpathyContact *contact, priv = GET_PRIV (contact); - if (presence == priv->presence) { + if (presence == priv->presence) return; - } priv->presence = presence; @@ -538,15 +543,14 @@ empathy_contact_get_presence_message (EmpathyContact *contact) void empathy_contact_set_presence_message (EmpathyContact *contact, - const gchar *message) + const gchar *message) { EmpathyContactPriv *priv = GET_PRIV (contact); g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - if (!tp_strdiff (message, priv->presence_message)) { + if (!tp_strdiff (message, priv->presence_message)) return; - } g_free (priv->presence_message); priv->presence_message = g_strdup (message); @@ -568,7 +572,7 @@ empathy_contact_get_handle (EmpathyContact *contact) void empathy_contact_set_handle (EmpathyContact *contact, - guint handle) + guint handle) { EmpathyContactPriv *priv; @@ -577,10 +581,11 @@ empathy_contact_set_handle (EmpathyContact *contact, priv = GET_PRIV (contact); g_object_ref (contact); - if (handle != priv->handle) { - priv->handle = handle; - g_object_notify (G_OBJECT (contact), "handle"); - } + if (handle != priv->handle) + { + priv->handle = handle; + g_object_notify (G_OBJECT (contact), "handle"); + } contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE); g_object_unref (contact); } @@ -598,8 +603,8 @@ empathy_contact_get_capabilities (EmpathyContact *contact) } void -empathy_contact_set_capabilities (EmpathyContact *contact, - EmpathyCapabilities capabilities) +empathy_contact_set_capabilities (EmpathyContact *contact, + EmpathyCapabilities capabilities) { EmpathyContactPriv *priv; @@ -607,9 +612,8 @@ empathy_contact_set_capabilities (EmpathyContact *contact, priv = GET_PRIV (contact); - if (priv->capabilities == capabilities) { + if (priv->capabilities == capabilities) return; - } priv->capabilities = capabilities; @@ -630,7 +634,7 @@ empathy_contact_is_user (EmpathyContact *contact) void empathy_contact_set_is_user (EmpathyContact *contact, - gboolean is_user) + gboolean is_user) { EmpathyContactPriv *priv; @@ -638,9 +642,8 @@ empathy_contact_set_is_user (EmpathyContact *contact, priv = GET_PRIV (contact); - if (priv->is_user == is_user) { + if (priv->is_user == is_user) return; - } priv->is_user = is_user; @@ -668,9 +671,8 @@ empathy_contact_get_status (EmpathyContact *contact) priv = GET_PRIV (contact); - if (priv->presence_message) { + if (priv->presence_message) return priv->presence_message; - } return empathy_presence_get_default_message (priv->presence); } @@ -702,10 +704,10 @@ empathy_contact_get_ready (EmpathyContact *contact) gboolean empathy_contact_equal (gconstpointer v1, - gconstpointer v2) + gconstpointer v2) { - McAccount *account_a; - McAccount *account_b; + McAccount *account_a; + McAccount *account_b; const gchar *id_a; const gchar *id_b; @@ -740,8 +742,8 @@ empathy_contact_hash (gconstpointer key) } static gboolean -contact_is_ready_func (GObject *contact, - gpointer user_data) +contact_is_ready_func (GObject *contact, + gpointer user_data) { EmpathyContactPriv *priv = GET_PRIV (contact); EmpathyContactReady ready; @@ -759,38 +761,37 @@ contact_is_ready_func (GObject *contact, } void -empathy_contact_run_until_ready (EmpathyContact *contact, - EmpathyContactReady ready, - GMainLoop **loop) +empathy_contact_run_until_ready (EmpathyContact *contact, + EmpathyContactReady ready, + GMainLoop **loop) { empathy_run_until_ready_full (contact, "notify::ready", - contact_is_ready_func, GUINT_TO_POINTER (ready), - loop); + contact_is_ready_func, GUINT_TO_POINTER (ready), + loop); } static gchar * contact_get_avatar_filename (EmpathyContact *contact, - const gchar *token) + const gchar *token) { EmpathyContactPriv *priv = GET_PRIV (contact); - gchar *avatar_path; - gchar *avatar_file; - gchar *token_escaped; - gchar *contact_escaped; + gchar *avatar_path; + gchar *avatar_file; + gchar *token_escaped; + gchar *contact_escaped; - if (G_STR_EMPTY (priv->id)) { + if (G_STR_EMPTY (priv->id)) return NULL; - } contact_escaped = tp_escape_as_identifier (priv->id); token_escaped = tp_escape_as_identifier (token); avatar_path = g_build_filename (g_get_user_cache_dir (), - PACKAGE_NAME, - "avatars", - mc_account_get_unique_name (priv->account), - contact_escaped, - NULL); + PACKAGE_NAME, + "avatars", + mc_account_get_unique_name (priv->account), + contact_escaped, + NULL); g_mkdir_with_parents (avatar_path, 0700); avatar_file = g_build_filename (avatar_path, token_escaped, NULL); @@ -804,14 +805,14 @@ contact_get_avatar_filename (EmpathyContact *contact, void empathy_contact_load_avatar_data (EmpathyContact *contact, - const guchar *data, - const gsize len, - const gchar *format, - const gchar *token) + const guchar *data, + const gsize len, + const gchar *format, + const gchar *token) { EmpathyAvatar *avatar; - gchar *filename; - GError *error = NULL; + gchar *filename; + GError *error = NULL; g_return_if_fail (EMPATHY_IS_CONTACT (contact)); g_return_if_fail (data != NULL); @@ -820,55 +821,61 @@ empathy_contact_load_avatar_data (EmpathyContact *contact, g_return_if_fail (!G_STR_EMPTY (token)); /* Load and set the avatar */ - avatar = empathy_avatar_new (g_memdup (data, len), len, - g_strdup (format), - g_strdup (token)); + avatar = empathy_avatar_new (g_memdup (data, len), len, g_strdup (format), + g_strdup (token)); empathy_contact_set_avatar (contact, avatar); empathy_avatar_unref (avatar); /* Save to cache if not yet in it */ filename = contact_get_avatar_filename (contact, token); - if (filename && !g_file_test (filename, G_FILE_TEST_EXISTS)) { - if (!empathy_avatar_save_to_file (avatar, filename, &error)) { - DEBUG ("Failed to save avatar in cache: %s", - error ? error->message : "No error given"); - g_clear_error (&error); - } else { - DEBUG ("Avatar saved to %s", filename); - } - } + if (filename && !g_file_test (filename, G_FILE_TEST_EXISTS)) + { + if (!empathy_avatar_save_to_file (avatar, filename, &error)) + { + DEBUG ("Failed to save avatar in cache: %s", + error ? error->message : "No error given"); + g_clear_error (&error); + } + else + { + DEBUG ("Avatar saved to %s", filename); + } + } g_free (filename); } gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact, - const gchar *token) + const gchar *token) { EmpathyAvatar *avatar = NULL; - gchar *filename; - gchar *data = NULL; - gsize len; - GError *error = NULL; + gchar *filename; + gchar *data = NULL; + gsize len; + GError *error = NULL; g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE); g_return_val_if_fail (!G_STR_EMPTY (token), FALSE); /* Load the avatar from file if it exists */ filename = contact_get_avatar_filename (contact, token); - if (filename && g_file_test (filename, G_FILE_TEST_EXISTS)) { - if (!g_file_get_contents (filename, &data, &len, &error)) { - DEBUG ("Failed to load avatar from cache: %s", - error ? error->message : "No error given"); - g_clear_error (&error); - } - } - - if (data) { - DEBUG ("Avatar loaded from %s", filename); - avatar = empathy_avatar_new (data, len, NULL, g_strdup (token)); - empathy_contact_set_avatar (contact, avatar); - empathy_avatar_unref (avatar); - } + if (filename && g_file_test (filename, G_FILE_TEST_EXISTS)) + { + if (!g_file_get_contents (filename, &data, &len, &error)) + { + DEBUG ("Failed to load avatar from cache: %s", + error ? error->message : "No error given"); + g_clear_error (&error); + } + } + + if (data) + { + DEBUG ("Avatar loaded from %s", filename); + avatar = empathy_avatar_new (data, len, NULL, g_strdup (token)); + empathy_contact_set_avatar (contact, avatar); + empathy_avatar_unref (avatar); + } g_free (filename); @@ -880,20 +887,21 @@ empathy_avatar_get_type (void) { static GType type_id = 0; - if (!type_id) { - type_id = g_boxed_type_register_static ("EmpathyAvatar", - (GBoxedCopyFunc) empathy_avatar_ref, - (GBoxedFreeFunc) empathy_avatar_unref); - } + if (!type_id) + { + type_id = g_boxed_type_register_static ("EmpathyAvatar", + (GBoxedCopyFunc) empathy_avatar_ref, + (GBoxedFreeFunc) empathy_avatar_unref); + } return type_id; } EmpathyAvatar * empathy_avatar_new (guchar *data, - gsize len, - gchar *format, - gchar *token) + gsize len, + gchar *format, + gchar *token) { EmpathyAvatar *avatar; @@ -913,12 +921,13 @@ empathy_avatar_unref (EmpathyAvatar *avatar) g_return_if_fail (avatar != NULL); avatar->refcount--; - if (avatar->refcount == 0) { - g_free (avatar->data); - g_free (avatar->format); - g_free (avatar->token); - g_slice_free (EmpathyAvatar, avatar); - } + if (avatar->refcount == 0) + { + g_free (avatar->data); + g_free (avatar->format); + g_free (avatar->token); + g_slice_free (EmpathyAvatar, avatar); + } } EmpathyAvatar * @@ -948,3 +957,4 @@ empathy_avatar_save_to_file (EmpathyAvatar *self, { return g_file_set_contents (filename, self->data, self->len, error); } + |