aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libindicate/indicator.c103
-rw-r--r--libindicate/indicator.h11
-rw-r--r--libindicate/server.c181
-rw-r--r--libindicate/server.h16
-rw-r--r--libindicate/tests/Makefile.am14
-rw-r--r--libindicate/tests/indicate-alot.c24
-rw-r--r--libindicate/tests/indicate-and-crash.c2
7 files changed, 330 insertions, 21 deletions
diff --git a/libindicate/indicator.c b/libindicate/indicator.c
index e16492d..8caf8e4 100644
--- a/libindicate/indicator.c
+++ b/libindicate/indicator.c
@@ -16,6 +16,9 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (IndicateIndicator, indicate_indicator, G_TYPE_OBJECT);
static void indicate_indicator_finalize (GObject * object);
+static void set_property (IndicateIndicator * indicator, const gchar * key, const gchar * data);
+static const gchar * get_property (IndicateIndicator * indicator, const gchar * key);
+static GPtrArray * list_properties (IndicateIndicator * indicator);
/* Functions */
@@ -51,6 +54,11 @@ indicate_indicator_class_init (IndicateIndicatorClass * class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ class->get_type = NULL;
+ class->set_property = set_property;
+ class->get_property = get_property;
+ class->list_properties = list_properties;
+
return;
}
@@ -59,10 +67,13 @@ indicate_indicator_init (IndicateIndicator * indicator)
{
g_debug("Indicator Object Initialized.");
- indicator->id = 0;
indicator->is_visible = FALSE;
+ indicator->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+
+
indicator->server = indicate_server_ref_default();
+ indicator->id = indicate_server_get_next_id(indicator->server);
indicate_server_add_indicator(indicator->server, indicator);
return;
@@ -100,6 +111,8 @@ indicate_indicator_show (IndicateIndicator * indicator)
indicator->is_visible = TRUE;
g_signal_emit(indicator, signals[SHOW], 0, TRUE);
+
+ return;
}
void
@@ -111,6 +124,8 @@ indicate_indicator_hide (IndicateIndicator * indicator)
indicator->is_visible = FALSE;
g_signal_emit(indicator, signals[HIDE], 0, TRUE);
+
+ return;
}
gboolean
@@ -139,4 +154,90 @@ indicate_indicator_get_indicator_type (IndicateIndicator * indicator)
return NULL;
}
+void
+indicate_indicator_user_display (IndicateIndicator * indicator)
+{
+ if (!indicator->is_visible) {
+ return;
+ }
+
+ g_signal_emit(indicator, signals[USER_DISPLAY], 0, TRUE);
+ return;
+}
+
+void
+indicate_indicator_set_property (IndicateIndicator * indicator, const gchar * key, const gchar * data)
+{
+ IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
+ if (class->set_property == NULL) {
+ return;
+ }
+
+ return class->set_property(indicator, key, data);
+}
+
+const gchar *
+indicate_indicator_get_property (IndicateIndicator * indicator, const gchar * key)
+{
+ IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
+ if (class->get_property == NULL) {
+ return NULL;
+ }
+
+ return class->get_property(indicator, key);
+}
+
+GPtrArray *
+indicate_indicator_list_properties (IndicateIndicator * indicator)
+{
+ IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
+ if (class->list_properties == NULL) {
+ return g_ptr_array_new();
+ }
+
+ return class->list_properties(indicator);
+}
+static void
+set_property (IndicateIndicator * indicator, const gchar * key, const gchar * data)
+{
+ g_return_if_fail(INDICATE_IS_INDICATOR(indicator));
+
+ if (key != NULL && !strcmp(key, "type")) {
+ g_warning("Trying to set the 'type' of an indicator which should be done through subclassing.");
+ return;
+ }
+
+ g_hash_table_insert(indicator->properties, g_strdup(key), g_strdup(data));
+ // TODO: Signal
+ return;
+}
+
+static const gchar *
+get_property (IndicateIndicator * indicator, const gchar * key)
+{
+ g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), NULL);
+
+ if (key != NULL && !strcmp(key, "type")) {
+ return indicate_indicator_get_indicator_type(indicator);
+ }
+
+ // TODO: Think about whether we should be strdup'ing this. Seems like overkill, but might not be.
+ return (const gchar *)g_hash_table_lookup(indicator->properties, key);
+}
+
+static GPtrArray *
+list_properties (IndicateIndicator * indicator)
+{
+ g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), g_ptr_array_new());
+
+ GList * keys = g_hash_table_get_keys(indicator->properties);
+ GPtrArray * properties = g_ptr_array_sized_new(g_list_length(keys) + 1);
+
+ g_ptr_array_add(properties, g_strdup("type"));
+ for (; keys != NULL; keys = keys->next) {
+ g_ptr_array_add(properties, g_strdup(keys->data));
+ }
+
+ return properties;
+}
diff --git a/libindicate/indicator.h b/libindicate/indicator.h
index 2a15e3b..91f08a7 100644
--- a/libindicate/indicator.h
+++ b/libindicate/indicator.h
@@ -33,6 +33,7 @@ struct _IndicateIndicator {
guint id;
gboolean is_visible;
IndicateServer * server;
+ GHashTable * properties;
};
struct _IndicateIndicatorClass {
@@ -43,6 +44,9 @@ struct _IndicateIndicatorClass {
void (*user_display) (IndicateIndicator * indicator, gpointer data);
const gchar * (*get_type) (IndicateIndicator * indicator);
+ void (*set_property) (IndicateIndicator * indicator, const gchar * key, const gchar * data);
+ const gchar * (*get_property) (IndicateIndicator * indicator, const gchar * key);
+ GPtrArray * (*list_properties) (IndicateIndicator * indicator);
};
GType indicate_indicator_get_type(void) G_GNUC_CONST;
@@ -65,6 +69,13 @@ guint indicate_indicator_get_id (IndicateIndicator * indicator);
* subclass and exported through this pretty function */
const gchar * indicate_indicator_get_indicator_type (IndicateIndicator * indicator);
+void indicate_indicator_user_display (IndicateIndicator * indicator);
+
+/* Properties handling */
+void indicate_indicator_set_property (IndicateIndicator * indicator, const gchar * key, const gchar * data);
+const gchar * indicate_indicator_get_property (IndicateIndicator * indicator, const gchar * key);
+GPtrArray * indicate_indicator_list_properties (IndicateIndicator * indicator);
+
G_END_DECLS
#endif /* INDICATE_INDICATOR_H_INCLUDED__ */
diff --git a/libindicate/server.c b/libindicate/server.c
index 48f1c71..fe32f57 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -13,6 +13,7 @@ enum {
NO_GET_INDICATOR_PROPERTY_GROUP,
NO_GET_INDICATOR_PROPERTIES,
NO_SHOW_INDICATOR_TO_USER,
+ INVALID_INDICATOR_ID,
LAST_ERROR
};
@@ -33,12 +34,13 @@ static void indicate_server_finalize (GObject * obj);
static gboolean get_desktop (IndicateServer * server, gchar ** desktop_path, GError **error);
static gboolean get_indicator_count (IndicateServer * server, guint * count, GError **error);
static gboolean get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error);
-static gboolean get_indicator_list (IndicateServer * server, guint ** indicators, GError ** error);
+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);
/* Code */
static void
@@ -84,6 +86,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;
}
@@ -96,6 +99,8 @@ indicate_server_init (IndicateServer * server)
server->path = g_strdup("/org/freedesktop/indicate");
server->indicators = NULL;
server->num_hidden = 0;
+ server->visible = FALSE;
+ server->current_id = 0;
return;
}
@@ -126,6 +131,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,10 +143,18 @@ indicate_server_show (IndicateServer * server)
dbus_g_connection_register_g_object(connection,
server->path,
G_OBJECT(server));
+ server->visible = TRUE;
return;
}
+static guint
+get_next_id (IndicateServer * server)
+{
+ server->current_id++;
+ return server->current_id;
+}
+
static void
indicator_show_cb (IndicateIndicator * indicator, IndicateServer * server)
{
@@ -223,7 +241,10 @@ indicate_server_set_default (IndicateServer * server)
static gboolean
get_desktop (IndicateServer * server, gchar ** desktop_path, GError **error)
{
-
+ if (server->path != NULL) {
+ // TODO: This might be a memory leak, check into that.
+ *desktop_path = g_strdup(server->path);
+ }
return TRUE;
}
@@ -239,16 +260,71 @@ get_indicator_count (IndicateServer * server, guint * count, GError **error)
return TRUE;
}
+typedef struct {
+ gchar * type;
+ guint count;
+} count_by_t;
+
+static void
+count_by_type (IndicateIndicator * indicator, count_by_t * cbt)
+{
+ g_return_if_fail(INDICATE_IS_INDICATOR(indicator));
+ if (!indicate_indicator_is_visible(indicator)) {
+ return;
+ }
+
+ const gchar * type = indicate_indicator_get_indicator_type(indicator);
+ /* g_debug("Looking for indicator of type '%s' and have type '%s'", cbt->type, type); */
+
+ if (type == NULL && cbt->type == NULL) {
+ cbt->count++;
+ } else if (type == NULL || cbt->type == NULL) {
+ } else if (!strcmp(type, cbt->type)) {
+ cbt->count++;
+ }
+
+ return;
+}
+
static gboolean
get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error)
{
+ /* g_debug("get_indicator_count_by_type: '%s'", type); */
+ count_by_t cbt;
+ cbt.type = type;
+ cbt.count = 0;
+
+ /* Handle the NULL string case as NULL itself, we're a big
+ boy language; we have pointers. */
+ if (cbt.type != NULL && cbt.type[0] == '\0') {
+ cbt.type = NULL;
+ }
+
+ g_slist_foreach(server->indicators, count_by_type, &cbt);
+ *count = cbt.count;
return TRUE;
}
static gboolean
-get_indicator_list (IndicateServer * server, guint ** indicators, GError ** error)
+get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error)
{
+ g_return_val_if_fail(INDICATE_IS_SERVER(server), TRUE);
+
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+ g_return_val_if_fail(class->get_indicator_count != NULL, TRUE);
+
+ *indicators = g_array_sized_new(FALSE, FALSE, sizeof(guint), g_slist_length(server->indicators) - server->num_hidden);
+
+ GSList * iter;
+ int i;
+ for (iter = server->indicators, i = 0; iter != NULL; iter = iter->next, i++) {
+ IndicateIndicator * indicator = INDICATE_INDICATOR(iter->data);
+ if (indicate_indicator_is_visible(indicator)) {
+ guint id = indicate_indicator_get_id(indicator);
+ g_array_insert_val(*indicators, i, id);
+ }
+ }
return TRUE;
}
@@ -256,35 +332,95 @@ get_indicator_list (IndicateServer * server, guint ** indicators, GError ** erro
static gboolean
get_indicator_list_by_type (IndicateServer * server, gchar * type, guint ** indicators, GError ** error)
{
+ g_return_val_if_fail(INDICATE_IS_SERVER(server), TRUE);
+
+ IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
+ g_return_val_if_fail(class->get_indicator_count != NULL, TRUE);
+
+ if (type != NULL && type[0] == '\0') {
+ type = NULL;
+ }
+
+ /* Can't be larger than this and it's not worth the reallocation
+ for the small number we have. The memory isn't worth the time. */
+ *indicators = g_array_sized_new(FALSE, FALSE, sizeof(guint), g_slist_length(server->indicators) - server->num_hidden);
+
+ GSList * iter;
+ int i;
+ for (iter = server->indicators, i = 0; iter != NULL; iter = iter->next) {
+ IndicateIndicator * indicator = INDICATE_INDICATOR(iter->data);
+ if (indicate_indicator_is_visible(indicator)) {
+ const gchar * itype = indicate_indicator_get_indicator_type(indicator);
+ guint id = indicate_indicator_get_id(indicator);
+
+ if (type == NULL && itype == NULL) {
+ g_array_insert_val(*indicators, i++, id);
+ } else if (type == NULL || itype == NULL) {
+ } else if (!strcmp(type, itype)) {
+ g_array_insert_val(*indicators, i++, id);
+ }
+ }
+ }
return TRUE;
}
+static IndicateIndicator *
+get_indicator (IndicateServer * server, guint id, GError **error)
+{
+ g_return_val_if_fail(INDICATE_IS_SERVER(server), TRUE);
+
+ GSList * iter;
+ for (iter = server->indicators; iter != NULL; iter = iter->next) {
+ IndicateIndicator * indicator = INDICATE_INDICATOR(iter->data);
+ if (indicate_indicator_get_id(indicator) == id) {
+ return indicator;
+ }
+ }
+
+ if (error) {
+ g_set_error(error,
+ indicate_server_error_quark(),
+ INVALID_INDICATOR_ID,
+ "Invalid Indicator ID: %d",
+ id);
+ }
+ return NULL;
+}
+
static gboolean
get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error)
{
+ IndicateIndicator * indicator = get_indicator(server, id, error);
+ if (indicator == NULL) {
+ return FALSE;
+ }
+ *value = indicate_indicator_get_property(indicator, property);
return TRUE;
}
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)
{
- return TRUE;
}
static gboolean
-get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error)
+get_indicator_properties (IndicateServer * server, guint id, GPtrArray ** properties, GError **error)
{
- return TRUE;
}
static gboolean
show_indicator_to_user (IndicateServer * server, guint id, GError ** error)
{
+ IndicateIndicator * indicator = get_indicator(server, id, error);
+ if (indicator == NULL) {
+ return FALSE;
+ }
+ indicate_indicator_user_display(indicator);
return TRUE;
}
@@ -305,6 +441,7 @@ indicate_server_get_desktop (IndicateServer * server, gchar ** desktop_path, GEr
NO_GET_DESKTOP,
"get_desktop function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
return TRUE;
@@ -325,6 +462,7 @@ indicate_server_get_indicator_count (IndicateServer * server, guint * count, GEr
NO_GET_INDICATOR_COUNT,
"get_indicator_count function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
return TRUE;
@@ -345,13 +483,14 @@ indicate_server_get_indicator_count_by_type (IndicateServer * server, gchar * ty
NO_GET_INDICATOR_COUNT_BY_TYPE,
"get_indicator_count_by_type function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
return TRUE;
}
gboolean
-indicate_server_get_indicator_list (IndicateServer * server, guint ** indicators, GError ** error)
+indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error)
{
IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
@@ -365,6 +504,7 @@ indicate_server_get_indicator_list (IndicateServer * server, guint ** indicators
NO_GET_INDICATOR_LIST,
"get_indicator_list function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
return TRUE;
@@ -385,6 +525,7 @@ indicate_server_get_indicator_list_by_type (IndicateServer * server, gchar * typ
NO_GET_INDICATOR_LIST_BY_TYPE,
"get_indicator_list_by_type function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
return TRUE;
@@ -405,13 +546,14 @@ indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar
NO_GET_INDICATOR_PROPERTY,
"get_indicator_property function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
return TRUE;
}
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);
@@ -425,13 +567,14 @@ indicate_server_get_indicator_property_group (IndicateServer * server, guint id,
NO_GET_INDICATOR_PROPERTY_GROUP,
"get_indicator_property_group function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
return TRUE;
}
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);
@@ -445,6 +588,7 @@ indicate_server_get_indicator_properties (IndicateServer * server, guint id, gch
NO_GET_INDICATOR_PROPERTIES,
"get_indicator_properties function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
return TRUE;
@@ -465,8 +609,21 @@ indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GErro
NO_SHOW_INDICATOR_TO_USER,
"show_indicator_to_user function doesn't exist for this server class: %s",
G_OBJECT_TYPE_NAME(server));
+ return FALSE;
}
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 ef00846..75a1ffb 100644
--- a/libindicate/server.h
+++ b/libindicate/server.h
@@ -24,6 +24,8 @@ 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;
@@ -42,12 +44,13 @@ 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);
- 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);
};
GType indicate_server_get_type (void) G_GNUC_CONST;
@@ -69,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);
@@ -79,11 +83,11 @@ 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);
-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
diff --git a/libindicate/tests/Makefile.am b/libindicate/tests/Makefile.am
index 1fe4856..814a50b 100644
--- a/libindicate/tests/Makefile.am
+++ b/libindicate/tests/Makefile.am
@@ -1,6 +1,7 @@
noinst_PROGRAMS = \
- indicate-and-crash
+ indicate-and-crash \
+ indicate-alot
indicate_and_crash_SOURCES = \
indicate-and-crash.c
@@ -12,3 +13,14 @@ indicate_and_crash_CFLAGS = \
indicate_and_crash_LDADD = \
../libindicate.la \
$(LIBINDICATE_LIBS)
+
+indicate_alot_SOURCES = \
+ indicate-alot.c
+
+indicate_alot_CFLAGS = \
+ -I $(srcdir)/../.. \
+ $(LIBINDICATE_CFLAGS)
+
+indicate_alot_LDADD = \
+ ../libindicate.la \
+ $(LIBINDICATE_LIBS)
diff --git a/libindicate/tests/indicate-alot.c b/libindicate/tests/indicate-alot.c
new file mode 100644
index 0000000..bebf726
--- /dev/null
+++ b/libindicate/tests/indicate-alot.c
@@ -0,0 +1,24 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+
+#define ALOT 30
+
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ IndicateIndicator * indicators[ALOT];
+ int i;
+
+ for (i = 0; i < ALOT; i++) {
+ indicators[i] = indicate_indicator_new();
+ indicate_indicator_show(indicators[i]);
+ }
+
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+
+ return 0;
+}
diff --git a/libindicate/tests/indicate-and-crash.c b/libindicate/tests/indicate-and-crash.c
index 3cf4428..44be76e 100644
--- a/libindicate/tests/indicate-and-crash.c
+++ b/libindicate/tests/indicate-and-crash.c
@@ -12,7 +12,7 @@ main (int argc, char ** argv)
IndicateIndicator * indicator = indicate_indicator_new();
indicate_indicator_show(indicator);
- //g_timeout_add_seconds(15, crashfunc, NULL);
+ g_timeout_add_seconds(15, crashfunc, NULL);
g_main_loop_run(g_main_loop_new(NULL, FALSE));