diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2007-09-12 03:33:47 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-09-12 03:33:47 +0800 |
commit | b8eefeb931f765e5046244ed98791b7030cec536 (patch) | |
tree | ae5f80a0c6d982dc3f1bfe53efbd0cf1fcc97e87 /shell/test | |
parent | dec7b2460dd1fc901d87cff50cb81bb514a5aef1 (diff) | |
download | gsoc2013-evolution-b8eefeb931f765e5046244ed98791b7030cec536.tar.gz gsoc2013-evolution-b8eefeb931f765e5046244ed98791b7030cec536.tar.zst gsoc2013-evolution-b8eefeb931f765e5046244ed98791b7030cec536.zip |
Move the test component to "shell/test" so it installs properly (#469992).
svn path=/trunk/; revision=34235
Diffstat (limited to 'shell/test')
-rw-r--r-- | shell/test/GNOME_Evolution_Test.server.in.in | 39 | ||||
-rw-r--r-- | shell/test/evolution-test-component.c | 180 | ||||
-rw-r--r-- | shell/test/evolution-test-component.h | 56 |
3 files changed, 275 insertions, 0 deletions
diff --git a/shell/test/GNOME_Evolution_Test.server.in.in b/shell/test/GNOME_Evolution_Test.server.in.in new file mode 100644 index 0000000000..ef0db8b1ac --- /dev/null +++ b/shell/test/GNOME_Evolution_Test.server.in.in @@ -0,0 +1,39 @@ +<oaf_info> + + <!-- (factory) --> + <oaf_server iid="OAFIID:GNOME_Evolution_Test_Factory:@VERSION@" + type="shlib" + location="@COMPONENTDIR_IN_SERVER_FILE@/libevolution-test@SOEXT@"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/ObjectFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="name" type="string" + _value="Evolution Test"/> + </oaf_server> + + <!-- Component Interface --> + + <oaf_server iid="OAFIID:GNOME_Evolution_Test_Component:@VERSION@" + type="factory" + location="OAFIID:GNOME_Evolution_Test_Factory:@VERSION@"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/Evolution/Component:@VERSION@"/> + </oaf_attribute> + + <oaf_attribute name="name" type="string" _value="Evolution Test component"/> + + <oaf_attribute name="evolution:component_alias" type="string" value="test"/> + + <oaf_attribute name="evolution:button_label" type="string" _value="Test"/> + <oaf_attribute name="evolution:button_sort_order" type="string" value="-1"/> + <oaf_attribute name="evolution:button_icon" type="string" value="stock_mail"/> + + <oaf_attribute name="evolution:component_icon" type="string" value="stock_mail"/> + <oaf_attribute name="evolution:component_display_order" type="number" value="1"/> + + </oaf_server> + +</oaf_info> diff --git a/shell/test/evolution-test-component.c b/shell/test/evolution-test-component.c new file mode 100644 index 0000000000..1e1cc92483 --- /dev/null +++ b/shell/test/evolution-test-component.c @@ -0,0 +1,180 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* tasks-component.c + * + * Copyright (C) 2004 Novell, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program 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 for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * Author: JP Rosevear <jpr@ximian.com> + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> +#include <string.h> +#include <bonobo/bonobo-shlib-factory.h> +#include <bonobo/bonobo-control.h> +#include <bonobo/bonobo-i18n.h> +#include <bonobo/bonobo-exception.h> +#include <gtk/gtklabel.h> +#include "e-task-bar.h" +#include "evolution-test-component.h" + + +#define FACTORY_ID "OAFIID:GNOME_Evolution_Test_Factory:" BASE_VERSION +#define TEST_COMPONENT_ID "OAFIID:GNOME_Evolution_Test_Component:" BASE_VERSION +#define CREATE_TEST_ID "test" + +#define PARENT_TYPE bonobo_object_get_type () + +static BonoboObjectClass *parent_class = NULL; + +struct _EvolutionTestComponentPrivate { + BonoboControl *view_control; + BonoboControl *sidebar_control; + BonoboControl *status_control; +}; + +/* GObject methods */ + +static void +impl_dispose (GObject *object) +{ + EvolutionTestComponentPrivate *priv; + + priv = EVOLUTION_TEST_COMPONENT (object)->priv; + + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +static void +impl_finalize (GObject *object) +{ + EvolutionTestComponentPrivate *priv = EVOLUTION_TEST_COMPONENT (object)->priv; + + g_free (priv); + + (* G_OBJECT_CLASS (parent_class)->finalize) (object); +} + +/* Evolution::Component CORBA methods */ + +static CORBA_boolean +impl_upgradeFromVersion (PortableServer_Servant servant, + CORBA_short major, + CORBA_short minor, + CORBA_short revision, + CORBA_Environment *ev) +{ + EvolutionTestComponent *component = EVOLUTION_TEST_COMPONENT (bonobo_object_from_servant (servant)); + EvolutionTestComponentPrivate *priv; + + priv = component->priv; + + g_message ("Upgrading from %d.%d.%d", major, minor, revision); + + return CORBA_TRUE; +} + + +static GNOME_Evolution_CreatableItemTypeList * +impl__get_userCreatableItems (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc (); + + list->_length = 1; + list->_maximum = list->_length; + list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length); + + CORBA_sequence_set_release (list, FALSE); + + list->_buffer[0].id = CREATE_TEST_ID; + list->_buffer[0].description = _("New Test"); + list->_buffer[0].menuDescription = _("_Test"); + list->_buffer[0].tooltip = _("Create a new test item"); + list->_buffer[0].menuShortcut = 'i'; + list->_buffer[0].iconName = ""; + + return list; +} + +static void +impl_requestCreateItem (PortableServer_Servant servant, + const CORBA_char *item_type_name, + CORBA_Environment *ev) +{ + EvolutionTestComponent *evolution_test_component = EVOLUTION_TEST_COMPONENT (bonobo_object_from_servant (servant)); + EvolutionTestComponentPrivate *priv; + + priv = evolution_test_component->priv; + + if (strcmp (item_type_name, CREATE_TEST_ID) == 0) { + g_message ("Creating test item"); + } else { + bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType); + return; + } +} + +/* Initialization */ + +static void +evolution_test_component_class_init (EvolutionTestComponentClass *klass) +{ + POA_GNOME_Evolution_Component__epv *epv = &klass->epv; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + epv->upgradeFromVersion = impl_upgradeFromVersion; + epv->_get_userCreatableItems = impl__get_userCreatableItems; + epv->requestCreateItem = impl_requestCreateItem; + + object_class->dispose = impl_dispose; + object_class->finalize = impl_finalize; +} + +static void +evolution_test_component_init (EvolutionTestComponent *component, EvolutionTestComponentClass *klass) +{ + EvolutionTestComponentPrivate *priv; + + priv = g_new0 (EvolutionTestComponentPrivate, 1); + + component->priv = priv; +} + +BONOBO_TYPE_FUNC_FULL (EvolutionTestComponent, GNOME_Evolution_Component, PARENT_TYPE, evolution_test_component) + +static BonoboObject * +factory (BonoboGenericFactory *factory, + const char *component_id, + void *closure) +{ + if (strcmp (component_id, TEST_COMPONENT_ID) == 0) { + BonoboObject *object = BONOBO_OBJECT (g_object_new (EVOLUTION_TEST_TYPE_COMPONENT, NULL)); + bonobo_object_ref (object); + return object; + } + + g_warning (FACTORY_ID ": Don't know what to do with %s", component_id); + + return NULL; +} + +BONOBO_ACTIVATION_SHLIB_FACTORY (FACTORY_ID, "Evolution Calendar component factory", factory, NULL) diff --git a/shell/test/evolution-test-component.h b/shell/test/evolution-test-component.h new file mode 100644 index 0000000000..598ddbedb5 --- /dev/null +++ b/shell/test/evolution-test-component.h @@ -0,0 +1,56 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* evolution-test-component.h + * + * Copyright (C) 2004 Novell, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program 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 for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * Author: JP Rosevear <jpr@ximian.com> + */ + +#ifndef _EVOLUTION_TEST_COMPONENT_H_ +#define _EVOLUTION_TEST_COMPONENT_H_ + +#include <bonobo/bonobo-object.h> +#include "Evolution.h" + + +#define EVOLUTION_TEST_TYPE_COMPONENT (evolution_test_component_get_type ()) +#define EVOLUTION_TEST_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TEST_TYPE_COMPONENT, EvolutionTestComponent)) +#define EVOLUTION_TEST_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TEST_TYPE_COMPONENT, EvolutionTestComponentClass)) +#define EVOLUTION_TEST_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TEST_TYPE_COMPONENT)) +#define EVOLUTION_TEST_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TEST_TYPE_COMPONENT)) + + +typedef struct _EvolutionTestComponent EvolutionTestComponent; +typedef struct _EvolutionTestComponentPrivate EvolutionTestComponentPrivate; +typedef struct _EvolutionTestComponentClass EvolutionTestComponentClass; + +struct _EvolutionTestComponent { + BonoboObject parent; + + EvolutionTestComponentPrivate *priv; +}; + +struct _EvolutionTestComponentClass { + BonoboObjectClass parent_class; + + POA_GNOME_Evolution_Component__epv epv; +}; + + +GType evolution_test_component_get_type (void); + +#endif /* _EVOLUTION_TEST_COMPONENT_H_ */ |