keyboard: use a GResource for GtkBuilder UI definition
https://bugzilla.gnome.org/show_bug.cgi?id=691132
This commit is contained in:
parent
214b514fcc
commit
3b98a73b69
3 changed files with 27 additions and 12 deletions
|
@ -3,7 +3,12 @@ cappletname = keyboard
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libkeyboard.la
|
noinst_LTLIBRARIES = libkeyboard.la
|
||||||
|
|
||||||
|
BUILT_SOURCES = \
|
||||||
|
cc-keyboard-resources.c \
|
||||||
|
cc-keyboard-resources.h
|
||||||
|
|
||||||
libkeyboard_la_SOURCES = \
|
libkeyboard_la_SOURCES = \
|
||||||
|
$(BUILT_SOURCES) \
|
||||||
cc-keyboard-panel.c \
|
cc-keyboard-panel.c \
|
||||||
cc-keyboard-panel.h \
|
cc-keyboard-panel.h \
|
||||||
cc-keyboard-item.c \
|
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_CFLAGS = $(PANEL_CFLAGS) $(KEYBOARD_PANEL_CFLAGS) -I$(top_srcdir)/panels/common/
|
||||||
libkeyboard_la_LIBADD = $(PANEL_LIBS) $(KEYBOARD_PANEL_LIBS)
|
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
|
@INTLTOOL_DESKTOP_RULE@
|
||||||
ui_DATA = gnome-keyboard-panel.ui
|
|
||||||
|
|
||||||
desktopdir = $(datadir)/applications
|
desktopdir = $(datadir)/applications
|
||||||
Desktop_in_files = gnome-keyboard-panel.desktop.in
|
Desktop_in_files = gnome-keyboard-panel.desktop.in
|
||||||
|
@ -45,16 +53,13 @@ pkgconfigdir = $(datadir)/pkgconfig
|
||||||
pkgconfig_DATA = gnome-keybindings.pc
|
pkgconfig_DATA = gnome-keybindings.pc
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
|
-DGNOMELOCALEDIR="\"$(datadir)/locale\""
|
||||||
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
|
|
||||||
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
|
|
||||||
-DGNOMECC_KEYBINDINGS_DIR="\"$(pkgdatadir)/keybindings\""
|
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
$(Desktop_in_files) \
|
$(Desktop_in_files) \
|
||||||
$(desktop_DATA) \
|
$(desktop_DATA) \
|
||||||
$(xml_DATA)
|
$(xml_DATA) \
|
||||||
EXTRA_DIST = $(ui_DATA) $(xml_in_files) gnome-keybindings.pc.in
|
$(BUILT_SOURCES)
|
||||||
|
EXTRA_DIST = $(xml_in_files) gnome-keybindings.pc.in $(resource_files) keyboard.gresource.xml
|
||||||
|
|
||||||
-include $(top_srcdir)/git.mk
|
-include $(top_srcdir)/git.mk
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cc-keyboard-panel.h"
|
#include "cc-keyboard-panel.h"
|
||||||
|
#include "cc-keyboard-resources.h"
|
||||||
|
|
||||||
#include "keyboard-general.h"
|
#include "keyboard-general.h"
|
||||||
#include "keyboard-shortcuts.h"
|
#include "keyboard-shortcuts.h"
|
||||||
|
|
||||||
|
@ -168,15 +170,17 @@ cc_keyboard_panel_class_init (CcKeyboardPanelClass *klass)
|
||||||
static void
|
static void
|
||||||
cc_keyboard_panel_init (CcKeyboardPanel *self)
|
cc_keyboard_panel_init (CcKeyboardPanel *self)
|
||||||
{
|
{
|
||||||
const gchar *uifile = GNOMECC_UI_DIR "/gnome-keyboard-panel.ui";
|
|
||||||
CcKeyboardPanelPrivate *priv;
|
CcKeyboardPanelPrivate *priv;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
priv = self->priv = KEYBOARD_PANEL_PRIVATE (self);
|
priv = self->priv = KEYBOARD_PANEL_PRIVATE (self);
|
||||||
|
g_resources_register (cc_keyboard_get_resource ());
|
||||||
|
|
||||||
priv->builder = gtk_builder_new ();
|
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_warning ("Could not load UI: %s", error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
|
|
6
panels/keyboard/keyboard.gresource.xml
Normal file
6
panels/keyboard/keyboard.gresource.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?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>
|
Loading…
Add table
Add a link
Reference in a new issue