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

display: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent d2ce735f
# This is used in PANEL_CFLAGS
cappletname = display
uidir = $(pkgdatadir)/ui
dist_ui_DATA = display-capplet.ui
noinst_LTLIBRARIES = libdisplay.la
BUILT_SOURCES = \
cc-display-resources.c \
cc-display-resources.h
libdisplay_la_SOURCES = \
$(BUILT_SOURCES) \
cc-display-panel.c \
cc-display-panel.h \
cc-rr-labeler.c \
......@@ -16,6 +18,12 @@ libdisplay_la_SOURCES = \
libdisplay_la_LIBADD = $(PANEL_LIBS) $(DISPLAY_PANEL_LIBS)
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/display.gresource.xml)
cc-display-resources.c: display.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_display $<
cc-display-resources.h: display.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_display $<
# You will need a recent intltool or the patch from this bug
# http://bugzilla.gnome.org/show_bug.cgi?id=462312
@INTLTOOL_POLICY_RULE@
......@@ -39,12 +47,10 @@ desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
INCLUDES = $(PANEL_CFLAGS) \
$(DISPLAY_PANEL_CFLAGS) \
-DSBINDIR="\"$(sbindir)\"" \
-DUIDIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\""
-DGNOMELOCALEDIR="\"$(datadir)/locale\""
CLEANFILES = $(Desktop_in_files) $(desktop_DATA)
CLEANFILES = $(Desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES)
EXTRA_DIST = $(resource_files) display.gresource.xml
if MAINTAINER_MODE
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
......
......@@ -25,6 +25,7 @@
#include <sys/wait.h>
#include "cc-display-panel.h"
#include "cc-display-resources.h"
#include <gtk/gtk.h>
#include "scrollarea.h"
......@@ -2571,6 +2572,7 @@ dialog_map_event_cb (GtkWidget *widget, GdkEventAny *event, gpointer data)
static void
cc_display_panel_init (CcDisplayPanel *self)
{
g_resources_register (cc_display_get_resource ());
}
static GObject *
......@@ -2594,7 +2596,7 @@ cc_display_panel_constructor (GType gtype,
error = NULL;
self->priv->builder = builder = gtk_builder_new ();
if (!gtk_builder_add_objects_from_file (builder, UIDIR "/display-capplet.ui", objects, &error))
if (!gtk_builder_add_objects_from_resource (builder, "/org/gnome/control-center/display/display-capplet.ui", objects, &error))
{
g_warning ("Could not parse UI definition: %s", error->message);
g_error_free (error);
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/display">
<file preprocess="xml-stripblanks">display-capplet.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