From bb241192eb773d7f0d178306dd55f9ca8e31c1f0 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Thu, 25 May 2000 05:55:59 +0000 Subject: Reorganized the shell to allow dynamic registration of storages and folder types, and changed all the components to work with the new setup. svn path=/trunk/; revision=3199 --- .../component/GNOME_Evolution_Addressbook.oaf.in | 26 ++++++ .../component/GNOME_Evolution_Addressbook.oafinfo | 26 ++++++ addressbook/gui/component/Makefile.am | 13 +++ addressbook/gui/component/addressbook-component.c | 99 ++++++++++++++++++++++ addressbook/gui/component/addressbook-component.h | 29 +++++++ addressbook/gui/component/addressbook-factory.c | 7 ++ addressbook/gui/component/addressbook.c | 12 ++- addressbook/gui/component/addressbook.gnorba | 12 +++ addressbook/gui/component/addressbook.h | 3 +- addressbook/gui/component/addressbook.oafinfo | 26 ++++++ 10 files changed, 249 insertions(+), 4 deletions(-) create mode 100644 addressbook/gui/component/addressbook-component.c create mode 100644 addressbook/gui/component/addressbook-component.h (limited to 'addressbook/gui/component') diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in index 8f51a1f07a..15820b2e03 100644 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in +++ b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in @@ -27,4 +27,30 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo b/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo index 8f51a1f07a..15820b2e03 100644 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo +++ b/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo @@ -27,4 +27,30 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am index 1a1752ea07..c122fa571c 100644 --- a/addressbook/gui/component/Makefile.am +++ b/addressbook/gui/component/Makefile.am @@ -6,6 +6,9 @@ INCLUDES = \ $(EXTRA_GNOME_CFLAGS) \ $(GNOME_INCLUDEDIR) \ -I$(top_srcdir) \ + -I$(top_builddir) \ + -I$(top_srcdir)/shell \ + -I$(top_builddir)/shell \ -I$(top_srcdir)/widgets/e-text \ -I$(top_srcdir)/widgets/e-table \ -I$(top_srcdir)/addressbook/gui/minicard \ @@ -27,11 +30,21 @@ evolution_addressbook_SOURCES = \ e-ldap-server-dialog.h \ e-addressbook-model.c \ e-addressbook-model.h \ + addressbook-component.c \ + addressbook-component.h \ addressbook-factory.c \ addressbook.c \ addressbook.h +# FIXME We should make a libeshell library instead of this gross hack. +SHELL_OBJS = \ + $(top_builddir)/shell/Evolution-common.o \ + $(top_builddir)/shell/Evolution-stubs.o \ + $(top_builddir)/shell/Evolution-skels.o \ + $(top_builddir)/shell/evolution-shell-component.o + evolution_addressbook_LDADD = \ + $(SHELL_OBJS) \ $(EXTRA_GNOME_LIBS) \ $(BONOBO_HTML_GNOME_LIBS) \ $(top_builddir)/addressbook/gui/minicard/libeminicard.a \ diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c new file mode 100644 index 0000000000..a3f3dd4fd0 --- /dev/null +++ b/addressbook/gui/component/addressbook-component.c @@ -0,0 +1,99 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* addressbook-component.c + * + * Copyright (C) 2000 Helix Code, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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: Ettore Perazzoli + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include "evolution-shell-component.h" + +#include "addressbook-component.h" + + +#ifdef USING_OAF +#define COMPONENT_FACTORY_ID "OAFIID:evolution-shell-component-factory:addressbook:dbf3bba0-4b0a-4f07-899b-1ec56fdf38a0" +#else +#define COMPONENT_FACTORY_ID "evolution-shell-component-factory:addressbook" +#endif + +static BonoboGenericFactory *factory = NULL; + +static const EvolutionShellComponentFolderType folder_types[] = { + { "contacts", "evolution-contacts.png" }, + { NULL, NULL } +}; + + +/* EvolutionShellComponent methods and signals. */ + +static BonoboControl * +create_view (EvolutionShellComponent *shell_component, + const char *physical_uri, + void *closure) +{ + BonoboControl *control; + + control = addressbook_factory_new_control (); + bonobo_control_set_property (control, "folder_uri", physical_uri, NULL); + + return control; +} + +static void +owner_set_cb (EvolutionShellComponent *shell_component, + Evolution_Shell shell_interface) +{ + g_print ("addressbook: Yeeeh! We have an owner!\n"); /* FIXME */ +} + + +/* The factory function. */ + +static BonoboObject * +factory_fn (BonoboGenericFactory *factory, + void *closure) +{ + EvolutionShellComponent *shell_component; + + shell_component = evolution_shell_component_new (folder_types, create_view, NULL); + + gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", + GTK_SIGNAL_FUNC (owner_set_cb), NULL); + + return BONOBO_OBJECT (shell_component); +} + + +void +addressbook_component_factory_init (void) +{ + if (factory != NULL) + return; + + factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL); + + if (factory == NULL) + g_error ("Cannot initialize the Evolution addressbook factory."); +} diff --git a/addressbook/gui/component/addressbook-component.h b/addressbook/gui/component/addressbook-component.h new file mode 100644 index 0000000000..ec37da694a --- /dev/null +++ b/addressbook/gui/component/addressbook-component.h @@ -0,0 +1,29 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* addressbook-component.h + * + * Copyright (C) 2000 Helix Code, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * 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: Ettore Perazzoli + */ + +#ifndef _ADDRESSBOOK_COMPONENT_H +#define _ADDRESSBOOK_COMPONENT_H + +void addressbook_component_factory_init (void); + +#endif /* _ADDRESSBOOK_COMPONENT_H */ diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c index 4761f9aa7a..f16c321b68 100644 --- a/addressbook/gui/component/addressbook-factory.c +++ b/addressbook/gui/component/addressbook-factory.c @@ -15,6 +15,7 @@ #include #include "addressbook.h" +#include "addressbook-component.h" #ifdef USING_OAF @@ -65,7 +66,13 @@ main (int argc, char **argv) init_bonobo (argc, argv); + /* FIXME: Messy names here. This file should be `main.c'. `addressbook.c' should + be `addressbook-control-factory.c' and the functions should be called + `addressbook_control_factory_something()'. And `addressbook-component.c' + should be `addressbook-component-factory.c'. */ + addressbook_factory_init (); + addressbook_component_factory_init (); e_cursors_init(); diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index af57378d5b..8421aa074b 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -822,8 +822,8 @@ change_view_type (AddressbookView *view, AddressbookViewType view_type) } -static BonoboObject * -addressbook_factory (BonoboGenericFactory *Factory, void *closure) +BonoboControl * +addressbook_factory_new_control (void) { AddressbookView *view; @@ -863,7 +863,13 @@ addressbook_factory (BonoboGenericFactory *Factory, void *closure) gtk_signal_connect (GTK_OBJECT (view->control), "activate", control_activate_cb, view); - return BONOBO_OBJECT (view->control); + return view->control; +} + +static BonoboObject * +addressbook_factory (BonoboGenericFactory *Factory, void *closure) +{ + return BONOBO_OBJECT (addressbook_factory_new_control ()); } void diff --git a/addressbook/gui/component/addressbook.gnorba b/addressbook/gui/component/addressbook.gnorba index 7114b1c332..bc3830686d 100644 --- a/addressbook/gui/component/addressbook.gnorba +++ b/addressbook/gui/component/addressbook.gnorba @@ -9,3 +9,15 @@ type=factory repo_id=IDL:BonoboControl/addressbook-control:1.0 IDL:GNOME/Control:1.0 description=A sample Bonobo control which displays an addressbook. location_info=control-factory:addressbook + +[evolution-shell-component-factory:addressbook] +type=exe +repo_id=IDL:GNOME/GenericFactory:1.0 +description=Factory for the Evolution addressbook component. +location_info=evolution-addressbook + +[evolution-shell-component:addressbook] +type=factory +repo_id=IDL:Evolution/ShellComponent:1.0 +description=Evolution component for handling contacts. +location_info=evolution-shell-component-factory:addressbook diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h index e9289128a6..66c5a7e4e6 100644 --- a/addressbook/gui/component/addressbook.h +++ b/addressbook/gui/component/addressbook.h @@ -3,6 +3,7 @@ #include -void addressbook_factory_init (void); +BonoboControl *addressbook_factory_new_control (void); +void addressbook_factory_init (void); #endif /* __ADDRESSBOOK_H__ */ diff --git a/addressbook/gui/component/addressbook.oafinfo b/addressbook/gui/component/addressbook.oafinfo index 8f51a1f07a..15820b2e03 100644 --- a/addressbook/gui/component/addressbook.oafinfo +++ b/addressbook/gui/component/addressbook.oafinfo @@ -27,4 +27,30 @@ + + + + + + + + + + + + + + + + + + + + -- cgit