From 68c166698b604451b1f14280c14838d4461121b2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 13 Jan 2012 16:38:58 +0100 Subject: Build a new dummy indicator --- tests/dummy-indicator-entry-func.c | 123 +++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 tests/dummy-indicator-entry-func.c (limited to 'tests/dummy-indicator-entry-func.c') diff --git a/tests/dummy-indicator-entry-func.c b/tests/dummy-indicator-entry-func.c new file mode 100644 index 0000000..7271e86 --- /dev/null +++ b/tests/dummy-indicator-entry-func.c @@ -0,0 +1,123 @@ +/* +Test for libindicator + +Copyright 2012 Canonical Ltd. + +Authors: + Ted Gould + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License version 3.0 for more details. + +You should have received a copy of the GNU General Public +License along with this library. If not, see +. +*/ + + +#include +#include + +#include "libindicator/indicator.h" +#include "libindicator/indicator-object.h" + +#define DUMMY_INDICATOR_ENTRY_FUNC_TYPE (dummy_indicator_entry_func_get_type ()) +#define DUMMY_INDICATOR_ENTRY_FUNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFunc)) +#define DUMMY_INDICATOR_ENTRY_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFuncClass)) +#define IS_DUMMY_INDICATOR_ENTRY_FUNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE)) +#define IS_DUMMY_INDICATOR_ENTRY_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DUMMY_INDICATOR_ENTRY_FUNC_TYPE)) +#define DUMMY_INDICATOR_ENTRY_FUNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFuncClass)) + +typedef struct _DummyIndicatorEntryFunc DummyIndicatorEntryFunc; +typedef struct _DummyIndicatorEntryFuncClass DummyIndicatorEntryFuncClass; + +struct _DummyIndicatorEntryFuncClass { + IndicatorObjectClass parent_class; +}; + +struct _DummyIndicatorEntryFunc { + IndicatorObject parent; +}; + +GType dummy_indicator_entry_func_get_type (void); + +INDICATOR_SET_VERSION +INDICATOR_SET_TYPE(DUMMY_INDICATOR_ENTRY_FUNC_TYPE) + + +GtkLabel * +get_label (IndicatorObject * io) +{ + return NULL; +} + +GtkImage * +get_icon (IndicatorObject * io) +{ + return NULL; +} + +GtkMenu * +get_menu (IndicatorObject * io) +{ + return NULL; +} +const gchar * +get_accessible_desc (IndicatorObject * io) +{ + return NULL; +} + +static void dummy_indicator_entry_func_class_init (DummyIndicatorEntryFuncClass *klass); +static void dummy_indicator_entry_func_init (DummyIndicatorEntryFunc *self); +static void dummy_indicator_entry_func_dispose (GObject *object); +static void dummy_indicator_entry_func_finalize (GObject *object); + +G_DEFINE_TYPE (DummyIndicatorEntryFunc, dummy_indicator_entry_func, INDICATOR_OBJECT_TYPE); + +static void +dummy_indicator_entry_func_class_init (DummyIndicatorEntryFuncClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = dummy_indicator_entry_func_dispose; + object_class->finalize = dummy_indicator_entry_func_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; + io_class->get_accessible_desc = get_accessible_desc; + + return; +} + +static void +dummy_indicator_entry_func_init (DummyIndicatorEntryFunc *self) +{ + + return; +} + +static void +dummy_indicator_entry_func_dispose (GObject *object) +{ + + G_OBJECT_CLASS (dummy_indicator_entry_func_parent_class)->dispose (object); + return; +} + +static void +dummy_indicator_entry_func_finalize (GObject *object) +{ + + G_OBJECT_CLASS (dummy_indicator_entry_func_parent_class)->finalize (object); + return; +} -- cgit v1.2.3 From 347ab41628cd47e996663d47244749d2d9fa1ea7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 13 Jan 2012 16:48:52 +0100 Subject: Moving things into a shared header --- tests/dummy-indicator-entry-func.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'tests/dummy-indicator-entry-func.c') diff --git a/tests/dummy-indicator-entry-func.c b/tests/dummy-indicator-entry-func.c index 7271e86..76d8605 100644 --- a/tests/dummy-indicator-entry-func.c +++ b/tests/dummy-indicator-entry-func.c @@ -20,30 +20,8 @@ License along with this library. If not, see . */ +#include "dummy-indicator-entry-func.h" -#include -#include - -#include "libindicator/indicator.h" -#include "libindicator/indicator-object.h" - -#define DUMMY_INDICATOR_ENTRY_FUNC_TYPE (dummy_indicator_entry_func_get_type ()) -#define DUMMY_INDICATOR_ENTRY_FUNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFunc)) -#define DUMMY_INDICATOR_ENTRY_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFuncClass)) -#define IS_DUMMY_INDICATOR_ENTRY_FUNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE)) -#define IS_DUMMY_INDICATOR_ENTRY_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DUMMY_INDICATOR_ENTRY_FUNC_TYPE)) -#define DUMMY_INDICATOR_ENTRY_FUNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFuncClass)) - -typedef struct _DummyIndicatorEntryFunc DummyIndicatorEntryFunc; -typedef struct _DummyIndicatorEntryFuncClass DummyIndicatorEntryFuncClass; - -struct _DummyIndicatorEntryFuncClass { - IndicatorObjectClass parent_class; -}; - -struct _DummyIndicatorEntryFunc { - IndicatorObject parent; -}; GType dummy_indicator_entry_func_get_type (void); -- cgit v1.2.3 From efcb3e654caba19ade1dbe905eb9ae8526f08791 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 13 Jan 2012 17:00:47 +0100 Subject: Setting up entry functions --- tests/dummy-indicator-entry-func.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/dummy-indicator-entry-func.c') diff --git a/tests/dummy-indicator-entry-func.c b/tests/dummy-indicator-entry-func.c index 76d8605..bccd818 100644 --- a/tests/dummy-indicator-entry-func.c +++ b/tests/dummy-indicator-entry-func.c @@ -52,6 +52,28 @@ get_accessible_desc (IndicatorObject * io) return NULL; } +static void +entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) +{ + + return; +} + +static void +entry_activate_window (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp) +{ + + return; +} + +static void +entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) +{ + + return; +} + + static void dummy_indicator_entry_func_class_init (DummyIndicatorEntryFuncClass *klass); static void dummy_indicator_entry_func_init (DummyIndicatorEntryFunc *self); static void dummy_indicator_entry_func_dispose (GObject *object); @@ -74,6 +96,10 @@ dummy_indicator_entry_func_class_init (DummyIndicatorEntryFuncClass *klass) io_class->get_menu = get_menu; io_class->get_accessible_desc = get_accessible_desc; + io_class->entry_activate = entry_activate; + io_class->entry_activate_window = entry_activate_window; + io_class->entry_close = entry_close; + return; } -- cgit v1.2.3 From b7c8a634f190e176b1d3b201ff08d861ba5e265b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sat, 14 Jan 2012 10:07:43 +0100 Subject: Mark the entry functions as called --- tests/dummy-indicator-entry-func.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/dummy-indicator-entry-func.c') diff --git a/tests/dummy-indicator-entry-func.c b/tests/dummy-indicator-entry-func.c index bccd818..96e5ad0 100644 --- a/tests/dummy-indicator-entry-func.c +++ b/tests/dummy-indicator-entry-func.c @@ -55,21 +55,24 @@ get_accessible_desc (IndicatorObject * io) static void entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) { - + DummyIndicatorEntryFunc * self = DUMMY_INDICATOR_ENTRY_FUNC(io); + self->entry_activate_called = TRUE; return; } static void entry_activate_window (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp) { - + DummyIndicatorEntryFunc * self = DUMMY_INDICATOR_ENTRY_FUNC(io); + self->entry_activate_window_called = TRUE; return; } static void entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) { - + DummyIndicatorEntryFunc * self = DUMMY_INDICATOR_ENTRY_FUNC(io); + self->entry_close_called = TRUE; return; } -- cgit v1.2.3 From 2dfe3fff249cd22eea6a993dc5ec50b129d961f1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sat, 14 Jan 2012 10:51:55 +0100 Subject: Add a function to swap out the window entry handler --- tests/dummy-indicator-entry-func.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/dummy-indicator-entry-func.c') diff --git a/tests/dummy-indicator-entry-func.c b/tests/dummy-indicator-entry-func.c index 96e5ad0..ac330aa 100644 --- a/tests/dummy-indicator-entry-func.c +++ b/tests/dummy-indicator-entry-func.c @@ -128,3 +128,17 @@ dummy_indicator_entry_func_finalize (GObject *object) G_OBJECT_CLASS (dummy_indicator_entry_func_parent_class)->finalize (object); return; } + +void +dummy_indicator_entry_func_support_window(DummyIndicatorEntryFunc * ind, gboolean different) +{ + DummyIndicatorEntryFuncClass * entry_class = DUMMY_INDICATOR_ENTRY_FUNC_GET_CLASS(ind); + + if (different) { + entry_class->parent_class.entry_activate_window = entry_activate_window; + } else { + entry_class->parent_class.entry_activate_window = NULL; + } + + return; +} -- cgit v1.2.3 From 6a0f41aaa53cb79e03520a8214cc2c9305821496 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 16 Jan 2012 03:59:29 +0100 Subject: Moving the function into the tester to making linking simpler --- tests/dummy-indicator-entry-func.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'tests/dummy-indicator-entry-func.c') diff --git a/tests/dummy-indicator-entry-func.c b/tests/dummy-indicator-entry-func.c index ac330aa..96e5ad0 100644 --- a/tests/dummy-indicator-entry-func.c +++ b/tests/dummy-indicator-entry-func.c @@ -128,17 +128,3 @@ dummy_indicator_entry_func_finalize (GObject *object) G_OBJECT_CLASS (dummy_indicator_entry_func_parent_class)->finalize (object); return; } - -void -dummy_indicator_entry_func_support_window(DummyIndicatorEntryFunc * ind, gboolean different) -{ - DummyIndicatorEntryFuncClass * entry_class = DUMMY_INDICATOR_ENTRY_FUNC_GET_CLASS(ind); - - if (different) { - entry_class->parent_class.entry_activate_window = entry_activate_window; - } else { - entry_class->parent_class.entry_activate_window = NULL; - } - - return; -} -- cgit v1.2.3