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

background: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent 3d27d8ca
# This is used in PANEL_CFLAGS
cappletname = background
uidir = $(pkgdatadir)/ui/background
dist_ui_DATA = \
background.ui
slideshowicondir = $(datadir)/icons/hicolor/scalable/categories/
dist_slideshowicon_DATA = slideshow-symbolic.svg
......@@ -15,17 +11,16 @@ INCLUDES = \
$(PANEL_CFLAGS) \
$(BACKGROUND_PANEL_CFLAGS) \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DUIDIR="\"$(uidir)\"" \
-DDATADIR="\"$(datadir)\"" \
-DGNOME_DESKTOP_USE_UNSTABLE_API \
-DPIXMAP_DIR=\""$(datadir)/gnome-control-center/pixmaps"\" \
$(NULL)
noinst_LTLIBRARIES = libbackground.la
BUILT_SOURCES = \
gdesktop-enums-types.c \
BUILT_SOURCES = \
cc-background-resources.c \
cc-background-resources.h \
gdesktop-enums-types.c \
gdesktop-enums-types.h
libbackground_la_SOURCES = \
......@@ -56,6 +51,12 @@ INCLUDES += $(SOCIALWEB_CFLAGS)
libbackground_la_LIBADD += $(SOCIALWEB_LIBS)
endif
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/background.gresource.xml)
cc-background-resources.c: background.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_background $<
cc-background-resources.h: background.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_background $<
gdesktop-enums-types.h: stamp-gdesktop-enums-types.h
@true
......@@ -91,5 +92,6 @@ desktop_in_files = gnome-background-panel.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES) stamp-gdesktop-enums-types.h
EXTRA_DIST = $(resource_files) background.gresource.xml
-include $(top_srcdir)/git.mk
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/background">
<file preprocess="xml-stripblanks">background.ui</file>
</gresource>
</gresources>
......@@ -30,11 +30,11 @@
#include "cc-background-panel.h"
#include "cc-background-chooser-dialog.h"
#include "cc-background-item.h"
#include "cc-background-resources.h"
#include "cc-background-xml.h"
#include "cc-background-chooser-dialog.h"
#include "bg-pictures-source.h"
#define WP_PATH_ID "org.gnome.desktop.background"
......@@ -733,12 +733,13 @@ cc_background_panel_init (CcBackgroundPanel *self)
priv = self->priv = BACKGROUND_PANEL_PRIVATE (self);
priv->builder = gtk_builder_new ();
priv->connection = g_application_get_dbus_connection (g_application_get_default ());
g_resources_register (cc_background_get_resource ());
gtk_builder_add_objects_from_file (priv->builder,
UIDIR"/background.ui",
objects, &err);
priv->builder = gtk_builder_new ();
gtk_builder_add_objects_from_resource (priv->builder,
"/org/gnome/control-center/background/background.ui",
objects, &err);
if (err)
{
......
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