[gnome-control-center] keyboard: use a GResource for GtkBuilder UI definition
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: use a GResource for GtkBuilder UI definition
- Date: Mon, 7 Jan 2013 10:05:14 +0000 (UTC)
commit 3b98a73b69c36c9cc137f0dff035816f43e6a262
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 4 15:12:45 2013 +0100
keyboard: use a GResource for GtkBuilder UI definition
https://bugzilla.gnome.org/show_bug.cgi?id=691132
panels/keyboard/Makefile.am | 25 +++++++++++++++----------
panels/keyboard/cc-keyboard-panel.c | 8 ++++++--
panels/keyboard/keyboard.gresource.xml | 6 ++++++
3 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/panels/keyboard/Makefile.am b/panels/keyboard/Makefile.am
index d863d02..667fe98 100644
--- a/panels/keyboard/Makefile.am
+++ b/panels/keyboard/Makefile.am
@@ -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
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index 4f989d0..c2bbdc2 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -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);
diff --git a/panels/keyboard/keyboard.gresource.xml b/panels/keyboard/keyboard.gresource.xml
new file mode 100644
index 0000000..c52ecc9
--- /dev/null
+++ b/panels/keyboard/keyboard.gresource.xml
@@ -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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]