aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libindicate/indicator.c3
-rw-r--r--libindicate/server.c22
-rw-r--r--libindicate/server.h3
3 files changed, 26 insertions, 2 deletions
diff --git a/libindicate/indicator.c b/libindicate/indicator.c
index e16492d..8121ceb 100644
--- a/libindicate/indicator.c
+++ b/libindicate/indicator.c
@@ -59,10 +59,9 @@ indicate_indicator_init (IndicateIndicator * indicator)
{
g_debug("Indicator Object Initialized.");
- indicator->id = 0;
indicator->is_visible = FALSE;
-
indicator->server = indicate_server_ref_default();
+ indicator->id = indicate_server_get_next_id(indicator->server);
indicate_server_add_indicator(indicator->server, indicator);
return;
diff --git a/libindicate/server.c b/libindicate/server.c
index 8878f69..8c0f956 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -39,6 +39,7 @@ static gboolean get_indicator_property (IndicateServer * server, guint id, gchar
static gboolean get_indicator_property_group (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error);
static gboolean get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error);
static gboolean show_indicator_to_user (IndicateServer * server, guint id, GError ** error);
+static guint get_next_id (IndicateServer * server);
/* Code */
static void
@@ -84,6 +85,7 @@ indicate_server_class_init (IndicateServerClass * class)
class->get_indicator_property_group = get_indicator_property_group;
class->get_indicator_properties = get_indicator_properties;
class->show_indicator_to_user = show_indicator_to_user;
+ class->get_next_id = get_next_id;
return;
}
@@ -97,6 +99,7 @@ indicate_server_init (IndicateServer * server)
server->indicators = NULL;
server->num_hidden = 0;
server->visible = FALSE;
+ server->current_id = 0;
return;
}
@@ -144,6 +147,13 @@ indicate_server_show (IndicateServer * server)
return;
}
+static guint
+get_next_id (IndicateServer * server)
+{
+ server->current_id++;
+ return server->current_id;
+}
+
static void
indicator_show_cb (IndicateIndicator * indicator, IndicateServer * server)
{
@@ -542,3 +552,15 @@ indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GErro
return TRUE;
}
+guint
+indicate_server_get_next_id (IndicateServer * server)
+{
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+
+ if (class != NULL) {
+ return class->get_next_id (server);
+ }
+
+ return 0;
+}
+
diff --git a/libindicate/server.h b/libindicate/server.h
index 3844b03..4eb45cb 100644
--- a/libindicate/server.h
+++ b/libindicate/server.h
@@ -25,6 +25,7 @@ struct _IndicateServer {
gchar * path;
GSList * indicators;
gboolean visible;
+ guint current_id;
// TODO: Should have a more robust way to track this, but this'll work for now
guint num_hidden;
@@ -49,6 +50,7 @@ struct _IndicateServerClass {
gboolean (*get_indicator_property_group) (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error);
gboolean (*get_indicator_properties) (IndicateServer * server, guint id, gchar *** properties, GError **error);
gboolean (*show_indicator_to_user) (IndicateServer * server, guint id, GError ** error);
+ guint (*get_next_id) (IndicateServer * server);
};
GType indicate_server_get_type (void) G_GNUC_CONST;
@@ -70,6 +72,7 @@ void indicate_server_set_desktop_file (const gchar * path);
void indicate_server_show (IndicateServer * server);
void indicate_server_hide (IndicateServer * server);
+guint indicate_server_get_next_id (IndicateServer * server);
void indicate_server_add_indicator (IndicateServer * server, IndicateIndicator * indicator);
void indicate_server_remove_indicator (IndicateServer * server, IndicateIndicator * indicator);