aboutsummaryrefslogtreecommitdiff
path: root/libindicate/indicator.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-08-06 14:57:57 +0100
committerTed Gould <ted@canonical.com>2009-08-06 14:57:57 +0100
commitd7f91b92ddb7484642a7dd42ef6dca1cf3d44b74 (patch)
treea28c00b9e1f44860f12243e1348be8cdb16ee6b7 /libindicate/indicator.c
parenta3e59c2205cb3aee151df1e3cb1947fb8699a1e4 (diff)
parent937dba5dd4878bc1f78cf76d6d24c19b69c800df (diff)
downloadlibayatana-indicator-d7f91b92ddb7484642a7dd42ef6dca1cf3d44b74.tar.gz
libayatana-indicator-d7f91b92ddb7484642a7dd42ef6dca1cf3d44b74.tar.bz2
libayatana-indicator-d7f91b92ddb7484642a7dd42ef6dca1cf3d44b74.zip
Aurelien's patch to add a set_server function to indicators.
Diffstat (limited to 'libindicate/indicator.c')
-rw-r--r--libindicate/indicator.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/libindicate/indicator.c b/libindicate/indicator.c
index cb257eb..18cdc4a 100644
--- a/libindicate/indicator.c
+++ b/libindicate/indicator.c
@@ -220,16 +220,39 @@ indicate_indicator_new_with_server (IndicateServer * server)
IndicateIndicator * indicator = g_object_new(INDICATE_TYPE_INDICATOR, NULL);
+ indicate_indicator_set_server (indicator, server);
+
+ return indicator;
+}
+
+/**
+ indicate_indicator_set_server:
+ @indicator: a #IndicateIndicator to act on
+ @server: the #IndicateServer which should be associated with @indicator
+
+ Defines which server this indicator must be associated to. Also, adds a
+ reference to the server.
+*/
+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);
+ if (server != NULL) {
+ indicate_server_add_indicator (server, indicator);
+ }
- return indicator;
+ return;
}