Re: [Evolution-hackers] Spliting evolution into several programs
- From: Srinivasa Ragavan <sragavan novell com>
- To: Diego González <diego pemas net>
- Cc: evolution-hackers gnome org
- Subject: Re: [Evolution-hackers] Spliting evolution into several programs
- Date: Sun, 01 Apr 2007 13:45:40 +0530
Hi Diego,
On Sat, 2007-03-31 at 21:28 +0200, Diego Gonz�z wrote:
> 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:
This is same as what I have demoed in last GUADEC (Vilanova 2006). I
have attached that pre-alpha patch that I have used in my demo. But I
felt that it shouldn't be the way to go. I can list the problems with
this approach.
1. Account setup lies with Mailer (Exchange/GW will have issues around
this)
2. Plugins aren't associated to any components. The EPlugin framework
has to load the plugins depending on the component loaded.
3. Though the shell gets invoked multiple times, the window pops out but
the process dies after that as it creates a new view out of it.
Ideally for the split we should do the following things before that
1. Move the account setup out of Mailer
2. Move away from libbonoboui to Gtk based menus
3. Have the shell interface for a all-component view (like what is there
today)
4. Have evolution-mail, evolution-calendar, evolution-contact, etc as
separate binaries. They should have a main function, that creates a
GtkWindow and creates the menus, toolbars, preferences dialog and partly
the required plugins. Some of this can be achieved via the shell
library, need to explore more on this.
>
> 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.
They too can be separate apps. Althought the calendar provides a unified
view.
>
> 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.
>
DBUS port is to replace BONOBO in eds for IPC etc. It has no other stuff
here in Evolution.
-Srini
PS: The patch use to apply on pre-2.8. Im not sure of the trunk.
> 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.
> _______________________________________________
> Evolution-hackers mailing list
> Evolution-hackers gnome org
> http://mail.gnome.org/mailman/listinfo/evolution-hackers
Index: e-component-registry.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-component-registry.c,v
retrieving revision 1.58
diff -u -p -r1.58 e-component-registry.c
--- e-component-registry.c 2 Jun 2006 17:32:19 -0000 1.58
+++ e-component-registry.c 13 Jul 2006 18:06:12 -0000
@@ -143,7 +143,7 @@ set_schemas (EComponentInfo *component_i
}
static void
-query_components (EComponentRegistry *registry)
+query_components (EComponentRegistry *registry, const char *component_id)
{
Bonobo_ServerInfoList *info_list;
CORBA_Environment ev;
@@ -151,8 +151,12 @@ query_components (EComponentRegistry *re
const GList *l;
char *query;
int i;
+ gboolean loaded=FALSE;
- if (registry->priv->init)
+ if (registry->priv->init && !component_id)
+ return;
+
+ if (component_id && (e_component_registry_peek_info_offline(registry, ECR_FIELD_ALIAS, component_id) != CORBA_OBJECT_NIL))
return;
registry->priv->init = TRUE;
@@ -174,7 +178,7 @@ query_components (EComponentRegistry *re
for (language_list=NULL;l;l=l->next)
language_list = g_slist_append(language_list, l->data);
- for (i = 0; i < info_list->_length; i++) {
+ for (i = 0; i < info_list->_length && !loaded; i++) {
const char *id;
const char *label;
const char *menu_label;
@@ -189,6 +193,15 @@ query_components (EComponentRegistry *re
GNOME_Evolution_Component iface;
id = info_list->_buffer[i].iid;
+ alias = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:component_alias", NULL);
+
+ if (component_id) {
+ if (!strcmp (component_id, alias))
+ loaded = TRUE;
+ else
+ continue;
+ }
+
iface = bonobo_activation_activate_from_id ((char *)id, 0, NULL, &ev);
if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) {
char *ex_text = bonobo_exception_get_text (&ev);
@@ -208,8 +221,6 @@ query_components (EComponentRegistry *re
menu_accelerator = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_accelerator", language_list);
- alias = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:component_alias", NULL);
-
icon_name = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_icon", NULL);
if (icon_name) {
icon = e_icon_factory_get_icon (icon_name, E_ICON_SIZE_LARGE_TOOLBAR);
@@ -288,11 +299,11 @@ e_component_registry_new (void)
GSList *
-e_component_registry_peek_list (EComponentRegistry *registry)
+e_component_registry_peek_list (EComponentRegistry *registry, const char *component_id)
{
g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL);
- query_components(registry);
+ query_components(registry, component_id);
return registry->priv->infos;
}
@@ -307,7 +318,39 @@ e_component_registry_peek_info (ECompone
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;
+
+ switch (field) {
+ case ECR_FIELD_ID:
+ if (info->id && (strcmp (info->id, key) == 0))
+ return info;
+ break;
+ case ECR_FIELD_ALIAS:
+ if (info->alias && (strcmp (info->alias, key) == 0))
+ return info;
+ break;
+ case ECR_FIELD_SCHEMA:
+ for (q = info->uri_schemas; q != NULL; q = q->next)
+ if (strcmp((char *)q->data, key) == 0)
+ return info;
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+EComponentInfo *
+e_component_registry_peek_info_offline (EComponentRegistry *registry,
+ enum _EComponentRegistryField field,
+ const char *key)
+{
+ GSList *p, *q;
+
+ g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL);
for (p = registry->priv->infos; p != NULL; p = p->next) {
EComponentInfo *info = p->data;
Index: e-component-registry.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-component-registry.h,v
retrieving revision 1.17
diff -u -p -r1.17 e-component-registry.h
--- e-component-registry.h 16 May 2005 04:46:40 -0000 1.17
+++ e-component-registry.h 13 Jul 2006 18:06:12 -0000
@@ -89,11 +89,13 @@ typedef struct _EComponentInfo EComponen
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 *component_id);
EComponentInfo *e_component_registry_peek_info (EComponentRegistry *registry,
enum _EComponentRegistryField type,
const char *key);
-
+EComponentInfo *e_component_registry_peek_info_offline (EComponentRegistry *registry,
+ enum _EComponentRegistryField type,
+ const char *key);
GNOME_Evolution_Component e_component_registry_activate (EComponentRegistry *registry,
const char *id,
CORBA_Environment *ev);
Index: e-shell-settings-dialog.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-settings-dialog.c,v
retrieving revision 1.38
diff -u -p -r1.38 e-shell-settings-dialog.c
--- e-shell-settings-dialog.c 21 Jan 2006 11:48:51 -0000 1.38
+++ e-shell-settings-dialog.c 13 Jul 2006 18:06:13 -0000
@@ -46,7 +46,6 @@ G_DEFINE_TYPE (EShellSettingsDialog, e_s
/* FIXME ugly hack to work around that sizing of invisible widgets is broken
with Bonobo. */
-
static void
set_dialog_size (EShellSettingsDialog *dialog)
{
@@ -154,7 +153,7 @@ load_pages (EShellSettingsDialog *dialog
GList *page_list;
GList *p;
int i, j;
-
+
priv = dialog->priv;
CORBA_exception_init (&ev);
@@ -181,14 +180,27 @@ load_pages (EShellSettingsDialog *dialog
const char *description;
const char *icon_path;
const char *priority_string;
- Bonobo_ActivationProperty *type;
+ const char *alias=NULL;
+ Bonobo_ActivationProperty *type, *comp;
int priority;
GdkPixbuf *icon;
-
+ gboolean loaded = FALSE;
+
CORBA_exception_init (&ev);
info = & control_list->_buffer[i];
-
+ comp = bonobo_server_info_prop_find (info, "evolution2:config_item:component");
+ if (dialog->component && !dialog->universal) {
+ Bonobo_StringList list = comp->v._u.value_stringv;
+
+ for (j = 0; j < list._length && !loaded; j++) {
+ if (!strcmp (dialog->component, list._buffer[j]))
+ loaded = TRUE;
+ }
+ if (!loaded)
+ continue;
+ }
+
title = bonobo_server_info_prop_lookup (info, "evolution2:config_item:title", language_list);
description = bonobo_server_info_prop_lookup (info, "evolution2:config_item:description", language_list);
icon_path = bonobo_server_info_prop_lookup (info, "evolution2:config_item:icon_name", NULL);
@@ -297,9 +309,11 @@ static void
e_shell_settings_dialog_class_init (EShellSettingsDialogClass *klass)
{
GObjectClass *object_class;
-
+ GParamSpec *spec;
+
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = impl_finalize;
+
}
static void
@@ -311,22 +325,23 @@ e_shell_settings_dialog_init (EShellSett
priv->types = g_hash_table_new (g_str_hash, g_str_equal);
dialog->priv = priv;
-
- load_pages (dialog);
- 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 *component, gboolean universal)
{
EShellSettingsDialog *new;
new = g_object_new (e_shell_settings_dialog_get_type (), NULL);
-
+ new->component = component;
+ new->universal = universal;
+
+ load_pages (new);
+ set_dialog_size (new);
+
+ gtk_window_set_title (GTK_WINDOW (new), _("Evolution Preferences"));
+ gtk_dialog_set_has_separator (GTK_DIALOG (new), FALSE);
return GTK_WIDGET (new);
}
Index: e-shell-settings-dialog.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-settings-dialog.h,v
retrieving revision 1.3
diff -u -p -r1.3 e-shell-settings-dialog.h
--- e-shell-settings-dialog.h 19 Jun 2002 19:18:19 -0000 1.3
+++ e-shell-settings-dialog.h 13 Jul 2006 18:06:13 -0000
@@ -45,6 +45,8 @@ typedef struct _EShellSettingsDialogClas
struct _EShellSettingsDialog {
EMultiConfigDialog parent;
+ const char *component;
+ gboolean universal;
EShellSettingsDialogPrivate *priv;
};
@@ -54,7 +56,7 @@ struct _EShellSettingsDialogClass {
GtkType e_shell_settings_dialog_get_type (void);
-GtkWidget *e_shell_settings_dialog_new (void);
+GtkWidget *e_shell_settings_dialog_new (const char *component, gboolean universal);
void e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog,
const char *type);
Index: e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.51
diff -u -p -r1.51 e-shell-window.c
--- e-shell-window.c 7 Jul 2006 03:19:43 -0000 1.51
+++ e-shell-window.c 13 Jul 2006 18:06:16 -0000
@@ -84,7 +84,8 @@ struct _EShellWindowPrivate {
EShell *shell;
EShellView *shell_view; /* CORBA wrapper for this, just a placeholder */
-
+ const char *component;
+
/* plugin menu manager */
ESMenu *menu;
@@ -639,7 +640,7 @@ static GConfEnumStringPair button_styles
};
static void
-setup_widgets (EShellWindow *window)
+setup_widgets (EShellWindow *window, char *component_id)
{
EShellWindowPrivate *priv = window->priv;
EComponentRegistry *registry = e_shell_peek_component_registry (priv->shell);
@@ -686,8 +687,14 @@ setup_widgets (EShellWindow *window)
visible ? "0" : "1",
NULL);
- e_sidebar_set_show_buttons (E_SIDEBAR (priv->sidebar), visible);
-
+ e_sidebar_set_show_buttons (E_SIDEBAR (priv->sidebar), visible && !component_id);
+ if (component_id) {
+ bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
+ "/menu/View/Window",
+ "visib",
+ "0",
+ NULL);
+ }
style = gconf_client_get_string (gconf_client,
"/apps/evolution/shell/view_defaults/buttons_style",
NULL);
@@ -758,7 +765,18 @@ setup_widgets (EShellWindow *window)
button_id = 0;
xml = g_string_new("");
- for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
+
+ if (component_id) {
+ /* Hide these, if it is a split model */
+ bonobo_ui_component_rm (e_shell_window_peek_bonobo_ui_component (window),
+ "/menu/View/Window",
+ NULL);
+ bonobo_ui_component_rm (e_shell_window_peek_bonobo_ui_component (window),
+ "/menu/View/Buttons",
+ NULL);
+ }
+
+ for (p = e_component_registry_peek_list (registry, component_id); p != NULL; p = p->next) {
char *tmp, *tmp2;
EComponentInfo *info = p->data;
ComponentView *view = component_view_new (info->id, info->alias, button_id);
@@ -769,40 +787,42 @@ setup_widgets (EShellWindow *window)
continue;
e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_tooltips, info->button_icon, button_id);
- g_string_printf(xml, "SwitchComponent-%s", info->alias);
- bonobo_ui_component_add_verb (e_shell_window_peek_bonobo_ui_component (window),
- xml->str,
- (BonoboUIVerbFn)menu_component_selected,
- window);
-
- g_string_printf(xml, "<submenu name=\"View\">"
- "<submenu name=\"Window\">"
- "<placeholder name=\"WindowComponent\">"
- "<menuitem name=\"SwitchComponent-%s\" "
- "verb=\"\" label=\"%s\" accel=\"%s\" tip=\"",
- info->alias,
- info->menu_label,
- info->menu_accelerator);
- tmp = g_strdup_printf (_("Switch to %s"), info->button_label);
- tmp2 = g_markup_escape_text (tmp, -1);
- g_string_append (xml, tmp2);
- g_free (tmp2);
- g_free (tmp);
-
- tmp = bonobo_ui_util_pixbuf_to_xml (info->menu_icon),
- g_string_append_printf(xml, "\" pixtype=\"pixbuf\" pixname=\"%s\"/>"
- "</placeholder></submenu></submenu>\n",
- tmp);
- g_free(tmp);
- bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
- "/menu",
- xml->str,
- NULL);
- g_string_printf(xml, "<cmd name=\"SwitchComponent-%s\"/>\n", info->alias);
- bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
- "/commands",
- xml->str,
- NULL);
+ if (!component_id) {
+ g_string_printf(xml, "SwitchComponent-%s", info->alias);
+ bonobo_ui_component_add_verb (e_shell_window_peek_bonobo_ui_component (window),
+ xml->str,
+ (BonoboUIVerbFn)menu_component_selected,
+ window);
+
+ g_string_printf(xml, "<submenu name=\"View\">"
+ "<submenu name=\"Window\" >"
+ "<placeholder name=\"WindowComponent\">"
+ "<menuitem name=\"SwitchComponent-%s\" "
+ "verb=\"\" label=\"%s\" accel=\"%s\" tip=\"",
+ info->alias,
+ info->menu_label,
+ info->menu_accelerator);
+ tmp = g_strdup_printf (_("Switch to %s"), info->button_label);
+ tmp2 = g_markup_escape_text (tmp, -1);
+ g_string_append (xml, tmp2);
+ g_free (tmp2);
+ g_free (tmp);
+
+ tmp = bonobo_ui_util_pixbuf_to_xml (info->menu_icon),
+ g_string_append_printf(xml, "\" pixtype=\"pixbuf\" pixname=\"%s\"/>"
+ "</placeholder></submenu></submenu>\n",
+ tmp);
+ g_free(tmp);
+ bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
+ "/menu",
+ xml->str,
+ NULL);
+ g_string_printf(xml, "<cmd name=\"SwitchComponent-%s\"/>\n", info->alias);
+ bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
+ "/commands",
+ xml->str,
+ NULL);
+ }
button_id ++;
}
g_string_free(xml, TRUE);
@@ -828,7 +848,8 @@ static void
impl_dispose (GObject *object)
{
EShellWindowPrivate *priv = E_SHELL_WINDOW (object)->priv;
-
+ EShellWindow *window = E_SHELL_WINDOW (object);
+
if (priv->shell != NULL) {
g_object_remove_weak_pointer (G_OBJECT (priv->shell), (void **) &priv->shell);
priv->shell = NULL;
@@ -844,6 +865,11 @@ impl_dispose (GObject *object)
priv->tooltips = NULL;
}
+ if (window->settings_dialog != NULL) {
+ gtk_widget_destroy (window->settings_dialog);
+ window->settings_dialog = NULL;
+ }
+
(* G_OBJECT_CLASS (e_shell_window_parent_class)->dispose) (object);
}
@@ -960,7 +986,7 @@ e_shell_window_init (EShellWindow *shell
priv->shell_view = e_shell_view_new(shell_window);
shell_window->priv = priv;
-
+ shell_window->settings_dialog = NULL;
/** @HookPoint: Shell Main Menu
* @Id: org.gnome.evolution.shell
* @Type: ESMenu
@@ -988,6 +1014,8 @@ e_shell_window_new (EShell *shell,
char *default_component_id = NULL;
char *xmlfile;
+ window->priv->component = component_id;
+ e_user_creatable_items_set_split (component_id ? TRUE: FALSE);
if (bonobo_window_construct (BONOBO_WINDOW (window),
bonobo_ui_container_new (),
"evolution", "Evolution") == NULL) {
@@ -1019,7 +1047,7 @@ e_shell_window_new (EShell *shell,
e_shell_window_commands_setup (window);
e_menu_activate((EMenu *)priv->menu, priv->ui_component, TRUE);
- setup_widgets (window);
+ setup_widgets (window, component_id);
if(gconf_client_get_bool (gconf_client,"/apps/evolution/shell/view_defaults/sidebar_visible",NULL))
gtk_widget_show (priv->sidebar);
@@ -1198,8 +1226,14 @@ void
e_shell_window_show_settings (EShellWindow *window)
{
g_return_if_fail (E_IS_SHELL_WINDOW (window));
+ const char *component;
+
+/* if (window->priv->component) */
+/* component = window->priv->component; */
+/* else */
+ component = window->priv->current_view ? window->priv->current_view->component_alias : NULL;
- e_shell_show_settings (window->priv->shell, window->priv->current_view ? window->priv->current_view->component_alias : NULL, window);
+ e_shell_show_settings (window->priv->shell, component, window, window->priv->component ? FALSE : TRUE);
}
void
Index: e-shell-window.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.h,v
retrieving revision 1.11
diff -u -p -r1.11 e-shell-window.h
--- e-shell-window.h 21 Dec 2005 07:18:49 -0000 1.11
+++ e-shell-window.h 13 Jul 2006 18:06:16 -0000
@@ -41,6 +41,7 @@ typedef struct _EShellWindowClass EShe
struct _EShellWindow {
BonoboWindow parent;
+ GtkWidget *settings_dialog;
EShellWindowPrivate *priv;
};
Index: e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.273
diff -u -p -r1.273 e-shell.c
--- e-shell.c 19 Jun 2006 15:21:55 -0000 1.273
+++ e-shell.c 13 Jul 2006 18:06:18 -0000
@@ -85,6 +85,7 @@ struct _EShellPrivate {
/* EUriSchemaRegistry *uri_schema_registry; FIXME */
EComponentRegistry *component_registry;
+ const char *default_component_id;
/* Names for the types of the folders that have maybe crashed. */
/* FIXME TODO */
@@ -97,7 +98,7 @@ struct _EShellPrivate {
EvolutionListener *line_status_listener;
/* Settings Dialog */
- GtkWidget *settings_dialog;
+/* GtkWidget *settings_dialog; */
/* If we're quitting and things are still busy, a timeout handler */
guint quit_timeout;
@@ -174,7 +175,7 @@ set_interactive (EShell *shell,
first_element = g_list_first (shell->priv->windows);
view = GTK_WIDGET (first_element->data);
- component_list = e_component_registry_peek_list (shell->priv->component_registry);
+ component_list = e_component_registry_peek_list (shell->priv->component_registry, shell->priv->default_component_id);
for (p = component_list; p != NULL; p = p->next) {
EComponentInfo *info = p->data;
@@ -450,10 +451,10 @@ impl_dispose (GObject *object)
/* No unreffing for these as they are aggregate. */
/* bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); */
- if (priv->settings_dialog != NULL) {
- gtk_widget_destroy (priv->settings_dialog);
- priv->settings_dialog = NULL;
- }
+/* if (priv->settings_dialog != NULL) { */
+/* gtk_widget_destroy (priv->settings_dialog); */
+/* priv->settings_dialog = NULL; */
+/* } */
if (priv->line_status_listener) {
priv->line_status_listener->complete = NULL;
@@ -603,7 +604,7 @@ attempt_upgrade (EShell *shell, int majo
success = TRUE;
- component_infos = e_component_registry_peek_list (shell->priv->component_registry);
+ component_infos = e_component_registry_peek_list (shell->priv->component_registry, shell->priv->default_component_id);
for (p = component_infos; success && p != NULL; p = p->next) {
const EComponentInfo *info = p->data;
CORBA_Environment ev;
@@ -685,7 +686,7 @@ e_shell_construct (EShell *shell,
/* activate all the components (peek list does this implictly) */
/* Do we really need to assign the result of this to the list? */
- component = e_component_registry_peek_list (shell->priv->component_registry);
+ component = e_component_registry_peek_list (shell->priv->component_registry, shell->priv->default_component_id);
e_shell_attempt_upgrade(shell);
@@ -726,13 +727,15 @@ e_shell_construct (EShell *shell,
**/
EShell *
e_shell_new (EShellStartupLineMode startup_line_mode,
+ const char *component_id,
EShellConstructResult *construct_result_return)
{
EShell *new;
EShellConstructResult construct_result;
new = g_object_new (e_shell_get_type (), NULL);
-
+ new->priv->default_component_id = component_id;
+
construct_result = e_shell_construct (new, E_SHELL_OAFIID, startup_line_mode);
if (construct_result != E_SHELL_CONSTRUCT_RESULT_OK) {
@@ -938,7 +941,7 @@ e_shell_create_window (EShell *shell,
g_signal_emit (shell, signals[NEW_WINDOW_CREATED], 0, window);
- gtk_widget_show (GTK_WIDGET (window));
+ gtk_window_present (GTK_WIDGET (window));
e_error_default_parent((GtkWindow *)window);
@@ -1143,7 +1146,7 @@ set_line_status(EShell *shell, GNOME_Evo
`need to not complete till we're really complete */
priv->line_status_pending += 2;
- component_infos = e_component_registry_peek_list (priv->component_registry);
+ component_infos = e_component_registry_peek_list (priv->component_registry, shell->priv->default_component_id);
for (p = component_infos; p != NULL; p = p->next) {
EComponentInfo *info = p->data;
@@ -1206,7 +1209,7 @@ e_shell_send_receive (EShell *shell)
g_return_if_fail (E_IS_SHELL (shell));
- component_list = e_component_registry_peek_list (shell->priv->component_registry);
+ component_list = e_component_registry_peek_list (shell->priv->component_registry, shell->priv->default_component_id);
for (p = component_list; p != NULL; p = p->next) {
EComponentInfo *info = p->data;
@@ -1227,7 +1230,8 @@ e_shell_send_receive (EShell *shell)
void
e_shell_show_settings (EShell *shell,
const char *type,
- EShellWindow *shell_window)
+ EShellWindow *shell_window,
+ gboolean universal)
{
EShellPrivate *priv;
@@ -1236,21 +1240,21 @@ e_shell_show_settings (EShell *shell,
priv = shell->priv;
- if (priv->settings_dialog != NULL) {
- gdk_window_show (priv->settings_dialog->window);
- gtk_widget_grab_focus (priv->settings_dialog);
+ if (shell_window->settings_dialog != NULL) {
+ gdk_window_show (shell_window->settings_dialog->window);
+ gtk_widget_grab_focus (shell_window->settings_dialog);
return;
}
- priv->settings_dialog = e_shell_settings_dialog_new ();
+ shell_window->settings_dialog = e_shell_settings_dialog_new (type, universal);
if (type != NULL)
- e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (priv->settings_dialog), type);
+ e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (shell_window->settings_dialog), type);
- g_object_add_weak_pointer (G_OBJECT (priv->settings_dialog), (void **) & priv->settings_dialog);
+ g_object_add_weak_pointer (G_OBJECT (shell_window->settings_dialog), (void **) & shell_window->settings_dialog);
- gtk_window_set_transient_for (GTK_WINDOW (priv->settings_dialog), GTK_WINDOW (shell_window));
- gtk_widget_show (priv->settings_dialog);
+ gtk_window_set_transient_for (GTK_WINDOW (shell_window->settings_dialog), GTK_WINDOW (shell_window));
+ gtk_widget_show (shell_window->settings_dialog);
}
@@ -1287,7 +1291,7 @@ es_run_quit(EShell *shell)
priv = shell->priv;
priv->preparing_to_quit = TRUE;
- component_infos = e_component_registry_peek_list (priv->component_registry);
+ component_infos = e_component_registry_peek_list (priv->component_registry, shell->priv->default_component_id);
done_quit = TRUE;
for (sp = component_infos; sp != NULL; sp = sp->next) {
EComponentInfo *info = sp->data;
@@ -1335,7 +1339,7 @@ e_shell_quit(EShell *shell)
if (priv->preparing_to_quit)
return FALSE;
- component_infos = e_component_registry_peek_list (priv->component_registry);
+ component_infos = e_component_registry_peek_list (priv->component_registry, shell->priv->default_component_id);
can_quit = TRUE;
for (sp = component_infos; sp != NULL; sp = sp->next) {
EComponentInfo *info = sp->data;
Index: e-shell.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.h,v
retrieving revision 1.70
diff -u -p -r1.70 e-shell.h
--- e-shell.h 22 Dec 2005 02:12:34 -0000 1.70
+++ e-shell.h 13 Jul 2006 18:06:18 -0000
@@ -97,6 +97,7 @@ EShellConstructResult e_shell_construct
const char *iid,
EShellStartupLineMode startup_line_mode);
EShell *e_shell_new (EShellStartupLineMode startup_line_mode,
+ const char *component_id,
EShellConstructResult *construct_result_return);
gboolean e_shell_attempt_upgrade (EShell *shell);
@@ -127,7 +128,8 @@ void e_shell_send_receive (EShell *she
void e_shell_show_settings (EShell *shell,
const char *type,
- EShellWindow *shell_window);
+ EShellWindow *shell_window,
+ gboolean universal);
gboolean e_shell_quit (EShell *shell);
Index: e-user-creatable-items-handler.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-user-creatable-items-handler.c,v
retrieving revision 1.17
diff -u -p -r1.17 e-user-creatable-items-handler.c
--- e-user-creatable-items-handler.c 12 Jul 2006 06:49:13 -0000 1.17
+++ e-user-creatable-items-handler.c 13 Jul 2006 18:06:19 -0000
@@ -60,6 +60,8 @@ struct _Component {
};
typedef struct _Component Component;
+static split = FALSE;
+
/* Representation of a single menu item. */
struct _MenuItem {
const char *label;
@@ -98,6 +100,7 @@ struct _EUserCreatableItemsHandlerPrivat
BonoboControl *new_control;
GtkTooltips *tooltips;
GtkAccelGroup *accel_group;
+ gboolean split;
};
enum {
@@ -247,6 +250,8 @@ ensure_menu_items (EUserCreatableItemsHa
int i;
component = (const Component *) p->data;
+ if (handler->priv->split && strcmp (handler->priv->this_component, component->alias))
+ continue;
if (component->type_list != NULL) {
for (i = 0; i < component->type_list->_length; i ++) {
const GNOME_Evolution_CreatableItemType *corba_item;
@@ -422,6 +427,9 @@ add_verbs (EUserCreatableItemsHandler *h
int i;
component = (const Component *) p->data;
+
+ if (handler->priv->split && strcmp (handler->priv->this_component, component->alias))
+ continue;
if (component->type_list != NULL) {
for (i = 0; i < component->type_list->_length; i ++) {
@@ -520,36 +528,39 @@ construct_menu (EUserCreatableItemsHandl
}
/* Then a separator */
- separator_func (handler, menu, 1);
-
- /* Then the objects from other components. */
- items = NULL;
- for (p = priv->objects; p != NULL; p = p->next) {
- item = p->data;
- if (! item_is_default (item, priv->this_component))
- items = g_slist_prepend (items, item);
- }
+ if (!handler->priv->split) {
+ separator_func (handler, menu, 1);
- items = g_slist_sort (items, item_types_sort_func);
- for (p = items; p != NULL; p = p->next)
- menu_item_func (handler, menu, p->data, FALSE);
- g_slist_free (items);
-
- /* Another separator */
- separator_func (handler, menu, 2);
+ /* Then the objects from other components. */
+ items = NULL;
+ for (p = priv->objects; p != NULL; p = p->next) {
+ item = p->data;
+ if (! item_is_default (item, priv->this_component))
+ items = g_slist_prepend (items, item);
+ }
- /* And finally the folders from other components */
- items = NULL;
- for (p = priv->folders; p != NULL; p = p->next) {
- item = p->data;
- if (! item_is_default (item, priv->this_component))
- items = g_slist_prepend (items, item);
+ items = g_slist_sort (items, item_types_sort_func);
+ for (p = items; p != NULL; p = p->next)
+ menu_item_func (handler, menu, p->data, FALSE);
+ g_slist_free (items);
+
+ /* Another separator */
+ separator_func (handler, menu, 2);
+
+ /* And finally the folders from other components */
+ items = NULL;
+ for (p = priv->folders; p != NULL; p = p->next) {
+ item = p->data;
+ if (! item_is_default (item, priv->this_component))
+ items = g_slist_prepend (items, item);
+ }
+ items = g_slist_sort (items, item_types_sort_func);
+ for (p = items; p != NULL; p = p->next)
+ menu_item_func (handler, menu, p->data, FALSE);
+ g_slist_free (items);
}
-
- items = g_slist_sort (items, item_types_sort_func);
- for (p = items; p != NULL; p = p->next)
- menu_item_func (handler, menu, p->data, FALSE);
- g_slist_free (items);
+
+
}
/* The XML description for "File -> New". */
@@ -877,6 +887,7 @@ e_user_creatable_items_handler_new (cons
NULL);
handler->priv->create_local = create_local;
handler->priv->create_data = data;
+ handler->priv->split = split;
return handler;
}
@@ -914,3 +925,11 @@ e_user_creatable_items_handler_activate
BONOBO_OBJREF (priv->new_control),
NULL);
}
+
+
+void e_user_creatable_items_set_split (gboolean status)
+{
+ split = status;
+}
+
+
Index: e-user-creatable-items-handler.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-user-creatable-items-handler.h,v
retrieving revision 1.3
diff -u -p -r1.3 e-user-creatable-items-handler.h
--- e-user-creatable-items-handler.h 21 Apr 2004 04:08:55 -0000 1.3
+++ e-user-creatable-items-handler.h 13 Jul 2006 18:06:19 -0000
@@ -62,7 +62,7 @@ EUserCreatableItemsHandler *e_user_creat
void e_user_creatable_items_handler_activate (EUserCreatableItemsHandler *handler,
BonoboUIComponent *ui_component);
-
+void e_user_creatable_items_set_split (gboolean status);
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: main.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/main.c,v
retrieving revision 1.184
diff -u -p -r1.184 main.c
--- main.c 17 Jun 2006 15:18:38 -0000 1.184
+++ main.c 13 Jul 2006 18:06:19 -0000
@@ -86,6 +86,7 @@
#include <pthread.h>
#include "e-util/e-plugin.h"
+#include "e-shell-view.h"
static EShell *shell = NULL;
@@ -103,7 +104,6 @@ static gint idle_cb (void *data);
static char *default_component_id = NULL;
static char *evolution_debug_log = NULL;
-static gchar **remaining_args;
static void
no_windows_left_cb (EShell *shell, gpointer data)
@@ -347,8 +347,9 @@ idle_cb (void *data)
else
startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;
- shell = e_shell_new (startup_line_mode, &result);
-
+ shell = e_shell_new (startup_line_mode, default_component_id, &result);
+ e_user_creatable_items_set_split (default_component_id ? TRUE: FALSE);
+ printf("it is %s\n", default_component_id);
switch (result) {
case E_SHELL_CONSTRUCT_RESULT_OK:
g_signal_connect (shell, "no_windows_left", G_CALLBACK (no_windows_left_cb), NULL);
@@ -381,16 +382,20 @@ idle_cb (void *data)
open_uris (corba_shell, uri_list);
} else {
CORBA_Environment ev;
-
+ EShellView *view;
+
CORBA_exception_init (&ev);
+
if (uri_list != NULL)
open_uris (corba_shell, uri_list);
- else
+ else {
if (default_component_id == NULL)
- GNOME_Evolution_Shell_createNewWindow (corba_shell, "", &ev);
+ view = GNOME_Evolution_Shell_createNewWindow (corba_shell, "", &ev);
else
- GNOME_Evolution_Shell_createNewWindow (corba_shell, default_component_id, &ev);
+ view = GNOME_Evolution_Shell_createNewWindow (corba_shell, default_component_id, &ev);
+ gtk_window_present (view);
+ }
CORBA_exception_free (&ev);
}
@@ -399,7 +404,7 @@ idle_cb (void *data)
CORBA_Object_release (corba_shell, &ev);
CORBA_exception_free (&ev);
-
+ printf("shell %d\n", shell);
if (shell == NULL)
bonobo_main_quit ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]