]> www.fi.muni.cz Git - evince.git/blobdiff - shell/main.c
[windows] Fix localization on Windows
[evince.git] / shell / main.c
index 187a794c45d9eb76d195483eb5b6c5935f8e6b64..4ed0b05ebd42067d934d64b144599ba637c43df7 100644 (file)
@@ -232,17 +232,39 @@ load_files (const char **files)
         }
 }
 
+static gchar*
+ev_get_locale_dir ()
+{
+#ifdef G_OS_WIN32
+       gchar *install_dir = NULL, *locale_dir;
+       gchar *retval = NULL;
+
+       install_dir =
+           g_win32_get_package_installation_directory_of_module (NULL);
+
+       if (install_dir) {
+               locale_dir = g_build_filename (install_dir,
+                                       "share", "locale", NULL);
+               retval = g_win32_locale_filename_from_utf8 (locale_dir);
+               g_free (install_dir);
+               g_free (locale_dir);
+       }
+
+       if (retval)
+               return retval;
+       else
+               return g_strdup ("");
+#else
+       return g_strdup (GNOMELOCALEDIR);
+#endif
+}
+
 int
 main (int argc, char *argv[])
 {
        GOptionContext *context;
        GError         *error = NULL;
 
-#ifdef WITH_GCONF
-       /* Remove when porting is done */
-       g_setenv ("GSETTINGS_BACKEND", "gconf", FALSE);
-#endif
-
 #ifdef G_OS_WIN32
 
     if (fileno (stdout) != -1 &&
@@ -274,7 +296,9 @@ main (int argc, char *argv[])
 
 #ifdef ENABLE_NLS
        /* Initialize the i18n stuff */
-       bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+       gchar *tmp = ev_get_locale_dir ();
+       bindtextdomain (GETTEXT_PACKAGE, tmp);
+       g_free (tmp);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        textdomain (GETTEXT_PACKAGE);
 #endif
@@ -321,14 +345,13 @@ main (int argc, char *argv[])
 
        ev_application_load_session (EV_APP);
        load_files (file_arguments);
-       if (ev_application_has_window (EV_APP)) {
-               /* Change directory so we don't prevent unmounting in case the initial cwd
-                * is on an external device (see bug #575436)
-                */
-               g_chdir (g_get_home_dir ());
 
-               gtk_main ();
-       }
+       /* Change directory so we don't prevent unmounting in case the initial cwd
+        * is on an external device (see bug #575436)
+        */
+       g_chdir (g_get_home_dir ());
+
+       gtk_main ();
 
        ev_shutdown ();
        ev_stock_icons_shutdown ();