summaryrefslogtreecommitdiff
path: root/font-viewer/font-view.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-01-08 17:48:44 +0100
committerraveit65 <[email protected]>2017-02-17 12:28:22 +0100
commit818bcecc7ce816f5ec273f88d4bbc92d303cfbc0 (patch)
treeeb1187c75811c3362dbc2d2eacfd64fe2eba8454 /font-viewer/font-view.c
parentc67f9e98c102a579271dcf549db6ef5ae600901a (diff)
downloadmate-control-center-818bcecc7ce816f5ec273f88d4bbc92d303cfbc0.tar.bz2
mate-control-center-818bcecc7ce816f5ec273f88d4bbc92d303cfbc0.tar.xz
Fontviewer: move FontConfig init/deinit to the application class
Safely init FontConfig once for the whole app, and de-init it when quitting. taken from: https://git.gnome.org/browse/gnome-font-viewer/commit/?id=beec585
Diffstat (limited to 'font-viewer/font-view.c')
-rw-r--r--font-viewer/font-view.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/font-viewer/font-view.c b/font-viewer/font-view.c
index a62a75e8..4457fe16 100644
--- a/font-viewer/font-view.c
+++ b/font-viewer/font-view.c
@@ -31,6 +31,7 @@
#include FT_SFNT_NAMES_H
#include FT_TRUETYPE_IDS_H
#include <cairo/cairo-ft.h>
+#include <fontconfig/fontconfig.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -655,6 +656,14 @@ font_view_application_activate (GApplication *application)
}
static void
+font_view_application_quit_mainloop (GApplication *application)
+{
+ G_APPLICATION_CLASS (font_view_application_parent_class)->quit_mainloop (application);
+
+ FcFini ();
+}
+
+static void
font_view_application_dispose (GObject *obj)
{
FontViewApplication *self = FONT_VIEW_APPLICATION (obj);
@@ -679,6 +688,7 @@ font_view_application_class_init (FontViewApplicationClass *klass)
aclass->activate = font_view_application_activate;
aclass->startup = font_view_application_startup;
aclass->open = font_view_application_open;
+ aclass->quit_mainloop = font_view_application_quit_mainloop;
oclass->dispose = font_view_application_dispose;
}
@@ -687,6 +697,10 @@ static GApplication *
font_view_application_new (void)
{
g_type_init ();
+
+ if (!FcInit ())
+ g_critical ("Can't initialize fontconfig library");
+
return g_object_new (FONT_VIEW_TYPE_APPLICATION,
"application-id", "org.mate.font-viewer",
"flags", G_APPLICATION_HANDLES_OPEN,