diff options
author | Aurelien Gateau <aurelien.gateau@canonical.com> | 2009-08-05 15:51:59 +0200 |
---|---|---|
committer | Aurelien Gateau <aurelien.gateau@canonical.com> | 2009-08-05 15:51:59 +0200 |
commit | c4bd83aaf7c881fbaa1ae2502814ab14e2a66c8b (patch) | |
tree | e272c9fbcf54fcbf6105368f0198f1a4a97f32fe /libindicate | |
parent | e4ac1dcf9a7372aa506d0acc773ae6b772ce976c (diff) | |
download | libayatana-indicator-c4bd83aaf7c881fbaa1ae2502814ab14e2a66c8b.tar.gz libayatana-indicator-c4bd83aaf7c881fbaa1ae2502814ab14e2a66c8b.tar.bz2 libayatana-indicator-c4bd83aaf7c881fbaa1ae2502814ab14e2a66c8b.zip |
Introduce indicate_indicator_set_server() so that server can be defined for
message indicators too.
Diffstat (limited to 'libindicate')
-rw-r--r-- | libindicate/indicator.c | 21 | ||||
-rw-r--r-- | libindicate/indicator.h | 3 |
2 files changed, 20 insertions, 4 deletions
diff --git a/libindicate/indicator.c b/libindicate/indicator.c index cb257eb..a526ce7 100644 --- a/libindicate/indicator.c +++ b/libindicate/indicator.c @@ -220,16 +220,29 @@ indicate_indicator_new_with_server (IndicateServer * server) IndicateIndicator * indicator = g_object_new(INDICATE_TYPE_INDICATOR, NULL); + indicate_indicator_set_server (indicator, server); + + return indicator; +} + +void +indicate_indicator_set_server (IndicateIndicator * indicator, IndicateServer * server) +{ IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); + + if (server != NULL) { + g_object_ref(server); + } + if (priv->server != NULL) { + indicate_server_remove_indicator (priv->server, indicator); g_object_unref(priv->server); - priv->server = NULL; } priv->server = server; - g_object_ref(priv->server); - - return indicator; + if (server != NULL) { + indicate_server_add_indicator (server, indicator); + } } diff --git a/libindicate/indicator.h b/libindicate/indicator.h index 20b998d..b2e33c0 100644 --- a/libindicate/indicator.h +++ b/libindicate/indicator.h @@ -119,6 +119,9 @@ void indicate_indicator_hide (IndicateIndicator * indicator); gboolean indicate_indicator_is_visible (IndicateIndicator * indicator); +/* Define this indicator server */ +void indicate_indicator_set_server (IndicateIndicator * indicator, IndicateServer * server); + /* Every entry has an ID, here's how to get it */ guint indicate_indicator_get_id (IndicateIndicator * indicator); |