aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog17
-rw-r--r--shell/e-component-registry.c42
-rw-r--r--shell/e-component-registry.h11
-rw-r--r--shell/e-shell-window.c1
-rw-r--r--shell/e-shell.c27
5 files changed, 60 insertions, 38 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index b4f1a05695..e6ffc3181a 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,20 @@
+2004-05-27 Not Zed <NotZed@Ximian.com>
+
+ ** See #58827.
+
+ * e-shell-window.c (switch_view): api change
+
+ * e-shell.c (impl_Shell_handleURI): Fixed for api change.
+ (impl_Shell_handleURI): check the component alias for an alternate
+ uri schema path. 'quick hack' for activating components from
+ command line. This may, or may not, continue to function.
+
+ * e-component-registry.c (e_component_registry_peek_info): added
+ an id for search type.
+ (e_component_registry_peek_info_for_uri_schema): ^ makes this
+ redundant, removed.
+ (e_component_registry_activate): fixed for api change.
+
2004-05-28 Rodney Dawes <dobey@novell.com>
* e-shell-importer.c (e_shell_importer_start_import):
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index e023872257..9abe47197c 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -282,44 +282,36 @@ e_component_registry_peek_list (EComponentRegistry *registry)
EComponentInfo *
e_component_registry_peek_info (EComponentRegistry *registry,
- const char *id)
+ enum _EComponentRegistryField field,
+ const char *key)
{
- GSList *p;
+ 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;
- if (strcmp (info->id, id) == 0)
- return info;
- }
-
- return NULL;
-}
-
-
-EComponentInfo *
-e_component_registry_peek_info_for_uri_schema (EComponentRegistry *registry,
- const char *requested_schema)
-{
- GSList *p, *q;
-
- for (p = registry->priv->infos; p != NULL; p = p->next) {
- EComponentInfo *info = p->data;
-
- for (q = info->uri_schemas; q != NULL; q = q->next) {
- const char *schema = q->data;
-
- if (strcmp (schema, requested_schema) == 0)
+ switch (field) {
+ case ECR_FIELD_ID:
+ if (strcmp (info->id, key) == 0)
return info;
+ break;
+ case ECR_FIELD_ALIAS:
+ if (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;
}
-
GNOME_Evolution_Component
e_component_registry_activate (EComponentRegistry *registry,
const char *id,
@@ -329,7 +321,7 @@ e_component_registry_activate (EComponentRegistry *registry,
g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), CORBA_OBJECT_NIL);
- info = e_component_registry_peek_info (registry, id);
+ info = e_component_registry_peek_info (registry, ECR_FIELD_ID, id);
if (info == NULL) {
g_warning (G_GNUC_FUNCTION " - Unknown id \"%s\"", id);
return CORBA_OBJECT_NIL;
diff --git a/shell/e-component-registry.h b/shell/e-component-registry.h
index 470fee289d..f4ba0df912 100644
--- a/shell/e-component-registry.h
+++ b/shell/e-component-registry.h
@@ -57,6 +57,11 @@ struct _EComponentRegistryClass {
GObjectClass parent_class;
};
+enum _EComponentRegistryField {
+ ECR_FIELD_ID,
+ ECR_FIELD_ALIAS,
+ ECR_FIELD_SCHEMA,
+};
struct _EComponentInfo {
char *id;
@@ -85,10 +90,8 @@ EComponentRegistry *e_component_registry_new (void);
GSList *e_component_registry_peek_list (EComponentRegistry *registry);
EComponentInfo *e_component_registry_peek_info (EComponentRegistry *registry,
- const char *id);
-
-EComponentInfo *e_component_registry_peek_info_for_uri_schema (EComponentRegistry *registry,
- const char *schema);
+ enum _EComponentRegistryField type,
+ const char *key);
GNOME_Evolution_Component e_component_registry_activate (EComponentRegistry *registry,
const char *id,
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 3811c136b2..996c151db9 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -280,6 +280,7 @@ switch_view (EShellWindow *window, ComponentView *component_view)
GConfClient *gconf_client = gconf_client_get_default ();
EComponentRegistry *registry = e_shell_peek_component_registry (window->priv->shell);
EComponentInfo *info = e_component_registry_peek_info (registry,
+ ECR_FIELD_ID,
component_view->component_id);
char *title;
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 6c608a24ab..825224f996 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -241,24 +241,33 @@ impl_Shell_handleURI (PortableServer_Servant servant,
{
EShell *shell = E_SHELL (bonobo_object_from_servant (servant));
EComponentInfo *component_info;
- const char *colon_p;
- char *schema;
+ char *schema, *p;
+ int show = FALSE;
- colon_p = strchr (uri, ':');
- if (colon_p == NULL)
- schema = g_strdup (uri);
- else
- schema = g_strndup (uri, colon_p - uri);
+ schema = g_alloca(strlen(uri)+1);
+ strcpy(schema, uri);
+ p = strchr(schema, ':');
+ if (p)
+ *p = 0;
- component_info = e_component_registry_peek_info_for_uri_schema (shell->priv->component_registry, schema);
- g_free (schema);
+ component_info = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_SCHEMA, schema);
+ if (component_info == NULL) {
+ show = TRUE;
+ component_info = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_ALIAS, schema);
+ }
if (component_info == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_UnsupportedSchema, NULL);
return;
}
+ if (show && shell->priv->windows)
+ e_shell_window_switch_to_component((EShellWindow *)shell->priv->windows->data, component_info->id);
+
GNOME_Evolution_Component_handleURI (component_info->iface, uri, ev);
+ /* not an error not to implement it */
+ if (ev->_id != NULL && strcmp(ev->_id, ex_CORBA_NO_IMPLEMENT) == 0)
+ memset(ev, 0, sizeof(*ev));
}
static void