diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-05-25 13:55:59 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-05-25 13:55:59 +0800 |
commit | bb241192eb773d7f0d178306dd55f9ca8e31c1f0 (patch) | |
tree | 4201777027364eeea243b2f625bb373bca30ef6d /calendar | |
parent | e90eea58a2109961faa8632ac5e5783d9970366b (diff) | |
download | gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.gz gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.bz2 gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.lz gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.xz gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.zst gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.zip |
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
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 22 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar.oaf.in | 29 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar.oafinfo | 29 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in | 29 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo | 29 | ||||
-rw-r--r-- | calendar/gui/Makefile.am | 20 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 96 | ||||
-rw-r--r-- | calendar/gui/calendar-component.h | 29 | ||||
-rw-r--r-- | calendar/gui/component-factory.c | 96 | ||||
-rw-r--r-- | calendar/gui/component-factory.h | 29 | ||||
-rw-r--r-- | calendar/gui/control-factory.c | 193 | ||||
-rw-r--r-- | calendar/gui/control-factory.h | 30 | ||||
-rw-r--r-- | calendar/gui/evolution-calendar-control.c | 24 | ||||
-rw-r--r-- | calendar/gui/evolution-calendar.gnorba | 11 | ||||
-rw-r--r-- | calendar/gui/evolution-calendar.oafinfo | 29 | ||||
-rw-r--r-- | calendar/gui/main.c | 93 |
16 files changed, 772 insertions, 16 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index e8c682efe9..14fe6509ce 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,25 @@ +2000-05-25 Ettore Perazzoli <ettore@helixcode.com> + + * gui/evolution-calendar-control.c: Removed. + + * gui/main.c: New. + + * gui/control-factory.c: New. + * gui/control-factory.h: New. + + * gui/calendar-component-factory.c: New. + * gui/calendar-component-factory.c: New. + + * gui/evolution-calendar-control.c (calendar_control_factory): + Renamed from `calendar_factory'. + (calendar_control_factory_init): Renamed from + `calendar_factory_init'. + + * gui/Makefile.am: Link with the files from `$(builddir)/shell'. + + * gui/evolution-calendar.gnorba: New. + * gui/evolution-calendar.oafinfo: New. + 2000-05-24 Christopher James Lahey <clahey@helixcode.com> * gui/Makefile.am: Added libepaned.a. diff --git a/calendar/gui/GNOME_Evolution_Calendar.oaf.in b/calendar/gui/GNOME_Evolution_Calendar.oaf.in new file mode 100644 index 0000000000..c8a4907854 --- /dev/null +++ b/calendar/gui/GNOME_Evolution_Calendar.oaf.in @@ -0,0 +1,29 @@ +<oaf_info> + +<oaf_server iid="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921" + type="exe" + location="evolution-calendar"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Bonobo/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Factory for the Evolution calendar component."/> + +</oaf_server> + +<oaf_server iid="OAFIID:evolution-shell-component:evolution-calendar:2eb9eb63-d305-4918-9c35-faae5db19e51" + type="factory" + location="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Evolution/ShellComponent:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Evolution component for handling the calendar."/> + +</oaf_server> + +</oaf_info> diff --git a/calendar/gui/GNOME_Evolution_Calendar.oafinfo b/calendar/gui/GNOME_Evolution_Calendar.oafinfo new file mode 100644 index 0000000000..c8a4907854 --- /dev/null +++ b/calendar/gui/GNOME_Evolution_Calendar.oafinfo @@ -0,0 +1,29 @@ +<oaf_info> + +<oaf_server iid="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921" + type="exe" + location="evolution-calendar"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Bonobo/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Factory for the Evolution calendar component."/> + +</oaf_server> + +<oaf_server iid="OAFIID:evolution-shell-component:evolution-calendar:2eb9eb63-d305-4918-9c35-faae5db19e51" + type="factory" + location="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Evolution/ShellComponent:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Evolution component for handling the calendar."/> + +</oaf_server> + +</oaf_info> diff --git a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in new file mode 100644 index 0000000000..c8a4907854 --- /dev/null +++ b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in @@ -0,0 +1,29 @@ +<oaf_info> + +<oaf_server iid="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921" + type="exe" + location="evolution-calendar"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Bonobo/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Factory for the Evolution calendar component."/> + +</oaf_server> + +<oaf_server iid="OAFIID:evolution-shell-component:evolution-calendar:2eb9eb63-d305-4918-9c35-faae5db19e51" + type="factory" + location="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Evolution/ShellComponent:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Evolution component for handling the calendar."/> + +</oaf_server> + +</oaf_info> diff --git a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo new file mode 100644 index 0000000000..c8a4907854 --- /dev/null +++ b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo @@ -0,0 +1,29 @@ +<oaf_info> + +<oaf_server iid="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921" + type="exe" + location="evolution-calendar"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Bonobo/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Factory for the Evolution calendar component."/> + +</oaf_server> + +<oaf_server iid="OAFIID:evolution-shell-component:evolution-calendar:2eb9eb63-d305-4918-9c35-faae5db19e51" + type="factory" + location="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Evolution/ShellComponent:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Evolution component for handling the calendar."/> + +</oaf_server> + +</oaf_info> diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 972cb893fd..737a1df49a 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -7,6 +7,8 @@ CPPFLAGS = \ INCLUDES = \ -DG_LOG_DOMAIN=\"calendar-gui\" \ + -I$(top_builddir)/shell \ + -I$(top_srcdir)/shell \ -I$(top_srcdir) \ -I$(top_srcdir)/calendar \ -I$(top_srcdir)/libical/src/libical \ @@ -39,6 +41,10 @@ evolution_calendar_SOURCES = \ alarm.h \ calendar-commands.c \ calendar-commands.h \ + control-factory.c \ + control-factory.h \ + component-factory.c \ + component-factory.h \ e-day-view-main-item.c \ e-day-view-main-item.h \ e-day-view-time-item.c \ @@ -59,7 +65,6 @@ evolution_calendar_SOURCES = \ event-editor.h \ event-editor-utils.c \ event-editor-utils.h \ - evolution-calendar-control.c \ getdate.y \ gncal-todo.c \ gncal-todo.h \ @@ -70,6 +75,7 @@ evolution_calendar_SOURCES = \ goto.c \ layout.c \ layout.h \ + main.c \ mark.c \ mark.h \ popup-menu.c \ @@ -78,7 +84,15 @@ evolution_calendar_SOURCES = \ print.h \ prop.c +# 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_calendar_LDADD = \ + $(SHELL_OBJS) \ $(EXTRA_GNOME_LIBS) \ $(BONOBO_HTML_GNOME_LIBS) \ $(top_builddir)/widgets/e-text/libetext.a \ @@ -89,10 +103,10 @@ evolution_calendar_LDFLAGS = `gnome-config --libs gdk_pixbuf` if USING_OAF oafdir = $(datadir)/oaf -oaf_DATA = calendar-control.oafinfo +oaf_DATA = calendar-control.oafinfo evolution-calendar.oafinfo else gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = calendar-control.gnorba +gnorba_DATA = calendar-control.gnorba evolution-calendar.gnorba endif EXTRA_DIST = \ diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c new file mode 100644 index 0000000000..ffc8055609 --- /dev/null +++ b/calendar/gui/calendar-component.c @@ -0,0 +1,96 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* component-factory.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 <config.h> +#endif + +#include <bonobo.h> + +#include "evolution-shell-component.h" + +#include "component-factory.h" + + +#ifdef USING_OAF +#define COMPONENT_FACTORY_ID "OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921" +#else +#define COMPONENT_FACTORY_ID "evolution-shell-component-factory:evolution-calendar" +#endif + +static BonoboGenericFactory *factory = NULL; + +static const EvolutionShellComponentFolderType folder_types[] = { + { "calendar", "evolution-calendar.png" }, + { NULL, NULL } +}; + + +/* EvolutionShellComponent methods and signals. */ + +static BonoboControl * +create_view (EvolutionShellComponent *shell_component, + const char *physical_uri, + void *closure) +{ + /* FIXME: The calendar has no way to specify the physical URI. */ + + return control_factory_new_control (); +} + +static void +owner_set_cb (EvolutionShellComponent *shell_component, + Evolution_Shell shell_interface) +{ + g_print ("evolution-calendar: 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 +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 Evolution's calendar component."); +} diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h new file mode 100644 index 0000000000..f83a849452 --- /dev/null +++ b/calendar/gui/calendar-component.h @@ -0,0 +1,29 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* component-factory.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 _COMPONENT_FACTORY_H_ +#define _COMPONENT_FACTORY_H_ + +void component_factory_init (void); + +#endif /* _COMPONENT_FACTORY_H_ */ diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c new file mode 100644 index 0000000000..ffc8055609 --- /dev/null +++ b/calendar/gui/component-factory.c @@ -0,0 +1,96 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* component-factory.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 <config.h> +#endif + +#include <bonobo.h> + +#include "evolution-shell-component.h" + +#include "component-factory.h" + + +#ifdef USING_OAF +#define COMPONENT_FACTORY_ID "OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921" +#else +#define COMPONENT_FACTORY_ID "evolution-shell-component-factory:evolution-calendar" +#endif + +static BonoboGenericFactory *factory = NULL; + +static const EvolutionShellComponentFolderType folder_types[] = { + { "calendar", "evolution-calendar.png" }, + { NULL, NULL } +}; + + +/* EvolutionShellComponent methods and signals. */ + +static BonoboControl * +create_view (EvolutionShellComponent *shell_component, + const char *physical_uri, + void *closure) +{ + /* FIXME: The calendar has no way to specify the physical URI. */ + + return control_factory_new_control (); +} + +static void +owner_set_cb (EvolutionShellComponent *shell_component, + Evolution_Shell shell_interface) +{ + g_print ("evolution-calendar: 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 +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 Evolution's calendar component."); +} diff --git a/calendar/gui/component-factory.h b/calendar/gui/component-factory.h new file mode 100644 index 0000000000..f83a849452 --- /dev/null +++ b/calendar/gui/component-factory.h @@ -0,0 +1,29 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* component-factory.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 _COMPONENT_FACTORY_H_ +#define _COMPONENT_FACTORY_H_ + +void component_factory_init (void); + +#endif /* _COMPONENT_FACTORY_H_ */ diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c new file mode 100644 index 0000000000..a55d0dac79 --- /dev/null +++ b/calendar/gui/control-factory.c @@ -0,0 +1,193 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* control-factory.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 <config.h> +#endif + +#include <config.h> +#include <gnome.h> +#include <glade/glade.h> +#include <bonobo.h> +#include <bonobo/bonobo-control.h> +#include <glade/glade.h> + +#ifdef USING_OAF +#include <liboaf/liboaf.h> +#else +#include <libgnorba/gnorba.h> +#endif + +#include <cal-util/timeutil.h> +#include <gui/alarm.h> +#include <gui/eventedit.h> +#include <gui/gnome-cal.h> +#include <gui/calendar-commands.h> + +#include "control-factory.h" + +#define PROPERTY_CALENDAR_URI "folder_uri" + +#define PROPERTY_CALENDAR_URI_IDX 1 + +#ifdef USING_OAF +#define CONTROL_FACTORY_ID "OAFIID:control-factory:calendar:f4f90989-0f50-4af2-ad94-8bbdf331f0bc" +#else +#define CONTROL_FACTORY_ID "control-factory:calendar" +#endif + + +CORBA_Environment ev; +CORBA_ORB orb; + + +static void +control_activate_cb (BonoboControl *control, + gboolean activate, + gpointer user_data) +{ + if (activate) + calendar_control_activate (control, user_data); + else + calendar_control_deactivate (control); +} + + +static void +get_prop (BonoboPropertyBag *bag, + BonoboArg *arg, + guint arg_id, + gpointer user_data) +{ + /*GnomeCalendar *gcal = user_data;*/ + + switch (arg_id) { + + case PROPERTY_CALENDAR_URI_IDX: + /* + if (fb && fb->uri) + BONOBO_ARG_SET_STRING (arg, fb->uri); + else + BONOBO_ARG_SET_STRING (arg, ""); + */ + break; + + default: + g_warning ("Unhandled arg %d\n", arg_id); + } +} + + +static void +set_prop (BonoboPropertyBag *bag, + const BonoboArg *arg, + guint arg_id, + gpointer user_data) +{ + GnomeCalendar *gcal = user_data; + char *filename; + + switch (arg_id) { + + case PROPERTY_CALENDAR_URI_IDX: + printf ("set_prop: '%s'\n", BONOBO_ARG_GET_STRING (arg)); + filename = g_strdup_printf ("%s/calendar.vcf", + BONOBO_ARG_GET_STRING (arg)); + calendar_set_uri (gcal, filename); + g_free (filename); + break; + + default: + g_warning ("Unhandled arg %d\n", arg_id); + break; + } +} + + +static void +calendar_properties_init (GnomeCalendar *gcal) +{ + gcal->properties = bonobo_property_bag_new (get_prop, set_prop, gcal); + + bonobo_property_bag_add (gcal->properties, + PROPERTY_CALENDAR_URI, + PROPERTY_CALENDAR_URI_IDX, + BONOBO_ARG_STRING, + NULL, + _("The URI that the calendar will display"), + 0); + + bonobo_control_set_property_bag (gcal->control, gcal->properties); +} + + +static BonoboControl * +create_control (void) +{ + BonoboControl *control; + GnomeCalendar *cal; + + cal = new_calendar (full_name, NULL, NULL, 0); + gtk_widget_show (GTK_WIDGET (cal)); + + control = bonobo_control_new (GTK_WIDGET (cal)); + cal->control = control; + + calendar_properties_init (cal); + + gtk_signal_connect (GTK_OBJECT (control), "activate", + control_activate_cb, cal); + + return control; +} + + +static BonoboObject * +control_factory (BonoboGenericFactory *Factory, void *closure) +{ + return BONOBO_OBJECT (create_control ()); +} + + +void +control_factory_init (void) +{ + static BonoboGenericFactory *factory = NULL; + + if (factory != NULL) + return; + + puts ("XXXXXX - initializing calendar factory!!!"); + + factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, control_factory, NULL); + + if (factory == NULL) + g_error ("I could not register a Calendar control factory."); +} + + +BonoboControl * +control_factory_new_control (void) +{ + return create_control (); +} diff --git a/calendar/gui/control-factory.h b/calendar/gui/control-factory.h new file mode 100644 index 0000000000..bacd2d3d90 --- /dev/null +++ b/calendar/gui/control-factory.h @@ -0,0 +1,30 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* control-factory.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: Federico Mena Quintero + */ + +#ifndef _CONTROL_FACTORY_H_ +#define _CONTROL_FACTORY_H_ + +void control_factory_init (void); +BonoboControl *control_factory_new_control (void); + +#endif /* _CONTROL_FACTORY_H_ */ diff --git a/calendar/gui/evolution-calendar-control.c b/calendar/gui/evolution-calendar-control.c index 9f8760fd3f..90b4f26cd4 100644 --- a/calendar/gui/evolution-calendar-control.c +++ b/calendar/gui/evolution-calendar-control.c @@ -24,9 +24,9 @@ #define PROPERTY_CALENDAR_URI_IDX 1 #ifdef USING_OAF -#define CONTROL_FACTORY_ID "OAFIID:control-factory:calendar:f4f90989-0f50-4af2-ad94-8bbdf331f0bc" +#define CONTROL_FACTORY_ID "OAFIID:control-factory:calendar:f4f90989-0f50-4af2-ad94-8bbdf331f0bc" #else -#define CONTROL_FACTORY_ID "control-factory:calendar" +#define CONTROL_FACTORY_ID "control-factory:calendar" #endif CORBA_Environment ev; @@ -138,7 +138,7 @@ calendar_properties_init (GnomeCalendar *gcal) static BonoboObject * -calendar_factory (BonoboGenericFactory *Factory, void *closure) +calendar_control_factory (BonoboGenericFactory *Factory, void *closure) { BonoboControl *control; @@ -160,22 +160,19 @@ calendar_factory (BonoboGenericFactory *Factory, void *closure) static void -calendar_factory_init (void) +calendar_control_factory_init (void) { - static BonoboGenericFactory *calendar_control_factory = NULL; + static BonoboGenericFactory *factory = NULL; - if (calendar_control_factory != NULL) + if (factory != NULL) return; puts ("XXXXXX - initializing calendar factory!!!"); - calendar_control_factory = - bonobo_generic_factory_new (CONTROL_FACTORY_ID, - calendar_factory, NULL); + factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, calendar_control_factory, NULL); - if (calendar_control_factory == NULL) { - g_error ("I could not register a Calendar factory."); - } + if (factory == NULL) + g_error ("I could not register a Calendar control factory."); } @@ -195,7 +192,8 @@ main (int argc, char **argv) CORBA_exception_init (&ev); - calendar_factory_init (); + calendar_control_factory_init (); + component_factory_init (); bonobo_main (); diff --git a/calendar/gui/evolution-calendar.gnorba b/calendar/gui/evolution-calendar.gnorba new file mode 100644 index 0000000000..e2f1107926 --- /dev/null +++ b/calendar/gui/evolution-calendar.gnorba @@ -0,0 +1,11 @@ +[evolution-shell-component-factory:evolution-calendar] +type=exe +repo_id=IDL:Bonobo/GenericFactory:1.0 +description=Factory for the Evolution calendar component. +location_info=evolution-calendar + +[evolution-shell-component:evolution-calendar] +type=factory +repo_id=IDL:Evolution/ShellComponent:1.0 +description=Evolution component for handling the calendar. +location_info=evolution-shell-component-factory:evolution-calendar diff --git a/calendar/gui/evolution-calendar.oafinfo b/calendar/gui/evolution-calendar.oafinfo new file mode 100644 index 0000000000..c8a4907854 --- /dev/null +++ b/calendar/gui/evolution-calendar.oafinfo @@ -0,0 +1,29 @@ +<oaf_info> + +<oaf_server iid="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921" + type="exe" + location="evolution-calendar"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Bonobo/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Factory for the Evolution calendar component."/> + +</oaf_server> + +<oaf_server iid="OAFIID:evolution-shell-component:evolution-calendar:2eb9eb63-d305-4918-9c35-faae5db19e51" + type="factory" + location="OAFIID:evolution-shell-component-factory:evolution-calendar:cba77062-1466-4aac-8ce7-b019eaf2e921"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Evolution/ShellComponent:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Evolution component for handling the calendar."/> + +</oaf_server> + +</oaf_info> diff --git a/calendar/gui/main.c b/calendar/gui/main.c new file mode 100644 index 0000000000..f1263b69e3 --- /dev/null +++ b/calendar/gui/main.c @@ -0,0 +1,93 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* control-factory.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 <config.h> +#endif + +#include <gnome.h> +#include <glade/glade.h> +#include <bonobo.h> +#include <bonobo/bonobo-control.h> +#include <glade/glade.h> + +#ifdef USING_OAF +#include <liboaf/liboaf.h> +#else +#include <libgnorba/gnorba.h> +#endif + +#include <cal-util/timeutil.h> +#include <gui/alarm.h> +#include <gui/eventedit.h> +#include <gui/gnome-cal.h> +#include <gui/calendar-commands.h> + + +static void +init_bonobo (int *argc, char **argv) +{ +#ifdef USING_OAF + /* FIXME: VERSION instead of "0.0". */ + gnome_init_with_popt_table ("evolution-calendar", "0.0", + *argc, argv, oaf_popt_options, + 0, NULL); + oaf_init (*argc, argv); +#else + CORBA_Environment ev; + + CORBA_exception_init (&ev); + gnome_CORBA_init_with_popt_table ( + "evolution-calendar", "0.0", + argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); + CORBA_exception_free (&ev); +#endif + + if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) + g_error (_("Could not initialize Bonobo")); + + glade_gnome_init (); +} + + +int +main (int argc, char **argv) +{ + init_bonobo (&argc, argv); + glade_gnome_init (); + alarm_init (); + + init_calendar (); + + //g_log_set_always_fatal ((GLogLevelFlags) 0xFFFF); + g_log_set_always_fatal (G_LOG_LEVEL_ERROR | + G_LOG_LEVEL_CRITICAL | + G_LOG_LEVEL_WARNING); + + control_factory_init (); + component_factory_init (); + + bonobo_main (); + + return 0; +} |