diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/Makefile.am | 2 | ||||
-rw-r--r-- | shell/e-shell-registry.c | 4 | ||||
-rw-r--r-- | shell/e-shell.c | 11 | ||||
-rw-r--r-- | shell/main.c | 4 | ||||
-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 |
9 files changed, 101 insertions, 302 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am index 13f71d80c4..7cdaf7f048 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -13,7 +13,7 @@ INCLUDES = \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DEVOLUTION_HELPDIR=\""$(evolutionhelpdir)"\" \ - -DEVOLUTION_MODULEDIR=\""$(evolutionmoduledir)"\" \ + -DEVOLUTION_MODULEDIR=\""$(moduledir)"\" \ -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \ -DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \ -DPREFIX=\""$(prefix)"\" \ diff --git a/shell/e-shell-registry.c b/shell/e-shell-registry.c index 5c841398c3..91f489111a 100644 --- a/shell/e-shell-registry.c +++ b/shell/e-shell-registry.c @@ -58,8 +58,6 @@ shell_registry_query_module (const gchar *filename) return; } - g_type_module_unuse (G_TYPE_MODULE (shell_module)); - loaded_modules = g_list_insert_sorted ( loaded_modules, shell_module, (GCompareFunc) e_shell_module_compare); @@ -121,7 +119,7 @@ e_shell_registry_init (void) GList * e_shell_registry_list_modules (void) { - return g_list_copy (loaded_modules); + return loaded_modules; } GType * diff --git a/shell/e-shell.c b/shell/e-shell.c index a91c06dbe7..f617fe27ad 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -60,6 +60,7 @@ shell_shutdown_timeout (void) static guint source_id = 0; static guint message_timer = 1; + /* Module list is read-only; do not free. */ list = e_shell_registry_list_modules (); /* Any module can defer shutdown if it's still busy. */ @@ -79,8 +80,6 @@ shell_shutdown_timeout (void) message_timer = (message_timer + 1) % 10; - g_list_free (list); - /* If we're go for shutdown, destroy all shell windows. Note, * we iterate over a /copy/ of the active windows list because * the act of destroying a shell window will modify the active @@ -118,6 +117,10 @@ e_shell_create_window (void) G_OBJECT (shell_window), (GWeakNotify) shell_window_weak_notify_cb, NULL); + g_list_foreach ( + e_shell_registry_list_modules (), + (GFunc) e_shell_module_window_created, shell_window); + gtk_widget_show (shell_window); return E_SHELL_WINDOW (shell_window); @@ -162,7 +165,9 @@ e_shell_handle_uri (const gchar *uri) void e_shell_send_receive (GtkWindow *parent) { - /* FIXME */ + g_list_foreach ( + e_shell_registry_list_modules (), + (GFunc) e_shell_module_send_and_receive, NULL); } void diff --git a/shell/main.c b/shell/main.c index 533c678236..ab15fdc3db 100644 --- a/shell/main.c +++ b/shell/main.c @@ -35,6 +35,7 @@ #include <e-util/e-icon-factory.h> #include "e-shell-constants.h" +#include "e-shell-registry.h" #include "e-util/e-profile-event.h" #include "e-util/e-util.h" @@ -661,7 +662,8 @@ main (int argc, char **argv) glade_init (); e_cursors_init (); e_icon_factory_init (); - e_passwords_init(); + e_passwords_init (); + e_shell_registry_init (); gtk_window_set_default_icon_name ("evolution"); 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); +} |