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
This commit is contained in:
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user