Kouhei Sutou
kous****@users*****
2006年 12月 6日 (水) 15:28:36 JST
Index: tomoe/lib/tomoe-context.c diff -u tomoe/lib/tomoe-context.c:1.49 tomoe/lib/tomoe-context.c:1.50 --- tomoe/lib/tomoe-context.c:1.49 Wed Dec 6 14:46:13 2006 +++ tomoe/lib/tomoe-context.c Wed Dec 6 15:28:36 2006 @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Copyright (C) 2006 Juernjakob Harder <juern****@gmail*****> * @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA * - * $Id: tomoe-context.c,v 1.49 2006/12/06 05:46:13 kous Exp $ + * $Id: tomoe-context.c,v 1.50 2006/12/06 06:28:36 kous Exp $ */ #include <stdio.h> @@ -389,6 +389,37 @@ return tomoe_dict_unregister_char (priv->user_dict, utf8); } +TomoeChar * +tomoe_context_get_char (TomoeContext *context, const gchar *utf8) +{ + TomoeContextPrivate *priv; + TomoeShelf *shelf; + TomoeChar *chr = NULL; + GList *names, *node; + + g_return_val_if_fail (TOMOE_IS_CONTEXT (context), chr); + + priv = TOMOE_CONTEXT_GET_PRIVATE (context); + + shelf = priv->shelf; + if (!shelf) return chr; + + names = tomoe_shelf_get_dict_names (shelf); + if (!names) return chr; + + for (node = names; node; node = g_list_next (node)) { + const gchar *name = node->data; + TomoeDict *dict; + + dict = tomoe_shelf_get_dict (shelf, name); + chr = tomoe_dict_get_char (dict, utf8); + if (chr) + break; + } + + return chr; +} + /* vi:ts=4:nowrap:ai:expandtab */ Index: tomoe/lib/tomoe-context.h diff -u tomoe/lib/tomoe-context.h:1.33 tomoe/lib/tomoe-context.h:1.34 --- tomoe/lib/tomoe-context.h:1.33 Tue Dec 5 17:33:05 2006 +++ tomoe/lib/tomoe-context.h Wed Dec 6 15:28:36 2006 @@ -17,7 +17,7 @@ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA * - * $Id: tomoe-context.h,v 1.33 2006/12/05 08:33:05 kous Exp $ + * $Id: tomoe-context.h,v 1.34 2006/12/06 06:28:36 kous Exp $ */ #ifndef __TOMOE_CONTEXT_H__ @@ -63,6 +63,9 @@ GList *tomoe_context_multi_search (TomoeContext *ctx, GList *queries); +TomoeChar *tomoe_context_get_char (TomoeContext *ctx, + const gchar *utf8); + gboolean tomoe_context_register (TomoeContext *ctx, TomoeChar *chr); gboolean tomoe_context_unregister (TomoeContext *ctx,