1 /* this file is part of evince, a gnome document viewer
3 * Copyright © 2009 Christian Persch
5 * Evince is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation; either version 2.1 of the License, or
8 * (at your option) any later version.
10 * Evince is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
13 * General Public License for more details.
15 * You should have received a copy of the GNU Lesser 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.
23 #include <glib/gi18n-lib.h>
29 #include "ev-backends-manager.h"
31 #include "ev-file-helpers.h"
33 static int ev_init_count;
37 static HMODULE evdocument_dll = NULL;
38 static gchar *locale_dir = NULL;
42 DllMain (HINSTANCE hinstDLL,
46 if (fdwReason == DLL_PROCESS_ATTACH)
47 evdocument_dll = hinstDLL;
54 _ev_win32_get_locale_dir (HMODULE module)
59 gchar *install_dir = NULL, *utf8_locale_dir;
62 if (evdocument_dll != NULL)
64 g_win32_get_package_installation_directory_of_module (module);
67 utf8_locale_dir = g_build_filename (install_dir,
68 "share", "locale", NULL);
70 locale_dir = g_win32_locale_filename_from_utf8 (utf8_locale_dir);
73 g_free (utf8_locale_dir);
77 locale_dir = g_strdup ("");
83 ev_get_locale_dir (void)
86 return _ev_win32_get_locale_dir (evdocument_dll);
88 return GNOMELOCALEDIR;
95 * Initializes the evince document library, and binds the evince
98 * You must call this before calling any other function in the evince
101 * Returns: %TRUE if any backends were found; %FALSE otherwise
106 static gboolean have_backends;
108 if (ev_init_count++ > 0)
109 return have_backends;
111 /* set up translation catalog */
112 bindtextdomain (GETTEXT_PACKAGE, ev_get_locale_dir ());
113 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
116 _ev_file_helpers_init ();
117 have_backends = _ev_backends_manager_init ();
119 return have_backends;
125 * Shuts the evince document library down.
130 g_assert (_ev_is_initialized ());
132 if (--ev_init_count > 0)
136 if (locale_dir != NULL)
140 _ev_backends_manager_shutdown ();
141 _ev_file_helpers_shutdown ();
142 _ev_debug_shutdown ();
146 * _ev_is_initialized:
148 * Returns: %TRUE if the evince document library has been initialized
151 _ev_is_initialized (void)
153 return ev_init_count > 0;