From 0575b91145b07ecc7fc861bcb8648296fbd74bb4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 3 Nov 2009 13:19:25 -0600 Subject: Redefining the interface. Now this object should get subclassed by folks. --- libindicator/indicator-object.h | 71 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 7 deletions(-) (limited to 'libindicator/indicator-object.h') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index fa6373d..6637f05 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -36,25 +36,82 @@ G_BEGIN_DECLS #define IS_INDICATOR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_OBJECT_TYPE)) #define INDICATOR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_OBJECT_TYPE, IndicatorObjectClass)) -typedef struct _IndicatorObject IndicatorObject; -typedef struct _IndicatorObjectClass IndicatorObjectClass; - +typedef struct _IndicatorObject IndicatorObject; +typedef struct _IndicatorObjectClass IndicatorObjectClass; +typedef struct _IndicatorObjectPrivate IndicatorObjectPrivate; +typedef struct _IndicatorObjectEntry IndicatorObjectEntry; + +/** + IndicatorObjectClass: + @parent_class: #GObjectClass + @get_label: Gets the label for this object. Should be set + to #NULL if @get_entries is set. Should NOT ref the + object. + @get_image: Gets the image for this object. Should be set + to #NULL if @get_entries is set. Should NOT ref the + object. + @get_menu: Gets the image for this object. Should be set + to #NULL if @get_entries is set. Should NOT ref the + object. + @get_entires: Gets all of the entires for this object returning + a #GList of #IndicatorObjectEntries. The list should be + under the ownership of the caller but the entires will + not be. + @entry_added: Slot for #IndicatorObject::entry-added + @entry_removed: Slot for #IndicatorObject::entry-removed + @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; - + + /* Virtual Functions */ + GtkLabel * get_label (IndicatorObject * io); + GtkImage * get_image (IndicatorObject * io); + GtkMenu * get_menu (IndicatorObject * io); + + GList * get_entries (IndicatorObject * io); + + /* Signals */ + void entry_added (IndicatorObject * io, IndicatorEntry * entry, gpointer user_data); + void entry_removed (IndicatorObject * io, IndicatorEntry * entry, 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); }; +/** + IndicatorObject: + @parent: #GObject + @priv: A cached reference to the private data for the + instance. +*/ struct _IndicatorObject { GObject parent; + IndicatorObjectPrivate * priv; +}; +/** + IndicatorObjectEntry: + @label: The label to be shown on the panel + @image: The image to be shown on the panel + @menu: The menu to be added to the menubar +*/ +struct _IndicatorObjectEntry { + GtkLabel * label; + GtkImage * image; + GtkMenu * menu; }; GType indicator_object_get_type (void); IndicatorObject * indicator_object_new_from_file (const gchar * file); -GtkLabel * indicator_object_get_label (IndicatorObject * io); -GtkImage * indicator_object_get_icon (IndicatorObject * io); -GtkMenu * indicator_object_get_menu (IndicatorObject * io); +GList * indicator_object_get_entries (IndicatorObject * io); G_END_DECLS -- cgit v1.2.3 From ed409d4cb434272e2ec0110305d53a06735b00c4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 3 Nov 2009 13:40:10 -0600 Subject: Whew, blew up the interface and built it back again. --- libindicator/indicator-object.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libindicator/indicator-object.h') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 6637f05..cd8cc79 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -32,8 +32,8 @@ G_BEGIN_DECLS #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)) -#define IS_INDICATOR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_OBJECT_TYPE)) -#define IS_INDICATOR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_OBJECT_TYPE)) +#define INDICATOR_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_OBJECT_TYPE)) +#define INDICATOR_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_OBJECT_TYPE)) #define INDICATOR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_OBJECT_TYPE, IndicatorObjectClass)) typedef struct _IndicatorObject IndicatorObject; @@ -68,15 +68,15 @@ struct _IndicatorObjectClass { GObjectClass parent_class; /* Virtual Functions */ - GtkLabel * get_label (IndicatorObject * io); - GtkImage * get_image (IndicatorObject * io); - GtkMenu * get_menu (IndicatorObject * io); + GtkLabel * (*get_label) (IndicatorObject * io); + GtkImage * (*get_image) (IndicatorObject * io); + GtkMenu * (*get_menu) (IndicatorObject * io); - GList * get_entries (IndicatorObject * io); + GList * (*get_entries) (IndicatorObject * io); /* Signals */ - void entry_added (IndicatorObject * io, IndicatorEntry * entry, gpointer user_data); - void entry_removed (IndicatorObject * io, IndicatorEntry * entry, gpointer user_data); + void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); + void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); /* Reserved */ void (* indicator_object_reserved_1) (void); -- cgit v1.2.3 From 1f96a346f7c2465a6a7785413d78071938829891 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 3 Nov 2009 16:38:11 -0600 Subject: Typo --- libindicator/indicator-object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libindicator/indicator-object.h') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index cd8cc79..c2d1944 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -53,7 +53,7 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry; @get_menu: Gets the image for this object. Should be set to #NULL if @get_entries is set. Should NOT ref the object. - @get_entires: Gets all of the entires for this object returning + @get_entries: Gets all of the entires for this object returning a #GList of #IndicatorObjectEntries. The list should be under the ownership of the caller but the entires will not be. -- cgit v1.2.3 From 0db39bf65d1007924bded3d48d928a1a7c034581 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 3 Nov 2009 23:15:10 -0600 Subject: Adding in some signals to make for some more fun. --- 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 c2d1944..1ac39b0 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -36,6 +36,9 @@ G_BEGIN_DECLS #define INDICATOR_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_OBJECT_TYPE)) #define INDICATOR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_OBJECT_TYPE, IndicatorObjectClass)) +#define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED "entry-added" +#define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED "entry-removed" + typedef struct _IndicatorObject IndicatorObject; typedef struct _IndicatorObjectClass IndicatorObjectClass; typedef struct _IndicatorObjectPrivate IndicatorObjectPrivate; -- cgit v1.2.3 From 7db7886923d8df734ccb9c300db8bd4a2ebf6e33 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 3 Nov 2009 23:17:33 -0600 Subject: Adding in some ID helpers. --- libindicator/indicator-object.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libindicator/indicator-object.h') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 1ac39b0..14f0db0 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -36,8 +36,10 @@ G_BEGIN_DECLS #define INDICATOR_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_OBJECT_TYPE)) #define INDICATOR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_OBJECT_TYPE, IndicatorObjectClass)) -#define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED "entry-added" -#define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED "entry-removed" +#define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED "entry-added" +#define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, INDICATOR_TYPE_OBJECT)) +#define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED "entry-removed" +#define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, INDICATOR_TYPE_OBJECT)) typedef struct _IndicatorObject IndicatorObject; typedef struct _IndicatorObjectClass IndicatorObjectClass; -- cgit v1.2.3 From db2a2391c759a2b8a17f4c661cc7e62e6c1d1495 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 4 Nov 2009 10:53:14 -0600 Subject: Using the proper define for the type. --- libindicator/indicator-object.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libindicator/indicator-object.h') diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 14f0db0..c100d02 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -37,9 +37,9 @@ G_BEGIN_DECLS #define INDICATOR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_OBJECT_TYPE, IndicatorObjectClass)) #define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED "entry-added" -#define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, INDICATOR_TYPE_OBJECT)) +#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_TYPE_OBJECT)) +#define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, INDICATOR_OBJECT_TYPE)) typedef struct _IndicatorObject IndicatorObject; typedef struct _IndicatorObjectClass IndicatorObjectClass; -- cgit v1.2.3