aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-01-14 05:15:25 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-01-14 05:15:25 +0800
commit3c89e1aa0252c6f558cf1573b39ab3a366cd4516 (patch)
treed6a3fa36c60ef5beef62f75e10f0021a20677fb5
parent8b75a400feebc8b524424d4d5e4ce9001d44003a (diff)
downloadgsoc2013-evolution-3c89e1aa0252c6f558cf1573b39ab3a366cd4516.tar
gsoc2013-evolution-3c89e1aa0252c6f558cf1573b39ab3a366cd4516.tar.gz
gsoc2013-evolution-3c89e1aa0252c6f558cf1573b39ab3a366cd4516.tar.bz2
gsoc2013-evolution-3c89e1aa0252c6f558cf1573b39ab3a366cd4516.tar.lz
gsoc2013-evolution-3c89e1aa0252c6f558cf1573b39ab3a366cd4516.tar.xz
gsoc2013-evolution-3c89e1aa0252c6f558cf1573b39ab3a366cd4516.tar.zst
gsoc2013-evolution-3c89e1aa0252c6f558cf1573b39ab3a366cd4516.zip
Removed. Removed.
* gui/config-control-factory.h: Removed. * gui/config-control-factory.c: Removed. * gui/itip-bonobo-control.c: Renamed from itip-control-factory.c. (itip_bonobo_control_new): New. (itip_control_factory_init): Removed. * gui/itip-bonobo-control.h: Renamed from itip-control-factory.h. * gui/tasks-control-factory.c: Removed. * gui/tasks-control-factory.h: Removed. * gui/control-factory.c (control_factory_init): Removed. * gui/Makefile.am: Updated to build everything as libevolution-calendar.so and install in the COMPONENTDIR. * gui/GNOME_Evolution_Calendar.server.in.in: Updated to build the component as a shared library. * gui/main.c (main): Removed. * gui/calendar-component.c (calendar_component_get_object): New. (owner_set_cb): Do not store the shell pointer in shells. (owner_unset_cb): Do not remove the shell pointer from shells; instead, just set global_shell_client to NULL. * gui/calendar-component.h: Renamed from component-factory.h. * gui/calendar-component.c: Renamed from component-factory.c. svn path=/trunk/; revision=19430
-rw-r--r--calendar/ChangeLog32
-rw-r--r--calendar/gui/GNOME_Evolution_Calendar.server.in.in72
-rw-r--r--calendar/gui/Makefile.am38
-rw-r--r--calendar/gui/calendar-component.c39
-rw-r--r--calendar/gui/calendar-component.h7
-rw-r--r--calendar/gui/calendar-config.c3
-rw-r--r--calendar/gui/component-factory.c787
-rw-r--r--calendar/gui/component-factory.h31
-rw-r--r--calendar/gui/config-control-factory.c61
-rw-r--r--calendar/gui/config-control-factory.h30
-rw-r--r--calendar/gui/control-factory.c71
-rw-r--r--calendar/gui/control-factory.h4
-rw-r--r--calendar/gui/dialogs/meeting-page.c3
-rw-r--r--calendar/gui/e-meeting-time-sel.c3
-rw-r--r--calendar/gui/e-tasks.c3
-rw-r--r--calendar/gui/gnome-cal.c2
-rw-r--r--calendar/gui/itip-bonobo-control.c28
-rw-r--r--calendar/gui/itip-bonobo-control.h4
-rw-r--r--calendar/gui/itip-control-factory.c252
-rw-r--r--calendar/gui/itip-control-factory.h29
-rw-r--r--calendar/gui/main.c118
-rw-r--r--calendar/gui/tasks-control-factory.c78
-rw-r--r--calendar/gui/tasks-control-factory.h30
-rw-r--r--calendar/gui/tasks-control.c2
-rw-r--r--calendar/gui/tasks-control.h2
-rw-r--r--calendar/gui/tasks-migrate.c3
26 files changed, 149 insertions, 1583 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 7adcf49a47..4497dc5f9e 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,35 @@
+2003-01-13 Ettore Perazzoli <ettore@ximian.com>
+
+ * gui/config-control-factory.h: Removed.
+ * gui/config-control-factory.c: Removed.
+
+ * gui/itip-bonobo-control.c: Renamed from itip-control-factory.c.
+ (itip_bonobo_control_new): New.
+ (itip_control_factory_init): Removed.
+
+ * gui/itip-bonobo-control.h: Renamed from itip-control-factory.h.
+
+ * gui/tasks-control-factory.c: Removed.
+ * gui/tasks-control-factory.h: Removed.
+
+ * gui/control-factory.c (control_factory_init): Removed.
+
+ * gui/Makefile.am: Updated to build everything as
+ libevolution-calendar.so and install in the COMPONENTDIR.
+
+ * gui/GNOME_Evolution_Calendar.server.in.in: Updated to build the
+ component as a shared library.
+
+ * gui/main.c (main): Removed.
+
+ * gui/calendar-component.c (calendar_component_get_object): New.
+ (owner_set_cb): Do not store the shell pointer in shells.
+ (owner_unset_cb): Do not remove the shell pointer from shells;
+ instead, just set global_shell_client to NULL.
+
+ * gui/calendar-component.h: Renamed from component-factory.h.
+ * gui/calendar-component.c: Renamed from component-factory.c.
+
2003-01-10 Ettore Perazzoli <ettore@ximian.com>
* importers/icalendar-importer.c (connect_to_shell):
diff --git a/calendar/gui/GNOME_Evolution_Calendar.server.in.in b/calendar/gui/GNOME_Evolution_Calendar.server.in.in
index ea64073540..8f0ed87967 100644
--- a/calendar/gui/GNOME_Evolution_Calendar.server.in.in
+++ b/calendar/gui/GNOME_Evolution_Calendar.server.in.in
@@ -1,21 +1,21 @@
<oaf_info>
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_iTip_ControlFactory"
- type="exe"
- location="@LIBEXECDIR@/evolution-calendar">
+<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_Factory"
+ type="shlib"
+ location="@COMPONENTDIR@/libevolution-calendar.so">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/ObjectFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string"
- _value="Factory for the calendar iTip view control"/>
+ _value="Factory for the Evolution Calendar objects"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_iTip_Control"
type="factory"
- location="OAFIID:GNOME_Evolution_Calendar_iTip_ControlFactory">
+ location="OAFIID:GNOME_Evolution_Calendar_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/Control:1.0"/>
@@ -29,14 +29,11 @@
<oaf_attribute name="name" type="string"
_value="Evolution calendar iTip/iMip viewer"/>
- <oaf_attribute name="description" type="string"
- _value="Factory for the calendar iTip view control"/>
-
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ShellComponent"
- type="exe"
- location="@LIBEXECDIR@/evolution-calendar">
+ type="factory"
+ location="OAFIID:GNOME_Evolution_Calendar_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Evolution/ShellComponent:1.0"/>
@@ -51,21 +48,9 @@
value="3"/>
</oaf_server>
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ControlFactory"
- type="exe"
- location="@LIBEXECDIR@/evolution-calendar">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory for the sample Calendar control"/>
-</oaf_server>
-
<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_Control"
type="factory"
- location="OAFIID:GNOME_Evolution_Calendar_ControlFactory">
+ location="OAFIID:GNOME_Evolution_Calendar_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:BonoboControl/calendar-control:1.0"/>
@@ -81,21 +66,9 @@
_value="A sample Bonobo control which displays an calendar."/>
</oaf_server>
-<oaf_server iid="OAFIID:GNOME_Evolution_Tasks_ControlFactory"
- type="exe"
- location="@LIBEXECDIR@/evolution-calendar">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory for the Evolution Tasks control"/>
-</oaf_server>
-
<oaf_server iid="OAFIID:GNOME_Evolution_Tasks_Control"
type="factory"
- location="OAFIID:GNOME_Evolution_Tasks_ControlFactory">
+ location="OAFIID:GNOME_Evolution_Calendar_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:BonoboControl/tasks-control:1.0"/>
@@ -111,21 +84,9 @@
_value="A Bonobo control which displays a task list."/>
</oaf_server>
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_CompEditorFactory_Factory"
- type="exe"
- location="@LIBEXECDIR@/evolution-calendar">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory to create a component editor factory"/>
-</oaf_server>
-
<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_CompEditorFactory"
type="factory"
- location="OAFIID:GNOME_Evolution_Calendar_CompEditorFactory_Factory">
+ location="OAFIID:GNOME_Evolution_Calendar_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Evolution/Calendar/CompEditorFactory:1.0"/>
@@ -136,19 +97,9 @@
_value="Factory to centralize calendar component editor dialogs"/>
</oaf_server>
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ConfigControlFactory"
- type="exe"
- location="@LIBEXECDIR@/evolution-calendar">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
-</oaf_server>
-
<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ConfigControl"
type="factory"
- location="OAFIID:GNOME_Evolution_Calendar_ConfigControlFactory">
+ location="OAFIID:GNOME_Evolution_Calendar_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Evolution/ConfigControl:1.0"/>
@@ -176,4 +127,3 @@
</oaf_server>
</oaf_info>
-
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 391206c975..cf5838b5bc 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -33,7 +33,8 @@ SUBDIRS = alarm-notify dialogs
help_base = $(datadir)/gnome/help/cal
-libexec_PROGRAMS = evolution-calendar
+componentdir = $(COMPONENT_DIR)
+component_LTLIBRARIES = libevolution-calendar.la
INCLUDES = \
-DG_LOG_DOMAIN=\"calendar-gui\" \
@@ -67,7 +68,7 @@ glade_DATA = \
etspecdir = $(datadir)/evolution/etspec/
etspec_DATA = e-calendar-table.etspec e-meeting-time-sel.etspec
-evolution_calendar_SOURCES = \
+libevolution_calendar_la_SOURCES = \
$(IDL_GENERATED) \
cal-search-bar.c \
cal-search-bar.h \
@@ -75,6 +76,8 @@ evolution_calendar_SOURCES = \
calendar-config.h \
calendar-commands.c \
calendar-commands.h \
+ calendar-component.c \
+ calendar-component.h \
calendar-model.c \
calendar-model.h \
calendar-offline-handler.c \
@@ -87,12 +90,8 @@ evolution_calendar_SOURCES = \
comp-editor-factory.h \
comp-util.c \
comp-util.h \
- config-control-factory.c \
- config-control-factory.h \
control-factory.c \
control-factory.h \
- component-factory.c \
- component-factory.h \
e-calendar-table.h \
e-calendar-table.c \
e-cell-date-edit-text.h \
@@ -140,8 +139,8 @@ evolution_calendar_SOURCES = \
gnome-cal.h \
goto.c \
goto.h \
- itip-control-factory.c \
- itip-control-factory.h \
+ itip-bonobo-control.c \
+ itip-bonobo-control.h \
itip-utils.c \
itip-utils.h \
main.c \
@@ -151,8 +150,6 @@ evolution_calendar_SOURCES = \
print.h \
tag-calendar.c \
tag-calendar.h \
- tasks-control-factory.c \
- tasks-control-factory.h \
tasks-control.c \
tasks-control.h \
tasks-migrate.c \
@@ -160,7 +157,7 @@ evolution_calendar_SOURCES = \
weekday-picker.c \
weekday-picker.h
-evolution_calendar_LDADD = \
+libevolution_calendar_la_LIBADD = \
alarm-notify/libalarm.a \
$(DB3_LDADD) \
$(top_builddir)/widgets/menus/libmenus.la \
@@ -179,14 +176,12 @@ evolution_calendar_LDADD = \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(EVOLUTION_CALENDAR_LIBS)
-evolution_calendar_LDFLAGS = -export-dynamic
-
server_in_files = GNOME_Evolution_Calendar.server.in.in
serverdir = $(libdir)/bonobo/servers
server_DATA = $(server_in_files:.server.in.in=.server)
$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
+ sed -e "s|\@COMPONENTDIR\@|$(componentdir)|" $< > $@
@INTLTOOL_SERVER_RULE@
@@ -195,22 +190,11 @@ EXTRA_DIST = \
$(etspec_DATA) \
$(server_in_files)
+CLEANFILES = $(BUILT_SOURCES)
+
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(help_base)/C
$(mkinstalldirs) $(Conduitsdir)
-if ENABLE_PURIFY
-PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-
-all-local: evolution-calendar.pure
-
-evolution-calendar.pure: evolution-calendar
- @rm -f evolution-calendar.pure
- $(PLINK) $(evolution_calendar_LDFLAGS) $(evolution_calendar_OBJECTS) $(evolution_calendar_LDADD) $(LIBS)
-
-endif
-
-CLEANFILES = $(BUILT_SOURCES)
-
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index ff13791617..9d64b2db67 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -1,8 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* component-factory.c
*
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003 Ximian, 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
@@ -34,11 +33,11 @@
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-context.h>
#include <bonobo/bonobo-exception.h>
+
#include "evolution-shell-component.h"
#include "calendar-offline-handler.h"
-#include "component-factory.h"
-#include "tasks-control-factory.h"
-#include "config-control-factory.h"
+#include "calendar-component.h"
+#include "tasks-control.h"
#include "control-factory.h"
#include "calendar-config.h"
#include "tasks-control.h"
@@ -502,8 +501,6 @@ request_quit (EvolutionShellComponent *shell_component, void *closure)
return e_comp_editor_registry_close_all (comp_editor_registry);
}
-static GList *shells = NULL;
-
static void
owner_set_cb (EvolutionShellComponent *shell_component,
EvolutionShellClient *shell_client,
@@ -519,21 +516,14 @@ owner_set_cb (EvolutionShellComponent *shell_component,
migrated = TRUE;
}
- shells = g_list_append (shells, shell_component);
-
global_shell_client = shell_client;
-
- config_control_factory_register (evolution_shell_client_corba_objref (shell_client));
}
static void
owner_unset_cb (EvolutionShellComponent *shell_component,
gpointer user_data)
{
- shells = g_list_remove (shells, shell_component);
-
- if (g_list_length (shells) == 0)
- bonobo_main_quit ();
+ global_shell_client = NULL;
}
/* Computes the final URI for a calendar component */
@@ -772,16 +762,17 @@ create_object (void)
}
-void
-component_factory_init (void)
+BonoboObject *
+calendar_component_get_object (void)
{
- BonoboObject *object;
- Bonobo_RegistrationResult result;
-
- object = create_object ();
+ static BonoboObject *object = NULL;
- result = bonobo_activation_active_server_register (COMPONENT_ID, bonobo_object_corba_objref (object));
+ if (object != NULL) {
+ bonobo_object_ref (BONOBO_OBJECT (object));
+ } else {
+ object = create_object ();
+ g_object_add_weak_pointer (G_OBJECT (object), (void *) &object);
+ }
- if (result != Bonobo_ACTIVATION_REG_SUCCESS)
- g_error ("Cannot initialize Evolution's calendar component.");
+ return object;
}
diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h
index 576255cb6d..2d94920adc 100644
--- a/calendar/gui/calendar-component.h
+++ b/calendar/gui/calendar-component.h
@@ -1,8 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* component-factory.h
*
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003 Ximian, 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
@@ -24,8 +23,10 @@
#ifndef _COMPONENT_FACTORY_H_
#define _COMPONENT_FACTORY_H_
+#include <bonobo/bonobo-object.h>
+
extern char *evolution_dir;
-void component_factory_init (void);
+BonoboObject *calendar_component_get_object (void);
#endif /* _COMPONENT_FACTORY_H_ */
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 0d62e661ee..c2ecfe78fe 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -34,7 +34,8 @@
#include <libgnomeui/gnome-dialog.h>
#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
#include <cal-util/timeutil.h>
-#include "component-factory.h"
+
+#include "calendar-component.h"
#include "calendar-commands.h"
#include "e-tasks.h"
#include "e-cell-date-edit-text.h"
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
deleted file mode 100644
index ff13791617..0000000000
--- a/calendar/gui/component-factory.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* component-factory.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, 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: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <libgnome/gnome-util.h>
-#include <libgnomevfs/gnome-vfs-types.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-directory.h>
-#include <libgnomevfs/gnome-vfs-file-info.h>
-
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-context.h>
-#include <bonobo/bonobo-exception.h>
-#include "evolution-shell-component.h"
-#include "calendar-offline-handler.h"
-#include "component-factory.h"
-#include "tasks-control-factory.h"
-#include "config-control-factory.h"
-#include "control-factory.h"
-#include "calendar-config.h"
-#include "tasks-control.h"
-#include "tasks-migrate.h"
-#include "e-comp-editor-registry.h"
-#include "dialogs/comp-editor.h"
-
-
-/* OAFIID for the component. */
-#define COMPONENT_ID "OAFIID:GNOME_Evolution_Calendar_ShellComponent"
-
-/* Folder type IDs */
-#define FOLDER_CALENDAR "calendar"
-#define FOLDER_TASKS "tasks"
-#define FOLDER_PUBLIC_CALENDAR "calendar/public"
-#define FOLDER_PUBLIC_TASKS "tasks/public"
-
-/* IDs for user creatable items */
-#define CREATE_EVENT_ID "event"
-#define CREATE_ALLDAY_EVENT_ID "allday-event"
-#define CREATE_MEETING_ID "meeting"
-#define CREATE_TASK_ID "task"
-
-char *evolution_dir;
-EvolutionShellClient *global_shell_client = NULL;
-extern ECompEditorRegistry *comp_editor_registry;
-
-static const EvolutionShellComponentFolderType folder_types[] = {
- { FOLDER_CALENDAR,
- "evolution-calendar.png",
- N_("Calendar"),
- N_("Folder containing appointments and events"),
- TRUE, NULL, NULL },
- { FOLDER_PUBLIC_CALENDAR,
- "evolution-calendar.png",
- N_("Public Calendar"),
- N_("Public folder containing appointments and events"),
- FALSE, NULL, NULL },
- { FOLDER_TASKS,
- "evolution-tasks.png",
- N_("Tasks"),
- N_("Folder containing to-do items"),
- TRUE, NULL, NULL },
- { FOLDER_PUBLIC_TASKS,
- "evolution-tasks.png",
- N_("Public Tasks"),
- N_("Public folder containing to-do items"),
- FALSE, NULL, NULL },
- { NULL, NULL }
-};
-
-
-
-static inline gboolean
-type_is_calendar (const char *type)
-{
- return !strcmp (type, FOLDER_CALENDAR) ||
- !strcmp (type, FOLDER_PUBLIC_CALENDAR);
-}
-
-static inline gboolean
-type_is_tasks (const char *type)
-{
- return !strcmp (type, FOLDER_TASKS) ||
- !strcmp (type, FOLDER_PUBLIC_TASKS);
-}
-
-/* EvolutionShellComponent methods and signals. */
-
-static EvolutionShellComponentResult
-create_view (EvolutionShellComponent *shell_component,
- const char *physical_uri,
- const char *type,
- const char *view_info,
- BonoboControl **control_return,
- void *closure)
-{
- BonoboControl *control;
-
- if (type_is_calendar (type)) {
- control = control_factory_new_control ();
- if (!control)
- return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
- } else if (type_is_tasks (type)) {
- control = tasks_control_new ();
- if (!control)
- return EVOLUTION_SHELL_COMPONENT_CORBAERROR;
- } else {
- return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
- }
-
- bonobo_control_set_property (control, NULL, "folder_uri", TC_CORBA_string, physical_uri, NULL);
- if (type_is_calendar (type) && *view_info)
- bonobo_control_set_property (control, NULL, "view", TC_CORBA_string, view_info, NULL);
-
- *control_return = control;
-
- return EVOLUTION_SHELL_COMPONENT_OK;
-}
-
-static void
-create_folder (EvolutionShellComponent *shell_component,
- const char *physical_uri,
- const char *type,
- const GNOME_Evolution_ShellComponentListener listener,
- void *closure)
-{
- CORBA_Environment ev;
- GnomeVFSURI *uri;
-
- CORBA_exception_init (&ev);
-
- if (!type_is_calendar (type) && !type_is_tasks (type)) {
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
- &ev);
- CORBA_exception_free (&ev);
- return;
- }
-
- uri = gnome_vfs_uri_new (physical_uri);
- if (uri) {
- /* we don't need to do anything */
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_OK, &ev);
- gnome_vfs_uri_unref (uri);
- }
- else {
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_INVALID_URI,
- &ev);
- }
-
- CORBA_exception_free (&ev);
-}
-
-/* Asks the alarm daemon to stop monitoring the specified URI */
-static void
-stop_alarms (GnomeVFSURI *uri)
-{
- char *str_uri;
- CORBA_Environment ev;
- GNOME_Evolution_Calendar_AlarmNotify an;
-
- /* Activate the alarm notification service */
-
- CORBA_exception_init (&ev);
- an = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_message ("stop_alarms(): Could not activate the alarm notification service");
- CORBA_exception_free (&ev);
- return;
- }
- CORBA_exception_free (&ev);
-
- /* Ask the service to remove the URI from its list of calendars */
-
- str_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
- g_assert (str_uri != NULL);
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_AlarmNotify_removeCalendar (an, str_uri, &ev);
- g_free (str_uri);
-
- if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI)) {
- g_message ("stop_alarms(): Invalid URI reported from the alarm notification service");
- } else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_NotFound)) {
- /* This is OK; the service may not have loaded that calendar */
- } else if (BONOBO_EX (&ev)) {
- g_message ("stop_alarms(): Could not issue the removeCalendar request");
- }
-
- CORBA_exception_free (&ev);
-
- /* Get rid of the service */
-
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (an, &ev);
- if (BONOBO_EX (&ev))
- g_message ("stop_alarms(): Could not unref the alarm notification service");
- CORBA_exception_free (&ev);
-}
-
-static void
-remove_folder (EvolutionShellComponent *shell_component,
- const char *physical_uri,
- const char *type,
- const GNOME_Evolution_ShellComponentListener listener,
- void *closure)
-{
- GnomeVFSURI *dir_uri, *data_uri, *backup_uri;
- GnomeVFSResult data_result, backup_result;
-
- /* check type */
- if (!type_is_calendar (type) && !type_is_tasks (type)) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
- &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("remove_folder(): Could not notify the listener of "
- "an unsupported folder type");
-
- CORBA_exception_free (&ev);
- return;
- }
-
- /* check URI */
- dir_uri = gnome_vfs_uri_new (physical_uri);
- if (!dir_uri) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_INVALID_URI,
- &ev);
- CORBA_exception_free (&ev);
- return;
- }
-
- /* Compute the URIs of the appropriate files */
-
- if (type_is_calendar (type)) {
- data_uri = gnome_vfs_uri_append_file_name (dir_uri, "calendar.ics");
- backup_uri = gnome_vfs_uri_append_file_name (dir_uri, "calendar.ics~");
- } else if (type_is_tasks (type)) {
- data_uri = gnome_vfs_uri_append_file_name (dir_uri, "tasks.ics");
- backup_uri = gnome_vfs_uri_append_file_name (dir_uri, "tasks.ics~");
- } else {
- g_assert_not_reached ();
- return;
- }
-
- if (!data_uri || !backup_uri) {
- CORBA_Environment ev;
-
- g_message ("remove_folder(): Could not generate the data/backup URIs");
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_INVALID_URI,
- &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("remove_folder(): Could not notify the listener "
- "of an invalid URI");
-
- CORBA_exception_free (&ev);
-
- goto out;
- }
-
- /* Ask the alarm daemon to stop monitoring this URI */
-
- stop_alarms (data_uri);
-
- /* Delete the data and backup files; the shell will take care of the rest */
-
- data_result = gnome_vfs_unlink_from_uri (data_uri);
- backup_result = gnome_vfs_unlink_from_uri (backup_uri);
-
- if ((data_result == GNOME_VFS_OK || data_result == GNOME_VFS_ERROR_NOT_FOUND)
- && (backup_result == GNOME_VFS_OK || backup_result == GNOME_VFS_ERROR_NOT_FOUND)) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_OK,
- &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("remove_folder(): Could not notify the listener about success");
-
- CORBA_exception_free (&ev);
- } else {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED,
- &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("remove_folder(): Could not notify the listener about failure");
-
- CORBA_exception_free (&ev);
- }
-
- out:
-
- gnome_vfs_uri_unref (dir_uri);
-
- if (data_uri)
- gnome_vfs_uri_unref (data_uri);
-
- if (backup_uri)
- gnome_vfs_uri_unref (backup_uri);
-}
-
-static GNOME_Evolution_ShellComponentListener_Result
-xfer_file (GnomeVFSURI *base_src_uri,
- GnomeVFSURI *base_dest_uri,
- const char *file_name,
- int remove_source)
-{
- GnomeVFSURI *src_uri, *dest_uri;
- GnomeVFSHandle *hin, *hout;
- GnomeVFSResult result;
- GnomeVFSFileInfo file_info;
- GnomeVFSFileSize size;
- char *buffer;
-
- src_uri = gnome_vfs_uri_append_file_name (base_src_uri, file_name);
-
- result = gnome_vfs_open_uri (&hin, src_uri, GNOME_VFS_OPEN_READ);
- if (result == GNOME_VFS_ERROR_NOT_FOUND) {
- gnome_vfs_uri_unref (src_uri);
- return GNOME_Evolution_ShellComponentListener_OK; /* No need to xfer anything. */
- }
- if (result != GNOME_VFS_OK) {
- gnome_vfs_uri_unref (src_uri);
- return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED;
- }
-
- result = gnome_vfs_get_file_info_uri (src_uri, &file_info, GNOME_VFS_FILE_INFO_DEFAULT);
- if (result != GNOME_VFS_OK) {
- gnome_vfs_uri_unref (src_uri);
- return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED;
- }
-
- dest_uri = gnome_vfs_uri_append_file_name (base_dest_uri, file_name);
-
- result = gnome_vfs_create_uri (&hout, dest_uri, GNOME_VFS_OPEN_WRITE, FALSE, 0600);
- if (result != GNOME_VFS_OK) {
- gnome_vfs_close (hin);
- gnome_vfs_uri_unref (src_uri);
- gnome_vfs_uri_unref (dest_uri);
- return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED;
- }
-
- /* write source file to destination file */
- buffer = g_malloc (file_info.size);
- result = gnome_vfs_read (hin, buffer, file_info.size, &size);
- if (result != GNOME_VFS_OK) {
- gnome_vfs_close (hin);
- gnome_vfs_close (hout);
- gnome_vfs_uri_unref (src_uri);
- gnome_vfs_uri_unref (dest_uri);
- g_free (buffer);
- return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED;
- }
-
- result = gnome_vfs_write (hout, buffer, file_info.size, &size);
- if (result != GNOME_VFS_OK) {
- gnome_vfs_close (hin);
- gnome_vfs_close (hout);
- gnome_vfs_uri_unref (src_uri);
- gnome_vfs_uri_unref (dest_uri);
- g_free (buffer);
- return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED;
- }
-
- if (remove_source) {
- char *text_uri;
-
- /* Sigh, we have to do this as there is no gnome_vfs_unlink_uri(). :-( */
-
- text_uri = gnome_vfs_uri_to_string (src_uri, GNOME_VFS_URI_HIDE_NONE);
- result = gnome_vfs_unlink (text_uri);
- g_free (text_uri);
- }
-
- gnome_vfs_close (hin);
- gnome_vfs_close (hout);
- gnome_vfs_uri_unref (src_uri);
- gnome_vfs_uri_unref (dest_uri);
- g_free (buffer);
-
- return GNOME_Evolution_ShellComponentListener_OK;
-}
-
-static void
-xfer_folder (EvolutionShellComponent *shell_component,
- const char *source_physical_uri,
- const char *destination_physical_uri,
- const char *type,
- gboolean remove_source,
- const GNOME_Evolution_ShellComponentListener listener,
- void *closure)
-{
- CORBA_Environment ev;
- GnomeVFSURI *src_uri;
- GnomeVFSURI *dest_uri;
- GnomeVFSResult result;
- char *filename, *backup_filename;
-
- CORBA_exception_init (&ev);
-
- /* check type */
- if (!type_is_calendar (type) && !type_is_tasks (type)) {
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
- &ev);
- CORBA_exception_free (&ev);
- return;
- }
-
- /* check URIs */
- src_uri = gnome_vfs_uri_new (source_physical_uri);
- dest_uri = gnome_vfs_uri_new (destination_physical_uri);
- if (!src_uri || ! dest_uri) {
- GNOME_Evolution_ShellComponentListener_notifyResult (
- listener,
- GNOME_Evolution_ShellComponentListener_INVALID_URI,
- &ev);
- gnome_vfs_uri_unref (src_uri);
- gnome_vfs_uri_unref (dest_uri);
- CORBA_exception_free (&ev);
- return;
- }
-
- if (type_is_calendar (type)) {
- filename = "calendar.ics";
- backup_filename = "calendar.ics~";
- } else if (type_is_tasks (type)) {
- filename = "tasks.ics";
- backup_filename = "tasks.ics~";
- } else {
- g_assert_not_reached ();
- return;
- }
-
- result = xfer_file (src_uri, dest_uri, filename, remove_source);
- if (result == GNOME_Evolution_ShellComponentListener_OK)
- result = xfer_file (src_uri, dest_uri, backup_filename, remove_source);
-
- GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev);
-
- gnome_vfs_uri_unref (src_uri);
- gnome_vfs_uri_unref (dest_uri);
-
- CORBA_exception_free (&ev);
-}
-
-static gboolean
-request_quit (EvolutionShellComponent *shell_component, void *closure)
-{
- return e_comp_editor_registry_close_all (comp_editor_registry);
-}
-
-static GList *shells = NULL;
-
-static void
-owner_set_cb (EvolutionShellComponent *shell_component,
- EvolutionShellClient *shell_client,
- const char *evolution_homedir,
- gpointer user_data)
-{
- static gboolean migrated = FALSE;
-
- evolution_dir = g_strdup (evolution_homedir);
-
- if (!migrated) {
- tasks_migrate ();
- migrated = TRUE;
- }
-
- shells = g_list_append (shells, shell_component);
-
- global_shell_client = shell_client;
-
- config_control_factory_register (evolution_shell_client_corba_objref (shell_client));
-}
-
-static void
-owner_unset_cb (EvolutionShellComponent *shell_component,
- gpointer user_data)
-{
- shells = g_list_remove (shells, shell_component);
-
- if (g_list_length (shells) == 0)
- bonobo_main_quit ();
-}
-
-/* Computes the final URI for a calendar component */
-static char *
-get_data_uri (const char *uri, CalComponentVType vtype)
-{
- if (uri) {
- if (*uri != '/' && strncmp (uri, "file:", 5) != 0)
- return g_strdup (uri);
-
- if (vtype == CAL_COMPONENT_EVENT)
- return cal_util_expand_uri ((char *) uri, FALSE);
- else if (vtype == CAL_COMPONENT_TODO)
- return cal_util_expand_uri ((char *) uri, TRUE);
- else
- g_assert_not_reached ();
- } else {
- if (vtype == CAL_COMPONENT_EVENT)
- return g_concat_dir_and_file (g_get_home_dir (),
- "evolution/local/Calendar/calendar.ics");
- else if (vtype == CAL_COMPONENT_TODO)
- return g_concat_dir_and_file (g_get_home_dir (),
- "evolution/local/Tasks/tasks.ics");
- else
- g_assert_not_reached ();
- }
-
- return NULL;
-}
-
-/* Creates a calendar component at a specified URI. If the URI is NULL then it
- * uses the default folder for that type of component.
- */
-static void
-create_component (const char *uri, GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode type)
-{
- char *real_uri;
- CORBA_Environment ev;
- GNOME_Evolution_Calendar_CompEditorFactory factory;
- CalComponentVType vtype;
-
- switch (type) {
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT:
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT:
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING:
- vtype = CAL_COMPONENT_EVENT;
- break;
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO:
- vtype = CAL_COMPONENT_TODO;
- break;
- default:
- g_assert_not_reached ();
- return;
- }
-
- real_uri = get_data_uri (uri, vtype);
-
- /* Get the factory */
-
- CORBA_exception_init (&ev);
- factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory",
- 0, NULL, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_message ("create_component(): Could not activate the component editor factory");
- CORBA_exception_free (&ev);
- g_free (real_uri);
- return;
- }
- CORBA_exception_free (&ev);
-
- /* Create the item */
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_CompEditorFactory_editNew (factory, real_uri, type, &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("create_component(): Exception while creating the component");
-
- CORBA_exception_free (&ev);
- g_free (real_uri);
-
- /* Get rid of the factory */
-
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (factory, &ev);
- if (BONOBO_EX (&ev))
- g_message ("create_component(): Could not unref the calendar component factory");
-
- CORBA_exception_free (&ev);
-}
-
-/* Callback used when we must create a user-creatable item */
-static void
-sc_user_create_new_item_cb (EvolutionShellComponent *shell_component,
- const char *id,
- const char *parent_folder_physical_uri,
- const char *parent_folder_type)
-{
- char *tmp_uri;
-
- if (strcmp (id, CREATE_EVENT_ID) == 0) {
- if (type_is_calendar (parent_folder_type))
- create_component (parent_folder_physical_uri,
- GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT);
- else {
- tmp_uri = calendar_config_default_calendar_folder ();
- create_component (tmp_uri,
- GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT);
- g_free (tmp_uri);
- }
- } else if (strcmp (id, CREATE_ALLDAY_EVENT_ID) == 0) {
- if (type_is_calendar (parent_folder_type))
- create_component (parent_folder_physical_uri,
- GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT);
- else {
- tmp_uri = calendar_config_default_calendar_folder ();
- create_component (tmp_uri,
- GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT);
- g_free (tmp_uri);
- }
- } else if (strcmp (id, CREATE_MEETING_ID) == 0) {
- if (type_is_calendar (parent_folder_type))
- create_component (parent_folder_physical_uri,
- GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING);
- else {
- tmp_uri = calendar_config_default_calendar_folder ();
- create_component (tmp_uri,
- GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING);
- g_free (tmp_uri);
- }
- } else if (strcmp (id, CREATE_TASK_ID) == 0) {
- if (type_is_tasks (parent_folder_type))
- create_component (parent_folder_physical_uri,
- GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO);
- else {
- tmp_uri = calendar_config_default_tasks_folder ();
- create_component (tmp_uri,
- GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO);
- g_free (tmp_uri);
- }
- } else
- g_assert_not_reached ();
-}
-
-
-/* The factory function. */
-
-static void
-add_creatable_item (EvolutionShellComponent *shell_component,
- const char *id,
- const char *description,
- const char *menu_description,
- const char *tooltip,
- const char *folder_type,
- char menu_shortcut,
- const char *icon_name)
-{
- char *icon_path;
- GdkPixbuf *icon;
-
- if (icon_name == NULL) {
- icon_path = NULL;
- icon = NULL;
- } else {
- icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, icon_name);
- icon = gdk_pixbuf_new_from_file (icon_path, NULL);
- }
-
- evolution_shell_component_add_user_creatable_item (shell_component,
- id,
- description,
- menu_description,
- tooltip,
- folder_type,
- menu_shortcut,
- icon);
-
- if (icon != NULL)
- gdk_pixbuf_unref (icon);
- g_free (icon_path);
-}
-
-static BonoboObject *
-create_object (void)
-{
- EvolutionShellComponent *shell_component;
- CalendarOfflineHandler *offline_handler;
-
- shell_component = evolution_shell_component_new (folder_types,
- NULL,
- create_view,
- create_folder,
- remove_folder,
- xfer_folder,
- NULL, /* populate_folder_context_menu_fn */
- NULL, /* unpopulate_folder_context_menu_fn */
- NULL, /* get_dnd_selection_fn */
- request_quit,
- NULL /* closure */);
-
- /* Offline handler */
- offline_handler = calendar_offline_handler_new ();
- bonobo_object_add_interface (BONOBO_OBJECT (shell_component),
- BONOBO_OBJECT (offline_handler));
-
- g_signal_connect (shell_component, "owner_set", G_CALLBACK (owner_set_cb), NULL);
- g_signal_connect (shell_component, "owner_unset", G_CALLBACK (owner_unset_cb), NULL);
-
- /* User creatable items */
-
- add_creatable_item (shell_component, CREATE_EVENT_ID,
- _("New appointment"), _("_Appointment"),
- _("Create a new appointment"),
- FOLDER_CALENDAR, 'a', "new_appointment.xpm");
-
- add_creatable_item (shell_component, CREATE_MEETING_ID,
- _("New meeting"), _("_Meeting"),
- _("Create a new meeting request"),
- FOLDER_CALENDAR, 's', "meeting-request-16.png");
-
- add_creatable_item (shell_component, CREATE_TASK_ID,
- _("New task"), _("_Task"),
- _("Create a new task"),
- FOLDER_TASKS, 't', "new_task-16.png");
-
- add_creatable_item (shell_component, CREATE_ALLDAY_EVENT_ID,
- _("New All Day Appointment"), _("All _Day Appointment"),
- _("Create a new all-day appointment"),
- FOLDER_CALENDAR, 'd', "new_all_day_event.png");
-
- g_signal_connect (shell_component, "user_create_new_item",
- G_CALLBACK (sc_user_create_new_item_cb), NULL);
-
- return BONOBO_OBJECT (shell_component);
-}
-
-
-void
-component_factory_init (void)
-{
- BonoboObject *object;
- Bonobo_RegistrationResult result;
-
- object = create_object ();
-
- result = bonobo_activation_active_server_register (COMPONENT_ID, bonobo_object_corba_objref (object));
-
- if (result != Bonobo_ACTIVATION_REG_SUCCESS)
- g_error ("Cannot initialize Evolution's calendar component.");
-}
diff --git a/calendar/gui/component-factory.h b/calendar/gui/component-factory.h
deleted file mode 100644
index 576255cb6d..0000000000
--- a/calendar/gui/component-factory.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* component-factory.h
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, 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: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifndef _COMPONENT_FACTORY_H_
-#define _COMPONENT_FACTORY_H_
-
-extern char *evolution_dir;
-
-void component_factory_init (void);
-
-#endif /* _COMPONENT_FACTORY_H_ */
diff --git a/calendar/gui/config-control-factory.c b/calendar/gui/config-control-factory.c
deleted file mode 100644
index f2a9b48383..0000000000
--- a/calendar/gui/config-control-factory.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* config-control-factory.c
- *
- * Copyright (C) 2002 Ximian, 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: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "config-control-factory.h"
-
-#include "dialogs/cal-prefs-dialog.h"
-
-#include <bonobo/bonobo-generic-factory.h>
-
-
-#define CONFIG_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_ConfigControlFactory"
-static BonoboGenericFactory *generic_factory = NULL;
-
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *generic_factory,
- void *data)
-{
- EvolutionConfigControl *config_control;
-
- config_control = cal_prefs_dialog_new ();
-
- return BONOBO_OBJECT (config_control);
-}
-
-gboolean
-config_control_factory_register (GNOME_Evolution_Shell shell)
-{
- generic_factory = bonobo_generic_factory_new (CONFIG_CONTROL_FACTORY_ID,
- factory_fn, shell);
-
- if (generic_factory == NULL) {
- g_warning ("Cannot register %s", CONFIG_CONTROL_FACTORY_ID);
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/calendar/gui/config-control-factory.h b/calendar/gui/config-control-factory.h
deleted file mode 100644
index b0ff927fa9..0000000000
--- a/calendar/gui/config-control-factory.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* config-control-factory.h
- *
- * Copyright (C) 2002 Ximian, 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: Ettore Perazzoli
- */
-
-#ifndef CONFIG_CONTROL_FACTORY_H
-#define CONFIG_CONTROL_FACTORY_H
-
-#include "Evolution.h"
-
-gboolean config_control_factory_register (GNOME_Evolution_Shell shell);
-
-#endif
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
index 951c4c6f4d..3844cfdff3 100644
--- a/calendar/gui/control-factory.c
+++ b/calendar/gui/control-factory.c
@@ -1,8 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* control-factory.c
*
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003 Ximian, 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
@@ -43,13 +42,10 @@
#define PROPERTY_CALENDAR_VIEW "view"
#define PROPERTY_CALENDAR_VIEW_IDX 2
-#define CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_ControlFactory"
-
CORBA_Environment ev;
CORBA_ORB orb;
-
static void
control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
{
@@ -178,68 +174,6 @@ calendar_properties_init (GnomeCalendar *gcal, BonoboControl *control)
bonobo_object_unref (BONOBO_OBJECT (pbag));
}
-/* Callback factory function for calendar controls */
-static BonoboObject *
-control_factory_fn (BonoboGenericFactory *Factory, const char *id, void *data)
-{
- BonoboControl *control;
-
- if (strcmp (id, CONTROL_FACTORY_ID) == 0) {
- control = control_factory_new_control ();
- if (control)
- return BONOBO_OBJECT (control);
- else
- return NULL;
- } else {
- g_warning ("Unknown ID in calendar control factory -- %s", id);
- return NULL;
- }
-}
-
-
-void
-control_factory_init (void)
-{
- static BonoboGenericFactory *factory = NULL;
-
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, control_factory_fn, NULL);
- bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
-
- if (factory == NULL)
- g_error ("I could not register a Calendar control factory.");
-}
-
-#if 0
-static int
-load_calendar (BonoboPersistFile *pf, const CORBA_char *filename, CORBA_Environment *ev, void *closure)
-{
- GnomeCalendar *gcal = closure;
-
- return gnome_calendar_open (gcal, filename);
-}
-
-static int
-save_calendar (BonoboPersistFile *pf, const CORBA_char *filename,
- CORBA_Environment *ev,
- void *closure)
-{
- /* Do not know how to save stuff yet */
- return -1;
-}
-
-static void
-calendar_persist_init (GnomeCalendar *gcal, BonoboControl *control)
-{
- BonoboPersistFile *f;
-
- f = bonobo_persist_file_new (load_calendar, save_calendar, gcal);
- bonobo_object_add_interface (BONOBO_OBJECT (control), BONOBO_OBJECT (f));
-}
-#endif
-
BonoboControl *
control_factory_new_control (void)
{
@@ -260,9 +194,6 @@ control_factory_new_control (void)
g_object_set_data (G_OBJECT (gcal), "control", control);
calendar_properties_init (gcal, control);
-#if 0
- calendar_persist_init (gcal, control);
-#endif
g_signal_connect (control, "activate", G_CALLBACK (control_activate_cb), gcal);
diff --git a/calendar/gui/control-factory.h b/calendar/gui/control-factory.h
index 322b5a4a4e..f599f7b3b8 100644
--- a/calendar/gui/control-factory.h
+++ b/calendar/gui/control-factory.h
@@ -1,8 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* control-factory.c
*
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003 Ximian, 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
@@ -24,7 +23,6 @@
#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/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 323ba6fb2c..9fc33b963c 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -43,7 +43,8 @@
#include <gal/widgets/e-gui-utils.h>
#include <widgets/misc/e-dateedit.h>
#include <e-util/e-dialog-widgets.h>
-#include "../component-factory.h"
+
+#include "../calendar-component.h"
#include "../e-meeting-attendee.h"
#include "../e-meeting-model.h"
#include "../itip-utils.h"
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index 2e8adf17f4..557fcc068b 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -63,7 +63,8 @@
#include <gal/e-table/e-table-header-utils.h>
#include <widgets/misc/e-dateedit.h>
-#include "component-factory.h"
+
+#include "calendar-component.h"
#include "calendar-config.h"
#include "e-meeting-utils.h"
#include "e-meeting-time-sel-item.h"
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index cdcead83b2..c8a9d0f77e 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -29,12 +29,13 @@
#include <gal/menus/gal-view-instance.h>
#include <gal/menus/gal-view-factory-etable.h>
#include <gal/menus/gal-view-etable.h>
+
#include "e-util/e-url.h"
#include "widgets/menus/gal-view-menus.h"
#include "dialogs/task-editor.h"
#include "cal-search-bar.h"
#include "calendar-config.h"
-#include "component-factory.h"
+#include "calendar-component.h"
#include "misc.h"
#include "e-tasks.h"
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index f929fc872d..d31a961591 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -47,7 +47,7 @@
#include "e-week-view.h"
#include "evolution-calendar.h"
#include "gnome-cal.h"
-#include "component-factory.h"
+#include "calendar-component.h"
#include "cal-search-bar.h"
#include "calendar-commands.h"
#include "calendar-config.h"
diff --git a/calendar/gui/itip-bonobo-control.c b/calendar/gui/itip-bonobo-control.c
index 56f362d6e3..2906046a39 100644
--- a/calendar/gui/itip-bonobo-control.c
+++ b/calendar/gui/itip-bonobo-control.c
@@ -34,7 +34,7 @@
#include <ical.h>
#include "e-itip-control.h"
-#include "itip-control-factory.h"
+#include "itip-bonobo-control.h"
extern gchar *evolution_dir;
@@ -195,10 +195,10 @@ set_prop ( BonoboPropertyBag *bag,
}
-static BonoboObject *
-itip_control_factory (BonoboGenericFactory *Factory, void *closure)
+BonoboControl *
+itip_bonobo_control_new (void)
{
- BonoboControl *control;
+ BonoboControl *control;
BonoboPropertyBag *prop_bag;
BonoboPersistStream *stream;
GtkWidget *itip;
@@ -230,23 +230,5 @@ itip_control_factory (BonoboGenericFactory *Factory, void *closure)
bonobo_object_add_interface (BONOBO_OBJECT (control),
BONOBO_OBJECT (stream));
- return BONOBO_OBJECT (control);
+ return control;
}
-
-void
-itip_control_factory_init (void)
-{
- static BonoboGenericFactory *factory = NULL;
-
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new (
- "OAFIID:GNOME_Evolution_Calendar_iTip_ControlFactory",
- itip_control_factory, NULL);
- bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));;
-
- if (factory == NULL)
- g_error ("I could not register an iTip control factory.");
-}
-
diff --git a/calendar/gui/itip-bonobo-control.h b/calendar/gui/itip-bonobo-control.h
index 6f8a95ec71..11b33e6602 100644
--- a/calendar/gui/itip-bonobo-control.h
+++ b/calendar/gui/itip-bonobo-control.h
@@ -24,6 +24,8 @@
#ifndef __ITIP_CONTROL_FACTORY_H__
#define __ITIP_CONTROL_FACTORY_H__
-void itip_control_factory_init (void);
+#include <bonobo/bonobo-control.h>
+
+BonoboControl *itip_bonobo_control_new (void);
#endif /* __ITIP_CONTROL_H__ */
diff --git a/calendar/gui/itip-control-factory.c b/calendar/gui/itip-control-factory.c
deleted file mode 100644
index 56f362d6e3..0000000000
--- a/calendar/gui/itip-control-factory.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - Control for displaying iTIP mail messages
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Jesse Pavel <jpavel@ximian.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <glib.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtkwidget.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-persist-stream.h>
-#include <bonobo/bonobo-stream-client.h>
-#include <bonobo/bonobo-context.h>
-#include <bonobo/bonobo-exception.h>
-#include <ical.h>
-
-#include "e-itip-control.h"
-#include "itip-control-factory.h"
-
-extern gchar *evolution_dir;
-
-enum E_ITIP_BONOBO_ARGS {
- FROM_ADDRESS_ARG_ID,
-};
-
-/*
- * Bonobo::PersistStream
- *
- * These two functions implement the Bonobo::PersistStream load and
- * save methods which allow data to be loaded into and out of the
- * BonoboObject.
- */
-
-static char *
-stream_read (Bonobo_Stream stream)
-{
- Bonobo_Stream_iobuf *buffer;
- CORBA_Environment ev;
- gchar *data = NULL;
- gint length = 0;
-
- CORBA_exception_init (&ev);
- do {
-#define READ_CHUNK_SIZE 65536
- Bonobo_Stream_read (stream, READ_CHUNK_SIZE,
- &buffer, &ev);
-
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- if (buffer->_length <= 0)
- break;
-
- data = g_realloc (data, length + buffer->_length + 1);
- memcpy (data + length, buffer->_buffer, buffer->_length);
- length += buffer->_length;
- data[length] = '\0';
-
- CORBA_free (buffer);
-#undef READ_CHUNK_SIZE
- } while (1);
-
- CORBA_free (buffer);
- CORBA_exception_free (&ev);
-
- if (data == NULL)
- data = g_strdup("");
-
- return data;
-} /* stream_read */
-
-/*
- * This function implements the Bonobo::PersistStream:load method.
- */
-static void
-pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- EItipControl *itip = data;
- gchar *text;
-
- if (type && g_strcasecmp (type, "text/calendar") != 0 &&
- g_strcasecmp (type, "text/x-calendar") != 0) {
- bonobo_exception_set (ev, ex_Bonobo_Persist_WrongDataType);
- return;
- }
-
- if ((text = stream_read (stream)) == NULL) {
- bonobo_exception_set (ev, ex_Bonobo_Persist_FileNotFound);
- return;
- }
-
- e_itip_control_set_data (itip, text);
- g_free (text);
-}
-/*
- * This function implements the Bonobo::PersistStream:save method.
- */
-static void
-pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- EItipControl *itip = data;
- gchar *text;
- gint len;
-
- if (type && g_strcasecmp (type, "text/calendar") != 0 &&
- g_strcasecmp (type, "text/x-calendar") != 0) {
- bonobo_exception_set (ev, ex_Bonobo_Persist_WrongDataType);
- return;
- }
-
- text = e_itip_control_get_data (itip);
- len = e_itip_control_get_data_size (itip);
-
- bonobo_stream_client_write (stream, text, len, ev);
- g_free (text);
-} /* pstream_save */
-
-static CORBA_long
-pstream_get_max_size (BonoboPersistStream *ps, void *data,
- CORBA_Environment *ev)
-{
- EItipControl *itip = data;
- gint len;
-
- len = e_itip_control_get_data_size (itip);
-
- if (len > 0)
- return len;
-
- return 0L;
-}
-
-static Bonobo_Persist_ContentTypeList *
-pstream_get_content_types (BonoboPersistStream *ps, void *closure,
- CORBA_Environment *ev)
-{
- return bonobo_persist_generate_content_types (2, "text/calendar", "text/x-calendar");
-}
-
-static void
-get_prop (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- EItipControl *itip = user_data;
-
- switch (arg_id) {
- case FROM_ADDRESS_ARG_ID:
- BONOBO_ARG_SET_STRING (arg, e_itip_control_get_from_address (itip));
- break;
- }
-}
-
-static void
-set_prop ( BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- EItipControl *itip = user_data;
-
- switch (arg_id) {
- case FROM_ADDRESS_ARG_ID:
- e_itip_control_set_from_address (itip, BONOBO_ARG_GET_STRING (arg));
- break;
- }
-}
-
-
-static BonoboObject *
-itip_control_factory (BonoboGenericFactory *Factory, void *closure)
-{
- BonoboControl *control;
- BonoboPropertyBag *prop_bag;
- BonoboPersistStream *stream;
- GtkWidget *itip;
-
- itip = e_itip_control_new ();
- gtk_widget_show (itip);
- control = bonobo_control_new (itip);
-
- /* create a property bag */
- prop_bag = bonobo_property_bag_new (get_prop, set_prop, itip);
- bonobo_property_bag_add (prop_bag, "from_address", FROM_ADDRESS_ARG_ID, BONOBO_ARG_STRING, NULL,
- "from_address", 0 );
-
- bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (prop_bag)), NULL);
- bonobo_object_unref (BONOBO_OBJECT (prop_bag));
-
- bonobo_control_set_automerge (control, TRUE);
-
- stream = bonobo_persist_stream_new (pstream_load, pstream_save,
- pstream_get_content_types,
- "OAFIID:GNOME_Evolution_Calendar_iTip_Control",
- itip);
-
- if (stream == NULL) {
- bonobo_object_unref (BONOBO_OBJECT (control));
- return NULL;
- }
-
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (stream));
-
- return BONOBO_OBJECT (control);
-}
-
-void
-itip_control_factory_init (void)
-{
- static BonoboGenericFactory *factory = NULL;
-
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new (
- "OAFIID:GNOME_Evolution_Calendar_iTip_ControlFactory",
- itip_control_factory, NULL);
- bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));;
-
- if (factory == NULL)
- g_error ("I could not register an iTip control factory.");
-}
-
diff --git a/calendar/gui/itip-control-factory.h b/calendar/gui/itip-control-factory.h
deleted file mode 100644
index 6f8a95ec71..0000000000
--- a/calendar/gui/itip-control-factory.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Evolution calendar - Control for displaying iTIP mail messages
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors:
- * Jesse Pavel <jpavel@ximian.com>
- * JP Rosevear <jpr@ximian.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __ITIP_CONTROL_FACTORY_H__
-#define __ITIP_CONTROL_FACTORY_H__
-
-void itip_control_factory_init (void);
-
-#endif /* __ITIP_CONTROL_H__ */
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 750d893b5f..592eeb9659 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* control-factory.c
+/* main.c
*
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003 Ximian, 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
@@ -31,20 +31,32 @@
#include <glade/glade.h>
#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-generic-factory.h>
+#include <bonobo/bonobo-shlib-factory.h>
#include <bonobo/bonobo-exception.h>
#include <gal/widgets/e-cursors.h>
+#include <evolution-shell-client.h>
+
+#include "dialogs/cal-prefs-dialog.h"
#include "alarm-notify/alarm.h"
#include "calendar-commands.h"
#include "calendar-config.h"
-#include "component-factory.h"
+#include "calendar-component.h"
#include "e-comp-editor-registry.h"
#include "comp-editor-factory.h"
#include "control-factory.h"
-#include "itip-control-factory.h"
-#include "tasks-control-factory.h"
+#include "itip-bonobo-control.h"
+#include "tasks-control.h"
+
+
+#define FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_Factory"
+
+#define CALENDAR_COMPONENT_ID "OAFIID:GNOME_Evolution_Calendar_ShellComponent"
+#define CALENDAR_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_Control"
+#define TASKS_CONTROL_ID "OAFIID:GNOME_Evolution_Tasks_Control"
+#define ITIP_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_iTip_Control"
+#define CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_ConfigControl"
ECompEditorRegistry *comp_editor_registry = NULL;
@@ -52,20 +64,6 @@ ECompEditorRegistry *comp_editor_registry = NULL;
static CompEditorFactory *comp_editor_factory = NULL;
-static void
-init_bonobo (int argc, char **argv)
-{
- if (gnome_init_with_popt_table ("evolution-calendar", VERSION, argc, argv,
- bonobo_activation_popt_options, 0, NULL) != 0)
- g_error (_("Could not initialize GNOME"));
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-
- if (!bonobo_activate ())
- g_error (_("Could not activate Bonobo"));
-}
-
/* Factory function for the calendar component factory; just creates and
* references a singleton service object.
*/
@@ -82,18 +80,6 @@ comp_editor_factory_fn (BonoboGenericFactory *factory, const char *id, void *dat
return BONOBO_OBJECT (comp_editor_factory);
}
-/* Creates and registers the component editor factory */
-static void
-component_editor_factory_init (void)
-{
- BonoboGenericFactory *factory;
-
- factory = bonobo_generic_factory_new (
- "OAFIID:GNOME_Evolution_Calendar_CompEditorFactory_Factory",
- comp_editor_factory_fn, NULL);
- if (!factory)
- g_error (_("Could not create the component editor factory"));
-}
/* Does a simple activation and unreffing of the alarm notification service so
* that the daemon will be launched if it is not running yet.
@@ -141,49 +127,51 @@ launch_alarm_daemon (void)
*idle_id = g_idle_add ((GSourceFunc) launch_alarm_daemon_cb, idle_id);
}
-int
-main (int argc, char **argv)
+static void
+initialize (void)
{
- free (malloc (8));
-
- bindtextdomain(PACKAGE, EVOLUTION_LOCALEDIR);
- textdomain(PACKAGE);
-
- init_bonobo (argc, argv);
-
- if (!gnome_vfs_init ())
- g_error (_("Could not initialize gnome-vfs"));
-
- glade_gnome_init ();
- e_cursors_init ();
-
-#if 0
- //g_log_set_always_fatal ((GLogLevelFlags) 0xFFFF);
- g_log_set_always_fatal (G_LOG_LEVEL_ERROR |
- G_LOG_LEVEL_CRITICAL |
- G_LOG_LEVEL_WARNING);
-#endif
-
comp_editor_registry = E_COMP_EDITOR_REGISTRY (e_comp_editor_registry_new ());
calendar_config_init ();
- control_factory_init ();
- component_factory_init ();
+#if 0
itip_control_factory_init ();
- tasks_control_factory_init ();
component_editor_factory_init ();
+#endif
launch_alarm_daemon ();
+}
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- bonobo_main ();
-
- alarm_done ();
- gnome_vfs_shutdown ();
+static BonoboObject *
+factory (BonoboGenericFactory *factory,
+ const char *component_id,
+ void *closure)
+{
+ static gboolean initialized = FALSE;
+
+ if (! initialized)
+ initialize ();
+
+ if (strcmp (component_id, CALENDAR_COMPONENT_ID) == 0)
+ return calendar_component_get_object ();
+ if (strcmp (component_id, CALENDAR_CONTROL_ID) == 0)
+ return BONOBO_OBJECT (control_factory_new_control ());
+ if (strcmp (component_id, TASKS_CONTROL_ID) == 0)
+ return BONOBO_OBJECT (tasks_control_new ());
+ if (strcmp (component_id, ITIP_CONTROL_ID) == 0)
+ return BONOBO_OBJECT (itip_bonobo_control_new ());
+ if (strcmp (component_id, CONFIG_CONTROL_ID) == 0) {
+ extern EvolutionShellClient *global_shell_client; /* FIXME ugly */
+
+ if (global_shell_client == NULL)
+ return NULL;
+ else
+ return BONOBO_OBJECT (cal_prefs_dialog_new ());
+ }
- return 0;
+ 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/calendar/gui/tasks-control-factory.c b/calendar/gui/tasks-control-factory.c
deleted file mode 100644
index 59bf57439e..0000000000
--- a/calendar/gui/tasks-control-factory.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* tasks-control-factory.c
- *
- * Copyright (C) 2000 Ximian, 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.
- *
- * Authors: Ettore Perazzoli
- * Damon Chaplin <damon@ximian.com>
- */
-
-#include <config.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-context.h>
-#include "tasks-control-factory.h"
-#include "tasks-control.h"
-
-
-#define TASKS_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Tasks_ControlFactory"
-
-
-CORBA_Environment ev;
-CORBA_ORB orb;
-
-static BonoboObject *tasks_control_factory_fn (BonoboGenericFactory *Factory,
- void *data);
-
-
-/* Registers the factory with Bonobo. Should be called on startup. */
-void
-tasks_control_factory_init (void)
-{
- static BonoboGenericFactory *factory = NULL;
-
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new (TASKS_CONTROL_FACTORY_ID,
- tasks_control_factory_fn, NULL);
- bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
-
- if (factory == NULL)
- g_error ("I could not register a Tasks control factory.");
-}
-
-
-/* Callback factory function to create a tasks control. */
-static BonoboObject *
-tasks_control_factory_fn (BonoboGenericFactory *Factory,
- void *data)
-{
- BonoboControl *control;
-
- control = tasks_control_new ();
-
- if (control)
- return BONOBO_OBJECT (control);
- else {
- gnome_warning_dialog (_("Could not create the tasks view. Please check your "
- "ORBit and OAF setup."));
- return NULL;
- }
-}
diff --git a/calendar/gui/tasks-control-factory.h b/calendar/gui/tasks-control-factory.h
deleted file mode 100644
index 468f03b9e7..0000000000
--- a/calendar/gui/tasks-control-factory.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* tasks-control-factory.h
- *
- * Copyright (C) 2000 Ximian, 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.
- *
- * Authors: Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- */
-
-#ifndef _TASKS_CONTROL_FACTORY_H_
-#define _TASKS_CONTROL_FACTORY_H_
-
-void tasks_control_factory_init (void);
-BonoboControl *tasks_control_factory_new_control (void);
-
-#endif /* _TASKS_CONTROL_FACTORY_H_ */
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index a4a4c4937f..b7526a68bc 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* tasks-control.c
*
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003 Ximian, 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
diff --git a/calendar/gui/tasks-control.h b/calendar/gui/tasks-control.h
index 2d701f0c85..c74b6d220b 100644
--- a/calendar/gui/tasks-control.h
+++ b/calendar/gui/tasks-control.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* tasks-control.h
*
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003 Ximian, 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
diff --git a/calendar/gui/tasks-migrate.c b/calendar/gui/tasks-migrate.c
index 8f1f2aeb8f..5c9ebd85fc 100644
--- a/calendar/gui/tasks-migrate.c
+++ b/calendar/gui/tasks-migrate.c
@@ -27,7 +27,8 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <cal-client/cal-client.h>
-#include "component-factory.h"
+
+#include "calendar-component.h"
#include "tasks-migrate.h"