aboutsummaryrefslogtreecommitdiff
path: root/tests/dummy-indicator-simple.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-11-05 09:13:41 -0600
committerTed Gould <ted@canonical.com>2009-11-05 09:13:41 -0600
commitdb9e8f49d8136dfbec1539812d7cf76d90b9bc69 (patch)
treed0abd50fd186a0652b3b319e0c51f073b00e4dd7 /tests/dummy-indicator-simple.c
parentc547687a407d935654aa71f7afa1e4392e50d5c5 (diff)
parent34f914c264d268efff97142ba1ea7f2c3eab0493 (diff)
downloadlibayatana-indicator-db9e8f49d8136dfbec1539812d7cf76d90b9bc69.tar.gz
libayatana-indicator-db9e8f49d8136dfbec1539812d7cf76d90b9bc69.tar.bz2
libayatana-indicator-db9e8f49d8136dfbec1539812d7cf76d90b9bc69.zip
Changing the indicator-object API to support indicators that have multiple entries, and are dynamic.
Diffstat (limited to 'tests/dummy-indicator-simple.c')
-rw-r--r--tests/dummy-indicator-simple.c78
1 files changed, 74 insertions, 4 deletions
diff --git a/tests/dummy-indicator-simple.c b/tests/dummy-indicator-simple.c
index cee4eac..654650f 100644
--- a/tests/dummy-indicator-simple.c
+++ b/tests/dummy-indicator-simple.c
@@ -1,23 +1,46 @@
+#include <glib.h>
+#include <glib-object.h>
#include "libindicator/indicator.h"
+#include "libindicator/indicator-object.h"
+
+#define DUMMY_INDICATOR_SIMPLE_TYPE (dummy_indicator_simple_get_type ())
+#define DUMMY_INDICATOR_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DUMMY_INDICATOR_SIMPLE_TYPE, DummyIndicatorSimple))
+#define DUMMY_INDICATOR_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DUMMY_INDICATOR_SIMPLE_TYPE, DummyIndicatorSimpleClass))
+#define IS_DUMMY_INDICATOR_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DUMMY_INDICATOR_SIMPLE_TYPE))
+#define IS_DUMMY_INDICATOR_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DUMMY_INDICATOR_SIMPLE_TYPE))
+#define DUMMY_INDICATOR_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DUMMY_INDICATOR_SIMPLE_TYPE, DummyIndicatorSimpleClass))
+
+typedef struct _DummyIndicatorSimple DummyIndicatorSimple;
+typedef struct _DummyIndicatorSimpleClass DummyIndicatorSimpleClass;
+
+struct _DummyIndicatorSimpleClass {
+ IndicatorObjectClass parent_class;
+};
+
+struct _DummyIndicatorSimple {
+ IndicatorObject parent;
+};
+
+GType dummy_indicator_simple_get_type (void);
INDICATOR_SET_VERSION
-INDICATOR_SET_NAME("dummy-indicator-simple")
+INDICATOR_SET_TYPE(DUMMY_INDICATOR_SIMPLE_TYPE)
GtkLabel *
-get_label (void)
+get_label (IndicatorObject * io)
{
return GTK_LABEL(gtk_label_new("Simple Item"));
}
GtkImage *
-get_icon (void)
+get_icon (IndicatorObject * io)
{
return GTK_IMAGE(gtk_image_new());
}
GtkMenu *
-get_menu (void)
+get_menu (IndicatorObject * io)
{
GtkMenu * main_menu = GTK_MENU(gtk_menu_new());
GtkWidget * loading_item = gtk_menu_item_new_with_label("Loading...");
@@ -26,3 +49,50 @@ get_menu (void)
return main_menu;
}
+
+static void dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass);
+static void dummy_indicator_simple_init (DummyIndicatorSimple *self);
+static void dummy_indicator_simple_dispose (GObject *object);
+static void dummy_indicator_simple_finalize (GObject *object);
+
+G_DEFINE_TYPE (DummyIndicatorSimple, dummy_indicator_simple, INDICATOR_OBJECT_TYPE);
+
+static void
+dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = dummy_indicator_simple_dispose;
+ object_class->finalize = dummy_indicator_simple_finalize;
+
+ IndicatorObjectClass * io_class = INDICATOR_OBJECT_CLASS(klass);
+
+ io_class->get_label = get_label;
+ io_class->get_image = get_icon;
+ io_class->get_menu = get_menu;
+
+ return;
+}
+
+static void
+dummy_indicator_simple_init (DummyIndicatorSimple *self)
+{
+
+ return;
+}
+
+static void
+dummy_indicator_simple_dispose (GObject *object)
+{
+
+ G_OBJECT_CLASS (dummy_indicator_simple_parent_class)->dispose (object);
+ return;
+}
+
+static void
+dummy_indicator_simple_finalize (GObject *object)
+{
+
+ G_OBJECT_CLASS (dummy_indicator_simple_parent_class)->finalize (object);
+ return;
+}