diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-05-28 23:43:24 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-05-28 23:43:24 +0800 |
commit | bbda044fa543cce525dd4b585941ea2a6f1f249f (patch) | |
tree | 359c60a50a270a34b843b5d290724775132ce441 /lib | |
parent | 6d3a2386b12ff5505fa9a78a7130240c94df3986 (diff) | |
download | gsoc2013-epiphany-bbda044fa543cce525dd4b585941ea2a6f1f249f.tar.gz gsoc2013-epiphany-bbda044fa543cce525dd4b585941ea2a6f1f249f.tar.zst gsoc2013-epiphany-bbda044fa543cce525dd4b585941ea2a6f1f249f.zip |
continuing checkin of previous patch (cvs aborted "broken pipe")
2003-05-28 Christian Persch <chpe@cvs.gnome.org>
continuing checkin of previous patch (cvs aborted "broken pipe")
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 1 | ||||
-rw-r--r-- | lib/ephy-langs.c | 42 | ||||
-rw-r--r-- | lib/ephy-langs.h | 45 | ||||
-rw-r--r-- | lib/ephy-string.c | 31 | ||||
-rw-r--r-- | lib/ephy-string.h | 2 |
5 files changed, 119 insertions, 2 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index a4769da1a..81edc43be 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -35,6 +35,7 @@ libephy_la_SOURCES = \ ephy-gui.c \ ephy-gui.h \ ephy-langs.h \ + ephy-langs.c \ ephy-marshal.c \ ephy-marshal.h \ ephy-node.c \ diff --git a/lib/ephy-langs.c b/lib/ephy-langs.c new file mode 100644 index 000000000..583aeb4dc --- /dev/null +++ b/lib/ephy-langs.c @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2003 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * 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. + */ + + #include "ephy-langs.h" + +void +language_group_info_free (LanguageGroupInfo *info) +{ + g_return_if_fail (info != NULL); + + g_free (info->title); + g_free (info->key); + + g_free (info); +} + +void +encoding_info_free (EncodingInfo *info) +{ + g_return_if_fail (info != NULL); + + g_free (info->title); + g_free (info->key); + g_free (info->encoding); + + g_free (info); +} diff --git a/lib/ephy-langs.h b/lib/ephy-langs.h index 38df4fecf..2d2c79dd2 100644 --- a/lib/ephy-langs.h +++ b/lib/ephy-langs.h @@ -16,6 +16,9 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef EPHY_LANGS_H +#define EPHY_LANGS_H + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -24,6 +27,42 @@ G_BEGIN_DECLS +/* language groups */ +typedef enum +{ + LG_ARABIC, + LG_BALTIC, + LG_CENTRAL_EUROPEAN, + LG_CHINESE, + LG_CYRILLIC, + LG_GREEK, + LG_HEBREW, + LG_INDIAN, + LG_JAPANESE, + LG_KOREAN, + LG_TURKISH, + LG_UNICODE, + LG_VIETNAMESE, + LG_WESTERN, + LG_OTHER, + LG_ALL +} LanguageGroup; + +typedef struct +{ + gchar *title; + gchar *key; + LanguageGroup group; +} LanguageGroupInfo; + +typedef struct +{ + gchar *title; + gchar *key; + gchar *encoding; + LanguageGroup group; +} EncodingInfo; + /* language encoding groups */ static const gchar *lang_encode_item[] = { @@ -44,4 +83,10 @@ static const gchar *lang_encode_item[] = }; static const guint n_lang_encode_items = G_N_ELEMENTS (lang_encode_item); +void language_group_info_free (LanguageGroupInfo *info); + +void encoding_info_free (EncodingInfo *info); + G_END_DECLS + +#endif diff --git a/lib/ephy-string.c b/lib/ephy-string.c index 46a6b6d9f..b97e0485c 100644 --- a/lib/ephy-string.c +++ b/lib/ephy-string.c @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -499,3 +499,32 @@ ephy_str_replace_substring (const char *string, return result; } + +/* copied from egg-toolbar-editor.c */ +gchar * +ephy_str_elide_underscores (const gchar *original) +{ + gchar *q, *result; + const gchar *p; + gboolean last_underscore; + + q = result = g_malloc (strlen (original) + 1); + last_underscore = FALSE; + + for (p = original; *p; p++) + { + if (!last_underscore && *p == '_') + { + last_underscore = TRUE; + } + else + { + last_underscore = FALSE; + *q++ = *p; + } + } + + *q = '\0'; + + return result; +} diff --git a/lib/ephy-string.h b/lib/ephy-string.h index 97e15e756..56dad3552 100644 --- a/lib/ephy-string.h +++ b/lib/ephy-string.h @@ -61,7 +61,7 @@ char *ephy_str_replace_substring (const char *string, const char *substring, const char *replacement); - +gchar *ephy_str_elide_underscores (const gchar *original); G_END_DECLS |