From df95abe3008bfdf1385ec04485d796514f15cfd2 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 2 Jun 2005 04:28:11 +0000 Subject: BonoboObject wrapper for Evolution::Component interface. Abstract, doesn't 2005-06-02 Not Zed * evolution-component.c: BonoboObject wrapper for Evolution::Component interface. Abstract, doesn't implement methods. * Evolution-Shell.idl: add a method to find a component by component alias. * e-shell.c (impl_Shell_findComponent): & implement it svn path=/trunk/; revision=29443 --- shell/ChangeLog | 11 +++++++++++ shell/Evolution-Shell.idl | 6 ++++++ shell/Makefile.am | 2 ++ shell/e-shell.c | 25 ++++++++++++++++++++++++ shell/evolution-component.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ shell/evolution-component.h | 45 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 136 insertions(+) create mode 100644 shell/evolution-component.c create mode 100644 shell/evolution-component.h diff --git a/shell/ChangeLog b/shell/ChangeLog index 5e21c59d45..6f7f518807 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,14 @@ +2005-06-02 Not Zed + + * evolution-component.c: BonoboObject wrapper for + Evolution::Component interface. Abstract, doesn't implement + methods. + + * Evolution-Shell.idl: add a method to find a component by + component alias. + + * e-shell.c (impl_Shell_findComponent): & implement it + 2005-06-01 Not Zed * e-shell-window-commands.c: fixed the utf8 in the last patch. diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl index ebd3f69719..f5e2d9b32a 100644 --- a/shell/Evolution-Shell.idl +++ b/shell/Evolution-Shell.idl @@ -48,6 +48,12 @@ module Evolution { */ void setLineStatus (in boolean online) raises (NotReady); + + /* + * Lookup a component by id. + */ + Component findComponent(in string id) + raises (NotReady, ComponentNotFound); }; }; }; diff --git a/shell/Makefile.am b/shell/Makefile.am index 2b9367fc87..171e33cfa6 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -80,11 +80,13 @@ eshellinclude_HEADERS = \ e-shell-utils.h \ e-user-creatable-items-handler.h \ evolution-config-control.h \ + evolution-component.h \ evolution-shell-component-utils.h libeshell_la_SOURCES = \ $(IDL_GENERATED) \ $(MARSHAL_GENERATED) \ + evolution-component.c \ e-shell-utils.c \ e-user-creatable-items-handler.c \ evolution-config-control.c \ diff --git a/shell/e-shell.c b/shell/e-shell.c index 44b05d0a2a..3c229f9e11 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -305,6 +305,30 @@ impl_Shell_setLineStatus (PortableServer_Servant servant, e_shell_go_offline (shell, NULL); } +static GNOME_Evolution_Component +impl_Shell_findComponent(PortableServer_Servant servant, + const CORBA_string id, + CORBA_Environment *ev) +{ + EShell *shell; + EComponentInfo *ci; + + if (raise_exception_if_not_ready (servant, ev)) + return CORBA_OBJECT_NIL; + + shell = (EShell *)bonobo_object_from_servant (servant); + ci = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_ALIAS, id); + if (ci == NULL) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_ComponentNotFound, NULL); + return CORBA_OBJECT_NIL; + } else if (ci->iface == NULL) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_NotReady, NULL); + return CORBA_OBJECT_NIL; + } else { + return ci->iface; + } +} + /* EShellWindow handling and bookkeeping. */ @@ -491,6 +515,7 @@ e_shell_class_init (EShellClass *klass) epv->createNewWindow = impl_Shell_createNewWindow; epv->handleURI = impl_Shell_handleURI; epv->setLineStatus = impl_Shell_setLineStatus; + epv->findComponent = impl_Shell_findComponent; } static void diff --git a/shell/evolution-component.c b/shell/evolution-component.c new file mode 100644 index 0000000000..b9fa313a8c --- /dev/null +++ b/shell/evolution-component.c @@ -0,0 +1,47 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* + * Copyright (C) 2005 Novell, Inc. + * + * Authors: Michael Zucchi + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "evolution-component.h" + +#define PARENT_TYPE bonobo_object_get_type () + +static BonoboObjectClass *parent_class = NULL; + +/* Evolution.Component */ + +/* Initialization */ + +static void +evolution_component_class_init (EvolutionComponentClass *klass) +{ + parent_class = g_type_class_peek_parent (klass); +} + +static void +evolution_component_init(EvolutionComponent *emf, EvolutionComponentClass *klass) +{ +} + +BONOBO_TYPE_FUNC_FULL (EvolutionComponent, GNOME_Evolution_Component, PARENT_TYPE, evolution_component) diff --git a/shell/evolution-component.h b/shell/evolution-component.h new file mode 100644 index 0000000000..737b28bb57 --- /dev/null +++ b/shell/evolution-component.h @@ -0,0 +1,45 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* + * Copyright (C) 2005 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Michael Zucchi + * + * Abstract class wrapper for EvolutionComponent + */ + +#ifndef _EVOLUTION_COMPONENT_H_ +#define _EVOLUTION_COMPONENT_H_ + +#include +#include "Evolution.h" + +typedef struct _EvolutionComponent EvolutionComponent; +typedef struct _EvolutionComponentClass EvolutionComponentClass; + +struct _EvolutionComponent { + BonoboObject parent; +}; + +struct _EvolutionComponentClass { + BonoboObjectClass parent_class; + + POA_GNOME_Evolution_Component__epv epv; +}; + +GType evolution_component_get_type(void); + +#endif /* _EVOLUTION_COMPONENT_H_ */ -- cgit v1.2.3