[Evolution-hackers] Spliting evolution into several programs



hi,

yesterday i gave a stab at spliting evolution into 3 components, attach
is a preliminary patch. 

The patch does the following things:
1) it creates three shells for Mail, Calendar and Addressbook
2) each shell does not have the switching buttons (but the menu is still
present although it does not do anything)
3) the settings components are only shown where they belong
4) modifies the "New" menu so that it only shows the meaningful
components inside each application.

Now, this is a "Bonobo-based" split (in that it uses bonobo as the basis
of the split (ie. there is only a new shell for each component, but the
components are still there), and there are several problems: 

a) not all the plugins can be used
b) the system that lets you add an address from the mailer does not work
as it requires functionality that belongs to the Address book component.
c) It is a Bonobo split, meaning that all the components and mostly
useless bonoboUI code is still there
d) I don't really know what to do with the memos and notes components
that belong to the calendar.

All in all this can be the begining of a crusade to remove BonoboUI (the
rest of the bonobo that is used in evolution is for communication with
EDS, but i believe there is plan and even a patch to port it to DBUS)
from Evolution and split it into 3 components, it only took me 3 hours
without knowing anything at all about evolution.

Other thing that might also be needed is to put the addressbook UI to
edit contacts into EDS this way there would be no inter-component
dependencies.

Last but not least i don't know how the exchange plugins work and thus i
don't know if this split breaks it and in which ways it does. 

Nevertheless i hope it shows a path for future work, i believe that if
evolution gets rid of the BonoboUI code contributors will find an easier
way into the code. I also say "it shows a path" because i don't think i
will have enough time to remove BonoboUI code.

I hope this inspires some hackers.

Best regards,
Diego

PD: i think the patch and files is everything i modified to make the
thing work, in case there is something left, just drop me a line.
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 33345)
+++ Makefile.am	(working copy)
@@ -20,7 +20,7 @@
 	$(SHELL_CFLAGS)						\
 	$(EVOLUTION_TEST_CFLAGS)
 
-noinst_PROGRAMS = evolution
+noinst_PROGRAMS =  evolution evomail evocal evobook
 
 # Shell CORBA stuff
 
@@ -80,7 +80,8 @@
 # Shell library
 
 privsolib_LTLIBRARIES =	\
-	libeshell.la
+	libeshell.la	\
+	libshell.la
 
 eshellincludedir = $(privincludedir)/shell
 
@@ -115,9 +116,7 @@
 	$(top_builddir)/widgets/misc/libemiscwidgets.la	\
 	$(SHELL_LIBS)
 
-# Evolution executable
-
-evolution_SOURCES =				\
+libshell_la_SOURCES =				\
 	$(DATASERVER_IDL_GENERATED)		\
 	$(NM_SUPPORT_FILES)			\
 	e-component-registry.c			\
@@ -146,17 +145,68 @@
 	e-sidebar.c				\
 	e-sidebar.h				\
 	es-event.c				\
-	es-menu.c				\
+	es-menu.c
+
+libshell_la_LIBADD =							\
+	libeshell.la							\
+	$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la	\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
+	$(top_builddir)/e-util/libeutil.la				\
+	$(TZDIALOG_LIBS)						\
+	$(SHELL_LIBS)
+
+libshell_la_LDFLAGS = $(NO_UNDEFINED)
+
+# Evolution executable
+
+evolution_SOURCES =				\
 	main.c					
 
 evolution_LDADD =							\
 	libeshell.la							\
+	libshell.la							\
 	$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la	\
 	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
 	$(top_builddir)/e-util/libeutil.la				\
 	$(TZDIALOG_LIBS)						\
 	$(SHELL_LIBS)
 
+evomail_SOURCES =				\
+	main-mail.c					
+
+evomail_LDADD =							\
+	libeshell.la							\
+	libshell.la							\
+	$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la	\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
+	$(top_builddir)/e-util/libeutil.la				\
+	$(TZDIALOG_LIBS)						\
+	$(SHELL_LIBS)
+
+evocal_SOURCES =				\
+	main-cal.c
+
+evocal_LDADD =							\
+	libeshell.la							\
+	libshell.la							\
+	$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la	\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
+	$(top_builddir)/e-util/libeutil.la				\
+	$(TZDIALOG_LIBS)						\
+	$(SHELL_LIBS)
+
+evobook_SOURCES =				\
+	main-book.c
+
+evobook_LDADD =							\
+	libeshell.la							\
+	libshell.la							\
+	$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la	\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
+	$(top_builddir)/e-util/libeutil.la				\
+	$(TZDIALOG_LIBS)						\
+	$(SHELL_LIBS)
+
 # Test component
 
 if ENABLE_TEST_COMPONENT
@@ -182,7 +232,7 @@
 
 # Misc stuff
 
