aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;
}