diff options
author | Robert Carr <racarr@ender> | 2009-01-13 06:32:44 -0500 |
---|---|---|
committer | Robert Carr <racarr@ender> | 2009-01-13 06:32:44 -0500 |
commit | 544dec8a4c8c8689530bf5eefcc81500812ad73a (patch) | |
tree | 768b905cd41c4818f9d7965d70122d9cb42c8216 /libindicate/indicator.c | |
parent | 35c50459f5f93afcb6fbb3a5a6c158b7f15656eb (diff) | |
parent | cd4f548dd5427b48706b29c17a8ea67d6360afd8 (diff) | |
download | libayatana-indicator-544dec8a4c8c8689530bf5eefcc81500812ad73a.tar.gz libayatana-indicator-544dec8a4c8c8689530bf5eefcc81500812ad73a.tar.bz2 libayatana-indicator-544dec8a4c8c8689530bf5eefcc81500812ad73a.zip |
Merge Ted's changes. I should have used bzr bind.
Diffstat (limited to 'libindicate/indicator.c')
-rw-r--r-- | libindicate/indicator.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/libindicate/indicator.c b/libindicate/indicator.c index 2db8468..e16492d 100644 --- a/libindicate/indicator.c +++ b/libindicate/indicator.c @@ -1,9 +1,12 @@ #include "glib.h" +#include "glib/gmessages.h" #include "indicator.h" /* Signals */ enum { + HIDE, + SHOW, USER_DISPLAY, LAST_SIGNAL }; @@ -19,6 +22,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); @@ -31,6 +36,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; } @@ -38,7 +57,10 @@ indicate_indicator_class_init (IndicateIndicatorClass * class) static void indicate_indicator_init (IndicateIndicator * indicator) { + g_debug("Indicator Object Initialized."); + indicator->id = 0; + indicator->is_visible = FALSE; indicator->server = indicate_server_ref_default(); indicate_server_add_indicator(indicator->server, indicator); @@ -65,3 +87,56 @@ indicate_indicator_new (void) return indicator; } +void +indicate_indicator_show (IndicateIndicator * indicator) +{ + if (indicator->is_visible) { + return; + } + + if (indicator->server) { + indicate_server_show(indicator->server); + } + + indicator->is_visible = TRUE; + g_signal_emit(indicator, signals[SHOW], 0, TRUE); +} + +void +indicate_indicator_hide (IndicateIndicator * indicator) +{ + if (!indicator->is_visible) { + return; + } + + indicator->is_visible = FALSE; + g_signal_emit(indicator, signals[HIDE], 0, TRUE); +} + +gboolean +indicate_indicator_is_visible (IndicateIndicator * indicator) +{ + return indicator->is_visible; +} + +guint +indicate_indicator_get_id (IndicateIndicator * indicator) +{ + g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), 0); + return indicator->id; +} + +const gchar * +indicate_indicator_get_indicator_type (IndicateIndicator * indicator) +{ + g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), NULL); + IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator); + + if (class->get_type != NULL) { + return INDICATE_INDICATOR_GET_CLASS(indicator)->get_type(indicator); + } + + return NULL; +} + + |