aboutsummaryrefslogtreecommitdiff
path: root/libindicator
diff options
context:
space:
mode:
Diffstat (limited to 'libindicator')
-rw-r--r--libindicator/Makefile.am30
-rw-r--r--libindicator/indicator-object-enum-types.c.template30
-rw-r--r--libindicator/indicator-object-enum-types.h.template27
-rw-r--r--libindicator/indicator-object-marshal.list1
-rw-r--r--libindicator/indicator-object.c27
-rw-r--r--libindicator/indicator-object.h23
6 files changed, 125 insertions, 13 deletions
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 <glib-object.h>
+
+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 5c11033..d9dd126 100644
--- a/libindicator/indicator-object-marshal.list
+++ b/libindicator/indicator-object-marshal.list
@@ -1 +1,2 @@
VOID: POINTER, UINT, UINT
+VOID: UINT,ENUM
diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c
index 87cd648..511a407 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:
@@ -56,6 +57,7 @@ enum {
ENTRY_ADDED,
ENTRY_REMOVED,
ENTRY_MOVED,
+ SCROLL,
LAST_SIGNAL
};
@@ -142,6 +144,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.
+
+ 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_ENUM,
+ G_TYPE_NONE, 2, G_TYPE_UINT, INDICATOR_OBJECT_TYPE_SCROLL_DIRECTION);
+
+
return;
}
@@ -188,7 +209,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 +232,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 +325,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..3c6bec5 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 <glib.h>
-#include <glib-object.h>
+#include <gtk/gtk.h>
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))
@@ -42,6 +49,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 +84,7 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry;
*/
struct _IndicatorObjectClass {
GObjectClass parent_class;
-
+
/* Virtual Functions */
GtkLabel * (*get_label) (IndicatorObject * io);
GtkImage * (*get_image) (IndicatorObject * io);
@@ -85,13 +94,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, IndicatorScrollDirection direction);
/* Reserved */
void (* indicator_object_reserved_1) (void);
- void (* indicator_object_reserved_2) (void);
};
/**