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

power: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent 495a399a
......@@ -5,15 +5,18 @@ SUBDIRS = icons
INCLUDES = \
$(PANEL_CFLAGS) \
$(POWER_PANEL_CFLAGS) \
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-I$(srcdir)/../../shell/ \
$(NULL)
noinst_LTLIBRARIES = libpower.la
BUILT_SOURCES = \
cc-power-resources.c \
cc-power-resources.h
libpower_la_SOURCES = \
$(BUILT_SOURCES) \
cc-power-panel.c \
cc-power-panel.h
......@@ -29,8 +32,11 @@ INCLUDES += $(NETWORK_MANAGER_CFLAGS)
libpower_la_LIBADD += $(NETWORK_MANAGER_LIBS)
endif
uidir = $(pkgdatadir)/ui
dist_ui_DATA = power.ui
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/power.gresource.xml)
cc-power-resources.c: power.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_power $<
cc-power-resources.h: power.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_power $<
@INTLTOOL_DESKTOP_RULE@
......@@ -38,6 +44,7 @@ desktopdir = $(datadir)/applications
desktop_in_files = gnome-power-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) power.gresource.xml
-include $(top_srcdir)/git.mk
......@@ -36,6 +36,7 @@
#endif
#include "cc-power-panel.h"
#include "cc-power-resources.h"
/* Uncomment this to test the behaviour of the panel in
* battery-less situations:
......@@ -1895,13 +1896,14 @@ cc_power_panel_init (CcPowerPanel *self)
GtkWidget *box;
priv = self->priv = POWER_PANEL_PRIVATE (self);
g_resources_register (cc_power_get_resource ());
priv->builder = gtk_builder_new ();
error = NULL;
gtk_builder_add_from_file (priv->builder,
GNOMECC_UI_DIR "/power.ui",
&error);
gtk_builder_add_from_resource (self->priv->builder,
"/org/gnome/control-center/power/power.ui",
&error);
if (error != NULL)
{
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/power">
<file preprocess="xml-stripblanks">power.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