aboutsummaryrefslogtreecommitdiff
path: root/src/status-provider.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-06-11 14:26:04 -0500
committerTed Gould <ted@canonical.com>2009-06-11 14:26:04 -0500
commit3567cdb657ebf873fc36ab3449ff4cc3e98bd43d (patch)
tree935deea763c29444fcfe93df2c05cfccebb732ff /src/status-provider.c
parentf9aa333e5737ae0fcab56d9f4c5c9ed463011e9f (diff)
downloadayatana-indicator-session-3567cdb657ebf873fc36ab3449ff4cc3e98bd43d.tar.gz
ayatana-indicator-session-3567cdb657ebf873fc36ab3449ff4cc3e98bd43d.tar.bz2
ayatana-indicator-session-3567cdb657ebf873fc36ab3449ff4cc3e98bd43d.zip
Adding in a good ol' signal handler and even emits this puppy. Whew.
Diffstat (limited to 'src/status-provider.c')
-rw-r--r--src/status-provider.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/status-provider.c b/src/status-provider.c
index 613019b..cc9eb32 100644
--- a/src/status-provider.c
+++ b/src/status-provider.c
@@ -4,6 +4,15 @@
#include "status-provider.h"
+/* Signals */
+enum {
+ STATUS_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+/* GObject Boilerplate */
static void status_provider_class_init (StatusProviderClass *klass);
static void status_provider_init (StatusProvider *self);
@@ -19,6 +28,22 @@ status_provider_class_init (StatusProviderClass *klass)
klass->set_status = NULL;
klass->get_status = NULL;
+ /**
+ StatusProvider::status-changed:
+ @arg0: The #StatusProvider object.
+ @arg1: The new status #StatusProviderStatus
+
+ Should be emitted by subclasses everytime that the status
+ changes externally to us.
+ */
+ signals[STATUS_CHANGED] = g_signal_new(STATUS_PROVIDER_SIGNAL_STATUS_CHANGED,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(StatusProviderClass, status_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE, 1, G_TYPE_UINT);
+
return;
}
@@ -54,6 +79,7 @@ status_provider_get_status (StatusProvider * sp)
void
status_provider_emit_status_changed (StatusProvider * sp, StatusProviderStatus newstatus)
{
-
+ g_return_if_fail(IS_STATUS_PROVIDER(sp));
+ g_signal_emit(sp, signals[STATUS_CHANGED], 0, newstatus, TRUE);
return;
}