/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* e-uri-schema-registry.c * * Copyright (C) 2001 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * Author: Ettore Perazzoli <ettore@ximian.com> */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "e-uri-schema-registry.h" #include <gal/util/e-util.h> #define PARENT_TYPE gtk_object_get_type () static GtkObjectClass *parent_class = NULL; struct _SchemaHandler { char *schema; EvolutionShellComponentClient *component; }; typedef struct _SchemaHandler SchemaHandler; struct _EUriSchemaRegistryPrivate { GHashTable *schema_to_handler; }; /* SchemaHandler. */ static SchemaHandler * schema_handler_new (const char *schema, EvolutionShellComponentClient *component) { SchemaHandler *handler; handler = g_new (SchemaHandler, 1); handler->schema = g_strdup (schema); handler->component = component; bonobo_object_ref (BONOBO_OBJECT (component)); return handler; } static void schema_handler_free (SchemaHandler *handler) { g_free (handler->schema); bonobo_object_unref (BONOBO_OBJECT (handler->component)); g_free (handler); } static void schema_to_handler_destroy_foreach_callback (void *key, void *value, void *data) { schema_handler_free ((SchemaHandler *) value); } /* GtkObject methods. */ static void impl_destroy (GtkObject *object) { EUriSchemaRegistry *registry; EUriSchemaRegistryPrivate *priv; registry = E_URI_SCHEMA_REGISTRY (object); priv = registry->priv; g_hash_table_foreach (priv->schema_to_handler, schema_to_handler_destroy_foreach_callback, NULL); g_hash_table_destroy (priv->schema_to_handler); g_free (priv); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } static void class_init (GtkObjectClass *object_class) { parent_class = gtk_type_class (PARENT_TYPE); object_class->destroy = impl_destroy; } static void init (EUriSchemaRegistry *uri_schema_registry) { EUriSchemaRegistryPrivate *priv; priv = g_new (EUriSchemaRegistryPrivate, 1); priv->schema_to_handler = g_hash_table_new (g_str_hash, g_str_equal); uri_schema_registry->priv = priv; GTK_OBJECT_UNSET_FLAGS (uri_schema_registry, GTK_FLOATING); } EUriSchemaRegistry * e_uri_schema_registry_new (void) { EUriSchemaRegistry *registry; registry = gtk_type_new (e_uri_schema_registry_get_type ()); return registry; } void e_uri_schema_registry_set_handler_for_schema (EUriSchemaRegistry *registry, const char *schema, EvolutionShellComponentClient *shell_component) { EUriSchemaRegistryPrivate *priv; SchemaHandler *existing_handler; SchemaHandler *new_handler; g_return_if_fail (registry != NULL); g_return_if_fail (E_IS_URI_SCHEMA_REGISTRY (registry)); g_return_if_fail (schema != NULL); g_return_if_fail (shell_component == NULL || EVOLUTION_IS_SHELL_COMPONENT_CLIENT (shell_component)); priv = registry->priv; existing_handler = g_hash_table_lookup (priv->schema_to_handler, schema); if (existing_handler != NULL) { g_hash_table_remove (priv->schema_to_handler, existing_handler->schema); schema_handler_free (existing_handler); } new_handler = schema_handler_new (schema, shell_component); g_hash_table_insert (priv->schema_to_handler, new_handler->schema, new_handler); } EvolutionShellComponentClient * e_uri_schema_registry_get_handler_for_schema (EUriSchemaRegistry *registry, const char *schema) { EUriSchemaRegistryPrivate *priv; const SchemaHandler *handler; g_return_val_if_fail (registry != NULL, NULL); g_return_val_if_fail (E_IS_URI_SCHEMA_REGISTRY (registry), NULL); g_return_val_if_fail (schema != NULL, NULL); priv = registry->priv; handler = g_hash_table_lookup (priv->schema_to_handler, schema); if (handler == NULL) return NULL; return handler->component; } E_MAKE_TYPE (e_uri_schema_registry, "EUriSchemaRegistry", EUriSchemaRegistry, class_init, init, PARENT_TYPE) > <option value='gstreamer0.10-removal'>gstreamer0.10-removal</option> <option value='main'>main</option> <option value='master'>master</option> <option value='mate-1.16'>mate-1.16</option> <option value='mate-1.18'>mate-1.18</option> <option value='mate-1.20'>mate-1.20</option> <option value='mate-1.22'>mate-1.22</option> </select> <input type='submit' value='switch'/></form></td></tr> <tr><td class='sub'>FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)</td><td class='sub right'></td></tr></table> <table class='tabs'><tr><td> <a href='/~lantw44/cgit/freebsd-ports-gnome/about/?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'>about</a><a href='/~lantw44/cgit/freebsd-ports-gnome/?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'>summary</a><a href='/~lantw44/cgit/freebsd-ports-gnome/refs/?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=949ad540f3b14fc02c09ce5cbc200581fb5ecdf6'>refs</a><a class='active' href='/~lantw44/cgit/freebsd-ports-gnome/log/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'>log</a><a href='/~lantw44/cgit/freebsd-ports-gnome/tree/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=949ad540f3b14fc02c09ce5cbc200581fb5ecdf6'>tree</a><a href='/~lantw44/cgit/freebsd-ports-gnome/commit/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=949ad540f3b14fc02c09ce5cbc200581fb5ecdf6'>commit</a><a href='/~lantw44/cgit/freebsd-ports-gnome/diff/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=949ad540f3b14fc02c09ce5cbc200581fb5ecdf6'>diff</a><a href='/~lantw44/cgit/freebsd-ports-gnome/stats/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'>stats</a></td><td class='form'><form class='right' method='get' action='/~lantw44/cgit/freebsd-ports-gnome/log/www/caddy'> <input type='hidden' name='h' value='dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'/><input type='hidden' name='id' value='949ad540f3b14fc02c09ce5cbc200581fb5ecdf6'/><select name='qt'> <option value='grep'>log msg</option> <option value='author'>author</option> <option value='committer'>committer</option> <option value='range'>range</option> </select> <input class='txt' type='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/~lantw44/cgit/freebsd-ports-gnome/log/?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=949ad540f3b14fc02c09ce5cbc200581fb5ecdf6'>root</a>/<a href='/~lantw44/cgit/freebsd-ports-gnome/log/www?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=949ad540f3b14fc02c09ce5cbc200581fb5ecdf6'>www</a>/<a href='/~lantw44/cgit/freebsd-ports-gnome/log/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=949ad540f3b14fc02c09ce5cbc200581fb5ecdf6'>caddy</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th></th><th class='left'>Commit message (<a href='/~lantw44/cgit/freebsd-ports-gnome/log/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=949ad540f3b14fc02c09ce5cbc200581fb5ecdf6&showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Age</th><th class='left'>Files</th><th class='left'>Lines</th></tr> <tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/freebsd-ports-gnome/commit/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=d9895303856a7efdf3ac4198640d5572dedfeda0'>Add missing run dependency to security/ca_root_nss</a></td><td>rodrigo</td><td><span title='2019-04-15 20:55:22 +0800'>2019-04-15</span></td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+3</span></td></tr> <tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/freebsd-ports-gnome/commit/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=82c973c4ad55c4413f3444a8748a62e9466ef7be'>Upgrade www/caddy from v0.11.1 to vO.11.5</a></td><td>rodrigo</td><td><span title='2019-04-06 01:50:31 +0800'>2019-04-06</span></td><td>3</td><td><span class='deletions'>-8</span>/<span class='insertions'>+8</span></td></tr> <tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/freebsd-ports-gnome/commit/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=f7b0ad46bf819b350736f05b975dbd82e3749119'>www/caddy: Update to 0.11.1</a></td><td>swills</td><td><span title='2019-01-05 20:05:12 +0800'>2019-01-05</span></td><td>3</td><td><span class='deletions'>-10</span>/<span class='insertions'>+10</span></td></tr> <tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/freebsd-ports-gnome/commit/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=8361dc07649fccdac512f46950b914bca3467314'>www/caddy: Update to 0.11.0</a></td><td>swills</td><td><span title='2018-05-11 22:45:34 +0800'>2018-05-11</span></td><td>4</td><td><span class='deletions'>-4</span>/<span class='insertions'>+34</span></td></tr> <tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/freebsd-ports-gnome/commit/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=51864edc940b95a60aa9e5146fd9b342458753e4'>www/caddy: update to 0.10.14</a></td><td>joneum</td><td><span title='2018-04-25 21:18:17 +0800'>2018-04-25</span></td><td>2</td><td><span class='deletions'>-4</span>/<span class='insertions'>+4</span></td></tr> <tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/freebsd-ports-gnome/commit/www/caddy?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=e84e7871920760687b58d68c6f90cd54c4c015f4'>Update www/caddy to 0.10.12</a></td><td>fernape</td><td><span title='2018-03-31 02:18:55 +0800'>2018-03-31</span></td><td>2</td><td><span class='deletions'>-4</span>/<span class='insertions'>+4</span></td></tr>