diff options
author | Ted Gould <ted@canonical.com> | 2009-10-29 20:02:46 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-10-29 20:02:46 -0500 |
commit | 9af4097a1f0df273ca8891e3ef6ec579e5032060 (patch) | |
tree | d3831f402f3b29afa6b798f2a4a791117117f6f9 /libindicator | |
parent | c099b0332adb448caa987370d95fbbc808f00935 (diff) | |
download | libayatana-indicator-9af4097a1f0df273ca8891e3ef6ec579e5032060.tar.gz libayatana-indicator-9af4097a1f0df273ca8891e3ef6ec579e5032060.tar.bz2 libayatana-indicator-9af4097a1f0df273ca8891e3ef6ec579e5032060.zip |
Signals and properties, oh my!
Diffstat (limited to 'libindicator')
-rw-r--r-- | libindicator/indicator-service-manager.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c index cd16cf6..dbf96b1 100644 --- a/libindicator/indicator-service-manager.c +++ b/libindicator/indicator-service-manager.c @@ -4,11 +4,33 @@ #include "indicator-service-manager.h" +/* Private Stuff */ typedef struct _IndicatorServiceManagerPrivate IndicatorServiceManagerPrivate; struct _IndicatorServiceManagerPrivate { - int dummy; + gchar * name; }; +/* Signals Stuff */ +enum { + CONNECTION_CHANGE, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + + +/* Properties */ +/* Enum for the properties so that they can be quickly + found and looked up. */ +enum { + PROP_0, + PROP_NAME, +}; + +/* The strings so that they can be slowly looked up. */ +#define PROP_NAME_S "name" + +/* GObject Stuff */ #define INDICATOR_SERVICE_MANAGER_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SERVICE_MANAGER_TYPE, IndicatorServiceManagerPrivate)) @@ -29,6 +51,29 @@ indicator_service_manager_class_init (IndicatorServiceManagerClass *klass) object_class->dispose = indicator_service_manager_dispose; object_class->finalize = indicator_service_manager_finalize; + /** + IndicatorServiceManager::connecton-change: + @arg0: The #IndicatorServiceManager object + @arg1: The state of the connection, TRUE is connected. + + Signaled when the service is connected or disconnected + depending on it's previous state. + */ + signals[CONNECTION_CHANGE] = g_signal_new (INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IndicatorServiceManagerClass, connection_change), + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE); + + /* Properties */ + g_object_class_install_property(object_class, PROP_NAME, + g_param_spec_string(PROP_NAME_S, + "The DBus name for the service to monitor", + "This is the name that should be used to start a service.", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); return; } @@ -61,7 +106,7 @@ IndicatorServiceManager * indicator_service_manager_new (gchar * dbus_name) { GObject * obj = g_object_new(INDICATOR_SERVICE_MANAGER_TYPE, - "name", dbus_name, + PROP_NAME_S, dbus_name, NULL); return INDICATOR_SERVICE_MANAGER(obj); |