aboutsummaryrefslogtreecommitdiff
path: root/libindicate
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-01-09 16:32:09 -0600
committerTed Gould <ted@canonical.com>2009-01-09 16:32:09 -0600
commit791b5f802bf0d0ffb72d39c85da512332c889453 (patch)
tree674915dc1d59d5777a19ea06d1e0ca6b48c26603 /libindicate
parent57b3f5814a7059fb382b377610b58703af6359b0 (diff)
downloadlibayatana-indicator-791b5f802bf0d0ffb72d39c85da512332c889453.tar.gz
libayatana-indicator-791b5f802bf0d0ffb72d39c85da512332c889453.tar.bz2
libayatana-indicator-791b5f802bf0d0ffb72d39c85da512332c889453.zip
Connecting indicators and servers. They create themselves easily.
Diffstat (limited to 'libindicate')
-rw-r--r--libindicate/indicator.c16
-rw-r--r--libindicate/indicator.h6
-rw-r--r--libindicate/server.h5
3 files changed, 22 insertions, 5 deletions
diff --git a/libindicate/indicator.c b/libindicate/indicator.c
index 74eefbf..2db8468 100644
--- a/libindicate/indicator.c
+++ b/libindicate/indicator.c
@@ -40,7 +40,8 @@ indicate_indicator_init (IndicateIndicator * indicator)
{
indicator->id = 0;
- /* TODO: Need to connect to a server here */
+ indicator->server = indicate_server_ref_default();
+ indicate_server_add_indicator(indicator->server, indicator);
return;
}
@@ -48,8 +49,19 @@ indicate_indicator_init (IndicateIndicator * indicator)
static void
indicate_indicator_finalize (GObject * obj)
{
- /* TODO: Need to disconnect from server here */
+ IndicateIndicator * indicator = INDICATE_INDICATOR(obj);
+
+ indicate_server_remove_indicator(indicator->server, indicator);
+ g_object_unref(indicator->server);
+ indicator->server = NULL;
return;
}
+IndicateIndicator *
+indicate_indicator_new (void)
+{
+ IndicateIndicator * indicator = g_object_new(INDICATE_TYPE_INDICATOR, NULL);
+ return indicator;
+}
+
diff --git a/libindicate/indicator.h b/libindicate/indicator.h
index e427f25..77fd82f 100644
--- a/libindicate/indicator.h
+++ b/libindicate/indicator.h
@@ -19,13 +19,17 @@
#define INDICATE_INDICATOR_SIGNAL_DISPLAY "user-display"
typedef struct _IndicateIndicator IndicateIndicator;
+typedef struct _IndicateIndicatorClass IndicateIndicatorClass;
+
+#include "server.h"
+
struct _IndicateIndicator {
GObject parent;
guint id;
+ IndicateServer * server;
};
-typedef struct _IndicateIndicatorClass IndicateIndicatorClass;
struct _IndicateIndicatorClass {
GObjectClass parent_class;
diff --git a/libindicate/server.h b/libindicate/server.h
index 159bcd7..ba766cb 100644
--- a/libindicate/server.h
+++ b/libindicate/server.h
@@ -5,8 +5,6 @@
#include <glib.h>
#include <glib-object.h>
-#include "indicator.h"
-
/* Boilerplate */
#define INDICATE_TYPE_SERVER (indicate_server_get_type ())
#define INDICATE_SERVER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), INDICATE_TYPE_SERVER, IndicateServer))
@@ -16,6 +14,9 @@
#define INDICATE_SERVER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), INDICATE_TYPE_SERVER, IndicateServerClass))
typedef struct _IndicateServer IndicateServer;
+
+#include "indicator.h"
+
struct _IndicateServer {
GObject parent;