-server_in_files = GNOME_Evolution_Shell.server.in.in
+server_in_files = GNOME_Evolution_Shell.server.in.in GNOME_Evolution_CalShell.server.in.in GNOME_Evolution_MailShell.server.in.in GNOME_Evolution_BookShell.server.in.in
 server_DATA = $(server_in_files:.server.in.in=_$(BASE_VERSION).server)
 @EVO_SERVER_RULE@
 @INTLTOOL_SERVER_RULE@
Index: e-shell-window.c
===================================================================
--- e-shell-window.c	(revision 33345)
+++ e-shell-window.c	(working copy)
@@ -666,8 +666,8 @@
 	gtk_widget_show (priv->paned);
 
 	priv->sidebar = e_sidebar_new ();
-	g_signal_connect (priv->sidebar, "button_selected",
-			  G_CALLBACK (sidebar_button_selected_callback), window);
+/*	g_signal_connect (priv->sidebar, "button_selected",
+			  G_CALLBACK (sidebar_button_selected_callback), window);*/
 	gtk_paned_pack1 (GTK_PANED (priv->paned), priv->sidebar, FALSE, FALSE);
 	gtk_widget_show (priv->sidebar);
 
@@ -696,7 +696,7 @@
 				      visible ? "0" : "1",
 				      NULL);
 
-	e_sidebar_set_show_buttons (E_SIDEBAR (priv->sidebar), visible);
+//	e_sidebar_set_show_buttons (E_SIDEBAR (priv->sidebar), visible);
 
 	style = gconf_client_get_string (gconf_client,
 					 "/apps/evolution/shell/view_defaults/buttons_style",
@@ -768,7 +768,7 @@
 
 	button_id = 0;
 	xml = g_string_new("");
-	for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
+	for (p = e_component_registry_peek_list (registry, NULL); p != NULL; p = p->next) {
 		char *tmp, *tmp2;
 		EComponentInfo *info = p->data;
 		ComponentView *view = component_view_new (info->id, info->alias, button_id);
@@ -777,7 +777,8 @@
 
 		if (!info->button_label || !info->menu_label)
 			continue;
-		e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_tooltips, info->button_icon, button_id);
+//		e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_tooltips, info->button_icon, button_id);
+		switch_view (window, view);
 
 		g_string_printf(xml, "SwitchComponent-%s", info->alias);
 		bonobo_ui_component_add_verb (e_shell_window_peek_bonobo_ui_component (window),
@@ -1113,7 +1114,7 @@
 		return;
 	}
 
-	e_sidebar_select_button (E_SIDEBAR (priv->sidebar), view->button_id);
+//e_sidebar_select_button (E_SIDEBAR (priv->sidebar), view->button_id);
 }
 
 
Index: e-user-creatable-items-handler.c
===================================================================
--- e-user-creatable-items-handler.c	(revision 33345)
+++ e-user-creatable-items-handler.c	(working copy)
@@ -171,9 +171,13 @@
 	GNOME_Evolution_Component corba_component;
 	Component *component;
 	int i;
+	char *g_query;
 
+	g_query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Component:%s') AND evolution:component_alias == '%s'", BASE_VERSION, handler->priv->this_component);
+
 	CORBA_exception_init (&ev);
-	info_list = bonobo_activation_query (component_query, NULL, &ev);
+	info_list = bonobo_activation_query (g_query, NULL, &ev);
+	g_free (g_query);
 	if (BONOBO_EX (&ev)) {
 		char *ex_text = bonobo_exception_get_text (&ev);
 		g_warning ("Cannot query for components: %s\n", ex_text);
@@ -182,6 +186,7 @@
 		return;
 	}
 
+
 	for (i = 0; i < info_list->_length; i++) {
 		iid = info_list->_buffer[i].iid;
 		corba_component = bonobo_activation_activate_from_id (iid, Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, &ev);
@@ -519,6 +524,7 @@
 			menu_item_func (handler, menu, item, FALSE);
 	}
 
+#if 0
 	/* Then a separator */
 	separator_func (handler, menu, 1);
 
@@ -550,6 +556,7 @@
 	for (p = items; p != NULL; p = p->next)
 		menu_item_func (handler, menu, p->data, FALSE);
 	g_slist_free (items);
+#endif
 }
 
 /* The XML description for "File -> New".  */
@@ -774,7 +781,7 @@
 	case PROP_THIS_COMPONENT:
 		handler->priv->this_component = g_value_dup_string (value);
 
-		get_components_from_bonobo (handler);	
+		get_components_from_bonobo (handler);
 		ensure_menu_items (handler);
 		break;
 	default:
Index: e-component-registry.c
===================================================================
--- e-component-registry.c	(revision 33345)
+++ e-component-registry.c	(working copy)
@@ -143,7 +143,7 @@
 }
 
 static void
