diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-08-14 06:22:49 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-08-14 06:22:49 +0800 |
commit | 4fe52955d1583e6895bf85cf62b08102d0923962 (patch) | |
tree | f9cc67795e7fadc3b4ec31e90e3800fb1ad077bd /shell/test | |
parent | 08bd7765721e5d866c4d7a546b94f691cf62d972 (diff) | |
download | gsoc2013-evolution-4fe52955d1583e6895bf85cf62b08102d0923962.tar.gz gsoc2013-evolution-4fe52955d1583e6895bf85cf62b08102d0923962.tar.zst gsoc2013-evolution-4fe52955d1583e6895bf85cf62b08102d0923962.zip |
Demonstrate loading the test module.
svn path=/branches/kill-bonobo/; revision=35983
Diffstat (limited to 'shell/test')
-rw-r--r-- | shell/test/GNOME_Evolution_Test.server.in.in | 39 | ||||
-rw-r--r-- | shell/test/Makefile.am | 21 | ||||
-rw-r--r-- | shell/test/evolution-test-component.c | 180 | ||||
-rw-r--r-- | shell/test/evolution-test-component.h | 56 | ||||
-rw-r--r-- | shell/test/evolution-test-module.c | 86 |
5 files changed, 88 insertions, 294 deletions
diff --git a/shell/test/GNOME_Evolution_Test.server.in.in b/shell/test/GNOME_Evolution_Test.server.in.in deleted file mode 100644 index ef0db8b1ac..0000000000 --- a/shell/test/GNOME_Evolution_Test.server.in.in +++ /dev/null @@ -1,39 +0,0 @@ -<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/Makefile.am b/shell/test/Makefile.am index 266685064c..f667ee42fe 100644 --- a/shell/test/Makefile.am +++ b/shell/test/Makefile.am @@ -1,4 +1,4 @@ -component_LTLIBRARIES = libevolution-test.la +module_LTLIBRARIES = libevolution-test.la INCLUDES = \ -I$(top_srcdir)/shell \ @@ -8,8 +8,7 @@ INCLUDES = \ $(EVOLUTION_TEST_CFLAGS) libevolution_test_la_SOURCES = \ - evolution-test-component.c \ - evolution-test-component.h + evolution-test-module.c libevolution_test_la_LIBADD = \ $(top_builddir)/shell/libeshell.la \ @@ -17,19 +16,3 @@ libevolution_test_la_LIBADD = \ libevolution_test_la_LDFLAGS = \ -avoid-version -module $(NO_UNDEFINED) - -testserver_in_files = GNOME_Evolution_Test.server.in.in -testserver_DATA = $(testserver_in_files:.server.in.in=.server) -testserverdir = $(serverdir) -@EVO_SERVER_RULE@ -@INTLTOOL_SERVER_RULE@ - -BUILT_SOURCES = $(testserver_DATA) -CLEANFILES = $(BUILT_SOURCES) - -EXTRA_DIST = \ - $(testserver_in_files) \ - GNOME_Evolution_Test.server.in.in - -dist-hook: - cd $(distdir); rm -f $(BUILD_SOURCES) diff --git a/shell/test/evolution-test-component.c b/shell/test/evolution-test-component.c deleted file mode 100644 index 88a7b05bf9..0000000000 --- a/shell/test/evolution-test-component.c +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* tasks-component.c - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * 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 <glib/gi18n.h> -#include <bonobo/bonobo-shlib-factory.h> -#include <bonobo/bonobo-control.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 = (char *) C_("New", "_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 deleted file mode 100644 index 2f8cc3722a..0000000000 --- a/shell/test/evolution-test-component.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* evolution-test-component.h - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * 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_ */ diff --git a/shell/test/evolution-test-module.c b/shell/test/evolution-test-module.c new file mode 100644 index 0000000000..a2ec2c7915 --- /dev/null +++ b/shell/test/evolution-test-module.c @@ -0,0 +1,86 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* e-test-module.c + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + * 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. + */ + +#include <e-shell-module.h> + +#define MODULE_SORT_ORDER 100 +#define MODULE_ALIASES "test" +#define MODULE_SCHEMES "" + +/* Module Entry Point */ +void e_shell_module_init (GTypeModule *module); + +static gboolean +test_module_is_busy (void) +{ + g_debug ("%s", G_STRFUNC); + + return FALSE; +} + +static gboolean +test_module_shutdown (void) +{ + g_debug ("%s", G_STRFUNC); + + return TRUE; +} + +static gboolean +test_module_handle_uri (const gchar *uri) +{ + g_debug ("%s (uri=%s)", G_STRFUNC, uri); + + return TRUE; +} + +static void +test_module_send_and_receive (void) +{ + g_debug ("%s", G_STRFUNC); +} + +static void +test_module_window_created (EShellWindow *window) +{ + g_debug ("%s (window=%p)", G_STRFUNC, window); +} + +static EShellModuleInfo module_info = { + + MODULE_SORT_ORDER, + MODULE_ALIASES, + MODULE_SCHEMES, + G_TYPE_INVALID, + + /* Methods */ + test_module_is_busy, + test_module_shutdown, + test_module_handle_uri, + test_module_send_and_receive, + test_module_window_created +}; + +void +e_shell_module_init (GTypeModule *module) +{ + g_type_module_set_name (module, "name"); + e_shell_module_set_info (E_SHELL_MODULE (module), &module_info); +} |