diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-11-12 20:11:55 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-11-13 19:37:17 +0800 |
commit | f349f9df875a373dd4070a1e7f5d5a81cc02b230 (patch) | |
tree | 42d543731e0bc68fa91a0b054c3ad04cb3c645ba | |
parent | 4c0ea57b6d3a4c77a27326c83ebaaffec194dd18 (diff) | |
download | gsoc2013-empathy-f349f9df875a373dd4070a1e7f5d5a81cc02b230.tar gsoc2013-empathy-f349f9df875a373dd4070a1e7f5d5a81cc02b230.tar.gz gsoc2013-empathy-f349f9df875a373dd4070a1e7f5d5a81cc02b230.tar.bz2 gsoc2013-empathy-f349f9df875a373dd4070a1e7f5d5a81cc02b230.tar.lz gsoc2013-empathy-f349f9df875a373dd4070a1e7f5d5a81cc02b230.tar.xz gsoc2013-empathy-f349f9df875a373dd4070a1e7f5d5a81cc02b230.tar.zst gsoc2013-empathy-f349f9df875a373dd4070a1e7f5d5a81cc02b230.zip |
notify-manager: fetch capabilities of the notification server
-rw-r--r-- | libempathy-gtk/empathy-notify-manager.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-notify-manager.c b/libempathy-gtk/empathy-notify-manager.c index 6d2648fe6..ae1894ad9 100644 --- a/libempathy-gtk/empathy-notify-manager.c +++ b/libempathy-gtk/empathy-notify-manager.c @@ -34,8 +34,10 @@ typedef struct { - gboolean dispose_has_run; + /* owned (gchar *) => TRUE */ + GHashTable *capabilities; + gboolean dispose_has_run; } EmpathyNotifyManagerPriv; G_DEFINE_TYPE (EmpathyNotifyManager, empathy_notify_manager, G_TYPE_OBJECT); @@ -49,6 +51,7 @@ notify_manager_constructor (GType type, { GObject *retval; EmpathyNotifyManagerPriv *priv; + GList *list, *l; if (notify_manager != NULL) return g_object_ref (notify_manager); @@ -61,6 +64,18 @@ notify_manager_constructor (GType type, priv = GET_PRIV (notify_manager); + /* fetch capabilities */ + list = notify_get_server_caps (); + for (l = list; l != NULL; l = g_list_next (l)) + { + gchar *capa = l->data; + + DEBUG ("add capability: %s", capa); + /* owernship of the string is transfered to the hash table */ + g_hash_table_insert (priv->capabilities, capa, GUINT_TO_POINTER (TRUE)); + } + g_list_free (list); + return retval; } @@ -80,6 +95,10 @@ notify_manager_dispose (GObject *object) static void notify_manager_finalize (GObject *object) { + EmpathyNotifyManagerPriv *priv = GET_PRIV (object); + + g_hash_table_destroy (priv->capabilities); + G_OBJECT_CLASS (empathy_notify_manager_parent_class)->finalize (object); } @@ -102,6 +121,9 @@ empathy_notify_manager_init (EmpathyNotifyManager *self) EMPATHY_TYPE_NOTIFY_MANAGER, EmpathyNotifyManagerPriv); self->priv = priv; + + priv->capabilities = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, + NULL); } EmpathyNotifyManager * |