1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
// SPDX-License-Identifier: LGPL-2.1-or-later
/* this file is part of papers, a gnome document viewer
*
* Copyright © 2009 Christian Persch
*/
#include <config.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <exempi/xmp.h>
#include "pps-document-factory.h"
#include "pps-file-helpers.h"
#include "pps-init.h"
static int pps_init_count;
/**
* pps_init:
*
* Initializes the papers document library, and binds the papers
* gettext domain.
*
* You must call this before calling any other function in the papers
* document library.
*
* Returns: %TRUE if any backends were found; %FALSE otherwise
*/
gboolean
pps_init (void)
{
static gboolean have_backends;
if (pps_init_count++ > 0)
return have_backends;
/* set up translation catalog */
bindtextdomain (GETTEXT_PACKAGE, PPS_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
xmp_init ();
gdk_pixbuf_init_modules (EXTRA_GDK_PIXBUF_LOADERS_DIR, NULL);
_pps_file_helpers_init ();
have_backends = _pps_document_factory_init ();
return have_backends;
}
/**
* pps_shutdown:
*
* Shuts the papers document library down.
*/
void
pps_shutdown (void)
{
g_assert (_pps_is_initialized ());
if (--pps_init_count > 0)
return;
xmp_terminate ();
_pps_document_factory_shutdown ();
_pps_file_helpers_shutdown ();
}
/*
* _pps_is_initialized:
*
* Returns: %TRUE if the papers document library has been initialized
*/
gboolean
_pps_is_initialized (void)
{
return pps_init_count > 0;
}
|