From 0fede2ff4a1f94b0aab8d8de1988a53ba6e3ba94 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 19 Nov 2003 19:06:46 +0000 Subject: Free ->uri_schemas. (set_schemas): New function to get the list of URI * e-component-registry.c (component_info_free): Free ->uri_schemas. (set_schemas): New function to get the list of URI schemas given a component's ServerInfo. (query_components): Call it. * e-component-registry.h (struct _EComponentInfo): Add "uri_schemas" member. * Evolution-Component.idl (Component.handleURI): New method. svn path=/trunk/; revision=23447 --- shell/ChangeLog | 13 +++++++++++++ shell/Evolution-Component.idl | 5 +++++ shell/e-component-registry.c | 34 ++++++++++++++++++++++++++++++++-- shell/e-component-registry.h | 3 +++ 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index a854194c16..ec1e979946 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,16 @@ +2003-11-19 Ettore Perazzoli + + * e-component-registry.c (component_info_free): Free + ->uri_schemas. + (set_schemas): New function to get the list of URI schemas given a + component's ServerInfo. + (query_components): Call it. + + * e-component-registry.h (struct _EComponentInfo): Add + "uri_schemas" member. + + * Evolution-Component.idl (Component.handleURI): New method. + 2003-11-19 Ettore Perazzoli * evolution-activity-client.c diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl index 4ccf92431a..0d1af94e75 100644 --- a/shell/Evolution-Component.idl +++ b/shell/Evolution-Component.idl @@ -69,6 +69,11 @@ module Evolution { raises (UnknownType); + /*** URI handling (e.g. for the command-line, "evolution + mailto:foo@bar.org") ***/ + void handleURI (in string uri); + + /*** Send/receive. ***/ void sendAndReceive (); diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c index 474ed06576..6188e3f2eb 100644 --- a/shell/e-component-registry.c +++ b/shell/e-component-registry.c @@ -81,6 +81,9 @@ component_info_free (EComponentInfo *info) if (info->iface != NULL) bonobo_object_release_unref (info->iface, NULL); + g_slist_foreach (info->uri_schemas, (GFunc) g_free, NULL); + g_slist_free (info->uri_schemas); + g_free (info); } @@ -97,6 +100,30 @@ component_info_compare_func (EComponentInfo *a, /* Utility methods. */ +static void +set_schemas (EComponentInfo *component_info, + Bonobo_ServerInfo *server_info) +{ + Bonobo_ActivationProperty *property = bonobo_server_info_prop_find (server_info, "evolution:uri_schemas"); + Bonobo_StringList *list; + int i; + + if (property == NULL) + return; + + if (property->v._d != Bonobo_ACTIVATION_P_STRINGV) { + CORBA_free (property); + return; + } + + list = & property->v._u.value_stringv; + + for (i = 0; i < list->_length; i ++) + component_info->uri_schemas = g_slist_prepend (component_info->uri_schemas, g_strdup (list->_buffer [i])); + + CORBA_free (property); +} + static void query_components (EComponentRegistry *registry) { @@ -125,6 +152,7 @@ query_components (EComponentRegistry *registry) const char *icon_name; const char *sort_order_string; GdkPixbuf *icon; + EComponentInfo *info; int sort_order; id = info_list->_buffer[i].iid; @@ -149,8 +177,10 @@ query_components (EComponentRegistry *registry) else sort_order = atoi (sort_order_string); - registry->priv->infos = g_slist_prepend (registry->priv->infos, - component_info_new (id, alias, label, sort_order, icon)); + info = component_info_new (id, alias, label, sort_order, icon); + set_schemas (info, & info_list->_buffer [i]); + + registry->priv->infos = g_slist_prepend (registry->priv->infos, info); if (icon != NULL) g_object_unref (icon); diff --git a/shell/e-component-registry.h b/shell/e-component-registry.h index 584d7aa209..865bd3fcd2 100644 --- a/shell/e-component-registry.h +++ b/shell/e-component-registry.h @@ -70,6 +70,9 @@ struct _EComponentInfo { GdkPixbuf *button_icon; int sort_order; + + /* List of URI schemas that this component supports. */ + GSList *uri_schemas; /* */ }; typedef struct _EComponentInfo EComponentInfo; -- cgit v1.2.3