aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-11-21 01:51:07 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-11-21 01:51:07 +0800
commitebc902721df626e57f28af7ce2f9273d89a859e1 (patch)
treecec45996321821c370339efd075e3aa309fec139 /shell
parent807e7a3c199b0973bb0c33fc39d6e1114bfce13e (diff)
downloadgsoc2013-evolution-ebc902721df626e57f28af7ce2f9273d89a859e1.tar
gsoc2013-evolution-ebc902721df626e57f28af7ce2f9273d89a859e1.tar.gz
gsoc2013-evolution-ebc902721df626e57f28af7ce2f9273d89a859e1.tar.bz2
gsoc2013-evolution-ebc902721df626e57f28af7ce2f9273d89a859e1.tar.lz
gsoc2013-evolution-ebc902721df626e57f28af7ce2f9273d89a859e1.tar.xz
gsoc2013-evolution-ebc902721df626e57f28af7ce2f9273d89a859e1.tar.zst
gsoc2013-evolution-ebc902721df626e57f28af7ce2f9273d89a859e1.zip
Reimplemented using EComponentRegistry.
* e-shell.c (impl_Shell_handleURI): Reimplemented using EComponentRegistry. * main.c (idle_cb): Create a new window even if we have a URI list. * e-component-registry.c (e_component_registry_peek_info_for_uri_schema): New. svn path=/trunk/; revision=23461
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog11
-rw-r--r--shell/e-component-registry.c22
-rw-r--r--shell/e-component-registry.h16
-rw-r--r--shell/e-shell.c46
-rw-r--r--shell/main.c9
5 files changed, 57 insertions, 47 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index ec1e979946..2a65fe3315 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,14 @@
+2003-11-20 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-shell.c (impl_Shell_handleURI): Reimplemented using
+ EComponentRegistry.
+
+ * main.c (idle_cb): Create a new window even if we have a URI
+ list.
+
+ * e-component-registry.c
+ (e_component_registry_peek_info_for_uri_schema): New.
+
2003-11-19 Ettore Perazzoli <ettore@ximian.com>
* e-component-registry.c (component_info_free): Free
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index 6188e3f2eb..71170f8e82 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -267,6 +267,28 @@ e_component_registry_peek_info (EComponentRegistry *registry,
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)
+ return info;
+ }
+ }
+
+ return NULL;
+}
+
+
GNOME_Evolution_Component
e_component_registry_activate (EComponentRegistry *registry,
const char *id,
diff --git a/shell/e-component-registry.h b/shell/e-component-registry.h
index 865bd3fcd2..76fbc778de 100644
--- a/shell/e-component-registry.h
+++ b/shell/e-component-registry.h
@@ -80,12 +80,16 @@ typedef struct _EComponentInfo EComponentInfo;
GType e_component_registry_get_type (void);
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);
-GNOME_Evolution_Component e_component_registry_activate (EComponentRegistry *registry,
- const char *id,
- CORBA_Environment *ev);
+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);
+
+GNOME_Evolution_Component e_component_registry_activate (EComponentRegistry *registry,
+ const char *id,
+ CORBA_Environment *ev);
#ifdef __cplusplus
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 84c4ddad85..d84cd4c0d5 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -209,52 +209,26 @@ impl_Shell_handleURI (PortableServer_Servant servant,
const CORBA_char *uri,
CORBA_Environment *ev)
{
-#if 0
- EvolutionShellComponentClient *schema_handler;
- EShell *shell;
- EShellPrivate *priv;
+ EShell *shell = E_SHELL (bonobo_object_from_servant (servant));
+ EComponentInfo *component_info;
const char *colon_p;
char *schema;
- if (raise_exception_if_not_ready (servant, ev))
- return;
-
- shell = E_SHELL (bonobo_object_from_servant (servant));
- priv = shell->priv;
-
- if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0
- || strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0) {
- e_shell_create_window (shell, NULL, NULL);
- return;
- }
-
- /* Extract the schema. */
-
colon_p = strchr (uri, ':');
- if (colon_p == NULL || colon_p == uri) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_InvalidURI, NULL);
- return;
- }
+ if (colon_p == NULL)
+ schema = g_strdup (uri);
+ else
+ schema = g_strndup (uri, colon_p - uri);
- schema = g_strndup (uri, colon_p - uri);
- schema_handler = e_uri_schema_registry_get_handler_for_schema (priv->uri_schema_registry, schema);
+ component_info = e_component_registry_peek_info_for_uri_schema (shell->priv->component_registry, schema);
g_free (schema);
- if (schema_handler == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_UnsupportedSchema, NULL);
+ if (component_info == NULL) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_UnsupportedSchema, NULL);
return;
}
- if (evolution_shell_component_client_handle_external_uri (schema_handler, uri)
- != EVOLUTION_SHELL_COMPONENT_OK) {
- /* FIXME: Just a wild guess here. */
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_NotFound, NULL);
- return;
- }
-#endif
+ GNOME_Evolution_Component_handleURI (component_info->iface, uri, ev);
}
static void
diff --git a/shell/main.c b/shell/main.c
index d89566a6aa..dfc4a17643 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -430,9 +430,9 @@ idle_cb (void *data)
have_evolution_uri = FALSE;
- if (uri_list == NULL && shell != NULL)
+ if (shell != NULL) {
e_shell_create_window (shell, default_component_id, NULL);
- else {
+ } else {
CORBA_Environment ev;
CORBA_exception_init (&ev);
@@ -445,9 +445,8 @@ idle_cb (void *data)
uri = (const char *) p->data;
GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
- if (ev._major == CORBA_NO_EXCEPTION) {
- g_warning ("CORBA exception %s when requesting URI -- %s",
- BONOBO_EX_REPOID (&ev), uri);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("Invalid URI: %s", uri);
CORBA_exception_free (&ev);
}
}