From 529ce66c4498e661281b83852cfbde03a918956e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 15:04:20 -0600 Subject: API changes required to have locations for the entries. --- libindicator/indicator-object.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'libindicator') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index c100d02..0356d1c 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -40,6 +40,8 @@ G_BEGIN_DECLS #define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, INDICATOR_OBJECT_TYPE)) #define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED "entry-removed" #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)) typedef struct _IndicatorObject IndicatorObject; typedef struct _IndicatorObjectClass IndicatorObjectClass; @@ -62,12 +64,14 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry; a #GList of #IndicatorObjectEntries. The list should be under the ownership of the caller but the entires will not be. + @get_location: Returns the location that a particular entry + should be placed in. This is really only relevant for + indicators that have more than one entry. @entry_added: Slot for #IndicatorObject::entry-added @entry_removed: Slot for #IndicatorObject::entry-removed + @entry_moved: Slot for #IndicatorObject::entry-moved @indicator_object_reserved_1: Reserved for future use @indicator_object_reserved_2: Reserved for future use - @indicator_object_reserved_3: Reserved for future use - @indicator_object_reserved_4: Reserved for future use */ struct _IndicatorObjectClass { GObjectClass parent_class; @@ -78,16 +82,16 @@ struct _IndicatorObjectClass { GtkMenu * (*get_menu) (IndicatorObject * io); GList * (*get_entries) (IndicatorObject * io); + 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); /* Reserved */ void (* indicator_object_reserved_1) (void); void (* indicator_object_reserved_2) (void); - void (* indicator_object_reserved_3) (void); - void (* indicator_object_reserved_4) (void); }; /** @@ -117,6 +121,7 @@ GType indicator_object_get_type (void); IndicatorObject * indicator_object_new_from_file (const gchar * file); GList * indicator_object_get_entries (IndicatorObject * io); +guint indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry); G_END_DECLS -- cgit v1.2.3 From 14b58238f792f17285dc61c6adb00ca764a5a3b6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 15:16:30 -0600 Subject: Setting up the move signal, which required custom marshallers. --- libindicator/Makefile.am | 8 ++++++++ libindicator/indicator-object-marshal.list | 1 + libindicator/indicator-object.c | 16 ++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 libindicator/indicator-object-marshal.list (limited to 'libindicator') diff --git a/libindicator/Makefile.am b/libindicator/Makefile.am index 6d5c627..19247ce 100644 --- a/libindicator/Makefile.am +++ b/libindicator/Makefile.am @@ -1,8 +1,11 @@ BUILT_SOURCES = CLEANFILES = +DISTCLEANFILES = EXTRA_DIST = \ indicator.pc.in +include $(top_srcdir)/Makefile.am.marshal + libindicatorincludedir=$(includedir)/libindicator-0.3/libindicator indicator_headers = \ @@ -21,6 +24,8 @@ libindicator_la_SOURCES = \ $(indicator_headers) \ dbus-shared.h \ indicator-object.c \ + indicator-object-marshal.h \ + indicator-object-marshal.c \ indicator-service.c \ indicator-service-manager.c @@ -35,6 +40,9 @@ libindicator_la_LIBADD = \ pkgconfig_DATA = indicator.pc pkgconfigdir = $(libdir)/pkgconfig +glib_marshal_list = indicator-object-marshal.list +glib_marshal_prefix = _indicator_object_marshal + ################################## # DBus Specs ################################## diff --git a/libindicator/indicator-object-marshal.list b/libindicator/indicator-object-marshal.list new file mode 100644 index 0000000..5c11033 --- /dev/null +++ b/libindicator/indicator-object-marshal.list @@ -0,0 +1 @@ +VOID: POINTER, UINT, UINT diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index e87fa5f..8e1edef 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -27,6 +27,7 @@ License along with this library. If not, see #include "indicator.h" #include "indicator-object.h" +#include "indicator-object-marshal.h" /** IndicatorObjectPrivate: @@ -54,6 +55,7 @@ struct _IndicatorObjectPrivate { enum { ENTRY_ADDED, ENTRY_REMOVED, + ENTRY_MOVED, LAST_SIGNAL }; @@ -116,6 +118,20 @@ indicator_object_class_init (IndicatorObjectClass *klass) NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_NONE); + /** + IndicatorObject::entry-moved: + @arg0: The #IndicatorObject object + + Signaled when an entry is removed and should + be removed by the person using this object. + */ + signals[ENTRY_MOVED] = g_signal_new (INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (IndicatorObjectClass, entry_moved), + NULL, NULL, + _indicator_object_marshal_VOID__POINTER_UINT_UINT, + G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_NONE); return; } -- cgit v1.2.3 From d334db5071495817e9dea5b50a2fc27709058410 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 15:28:31 -0600 Subject: Fixing the signal comments. --- libindicator/indicator-object.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'libindicator') diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 8e1edef..3b00c97 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -92,7 +92,9 @@ indicator_object_class_init (IndicatorObjectClass *klass) /** IndicatorObject::entry-added: @arg0: The #IndicatorObject object - + @arg1: A pointer to the #IndicatorObjectEntry that + is being added. + Signaled when a new entry is added and should be shown by the person using this object. */ @@ -107,7 +109,9 @@ indicator_object_class_init (IndicatorObjectClass *klass) /** IndicatorObject::entry-removed: @arg0: The #IndicatorObject object - + @arg1: A pointer to the #IndicatorObjectEntry that + is being removed. + Signaled when an entry is removed and should be removed by the person using this object. */ @@ -121,9 +125,13 @@ indicator_object_class_init (IndicatorObjectClass *klass) /** IndicatorObject::entry-moved: @arg0: The #IndicatorObject object - - Signaled when an entry is removed and should - be removed by the person using this object. + @arg1: A pointer to the #IndicatorObjectEntry that + is being moved. + @arg2: The old location of the entry + @arg3: The new location of the entry + + When the order of the entries change, then this signal + is sent to tell the new location. */ signals[ENTRY_MOVED] = g_signal_new (INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_TYPE_FROM_CLASS(klass), -- cgit v1.2.3 From 308e4db1bc070b6f548817fa6fe9297e64434613 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 15:35:55 -0600 Subject: Fleshing out the get_location function as much as they're implemented here. --- libindicator/indicator-object.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libindicator') diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 3b00c97..f186a4f 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -88,6 +88,7 @@ indicator_object_class_init (IndicatorObjectClass *klass) klass->get_image = NULL; klass->get_entries = get_entries_default; + klass->get_location = NULL; /** IndicatorObject::entry-added: @@ -366,3 +367,29 @@ indicator_object_get_entries (IndicatorObject * io) g_error("No get_entries function on object. It must have been deleted?!?!"); return NULL; } + +/** + indicator_object_get_location: + @io: #IndicatorObject to query + @entry: The #IndicatorObjectEntry to look for. + + This function looks on the class for the object and calls + it's #IndicatorObjectClass::get_location function. If the + function doesn't exist it returns zero. + + Return value: Location of the @entry in the display or + zero if no location is specified. +*/ +guint +indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry) +{ + g_return_val_if_fail(INDICATOR_IS_OBJECT(io), 0); + IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io); + + if (class->get_location) { + return class->get_location(io, entry); + } + + g_error("No get_entries function on object. It must have been deleted?!?!"); + return 0; +} -- cgit v1.2.3 From c25db995a7c12f9b0460e903633d01926c9b4aed Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 16:08:35 -0600 Subject: No error on not having a get_location function. We'll just return zero. --- libindicator/indicator-object.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libindicator') diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index f186a4f..87cd648 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -390,6 +390,5 @@ indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entr return class->get_location(io, entry); } - g_error("No get_entries function on object. It must have been deleted?!?!"); return 0; } -- cgit v1.2.3