Commit f7ae09c5 authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Bastien Nocera
Browse files

universal-access: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent 28b6974b
......@@ -3,15 +3,18 @@ cappletname = universal-access
INCLUDES = \
$(PANEL_CFLAGS) \
$(UNIVERSAL_ACCESS_PANEL_CFLAGS) \
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-I$(top_srcdir)/panels/common/ \
$(NULL)
noinst_LTLIBRARIES = libuniversal-access.la
BUILT_SOURCES = \
cc-ua-resources.c \
cc-ua-resources.h
libuniversal_access_la_SOURCES = \
$(BUILT_SOURCES) \
cc-ua-panel.c \
cc-ua-panel.h \
zoom-options.c \
......@@ -19,9 +22,11 @@ libuniversal_access_la_SOURCES = \
libuniversal_access_la_LIBADD = $(PANEL_LIBS) $(UNIVERSAL_ACCESS_PANEL_LIBS)
uidir = $(pkgdatadir)/ui
dist_ui_DATA = uap.ui zoom-options.ui
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/universal-access.gresource.xml)
cc-ua-resources.c: universal-access.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_universal_access $<
cc-ua-resources.h: universal-access.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_universal_access $<
@INTLTOOL_DESKTOP_RULE@
......@@ -29,6 +34,7 @@ desktopdir = $(datadir)/applications
desktop_in_files = gnome-universal-access-panel.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
CLEANFILES = $(desktop_in_files) $(desktop_DATA)
CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES)
EXTRA_DIST = $(resource_files) universal-access.gresource.xml
-include $(top_srcdir)/git.mk
......@@ -27,7 +27,9 @@
#include <math.h>
#include <glib/gi18n-lib.h>
#include <gdesktop-enums.h>
#include "cc-ua-panel.h"
#include "cc-ua-resources.h"
#include "zoom-options.h"
......@@ -616,13 +618,14 @@ cc_ua_panel_init (CcUaPanel *self)
NULL };
priv = self->priv = UA_PANEL_PRIVATE (self);
g_resources_register (cc_universal_access_get_resource ());
priv->builder = gtk_builder_new ();
gtk_builder_add_objects_from_file (priv->builder,
GNOMECC_UI_DIR "/uap.ui",
objects,
&err);
gtk_builder_add_objects_from_resource (priv->builder,
"/org/gnome/control-center/universal-access/uap.ui",
objects,
&err);
if (err)
{
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/universal-access">
<file preprocess="xml-stripblanks">uap.ui</file>
<file preprocess="xml-stripblanks">zoom-options.ui</file>
</gresource>
</gresources>
......@@ -512,9 +512,9 @@ zoom_options_init (ZoomOptions *self)
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ZOOM_TYPE_OPTIONS, ZoomOptionsPrivate);
priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (priv->builder,
GNOMECC_UI_DIR "/zoom-options.ui",
&err);
gtk_builder_add_from_resource (priv->builder,
"/org/gnome/control-center/universal-access/zoom-options.ui",
&err);
if (err)
{
g_warning ("Could not load interface file: %s", err->message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment