[Telepathy-commits] [telepathy-mission-control/master] Add stubs of profile presences getters.

Alberto Mardegan alberto.mardegan at nokia.com
Mon Nov 17 00:05:26 PST 2008


---
 libmcclient/mc-profile.c |   68 ++++++++++++++++++++++++++++++++++++++++++---
 libmcclient/mc-profile.h |    9 ++++++
 2 files changed, 72 insertions(+), 5 deletions(-)

diff --git a/libmcclient/mc-profile.c b/libmcclient/mc-profile.c
index b8bc5af..8da6b8a 100644
--- a/libmcclient/mc-profile.c
+++ b/libmcclient/mc-profile.c
@@ -80,6 +80,7 @@ typedef struct {
     gchar *default_account_domain;
     gchar *avatar_mime_type;
     gchar *default_account_name;
+    gchar *localization_domain;
     gint priority;
     gboolean vcard_default;
     McProfileCapabilityFlags capabilities;
@@ -126,6 +127,7 @@ mc_profile_finalize (GObject *object)
     g_free (priv->default_account_domain);
     g_free (priv->avatar_mime_type);
     g_free (priv->default_account_name);
+    g_free (priv->localization_domain);
     g_hash_table_destroy (priv->default_settings);
     g_hash_table_destroy (priv->vcard_mangle_hash);
     g_array_free (priv->supported_presences, TRUE);
@@ -275,7 +277,7 @@ _mc_profile_load (McProfile *profile)
     gchar *filename;
     GKeyFile *keyfile;
     GError *error = NULL;
-    gchar *caps, *localization_domain;
+    gchar *caps;
     gchar **keys, **tmp;
     McProfilePrivate *priv;
     gchar **presences_str;
@@ -309,16 +311,17 @@ _mc_profile_load (McProfile *profile)
     priv->avatar_mime_type = g_key_file_get_string (keyfile, PROFILE_GROUP, "AvatarMimeType", NULL);
     priv->default_account_name = g_key_file_get_string (keyfile, PROFILE_GROUP, "DefaultAccountName", NULL);
     priv->priority = g_key_file_get_integer (keyfile, PROFILE_GROUP, "Priority", NULL);
-    localization_domain = g_key_file_get_string (keyfile, PROFILE_GROUP, "LocalizationDomain", NULL);
-    if (localization_domain)
+    priv->localization_domain = g_key_file_get_string (keyfile, PROFILE_GROUP,
+                                                       "LocalizationDomain",
+                                                       NULL);
+    if (priv->localization_domain)
     {
 	gchar *display_name;
 
-	display_name = g_strdup (dgettext (localization_domain,
+	display_name = g_strdup (dgettext (priv->localization_domain,
 					   priv->display_name));
 	g_free (priv->display_name);
 	priv->display_name = display_name;
-	g_free (localization_domain);
     }
 
     g_key_file_set_list_separator (keyfile, ',');
@@ -1072,3 +1075,58 @@ mc_profile_get_vcard_mangle (McProfile *id, const gchar *vcard_field)
     return (const gchar *) g_hash_table_lookup (MC_PROFILE_PRIV (id)->vcard_mangle_hash, vcard_field);
 }
 
+/**
+ * mc_profile_presences_list:
+ * @id: The #McProfile.
+ *
+ * List the presences supported by this profile.
+ *
+ * Returns: an array of strings representing the presence statuses supported by
+ * this profile (do not free).
+ */
+const gchar * const *
+mc_profile_presences_list (McProfile *id)
+{
+    g_return_val_if_fail (MC_IS_PROFILE (id), NULL);
+}
+
+/**
+ * mc_profile_presence_get_name:
+ * @id: The #McProfile.
+ * @presence: status name of the presence.
+ *
+ * Returns: the localized name of the presence status.
+ */
+gchar *
+mc_profile_presence_get_name (McProfile *id, const gchar *presence)
+{
+    g_return_val_if_fail (MC_IS_PROFILE (id), NULL);
+}
+
+/**
+ * mc_profile_presence_get_type:
+ * @id: The #McProfile.
+ * @presence: status name of the presence.
+ *
+ * Returns: the #TpConnectionPresenceType of @presence.
+ */
+TpConnectionPresenceType
+mc_profile_presence_get_type (McProfile *id, const gchar *presence)
+{
+    g_return_val_if_fail (MC_IS_PROFILE (id),
+                          TP_CONNECTION_PRESENCE_TYPE_UNSET);
+}
+
+/**
+ * mc_profile_presence_get_icon_name:
+ * @id: The #McProfile.
+ * @presence: status name of the presence.
+ *
+ * Returns: the branding icon name for @presence.
+ */
+gchar *
+mc_profile_presence_get_icon_name (McProfile *id, const gchar *presence)
+{
+    g_return_val_if_fail (MC_IS_PROFILE (id), NULL);
+}
+
diff --git a/libmcclient/mc-profile.h b/libmcclient/mc-profile.h
index d8ec0b5..9858ea5 100644
--- a/libmcclient/mc-profile.h
+++ b/libmcclient/mc-profile.h
@@ -116,6 +116,15 @@ const gchar *mc_profile_get_default_setting (McProfile *id,
 					     const gchar *setting);
 const gchar *mc_profile_get_vcard_mangle (McProfile *id, const gchar *vcard_field);
 
+/* presences */
+const gchar * const *mc_profile_presences_list (McProfile *id);
+gchar *mc_profile_presence_get_name (McProfile *id,
+                                     const gchar *presence);
+TpConnectionPresenceType mc_profile_presence_get_type (McProfile *id,
+                                                       const gchar *presence);
+gchar *mc_profile_presence_get_icon_name (McProfile *id,
+                                          const gchar *presence);
+
 G_END_DECLS
 
 #endif /* __MC_PROFILE_H__ */
-- 
1.5.6.5




More information about the Telepathy-commits mailing list