From 55256284a380043320b61b0f5f38741b083e94ab Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jan 2009 23:14:09 -0600 Subject: Fleshing out more functions, we can now return a list of ids. Need to test with more. --- libindicate/server.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libindicate/server.h') diff --git a/libindicate/server.h b/libindicate/server.h index 486252c..8a61293 100644 --- a/libindicate/server.h +++ b/libindicate/server.h @@ -40,7 +40,7 @@ struct _IndicateServerClass { gboolean (*get_desktop) (IndicateServer * server, gchar ** desktop_path, GError **error); gboolean (*get_indicator_count) (IndicateServer * server, guint * count, GError **error); gboolean (*get_indicator_count_by_type) (IndicateServer * server, gchar * type, guint * count, GError **error); - gboolean (*get_indicator_list) (IndicateServer * server, guint ** indicators, GError ** error); + gboolean (*get_indicator_list) (IndicateServer * server, GArray ** indicators, GError ** error); gboolean (*get_indicator_list_by_type) (IndicateServer * server, gchar * type, guint ** indicators, GError ** error); gboolean (*get_indicator_property) (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); gboolean (*get_indicator_property_group) (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error); @@ -75,7 +75,7 @@ void indicate_server_set_default (IndicateServer * server); gboolean indicate_server_get_desktop (IndicateServer * server, gchar ** desktop_path, GError **error); gboolean indicate_server_get_indicator_count (IndicateServer * server, guint * count, GError **error); gboolean indicate_server_get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error); -gboolean indicate_server_get_indicator_list (IndicateServer * server, guint ** indicators, GError ** error); +gboolean indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error); gboolean indicate_server_get_indicator_list_by_type (IndicateServer * server, gchar * type, guint ** indicators, GError ** error); gboolean indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); gboolean indicate_server_get_indicator_property_group (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error); -- cgit v1.2.3 From 0b4e54d7e08c652fd0468b307f0fe6eeb987a149 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 13 Jan 2009 13:43:32 -0600 Subject: Ah, we weren't checking if we were visible. Now things are better. --- libindicate/server.c | 7 +++++++ libindicate/server.h | 1 + 2 files changed, 8 insertions(+) (limited to 'libindicate/server.h') diff --git a/libindicate/server.c b/libindicate/server.c index f79c78e..8878f69 100644 --- a/libindicate/server.c +++ b/libindicate/server.c @@ -96,6 +96,7 @@ indicate_server_init (IndicateServer * server) server->path = g_strdup("/org/freedesktop/indicate"); server->indicators = NULL; server->num_hidden = 0; + server->visible = FALSE; return; } @@ -126,6 +127,11 @@ indicate_server_error_quark (void) void indicate_server_show (IndicateServer * server) { + g_return_if_fail(INDICATE_IS_SERVER(server)); + + if (server->visible) + return; + DBusGConnection * connection; connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); @@ -133,6 +139,7 @@ indicate_server_show (IndicateServer * server) dbus_g_connection_register_g_object(connection, server->path, G_OBJECT(server)); + server->visible = TRUE; return; } diff --git a/libindicate/server.h b/libindicate/server.h index e119cfd..3844b03 100644 --- a/libindicate/server.h +++ b/libindicate/server.h @@ -24,6 +24,7 @@ struct _IndicateServer { gchar * path; GSList * indicators; + gboolean visible; // TODO: Should have a more robust way to track this, but this'll work for now guint num_hidden; -- cgit v1.2.3 From 82dee9414fc6ae41006f1664c1be0636a15ca4dd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 13 Jan 2009 14:18:47 -0600 Subject: Making it so that the indicators all have unique IDs --- libindicate/indicator.c | 3 +-- libindicate/server.c | 22 ++++++++++++++++++++++ libindicate/server.h | 3 +++ 3 files changed, 26 insertions(+), 2 deletions(-) (limited to 'libindicate/server.h') 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); -- cgit v1.2.3 From c14592279f3feaad53e397155ecc515e5623d940 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 14 Jan 2009 10:11:17 -0600 Subject: Chaning the property list parameters to be pointer arrays. --- libindicate/server.c | 12 ++++++------ libindicate/server.h | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'libindicate/server.h') diff --git a/libindicate/server.c b/libindicate/server.c index 41b8d56..fe32f57 100644 --- a/libindicate/server.c +++ b/libindicate/server.c @@ -37,8 +37,8 @@ static gboolean get_indicator_count_by_type (IndicateServer * server, gchar * ty static gboolean get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error); static gboolean get_indicator_list_by_type (IndicateServer * server, gchar * type, guint ** indicators, GError ** error); static gboolean get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); -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 get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, GPtrArray ** value, GError **error); +static gboolean get_indicator_properties (IndicateServer * server, guint id, GPtrArray ** properties, GError **error); static gboolean show_indicator_to_user (IndicateServer * server, guint id, GError ** error); static guint get_next_id (IndicateServer * server); @@ -401,13 +401,13 @@ get_indicator_property (IndicateServer * server, guint id, gchar * property, gch } static gboolean -get_indicator_property_group (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error) +get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, GPtrArray ** value, GError **error) { } static gboolean -get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error) +get_indicator_properties (IndicateServer * server, guint id, GPtrArray ** properties, GError **error) { } @@ -553,7 +553,7 @@ indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar } gboolean -indicate_server_get_indicator_property_group (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error) +indicate_server_get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, GPtrArray ** value, GError **error) { IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); @@ -574,7 +574,7 @@ indicate_server_get_indicator_property_group (IndicateServer * server, guint id, } gboolean -indicate_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error) +indicate_server_get_indicator_properties (IndicateServer * server, guint id, GPtrArray ** properties, GError **error) { IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); diff --git a/libindicate/server.h b/libindicate/server.h index 4eb45cb..75a1ffb 100644 --- a/libindicate/server.h +++ b/libindicate/server.h @@ -47,8 +47,8 @@ struct _IndicateServerClass { gboolean (*get_indicator_list) (IndicateServer * server, GArray ** indicators, GError ** error); gboolean (*get_indicator_list_by_type) (IndicateServer * server, gchar * type, guint ** indicators, GError ** error); gboolean (*get_indicator_property) (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); - 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 (*get_indicator_property_group) (IndicateServer * server, guint id, GPtrArray * properties, GPtrArray ** value, GError **error); + gboolean (*get_indicator_properties) (IndicateServer * server, guint id, GPtrArray ** properties, GError **error); gboolean (*show_indicator_to_user) (IndicateServer * server, guint id, GError ** error); guint (*get_next_id) (IndicateServer * server); }; @@ -86,8 +86,8 @@ gboolean indicate_server_get_indicator_count_by_type (IndicateServer * server, g gboolean indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error); gboolean indicate_server_get_indicator_list_by_type (IndicateServer * server, gchar * type, guint ** indicators, GError ** error); gboolean indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); -gboolean indicate_server_get_indicator_property_group (IndicateServer * server, guint id, gchar ** properties, gchar *** value, GError **error); -gboolean indicate_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error); +gboolean indicate_server_get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, GPtrArray ** value, GError **error); +gboolean indicate_server_get_indicator_properties (IndicateServer * server, guint id, GPtrArray ** properties, GError **error); gboolean indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GError ** error); G_END_DECLS -- cgit v1.2.3