[gnome-control-center] bluetooth: use a GResource for GtkBuilder UI definition
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] bluetooth: use a GResource for GtkBuilder UI definition
- Date: Mon, 7 Jan 2013 10:04:49 +0000 (UTC)
commit ddf9d29f66458d2d0fe14cc76abc348dadcf996c
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 4 13:29:29 2013 +0100
bluetooth: use a GResource for GtkBuilder UI definition
https://bugzilla.gnome.org/show_bug.cgi?id=691132
panels/bluetooth/Makefile.am | 19 +++++++++++++------
panels/bluetooth/bluetooth.gresource.xml | 6 ++++++
panels/bluetooth/cc-bluetooth-panel.c | 10 ++++++----
3 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/panels/bluetooth/Makefile.am b/panels/bluetooth/Makefile.am
index d07b795..78303b6 100644
--- a/panels/bluetooth/Makefile.am
+++ b/panels/bluetooth/Makefile.am
@@ -7,25 +7,32 @@ INCLUDES = \
$(PANEL_CFLAGS) \
$(BLUETOOTH_CFLAGS) \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
- -DPKGDATADIR="\"$(pkgdatadir)\"" \
$(NULL)
+BUILT_SOURCES = \
+ cc-bluetooth-resources.h \
+ cc-bluetooth-resources.c
+
libbluetooth_la_SOURCES = \
+ $(BUILT_SOURCES) \
cc-bluetooth-panel.c \
cc-bluetooth-panel.h
libbluetooth_la_LIBADD = $(PANEL_LIBS) $(BLUETOOTH_LIBS)
+resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/bluetooth.gresource.xml)
+cc-bluetooth-resources.c: bluetooth.gresource.xml $(resource_files)
+ $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_bluetooth $<
+cc-bluetooth-resources.h: bluetooth.gresource.xml $(resource_files)
+ $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_bluetooth $<
+
desktopdir = $(datadir)/applications
desktop_in_in_files = gnome-bluetooth-panel.desktop.in.in
desktop_in_files = gnome-bluetooth-panel.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
-ui_DATA = bluetooth.ui
-uidir = $(pkgdatadir)
-
-CLEANFILES = $(desktop_DATA)
-EXTRA_DIST = $(man_MANS) $(desktop_in_in_files) $(ui_DATA)
+CLEANFILES = $(desktop_DATA) $(BUILT_SOURCES)
+EXTRA_DIST = $(man_MANS) $(desktop_in_in_files) $(resource_files) bluetooth.gresource.xml
-include $(top_srcdir)/git.mk
diff --git a/panels/bluetooth/bluetooth.gresource.xml b/panels/bluetooth/bluetooth.gresource.xml
new file mode 100644
index 0000000..95f0a07
--- /dev/null
+++ b/panels/bluetooth/bluetooth.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/control-center/bluetooth">
+ <file preprocess="xml-stripblanks">bluetooth.ui</file>
+ </gresource>
+</gresources>
diff --git a/panels/bluetooth/cc-bluetooth-panel.c b/panels/bluetooth/cc-bluetooth-panel.c
index accd9b8..9784044 100644
--- a/panels/bluetooth/cc-bluetooth-panel.c
+++ b/panels/bluetooth/cc-bluetooth-panel.c
@@ -29,6 +29,7 @@
#include <shell/cc-shell.h>
#include "cc-bluetooth-panel.h"
+#include "cc-bluetooth-resources.h"
#include <bluetooth-client.h>
#include <bluetooth-utils.h>
@@ -782,6 +783,7 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
GtkStyleContext *context;
self->priv = BLUETOOTH_PANEL_PRIVATE (self);
+ g_resources_register (cc_bluetooth_get_resource ());
bluetooth_plugin_manager_init ();
self->priv->killswitch = bluetooth_killswitch_new ();
@@ -794,11 +796,11 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
self->priv->builder = gtk_builder_new ();
gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE);
- gtk_builder_add_from_file (self->priv->builder,
- PKGDATADIR "/bluetooth.ui",
- &error);
+ gtk_builder_add_from_resource (self->priv->builder,
+ "/org/gnome/control-center/bluetooth/bluetooth.ui",
+ &error);
if (error != NULL) {
- g_warning ("Failed to load '%s': %s", PKGDATADIR "/bluetooth.ui", error->message);
+ g_warning ("Could not load ui: %s", error->message);
g_error_free (error);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]