[Evolution-hackers] bug #58827, evo handling uri's




Well 'work in progress' on this bug,
http://bugzilla.ximian.com/show_bug.cgi?id=58827

we can't really keep the "evolution" uri working, but I thought it might be possible to:
- if you specify the component name, show the component
- then pass it onto the component to handle, if it knows how, it'll be up to it to interpret the uri.  I was thinking mail uril's would be something like mail:///On This Computer/Inbox - but thats kinda fugly too.

Issues:
- should the shell open a new window when its passed such an argument?  I can't remember what it did before
- handleURI seems the best place to do it, but ... (conflicts slightly with above, e.g. you don't want to open a window if its the first call).

If you don't grok the patch, basically it allows you to do (with no extra code):

evolution-1.5 mail:
- to show the mail component on startup
evolution-1.5 tasks:
- to show tasks, etc.

And then its up to the component to interpret this uri (i.e. if there's more to it) via handleURI, e.g. to show that folder, etc.

My system was doing extremely weird shit today (like X.h suddenly being filled with partially but not totally random crap), I ran some diags - with little results apart from some possible hard drive issues, and i ordered a new hard drive.  Maybe its just the centrino wireless driver, so i'm back on the pcmcia card to see what transpires.  A big big waste of time :(

Michael Zucchi <notzed ximian com>

Ximian Evolution and Free Software Developer

Novell, Inc.
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1441
diff -u -3 -r1.1441 ChangeLog
--- shell/ChangeLog	26 May 2004 10:06:36 -0000	1.1441
+++ shell/ChangeLog	27 May 2004 10:57:26 -0000
@@ -1,3 +1,18 @@
+2004-05-27  Not Zed  <NotZed Ximian com>
+
+	* 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.
+
+	* 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-26  Sarfraaz Ahmed <asarfraaz novell com>
 
 	* e-shell.c (set_interactive): Implemented. Sends the "interactive"
Index: shell/e-component-registry.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-component-registry.c,v
retrieving revision 1.49
diff -u -3 -r1.49 e-component-registry.c
--- shell/e-component-registry.c	19 May 2004 03:50:52 -0000	1.49
+++ shell/e-component-registry.c	27 May 2004 10:57:26 -0000
@@ -282,44 +282,36 @@
 
 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 @@
 
 	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;
Index: shell/e-component-registry.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-component-registry.h,v
retrieving revision 1.15
diff -u -3 -r1.15 e-component-registry.h
--- shell/e-component-registry.h	19 May 2004 03:50:52 -0000	1.15
+++ shell/e-component-registry.h	27 May 2004 10:57:26 -0000
@@ -57,6 +57,11 @@
 	GObjectClass parent_class;
 };
 
+enum _EComponentRegistryField {
+	ECR_FIELD_ID,
+	ECR_FIELD_ALIAS,
+	ECR_FIELD_SCHEMA,
+};
 
 struct _EComponentInfo {
 	char *id;
@@ -85,10 +90,8 @@
 
 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,
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.24
diff -u -3 -r1.24 e-shell-window.c
--- shell/e-shell-window.c	19 May 2004 03:50:52 -0000	1.24
+++ shell/e-shell-window.c	27 May 2004 10:57:27 -0000
@@ -280,6 +280,7 @@
 	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;
 
Index: shell/e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.248
diff -u -3 -r1.248 e-shell.c
--- shell/e-shell.c	26 May 2004 10:06:36 -0000	1.248
+++ shell/e-shell.c	27 May 2004 10:57:27 -0000
@@ -241,24 +241,33 @@
 {
 	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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]