aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog21
-rw-r--r--shell/e-component-registry.c40
-rw-r--r--shell/e-shell-window.c28
-rw-r--r--shell/e-shell.c14
4 files changed, 62 insertions, 41 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 450021970e..3bd6586673 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,24 @@
+2004-06-24 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #57367.
+
+ * e-shell-window.c (e_shell_window_new): fix gconf client leak and
+ clean up some logic.
+
+ * e-shell.c (e_shell_construct): dont activate the components
+ individually, component registry does that implictly.
+
+ * e-component-registry.c (init): dont call query_components here.
+ (query_components): setup a run-once guard. before adding a
+ component info to the list, make sure we can activate it.
+ (component_info_new): take the interface as a construct argument
+ now.
+ (e_component_registry_peek_list): perform the component list query
+ if we haven't already.
+ (e_component_registry_peek_info): same.
+ (e_component_registry_activate): just always return
+ the reffed component, it isn't added unless it was already activated.
+
2004-06-21 Chris Toshok <toshok@ximian.com>
* e-user-creatable-items-handler.c (impl_finalize): free
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index 9abe47197c..d83c0ae572 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -45,6 +45,8 @@ static GObjectClass *parent_class = NULL;
struct _EComponentRegistryPrivate {
GSList *infos;
+
+ int init:1;
};
@@ -52,6 +54,7 @@ struct _EComponentRegistryPrivate {
static EComponentInfo *
component_info_new (const char *id,
+ GNOME_Evolution_Component iface,
const char *alias,
const char *button_label,
const char *menu_label,
@@ -63,6 +66,7 @@ component_info_new (const char *id,
EComponentInfo *info = g_new0 (EComponentInfo, 1);
info->id = g_strdup (id);
+ info->iface = bonobo_object_dup_ref(iface, NULL);
info->alias = g_strdup (alias);
info->button_label = g_strdup (button_label);
info->menu_label = g_strdup (menu_label);
@@ -151,6 +155,11 @@ query_components (EComponentRegistry *registry)
char *query;
int i;
+ if (registry->priv->init)
+ return;
+
+ registry->priv->init = TRUE;
+
CORBA_exception_init (&ev);
query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Component:%s')", BASE_VERSION);
info_list = bonobo_activation_query (query, NULL, &ev);
@@ -179,8 +188,20 @@ query_components (EComponentRegistry *registry)
GdkPixbuf *icon = NULL, *menuicon = NULL;
EComponentInfo *info;
int sort_order;
+ GNOME_Evolution_Component iface;
id = info_list->_buffer[i].iid;
+ iface = bonobo_activation_activate_from_id (id, 0, NULL, &ev);
+ if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) {
+ char *ex_text = bonobo_exception_get_text (&ev);
+
+ g_warning("Cannot activate '%s': %s\n", id, ex_text);
+ g_free(ex_text);
+ CORBA_exception_free(&ev);
+ CORBA_exception_init(&ev);
+ continue;
+ }
+
label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_label", language_list);
if (label == NULL)
label = g_strdup (_("Unknown"));
@@ -206,7 +227,7 @@ query_components (EComponentRegistry *registry)
else
sort_order = atoi (sort_order_string);
- info = component_info_new (id, alias, label, menu_label,
+ info = component_info_new (id, iface, alias, label, menu_label,
menu_accelerator, sort_order, icon, menuicon);
set_schemas (info, & info_list->_buffer [i]);
@@ -214,6 +235,7 @@ query_components (EComponentRegistry *registry)
if (icon != NULL)
g_object_unref (icon);
+ bonobo_object_release_unref(iface, NULL);
}
g_slist_free(language_list);
@@ -259,8 +281,6 @@ static void
init (EComponentRegistry *registry)
{
registry->priv = g_new0 (EComponentRegistryPrivate, 1);
-
- query_components (registry);
}
@@ -276,6 +296,8 @@ e_component_registry_peek_list (EComponentRegistry *registry)
{
g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL);
+ query_components(registry);
+
return registry->priv->infos;
}
@@ -289,6 +311,8 @@ e_component_registry_peek_info (EComponentRegistry *registry,
g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL);
+ query_components(registry);
+
for (p = registry->priv->infos; p != NULL; p = p->next) {
EComponentInfo *info = p->data;
@@ -327,15 +351,7 @@ e_component_registry_activate (EComponentRegistry *registry,
return CORBA_OBJECT_NIL;
}
- if (info->iface != CORBA_OBJECT_NIL)
- return bonobo_object_dup_ref (info->iface, NULL);
-
- info->iface = bonobo_activation_activate_from_id (info->id, 0, NULL, ev);
- if (BONOBO_EX (ev) || info->iface == CORBA_OBJECT_NIL) {
- info->iface = CORBA_OBJECT_NIL;
- return CORBA_OBJECT_NIL;
- }
-
+ /* it isn't in the registry unless it is already activated */
return bonobo_object_dup_ref (info->iface, NULL);
}
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 3b7ed348bc..1d9c4f5202 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -751,6 +751,7 @@ e_shell_window_new (EShell *shell,
EShellWindowPrivate *priv = window->priv;
GConfClient *gconf_client = gconf_client_get_default ();
BonoboUIContainer *ui_container;
+ char *default_component_id = NULL;
if (bonobo_window_construct (BONOBO_WINDOW (window),
bonobo_ui_container_new (),
@@ -786,24 +787,19 @@ e_shell_window_new (EShell *shell,
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
- if (component_id != NULL) {
- e_shell_window_switch_to_component (window, component_id);
- } else {
- char *default_component_id;
-
- default_component_id = gconf_client_get_string (gconf_client,
- "/apps/evolution/shell/view_defaults/component_id",
- NULL);
- g_object_unref (gconf_client);
-
- if (default_component_id == NULL) {
- e_shell_window_switch_to_component (window, "mail");
- } else {
- e_shell_window_switch_to_component (window, default_component_id);
- g_free (default_component_id);
- }
+ if (component_id == NULL) {
+ component_id = default_component_id =
+ gconf_client_get_string (gconf_client,
+ "/apps/evolution/shell/view_defaults/component_id",
+ NULL);
+ if (component_id == NULL)
+ component_id = "mail";
}
+ e_shell_window_switch_to_component (window, component_id);
+ g_free(default_component_id);
+ g_object_unref (gconf_client);
+
gtk_window_set_default_size (GTK_WINDOW (window),
gconf_client_get_int (gconf_client, "/apps/evolution/shell/view_defaults/width", NULL),
gconf_client_get_int (gconf_client, "/apps/evolution/shell/view_defaults/height", NULL));
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 825224f996..f1228045f0 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -644,20 +644,8 @@ e_shell_construct (EShell *shell,
while (gtk_events_pending ())
gtk_main_iteration ();
- /* activate all the components */
+ /* activate all the components (peek list does this implictly) */
component = e_component_registry_peek_list (shell->priv->component_registry);
- while (component != NULL) {
- const EComponentInfo *info = component->data;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- e_component_registry_activate (shell->priv->component_registry, info->id, &ev);
-
- CORBA_exception_free (&ev);
-
- component = component->next;
- }
attempt_upgrade(shell);