From d3392a98f7b2ceb1bb4fce4a41feed261012346d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 12 Jan 2012 14:51:30 +0100 Subject: initial revision for GSettings/GtkMenu visibility support --- libindicator/indicator-object.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libindicator/indicator-object.h') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 3a120f5..51ca758 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -60,6 +60,9 @@ typedef enum #define INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE "secondary-activate" #define INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE, INDICATOR_OBJECT_TYPE)) +/* the name of the GSettings schema-id property */ +#define INDICATOR_OBJECT_GSETTINGS_SCHEMA_ID "gsettings-schema-id" + typedef struct _IndicatorObject IndicatorObject; typedef struct _IndicatorObjectClass IndicatorObjectClass; typedef struct _IndicatorObjectPrivate IndicatorObjectPrivate; -- cgit v1.2.3 From c52fbaa41bd72b45341f751ba2a19e00c42a4b6d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Jan 2012 05:54:17 +0100 Subject: Better implementation. This version handles the bootstrapping conditions better, and also refs+detaches the GtkMenu for safekeeping between removed->added events s.t. it can keep being reused. --- libindicator/indicator-object.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libindicator/indicator-object.h') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 51ca758..a46600f 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -61,7 +61,10 @@ typedef enum #define INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE, INDICATOR_OBJECT_TYPE)) /* the name of the GSettings schema-id property */ -#define INDICATOR_OBJECT_GSETTINGS_SCHEMA_ID "gsettings-schema-id" +#define INDICATOR_OBJECT_GSETTINGS_SCHEMA_ID "indicator-object-gsettings-schema-id" + +/* the name of the property to decide whether or not entries are visible by default */ +#define INDICATOR_OBJECT_DEFAULT_VISIBILITY "indicator-object-default-visibility" typedef struct _IndicatorObject IndicatorObject; typedef struct _IndicatorObjectClass IndicatorObjectClass; @@ -186,6 +189,7 @@ 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); guint indicator_object_get_show_now (IndicatorObject * io, IndicatorObjectEntry * entry); +void indicator_object_set_visible (IndicatorObject * io, gboolean visible); void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); void indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); -- cgit v1.2.3 From 4f4190f71f8495e5bcf6779d73157931572e42ac Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 23 Jan 2012 05:39:50 -0600 Subject: another iteration of the indicator-object visibility support patch, incorporating ideas from discussion with ted - some functions were public when they should have been private - the hide/show handler is now a virtual function & is documented in indicator-object.h - added unit tests - the GSettings monitor has been removed --- libindicator/indicator-object.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libindicator/indicator-object.h') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index a46600f..803f1b3 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -60,9 +60,6 @@ typedef enum #define INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE "secondary-activate" #define INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE, INDICATOR_OBJECT_TYPE)) -/* the name of the GSettings schema-id property */ -#define INDICATOR_OBJECT_GSETTINGS_SCHEMA_ID "indicator-object-gsettings-schema-id" - /* the name of the property to decide whether or not entries are visible by default */ #define INDICATOR_OBJECT_DEFAULT_VISIBILITY "indicator-object-default-visibility" @@ -97,6 +94,12 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry; @get_show_now: Returns whether the entry is requesting to be shown "right now" in that it has something important to tell the user. + @entry_being_removed: Called before an entry is removed. + The default implementation is to ref and unparent the + entry's widgets so that they can be re-added later. + @entry_was_added: Called after an entry is added. + The default implementation is to unref the entry's widgets if + previously reffed by entry_being_removed's default impementation @entry_activate: Should be called when the menus for a given entry are shown to the user. @entry_close: Called when the menu is closed. @@ -123,6 +126,9 @@ struct _IndicatorObjectClass { guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry); gboolean (*get_show_now) (IndicatorObject * io, IndicatorObjectEntry * entry); + void (*entry_being_removed) (IndicatorObject * io, IndicatorObjectEntry * entry); + void (*entry_was_added) (IndicatorObject * io, IndicatorObjectEntry * entry); + void (*entry_activate) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); void (*entry_close) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); -- cgit v1.2.3