-query_components (EComponentRegistry *registry)
+query_components (EComponentRegistry *registry, const char *alias)
 {
 	Bonobo_ServerInfoList *info_list;
 	const gchar * const *language_names;
@@ -159,7 +159,11 @@
 	registry->priv->init = TRUE;
 
 	CORBA_exception_init (&ev);
-	query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Component:%s')", BASE_VERSION);
+	if (alias != NULL)
+		query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Component:%s') AND evolution:component_alias == '%s'", BASE_VERSION, alias);
+	else
+		query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Component:%s')", BASE_VERSION);
+	
 	info_list = bonobo_activation_query (query, NULL, &ev);
 	g_free (query);
 
@@ -289,11 +293,11 @@
 
 
 GSList *
-e_component_registry_peek_list (EComponentRegistry *registry)
+e_component_registry_peek_list (EComponentRegistry *registry, const char *alias)
 {
 	g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL);
 
-	query_components(registry);
+	query_components(registry, alias);
 
 	return registry->priv->infos;
 }
@@ -308,7 +312,7 @@
 
 	g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL);
 
-	query_components(registry);
+	query_components(registry, NULL);
 
 	for (p = registry->priv->infos; p != NULL; p = p->next) {
 		EComponentInfo *info = p->data;
Index: e-component-registry.h
===================================================================
--- e-component-registry.h	(revision 33345)
+++ e-component-registry.h	(working copy)
@@ -89,7 +89,7 @@
 GType               e_component_registry_get_type  (void);
 EComponentRegistry *e_component_registry_new       (void);
 
-GSList         *e_component_registry_peek_list  (EComponentRegistry *registry);
+GSList         *e_component_registry_peek_list  (EComponentRegistry *registry, const char *alias);
 EComponentInfo *e_component_registry_peek_info  (EComponentRegistry *registry,
 						 enum _EComponentRegistryField type,
 						 const char *key);
Index: e-shell-settings-dialog.c
===================================================================
--- e-shell-settings-dialog.c	(revision 33345)
+++ e-shell-settings-dialog.c	(working copy)
@@ -144,10 +144,11 @@
 }
 
 static void
-load_pages (EShellSettingsDialog *dialog)
+load_pages (EShellSettingsDialog *dialog, const char *alias)
 {
 	EShellSettingsDialogPrivate *priv;
 	Bonobo_ServerInfoList *control_list;
+	gchar *query;
 	const gchar * const *language_names;
 	CORBA_Environment ev;
 	GSList *languages = NULL;
@@ -159,7 +160,10 @@
 	
 	CORBA_exception_init (&ev);
 
-	control_list = bonobo_activation_query ("repo_ids.has('IDL:GNOME/Evolution/ConfigControl:" BASE_VERSION "')", NULL, &ev);
+	query = g_strdup_printf ("repo_ids.has('IDL:GNOME/Evolution/ConfigControl:%s') AND evolution:component == '%s'", BASE_VERSION, alias);
+	g_print ("QUERY FOR SETTINGS PAGES: %s\n", query);
+	control_list = bonobo_activation_query (query, NULL, &ev);
+	g_free (query);
 	if (ev._major != CORBA_NO_EXCEPTION || control_list == NULL) {
 		g_warning ("Cannot load configuration pages -- %s", BONOBO_EX_REPOID (&ev));
 		CORBA_exception_free (&ev);
@@ -310,23 +314,29 @@
 	priv->types = g_hash_table_new (g_str_hash, g_str_equal);
 
 	dialog->priv = priv;
+}
 
-	load_pages (dialog);
+
+void
+e_shell_settings_dialog_construct (EShellSettingsDialog *dialog, 
+				   const char *alias)
+{
+	load_pages (dialog, alias);
 	set_dialog_size (dialog);
 	
 	gtk_window_set_title (GTK_WINDOW (dialog), _("Evolution Preferences"));
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
 }
 
-
 GtkWidget *
-e_shell_settings_dialog_new ()
+e_shell_settings_dialog_new (const char *alias)
 {
-	EShellSettingsDialog *new;
+	EShellSettingsDialog *dialog;
 
-	new = g_object_new (e_shell_settings_dialog_get_type (), NULL);
+	dialog = g_object_new (e_shell_settings_dialog_get_type (), NULL);
+	e_shell_settings_dialog_construct (dialog, alias);
 
-	return GTK_WIDGET (new);
+	return GTK_WIDGET (dialog);
 }
 
 void
Index: e-shell-settings-dialog.h
===================================================================
--- e-shell-settings-dialog.h	(revision 33345)
+++ e-shell-settings-dialog.h	(working copy)
@@ -54,7 +54,7 @@
 
 
 GtkType    e_shell_settings_dialog_get_type  (void);
-GtkWidget *e_shell_settings_dialog_new       (void);
+GtkWidget *e_shell_settings_dialog_new       (const char *alias);
 void       e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog,
 					      const char           *type);
 

Attachment: files.tar.gz
Description: application/compressed-tar



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]