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 From 02d3dde87c8fcf2702741ab265dbaa24d498cd51 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Tue, 16 Mar 2010 11:40:14 -0500 Subject: Define IndicatorScrollDirection enum for scroll signal parameter. --- configure.ac | 4 ++- libindicator/Makefile.am | 30 +++++++++++++++++++--- .../indicator-object-enum-types.c.template | 30 ++++++++++++++++++++++ .../indicator-object-enum-types.h.template | 27 +++++++++++++++++++ libindicator/indicator-object-marshal.list | 2 +- libindicator/indicator-object.c | 5 ++-- libindicator/indicator-object.h | 11 ++++++-- 7 files changed, 100 insertions(+), 9 deletions(-) create mode 100644 libindicator/indicator-object-enum-types.c.template create mode 100644 libindicator/indicator-object-enum-types.h.template diff --git a/configure.ac b/configure.ac index b3f3d78..ca3ab46 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,8 @@ AM_PROG_CC_C_O AC_STDC_HEADERS AC_PROG_LIBTOOL +AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) + AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) AC_SUBST(VERSION) @@ -66,7 +68,7 @@ else REAL_PREFIX=$prefix fi -# Have to go $sysconfdir->$prefix/etc->/usr/local/etc +# Have to go $sysconfdir->$prefix/etc->/usr/local/etc # if you actually know how to code shell then fix this :-) SYSCONFDIR_TMP="$sysconfdir" old_prefix=$prefix diff --git a/libindicator/Makefile.am b/libindicator/Makefile.am index 890160c..4b11a77 100644 --- a/libindicator/Makefile.am +++ b/libindicator/Makefile.am @@ -1,6 +1,6 @@ -BUILT_SOURCES = -CLEANFILES = -DISTCLEANFILES = +BUILT_SOURCES = indicator-object-enum-types.h indicator-object-enum-types.c +CLEANFILES = +DISTCLEANFILES = EXTRA_DIST = \ indicator.pc.in @@ -26,6 +26,7 @@ libindicator_la_SOURCES = \ $(indicator_headers) \ dbus-shared.h \ indicator-object.c \ + indicator-object-enum-types.c \ indicator-desktop-shortcuts.c \ indicator-image-helper.c \ indicator-object-marshal.h \ @@ -47,6 +48,29 @@ pkgconfigdir = $(libdir)/pkgconfig glib_marshal_list = indicator-object-marshal.list glib_marshal_prefix = _indicator_object_marshal +indicator-object-enum-types.h: s-enum-types-h + @true +s-enum-types-h: $(indicator_headers) + ( cd $(srcdir) && $(GLIB_MKENUMS) --template $(srcdir)/indicator-object-enum-types.h.template \ + $(indicator_headers) ) >> tmp-indicator-object-enum-types.h \ + && (cmp -s tmp-indicator-object-enum-types.h indicator-object-enum-types.h || cp tmp-indicator-object-enum-types.h indicator-object-enum-types.h ) \ + && rm -f tmp-indicator-object-enum-types.h && echo timestamp > $(@F) + +indicator-object-enum-types.c: s-enum-types-c + @true +s-enum-types-c: $(indicator_headers) + ( cd $(srcdir) && $(GLIB_MKENUMS) --template $(srcdir)/indicator-object-enum-types.c.template \ + $(indicator_headers) ) > tmp-indicator-object-enum-types.c \ + && (cmp -s tmp-indicator-object-enum-types.c indicator-object-enum-types.c || cp tmp-indicator-object-enum-types.c indicator-object-enum-types.c ) \ + && rm -f tmp-indicator-object-enum-types.c + +EXTRA_DIST += indicator-object-enum-types.h +CLEANFILES += \ + indicator-object-enum-types.h \ + indicator-object-enum-types.c \ + s-enum-types-h \ + s-enum-types-c + ################################## # DBus Specs ################################## diff --git a/libindicator/indicator-object-enum-types.c.template b/libindicator/indicator-object-enum-types.c.template new file mode 100644 index 0000000..dd7d595 --- /dev/null +++ b/libindicator/indicator-object-enum-types.c.template @@ -0,0 +1,30 @@ +/*** BEGIN file-header ***/ +#include "indicator-object-enum-types.h" +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) { + static GType enum_type_id = 0; + if (G_UNLIKELY (!enum_type_id)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + enum_type_id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + } + return enum_type_id; +} +/*** END value-tail ***/ diff --git a/libindicator/indicator-object-enum-types.h.template b/libindicator/indicator-object-enum-types.h.template new file mode 100644 index 0000000..07175a0 --- /dev/null +++ b/libindicator/indicator-object-enum-types.h.template @@ -0,0 +1,27 @@ +/*** BEGIN file-header ***/ + +#ifndef __INDICATOR_OBJECT_ENUM_TYPES_H__ +#define __INDICATOR_OBJECT_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* !__INDICATOR_OBJECT_ENUM_TYPES_H__ */ +/*** END file-tail ***/ + +/*** BEGIN value-header ***/ + +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define INDICATOR_OBJECT_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) + +/*** END value-header ***/ diff --git a/libindicator/indicator-object-marshal.list b/libindicator/indicator-object-marshal.list index c6ec0ac..d9dd126 100644 --- a/libindicator/indicator-object-marshal.list +++ b/libindicator/indicator-object-marshal.list @@ -1,2 +1,2 @@ VOID: POINTER, UINT, UINT -VOID: UINT, BOOL +VOID: UINT,ENUM diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index a905cb8..c3e0139 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -28,6 +28,7 @@ License along with this library. If not, see #include "indicator.h" #include "indicator-object.h" #include "indicator-object-marshal.h" +#include "indicator-object-enum-types.h" /** IndicatorObjectPrivate: @@ -158,8 +159,8 @@ indicator_object_class_init (IndicatorObjectClass *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); + _indicator_object_marshal_VOID__UINT_ENUM, + G_TYPE_NONE, 2, G_TYPE_UINT, INDICATOR_OBJECT_TYPE_SCROLL_DIRECTION); return; diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 335dc0d..7bd296d 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -24,11 +24,18 @@ License along with this library. If not, see #ifndef __INDICATOR_OBJECT_H__ #define __INDICATOR_OBJECT_H__ -#include -#include +#include G_BEGIN_DECLS +typedef enum +{ + INDICATOR_OBJECT_SCROLL_UP, + INDICATOR_OBJECT_SCROLL_DOWN, + INDICATOR_OBJECT_SCROLL_LEFT, + INDICATOR_OBJECT_SCROLL_RIGHT +} IndicatorScrollDirection; + #define INDICATOR_OBJECT_TYPE (indicator_object_get_type ()) #define INDICATOR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_OBJECT_TYPE, IndicatorObject)) #define INDICATOR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_OBJECT_TYPE, IndicatorObjectClass)) -- cgit v1.2.3 From 11c78ed1bb7f41218518fcee6bdb94548277b67b Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Tue, 16 Mar 2010 15:31:15 -0500 Subject: Use IndicatorScrollDirection instead of gboolean in IndicatorObjectClass->scroll function pointer. --- libindicator/indicator-object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 7bd296d..3c6bec5 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -97,7 +97,7 @@ struct _IndicatorObjectClass { 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); + void (*scroll) (IndicatorObject * io, gint delta, IndicatorScrollDirection direction); /* Reserved */ void (* indicator_object_reserved_1) (void); -- cgit v1.2.3 From b782a8a4eaae520a0d4b3fffef466205d3df9c28 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Wed, 17 Mar 2010 01:14:13 -0500 Subject: Documentation fix. --- libindicator/indicator-object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index c3e0139..511a407 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -149,7 +149,7 @@ indicator_object_class_init (IndicatorObjectClass *klass) 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. + @arg2: The orientation of the scroll event. When the indicator receives a mouse scroll wheel event from the user, this signal is emitted. -- cgit v1.2.3 From e0c1a3ca394f6a62dfbf09fd13f5957505f356c3 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Wed, 17 Mar 2010 01:21:58 -0500 Subject: name --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index b6c2e7d..f2712a9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1,2 @@ Ted Gould +Cody Russell \ No newline at end of file -- cgit v1.2.3 From 999f1483f967db63d71ff2a9453b5866eec339bf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Mar 2010 10:49:26 -0500 Subject: 0.3.6 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ca3ab46..136ab6a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.5, ted@canonical.com) +AC_INIT(libindicator, 0.3.6, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.5) +AM_INIT_AUTOMAKE(libindicator, 0.3.6) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3