From 4adb9ab724e53a65603fe53abbb96304a8cab260 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Mon, 15 Mar 2010 14:12:20 -0500 Subject: Add 'scroll' signal. --- libindicator/indicator-object-marshal.list | 1 + libindicator/indicator-object.c | 26 +++++++++++++++++++++++--- libindicator/indicator-object.h | 12 +++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/libindicator/indicator-object-marshal.list b/libindicator/indicator-object-marshal.list index 5c11033..c6ec0ac 100644 --- a/libindicator/indicator-object-marshal.list +++ b/libindicator/indicator-object-marshal.list @@ -1 +1,2 @@ VOID: POINTER, UINT, UINT +VOID: UINT, BOOL diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 87cd648..a905cb8 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -56,6 +56,7 @@ enum { ENTRY_ADDED, ENTRY_REMOVED, ENTRY_MOVED, + SCROLL, LAST_SIGNAL }; @@ -142,6 +143,25 @@ indicator_object_class_init (IndicatorObjectClass *klass) _indicator_object_marshal_VOID__POINTER_UINT_UINT, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_NONE); + + /** + IndicatorObject::scroll: + @arg0: The #IndicatorObject object + @arg1: The delta of the scroll event + @arg2: The orientation of the scroll event. %TRUE indicates up, %FALSE down. + + When the indicator receives a mouse scroll wheel event + from the user, this signal is emitted. + */ + signals[SCROLL] = g_signal_new (INDICATOR_OBJECT_SIGNAL_SCROLL, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IndicatorObjectClass, scroll), + NULL, NULL, + _indicator_object_marshal_VOID__UINT_BOOL, + G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_BOOLEAN); + + return; } @@ -188,7 +208,7 @@ static void indicator_object_finalize (GObject *object) { IndicatorObjectPrivate * priv = INDICATOR_OBJECT_GET_PRIVATE(object); - + if (priv->module != NULL) { /* Wow, this is convoluted. So basically we want to unref the module which will cause the code it included to be @@ -211,7 +231,7 @@ indicator_object_finalize (GObject *object) This function builds an #IndicatorObject using the symbols that are found in @file. The module is loaded and the - references are all kept by the object. To unload the + references are all kept by the object. To unload the module the object must be destroyed. Return value: A valid #IndicatorObject or #NULL if error. @@ -304,7 +324,7 @@ unrefandout: /* The default get entries function uses the other single entries in the class to create an entry structure and put it into a list. This makes it simple for simple objects - to create the list. Small changes from the way they + to create the list. Small changes from the way they previously were. */ static GList * get_entries_default (IndicatorObject * io) diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 0356d1c..335dc0d 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -42,6 +42,8 @@ G_BEGIN_DECLS #define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, INDICATOR_OBJECT_TYPE)) #define INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED "entry-moved" #define INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, INDICATOR_OBJECT_TYPE)) +#define INDICATOR_OBJECT_SIGNAL_SCROLL "scroll" +#define INDICATOR_OBJECT_SIGNAL_SCROLL_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SCROLL, INDICATOR_OBJECT_TYPE)) typedef struct _IndicatorObject IndicatorObject; typedef struct _IndicatorObjectClass IndicatorObjectClass; @@ -75,7 +77,7 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry; */ struct _IndicatorObjectClass { GObjectClass parent_class; - + /* Virtual Functions */ GtkLabel * (*get_label) (IndicatorObject * io); GtkImage * (*get_image) (IndicatorObject * io); @@ -85,13 +87,13 @@ struct _IndicatorObjectClass { guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry); /* Signals */ - void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); - void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); - void (*entry_moved) (IndicatorObject * io, IndicatorObjectEntry * entry, guint old_pos, guint new_pos, gpointer user_data); + void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); + void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); + void (*entry_moved) (IndicatorObject * io, IndicatorObjectEntry * entry, guint old_pos, guint new_pos, gpointer user_data); + void (*scroll) (IndicatorObject * io, gint delta, gboolean orientation); /* Reserved */ void (* indicator_object_reserved_1) (void); - void (* indicator_object_reserved_2) (void); }; /** -- cgit v1.2.3