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