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

keyboard: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent 214b514f
......@@ -3,7 +3,12 @@ cappletname = keyboard
noinst_LTLIBRARIES = libkeyboard.la
BUILT_SOURCES = \
cc-keyboard-resources.c \
cc-keyboard-resources.h
libkeyboard_la_SOURCES = \
$(BUILT_SOURCES) \
cc-keyboard-panel.c \
cc-keyboard-panel.h \
cc-keyboard-item.c \
......@@ -20,10 +25,13 @@ libkeyboard_la_SOURCES = \
libkeyboard_la_CFLAGS = $(PANEL_CFLAGS) $(KEYBOARD_PANEL_CFLAGS) -I$(top_srcdir)/panels/common/
libkeyboard_la_LIBADD = $(PANEL_LIBS) $(KEYBOARD_PANEL_LIBS)
@INTLTOOL_DESKTOP_RULE@
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/keyboard.gresource.xml)
cc-keyboard-resources.c: keyboard.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_keyboard $<
cc-keyboard-resources.h: keyboard.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_keyboard $<
uidir = $(pkgdatadir)/ui
ui_DATA = gnome-keyboard-panel.ui
@INTLTOOL_DESKTOP_RULE@
desktopdir = $(datadir)/applications
Desktop_in_files = gnome-keyboard-panel.desktop.in
......@@ -45,16 +53,13 @@ pkgconfigdir = $(datadir)/pkgconfig
pkgconfig_DATA = gnome-keybindings.pc
INCLUDES = \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMECC_KEYBINDINGS_DIR="\"$(pkgdatadir)/keybindings\""
-DGNOMELOCALEDIR="\"$(datadir)/locale\""
CLEANFILES = \
$(Desktop_in_files) \
$(desktop_DATA) \
$(xml_DATA)
EXTRA_DIST = $(ui_DATA) $(xml_in_files) gnome-keybindings.pc.in
$(xml_DATA) \
$(BUILT_SOURCES)
EXTRA_DIST = $(xml_in_files) gnome-keybindings.pc.in $(resource_files) keyboard.gresource.xml
-include $(top_srcdir)/git.mk
......@@ -20,6 +20,8 @@
*/
#include "cc-keyboard-panel.h"
#include "cc-keyboard-resources.h"
#include "keyboard-general.h"
#include "keyboard-shortcuts.h"
......@@ -168,15 +170,17 @@ cc_keyboard_panel_class_init (CcKeyboardPanelClass *klass)
static void
cc_keyboard_panel_init (CcKeyboardPanel *self)
{
const gchar *uifile = GNOMECC_UI_DIR "/gnome-keyboard-panel.ui";
CcKeyboardPanelPrivate *priv;
GError *error = NULL;
priv = self->priv = KEYBOARD_PANEL_PRIVATE (self);
g_resources_register (cc_keyboard_get_resource ());
priv->builder = gtk_builder_new ();
if (gtk_builder_add_from_file (priv->builder, uifile, &error) == 0)
if (gtk_builder_add_from_resource (priv->builder,
"/org/gnome/control-center/keyboard/gnome-keyboard-panel.ui",
&error) == 0)
{
g_warning ("Could not load UI: %s", error->message);
g_clear_error (&error);
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/keyboard">
<file preprocess="xml-stripblanks">gnome-keyboard-panel.ui</file>
</gresource>
</gresources>
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