2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2002 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34 #include "prefs_common.h"
38 static gchar *sylpheeddoc_manuals[] =
46 static gchar *get_language()
51 language = g_strdup(setlocale(LC_MESSAGES, NULL));
52 if((c = strchr(language, ',')) != NULL)
54 if((c = strchr(language, '_')) != NULL)
60 static gchar *get_local_path_with_locale(gchar *rootpath)
62 gchar *lang_str, *dir;
64 lang_str = get_language();
65 dir = g_strconcat(rootpath, G_DIR_SEPARATOR_S,
68 if(!is_dir_exist(dir)) {
70 dir = g_strconcat(rootpath, G_DIR_SEPARATOR_S,
72 if(!is_dir_exist(dir)) {
81 gboolean manual_available(ManualType type)
87 case MANUAL_MANUAL_LOCAL:
88 dir = get_local_path_with_locale(MANUALDIR);
94 case MANUAL_FAQ_LOCAL:
95 dir = get_local_path_with_locale(FAQDIR);
108 static gchar *get_syldoc_language()
113 language = get_language();
114 for (i = 0; i < sizeof(sylpheeddoc_manuals) / sizeof(sylpheeddoc_manuals[0]); i++) {
115 if (strcmp(language, sylpheeddoc_manuals[i]) == 0) {
121 return g_strdup("en");
124 void manual_open(ManualType type)
131 case MANUAL_MANUAL_LOCAL:
132 dir = get_local_path_with_locale(MANUALDIR);
134 uri = g_strconcat("file://", dir, G_DIR_SEPARATOR_S, MANUAL_HTML_INDEX, NULL);
139 case MANUAL_FAQ_LOCAL:
140 dir = get_local_path_with_locale(FAQDIR);
142 uri = g_strconcat("file://", dir, G_DIR_SEPARATOR_S, FAQ_HTML_INDEX, NULL);
147 case MANUAL_MANUAL_SYLDOC:
148 lang_str = get_syldoc_language();
149 uri = g_strconcat(SYLDOC_URI, lang_str, SYLDOC_MANUAL_HTML_INDEX, NULL);
153 case MANUAL_FAQ_SYLDOC:
154 lang_str = get_syldoc_language();
155 uri = g_strconcat(SYLDOC_URI, lang_str, SYLDOC_FAQ_HTML_INDEX, NULL);
159 case MANUAL_FAQ_CLAWS:
160 uri = g_strconcat(FAQ_URI, NULL);
166 open_uri(uri, prefs_common.uri_cmd);