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/e-component-registry.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'shell/e-component-registry.c') 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); -- cgit v1.2.3