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.
30 #include "prefs_common.h"
34 static gchar *sylpheeddoc_manuals[] =
42 static gchar *get_language()
47 language = g_strdup(setlocale(LC_MESSAGES, NULL));
48 if((c = strchr(language, ',')) != NULL)
50 if((c = strchr(language, '_')) != NULL)
56 static gchar *get_local_path_with_locale(gchar *rootpath)
58 gchar *lang_str, *dir;
60 lang_str = get_language();
61 dir = g_strconcat(rootpath, G_DIR_SEPARATOR_S,
64 if(!is_dir_exist(dir)) {
66 dir = g_strconcat(rootpath, G_DIR_SEPARATOR_S,
68 if(!is_dir_exist(dir)) {
77 gboolean manual_available(ManualType type)
83 case MANUAL_MANUAL_LOCAL:
84 dir = get_local_path_with_locale(MANUALDIR);
90 case MANUAL_FAQ_LOCAL:
91 dir = get_local_path_with_locale(FAQDIR);
104 static gchar *get_syldoc_language()
109 language = get_language();
110 for (i = 0; i < sizeof(sylpheeddoc_manuals) / sizeof(sylpheeddoc_manuals[0]); i++) {
111 if (strcmp(language, sylpheeddoc_manuals[i]) == 0) {
117 return g_strdup("en");
120 void manual_open(ManualType type)
127 case MANUAL_MANUAL_LOCAL:
128 dir = get_local_path_with_locale(MANUALDIR);
130 uri = g_strconcat("file://", dir, G_DIR_SEPARATOR_S, MANUAL_HTML_INDEX, NULL);
135 case MANUAL_FAQ_LOCAL:
136 dir = get_local_path_with_locale(FAQDIR);
138 uri = g_strconcat("file://", dir, G_DIR_SEPARATOR_S, FAQ_HTML_INDEX, NULL);
143 case MANUAL_MANUAL_SYLDOC:
144 lang_str = get_syldoc_language();
145 uri = g_strconcat(SYLDOC_URI, lang_str, SYLDOC_MANUAL_HTML_INDEX, NULL);
149 case MANUAL_FAQ_SYLDOC:
150 lang_str = get_syldoc_language();
151 uri = g_strconcat(SYLDOC_URI, lang_str, SYLDOC_FAQ_HTML_INDEX, NULL);
155 case MANUAL_FAQ_CLAWS:
156 uri = g_strconcat(FAQ_URI, NULL);
162 open_uri(uri, prefs_common.uri_cmd);