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;
41 DllMain (HINSTANCE hinstDLL,
45 if (fdwReason == DLL_PROCESS_ATTACH)
46 evdocument_dll = hinstDLL;
55 _ev_get_locale_dir (void)
58 gchar *install_dir = NULL, *locale_dir;
61 if (evdocument_dll != NULL)
62 install_dir = g_win32_get_package_installation_directory_of_module (evdocument_dll);
65 locale_dir = g_build_filename (install_dir,
66 "share", "locale", NULL);
68 retval = g_win32_locale_filename_from_utf8 (locale_dir);
79 return g_strdup (GNOMELOCALEDIR);
86 * Initializes the evince document library, and binds the evince
89 * You must call this before calling any other function in the evince
92 * Returns: %TRUE if any backends were found; %FALSE otherwise
97 static gboolean have_backends;
99 if (ev_init_count++ > 0)
100 return have_backends;
102 /* set up translation catalog */
103 gchar *tmp = _ev_get_locale_dir ();
104 bindtextdomain (GETTEXT_PACKAGE, tmp);
106 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
109 _ev_file_helpers_init ();
110 have_backends = _ev_backends_manager_init ();
112 return have_backends;
118 * Shuts the evince document library down.
123 g_assert (_ev_is_initialized ());
125 if (--ev_init_count > 0)
128 _ev_backends_manager_shutdown ();
129 _ev_file_helpers_shutdown ();
130 _ev_debug_shutdown ();
134 * _ev_is_initialized:
136 * Returns: %TRUE if the evince document library has been initialized
139 _ev_is_initialized (void)
141 return ev_init_count > 0;