From b687b3aefb3b7a231d18dea06ca511b990049487 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jan 2009 16:07:22 -0600 Subject: Changing to showing the inicator and make it so that we dont' crash right now. --- libindicate/tests/indicate-and-crash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libindicate/tests') diff --git a/libindicate/tests/indicate-and-crash.c b/libindicate/tests/indicate-and-crash.c index 1886a24..fbc32b0 100644 --- a/libindicate/tests/indicate-and-crash.c +++ b/libindicate/tests/indicate-and-crash.c @@ -10,9 +10,9 @@ main (int argc, char ** argv) g_type_init(); IndicateIndicator * indicator = indicate_indicator_new(); - indicate_server_show(indicator->server); + indicator_show(indicator->server); - g_timeout_add_seconds(15, crashfunc, NULL); + //g_timeout_add_seconds(15, crashfunc, NULL); g_main_loop_run(g_main_loop_new(NULL, FALSE)); -- cgit v1.2.3 From 3d55f9063f2ee1a1a472f5a7b0b4bfa4a798b1f9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jan 2009 16:17:25 -0600 Subject: Basic show hide support in the indicator --- libindicate/indicator.c | 22 +++++++++++++++++++--- libindicate/indicator.h | 2 ++ libindicate/tests/indicate-and-crash.c | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'libindicate/tests') diff --git a/libindicate/indicator.c b/libindicate/indicator.c index 3e168c9..43eac55 100644 --- a/libindicate/indicator.c +++ b/libindicate/indicator.c @@ -33,6 +33,20 @@ indicate_indicator_class_init (IndicateIndicatorClass * class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + signals[HIDE] = g_signal_new(INDICATE_INDICATOR_SIGNAL_HIDE, + G_TYPE_FROM_CLASS(class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(IndicateIndicatorClass, hide), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + signals[SHOW] = g_signal_new(INDICATE_INDICATOR_SIGNAL_SHOW, + G_TYPE_FROM_CLASS(class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(IndicateIndicatorClass, show), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); return; } @@ -70,14 +84,16 @@ indicate_indicator_new (void) void indicate_indicator_show (IndicateIndicator * indicator) { + if (indicator->server) { + indicate_server_show(indicator->server); + } - + g_signal_emit(indicator, signals[SHOW], NULL, G_TYPE_NONE); } void indicate_indicator_hide (IndicateIndicator * indicator) { - - + g_signal_emit(indicator, signals[HIDE], NULL, G_TYPE_NONE); } diff --git a/libindicate/indicator.h b/libindicate/indicator.h index 976e4b6..cfa93aa 100644 --- a/libindicate/indicator.h +++ b/libindicate/indicator.h @@ -16,6 +16,8 @@ /* This is a signal that signals to the indicator that the user * has done an action where they'd like this indicator to be * displayed. */ +#define INDICATE_INDICATOR_SIGNAL_HIDE "hide" +#define INDICATE_INDICATOR_SIGNAL_SHOW "show" #define INDICATE_INDICATOR_SIGNAL_DISPLAY "user-display" typedef struct _IndicateIndicator IndicateIndicator; diff --git a/libindicate/tests/indicate-and-crash.c b/libindicate/tests/indicate-and-crash.c index fbc32b0..3cf3968 100644 --- a/libindicate/tests/indicate-and-crash.c +++ b/libindicate/tests/indicate-and-crash.c @@ -10,7 +10,7 @@ main (int argc, char ** argv) g_type_init(); IndicateIndicator * indicator = indicate_indicator_new(); - indicator_show(indicator->server); + indicate_indicator_show(indicator->server); //g_timeout_add_seconds(15, crashfunc, NULL); -- cgit v1.2.3 From 2dc2f266359d30841fa2970dba0265cb22556b89 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jan 2009 16:38:46 -0600 Subject: Clean up the signal handlers and fixing the call in the test function. Now we're to the point of showing the way I think things should be. --- libindicate/indicator.c | 8 ++++++-- libindicate/server.c | 3 +++ libindicate/tests/indicate-and-crash.c | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'libindicate/tests') diff --git a/libindicate/indicator.c b/libindicate/indicator.c index 43eac55..a319af2 100644 --- a/libindicate/indicator.c +++ b/libindicate/indicator.c @@ -21,6 +21,8 @@ static void indicate_indicator_finalize (GObject * object); static void indicate_indicator_class_init (IndicateIndicatorClass * class) { + g_debug("Indicator Class Initialized."); + GObjectClass * gobj; gobj = G_OBJECT_CLASS(class); @@ -54,6 +56,8 @@ indicate_indicator_class_init (IndicateIndicatorClass * class) static void indicate_indicator_init (IndicateIndicator * indicator) { + g_debug("Indicator Object Initialized."); + indicator->id = 0; indicator->server = indicate_server_ref_default(); @@ -88,12 +92,12 @@ indicate_indicator_show (IndicateIndicator * indicator) indicate_server_show(indicator->server); } - g_signal_emit(indicator, signals[SHOW], NULL, G_TYPE_NONE); + g_signal_emit(indicator, signals[SHOW], 0, TRUE); } void indicate_indicator_hide (IndicateIndicator * indicator) { - g_signal_emit(indicator, signals[HIDE], NULL, G_TYPE_NONE); + g_signal_emit(indicator, signals[HIDE], 0, TRUE); } diff --git a/libindicate/server.c b/libindicate/server.c index dd4513a..95c0a2c 100644 --- a/libindicate/server.c +++ b/libindicate/server.c @@ -44,6 +44,7 @@ static gboolean show_indicator_to_user (IndicateServer * server, guint id, GErro static void indicate_server_class_init (IndicateServerClass * class) { + g_debug("Server Class Initialized"); GObjectClass * gobj; gobj = G_OBJECT_CLASS(class); @@ -90,6 +91,8 @@ indicate_server_class_init (IndicateServerClass * class) static void indicate_server_init (IndicateServer * server) { + g_debug("Server Object Initialized"); + server->path = g_strdup("/org/freedesktop/indicate"); server->indicators = NULL; diff --git a/libindicate/tests/indicate-and-crash.c b/libindicate/tests/indicate-and-crash.c index 3cf3968..3cf4428 100644 --- a/libindicate/tests/indicate-and-crash.c +++ b/libindicate/tests/indicate-and-crash.c @@ -10,7 +10,7 @@ main (int argc, char ** argv) g_type_init(); IndicateIndicator * indicator = indicate_indicator_new(); - indicate_indicator_show(indicator->server); + indicate_indicator_show(indicator); //g_timeout_add_seconds(15, crashfunc, NULL); -- cgit v1.2.3