diff options
Diffstat (limited to 'src/libcustomindicator')
-rw-r--r-- | src/libcustomindicator/custom-indicator.c | 82 | ||||
-rw-r--r-- | src/libcustomindicator/custom-indicator.h | 5 |
2 files changed, 86 insertions, 1 deletions
diff --git a/src/libcustomindicator/custom-indicator.c b/src/libcustomindicator/custom-indicator.c index 7fb8fb8..314493f 100644 --- a/src/libcustomindicator/custom-indicator.c +++ b/src/libcustomindicator/custom-indicator.c @@ -7,14 +7,31 @@ #include "libcustomindicator/custom-indicator.h" #include "libcustomindicator/custom-indicator-enum-types.h" +/** + CustomIndicatorPrivate: + + All of the private data in an instance of a + custom indicator. +*/ typedef struct _CustomIndicatorPrivate CustomIndicatorPrivate; struct _CustomIndicatorPrivate { int placeholder; }; +/* Signals Stuff */ +enum { + NEW_ICON, + NEW_ATTENTION_ICON, + NEW_STATUS, + CONNECTION_CHANGED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + /* Enum for the properties so that they can be quickly found and looked up. */ -enum properties { +enum { PROP_0, PROP_ID, PROP_CATEGORY, @@ -108,6 +125,69 @@ custom_indicator_class_init (CustomIndicatorClass *klass) DBUSMENU_TYPE_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /* Signals */ + + /** + CustomIndicator::new-icon: + @arg0: The #CustomIndicator object + + Signaled when there is a new icon set for the + object. + */ + signals[NEW_ICON] = g_signal_new (CUSTOM_INDICATOR_SIGNAL_NEW_ICON, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CustomIndicatorClass, new_icon), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, G_TYPE_NONE); + + /** + CustomIndicator::new-attention-icon: + @arg0: The #CustomIndicator object + + Signaled when there is a new attention icon set for the + object. + */ + signals[NEW_ATTENTION_ICON] = g_signal_new (CUSTOM_INDICATOR_SIGNAL_NEW_ATTENTION_ICON, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CustomIndicatorClass, new_attention_icon), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, G_TYPE_NONE); + + /** + CustomIndicator::new-status: + @arg0: The #CustomIndicator object + @arg1: The string value of the #CustomIndicatorStatus enum. + + Signaled when the status of the indicator changes. + */ + signals[NEW_STATUS] = g_signal_new (CUSTOM_INDICATOR_SIGNAL_NEW_STATUS, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CustomIndicatorClass, new_status), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING, G_TYPE_NONE); + + /** + CustomIndicator::connection-changed: + @arg0: The #CustomIndicator object + @arg1: Whether we're connected or not + + Signaled when we connect to a watcher, or when it drops + away. + */ + signals[CONNECTION_CHANGED] = g_signal_new (CUSTOM_INDICATOR_SIGNAL_CONNECTION_CHANGED, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CustomIndicatorClass, connection_changed), + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE); + return; } diff --git a/src/libcustomindicator/custom-indicator.h b/src/libcustomindicator/custom-indicator.h index d9322e7..a4fc3f1 100644 --- a/src/libcustomindicator/custom-indicator.h +++ b/src/libcustomindicator/custom-indicator.h @@ -13,6 +13,11 @@ G_BEGIN_DECLS #define IS_CUSTOM_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CUSTOM_INDICATOR_TYPE)) #define CUSTOM_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CUSTOM_INDICATOR_TYPE, CustomIndicatorClass)) +#define CUSTOM_INDICATOR_SIGNAL_NEW_ICON "new-icon" +#define CUSTOM_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon" +#define CUSTOM_INDICATOR_SIGNAL_NEW_STATUS "new-status" +#define CUSTOM_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed" + /** CustomIndicatorCategory: @CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS: The indicator is used to display the status of the application. |