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

screen: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent 887c3ae3
......@@ -3,21 +3,27 @@ cappletname = screen
INCLUDES = \
$(PANEL_CFLAGS) \
$(SCREEN_PANEL_CFLAGS) \
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
$(NULL)
noinst_LTLIBRARIES = libscreen.la
BUILT_SOURCES = \
cc-screen-resources.c \
cc-screen-resources.h
libscreen_la_SOURCES = \
$(BUILT_SOURCES) \
cc-screen-panel.c \
cc-screen-panel.h
libscreen_la_LIBADD = $(PANEL_LIBS) $(SCREEN_PANEL_LIBS)
uidir = $(pkgdatadir)/ui
dist_ui_DATA = screen.ui
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/screen.gresource.xml)
cc-screen-resources.c: screen.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_screen $<
cc-screen-resources.h: screen.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_screen $<
@INTLTOOL_DESKTOP_RULE@
......@@ -25,6 +31,7 @@ desktopdir = $(datadir)/applications
desktop_in_files = gnome-screen-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) screen.gresource.xml
-include $(top_srcdir)/git.mk
......@@ -20,6 +20,8 @@
*/
#include "cc-screen-panel.h"
#include "cc-screen-resources.h"
#include <string.h>
CC_PANEL_REGISTER (CcScreenPanel, cc_screen_panel)
......@@ -435,13 +437,14 @@ cc_screen_panel_init (CcScreenPanel *self)
GtkWidget *widget;
self->priv = SCREEN_PANEL_PRIVATE (self);
g_resources_register (cc_screen_get_resource ());
self->priv->builder = gtk_builder_new ();
error = NULL;
gtk_builder_add_from_file (self->priv->builder,
GNOMECC_UI_DIR "/screen.ui",
&error);
gtk_builder_add_from_resource (self->priv->builder,
"/org/gnome/control-center/screen/screen.ui",
&error);
if (error != NULL)
{
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/screen">
<file preprocess="xml-stripblanks">screen.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