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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 #include "prefs_common.h"
33 static gchar *sylpheeddoc_manuals[] =
41 static gchar *get_language()
46 language = g_strdup(setlocale(LC_ALL, NULL));
47 if((c = strchr(language, ',')) != NULL)
49 if((c = strchr(language, '_')) != NULL)
55 static gchar *get_local_path_with_locale(gchar *rootpath)
57 gchar *lang_str, *dir;
59 lang_str = get_language();
60 dir = g_strconcat(rootpath, G_DIR_SEPARATOR_S,
63 if(!is_dir_exist(dir)) {
65 dir = g_strconcat(rootpath, G_DIR_SEPARATOR_S,
67 if(!is_dir_exist(dir)) {
76 gboolean manual_available(ManualType type)
82 case MANUAL_MANUAL_LOCAL:
83 dir = get_local_path_with_locale(MANUALDIR);
89 case MANUAL_FAQ_LOCAL:
90 dir = get_local_path_with_locale(FAQDIR);
103 static gchar *get_syldoc_language()
108 language = get_language();
109 for (i = 0; i < sizeof(sylpheeddoc_manuals) / sizeof(sylpheeddoc_manuals[0]); i++) {
110 if (strcmp(language, sylpheeddoc_manuals[i]) == 0) {
116 return g_strdup("en");
119 void manual_open(ManualType type)
126 case MANUAL_MANUAL_LOCAL:
127 dir = get_local_path_with_locale(MANUALDIR);
129 uri = g_strconcat("file://", dir, G_DIR_SEPARATOR_S, MANUAL_HTML_INDEX, NULL);
134 case MANUAL_FAQ_LOCAL:
135 dir = get_local_path_with_locale(FAQDIR);
137 uri = g_strconcat("file://", dir, G_DIR_SEPARATOR_S, FAQ_HTML_INDEX, NULL);
142 case MANUAL_MANUAL_SYLDOC:
143 lang_str = get_syldoc_language();
144 uri = g_strconcat("http://sylpheeddoc.sourceforge.net/", lang_str, "/manual/manual.html", NULL);
148 case MANUAL_FAQ_SYLDOC:
149 lang_str = get_syldoc_language();
150 uri = g_strconcat("http://sylpheeddoc.sourceforge.net/", lang_str, "/faq/faq.html", NULL);
157 open_uri(uri, prefs_common.uri_cmd);