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

search: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent b6b77de9
......@@ -3,16 +3,19 @@ cappletname = search
INCLUDES = \
$(PANEL_CFLAGS) \
$(SEARCH_PANEL_CFLAGS) \
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DDATADIR="\"$(datadir)\"" \
-I$(top_srcdir)/panels/common/ \
$(NULL)
noinst_LTLIBRARIES = libsearch.la
BUILT_SOURCES = \
cc-search-resources.c \
cc-search-resources.h
libsearch_la_SOURCES = \
$(BUILT_SOURCES) \
cc-search-locations-dialog.c \
cc-search-locations-dialog.h \
cc-search-panel.c \
......@@ -20,10 +23,11 @@ libsearch_la_SOURCES = \
libsearch_la_LIBADD = $(PANEL_LIBS) $(SEARCH_PANEL_LIBS)
uidir = $(pkgdatadir)/ui
dist_ui_DATA = \
search.ui \
search-locations-dialog.ui
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/search.gresource.xml)
cc-search-resources.c: search.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_search $<
cc-search-resources.h: search.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_search $<
@INTLTOOL_DESKTOP_RULE@
......@@ -31,6 +35,7 @@ desktopdir = $(datadir)/applications
desktop_in_files = gnome-search-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) search.gresource.xml
-include $(top_srcdir)/git.mk
......@@ -705,9 +705,9 @@ cc_search_locations_dialog_new (CcSearchPanel *self)
GError *error = NULL;
dialog_builder = gtk_builder_new ();
gtk_builder_add_from_file (dialog_builder,
GNOMECC_UI_DIR "/search-locations-dialog.ui",
&error);
gtk_builder_add_from_resource (dialog_builder,
"/org/gnome/control-center/search/search-locations-dialog.ui",
&error);
if (error != NULL)
{
......
......@@ -21,6 +21,7 @@
#include "cc-search-panel.h"
#include "cc-search-locations-dialog.h"
#include "cc-search-resources.h"
#include <egg-list-box/egg-list-box.h>
#include <gio/gdesktopappinfo.h>
......@@ -576,13 +577,14 @@ cc_search_panel_init (CcSearchPanel *self)
guint res;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CC_TYPE_SEARCH_PANEL, CcSearchPanelPrivate);
g_resources_register (cc_search_get_resource ());
self->priv->builder = gtk_builder_new ();
error = NULL;
res = gtk_builder_add_from_file (self->priv->builder,
GNOMECC_UI_DIR "/search.ui",
&error);
res = gtk_builder_add_from_resource (self->priv->builder,
"/org/gnome/control-center/search/search.ui",
&error);
if (res == 0)
{
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/search">
<file preprocess="xml-stripblanks">search.ui</file>
<file preprocess="xml-stripblanks">search-locations-dialog.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