Use g_win32_getlocale() in manual availability detection on Windows.
[claws.git] / src / manual.c
index a9ce3fc8781badd273b34148f0118117604e291b..6620720619b697258b3d783e374621d6c888888b 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
+ * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
  *
  * 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 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include "defs.h"
@@ -46,17 +47,13 @@ static gchar *get_language()
        gchar *c;
 
 #ifdef G_OS_WIN32
-       language = g_strdup(gtk_set_locale());
+       language = g_win32_getlocale();
 #else
-        /* FIXME: Why not using gtk_set_locale here too? -wk */
        language = g_strdup(setlocale(LC_MESSAGES, NULL));
 #endif
-        /* At least under W32 it is possible that gtk_set_locate
-           returns NULL.  This is not documented but well, it happens
-           and g_strdup is happy with a NULL argument.  We return a
-           standard language string in this case. */
-        if (!language)
-                return g_strdup("en");
+       if (!language)
+               return g_strdup("en");
+
        if((c = strchr(language, ',')) != NULL)
                *c = '\0';
        if((c = strchr(language, '_')) != NULL)
@@ -92,7 +89,7 @@ gboolean manual_available(ManualType type)
        gchar *dir = NULL, *uri = NULL;
        
        switch (type) {
-               case MANUAL_MANUAL_LOCAL:
+               case MANUAL_MANUAL_CLAWS:
                        dir = get_local_path_with_locale(MANUALDIR);
                        if (dir != NULL) {
                                uri = g_strconcat(dir, G_DIR_SEPARATOR_S, MANUAL_HTML_INDEX, NULL);
@@ -117,7 +114,7 @@ void manual_open(ManualType type, gchar *url_anchor)
        gchar *dir;
 
        switch (type) {
-               case MANUAL_MANUAL_LOCAL:
+               case MANUAL_MANUAL_CLAWS:
                        dir = get_local_path_with_locale(MANUALDIR);
                        if (dir != NULL) {
                                gchar *tmp_anchor = NULL;
@@ -129,6 +126,8 @@ void manual_open(ManualType type, gchar *url_anchor)
                                                NULL);
                                g_free(tmp_anchor);
                                g_free(dir);
+                       } else {
+                               uri = g_strconcat(MANUAL_URI, NULL);
                        }
                        break;
                case MANUAL_FAQ_CLAWS:
@@ -138,11 +137,11 @@ void manual_open(ManualType type, gchar *url_anchor)
                default:
                        break;
        }
-       open_uri(uri, prefs_common.uri_cmd);
+       open_uri(uri, prefs_common_get_uri_cmd());
        g_free(uri);
 }
 
 void manual_open_with_anchor_cb(GtkWidget *widget, gchar *url_anchor)
 {
-       manual_open(MANUAL_MANUAL_LOCAL, url_anchor);
+       manual_open(MANUAL_MANUAL_CLAWS, url_anchor);
 }