/* -*- 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 */ #ifdef HAVE_CONFIG_H #include #endif #include "e-uri-schema-registry.h" #include #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) value='main'>main FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* - hamlib should have been hamradiodb2014-07-021-1/+1
* Fix perl module .packlist and remove perllocal.podshurd2014-06-281-1/+5
* Support LIBS like LDFLAGS.tijl2014-06-111-1/+1
* Remove all the bootstrap files (.bs) from the plists.mat2014-06-101-1/+0
* The FreeBSD x11@ and graphics team proudly presentszeising2014-04-171-0/+1
* - Convert to USES=tclgahr2014-01-291-2/+1
* - Enable stagingdb2013-12-312-12/+12
* Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-211-1/+2
* Eliminate USE_GNOME=pkgconfig from commsbapt2013-09-021-2/+2
* - Convert header into new formdb2012-11-031-6/+3
* Changes in this release from 1.2.15.2 are:db2012-11-033-7/+7
* - Fix typos (LICENSE is correct form inside bsd.licenses.mk).az2012-10-031-1/+1
* - Update to Version 1.2.15.2db2012-08-094-11/+11
* - Update to 1.2.15db2012-02-045-12/+18
* - Add LDFLAGS to CONFIGURE_ENV and MAKE_ENV (as it was done with LDFLAGS)amdmi32011-09-241-1/+2
* - Update to hamlib 1.2.14db2011-08-043-5/+12
* From releaae e-mail:db2011-05-303-7/+7
* Update todb2011-03-145-116/+118
* - DISTNAME= ${PORTNAME}-${PORTVERSION} is the default and not needed.pgollucci2010-12-301-1/+0
* Sync to new bsd.autotools.mkade2010-12-041-1/+1
* Punt autoconf267->autoconf268ade2010-10-161-1/+1
* Autotools update. Read ports/UPDATING 20100915 for details.ade2010-09-161-1/+2
* - Update to 1.2.11db2010-06-105-13/+41
* - Update to 1.2.10db2009-11-266-80/+55
* - Switch SourceForge ports to the new File Release System: categories startin...amdmi32009-08-221-2/+1
* -Repocopy devel/libtool15 -> libtool22 and libltdl15 -> libltdl22.mezz2009-08-031-1/+1
* Utilize %%SITE_PERL%% and %%PERL_ARCH%% in pkg-plistspgollucci2009-07-311-2/+2
* - Update to latest vendor version of hamlib.db2009-02-285-21/+12