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

printers: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent 0653773e
cappletname = printers
uidir = $(pkgdatadir)/ui/printers
dist_ui_DATA = \
new-printer-dialog.ui \
ppd-selection-dialog.ui \
options-dialog.ui \
jobs-dialog.ui \
printers.ui
INCLUDES = \
$(PANEL_CFLAGS) \
$(PRINTERS_PANEL_CFLAGS) \
-I$(top_srcdir)/shell/ \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DDATADIR="\"$(uidir)\"" \
$(NULL)
noinst_LTLIBRARIES = libprinters.la
BUILT_SOURCES = \
cc-printers-resources.c \
cc-printers-resources.h
libprinters_la_SOURCES = \
$(BUILT_SOURCES) \
pp-new-printer.c \
pp-new-printer.h \
pp-maintenance-command.c \
......@@ -47,12 +42,19 @@ libprinters_la_SOURCES = \
libprinters_la_LIBADD = $(PRINTERS_PANEL_LIBS) $(PANEL_LIBS) $(CUPS_LIBS)
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/printers.gresource.xml)
cc-printers-resources.c: printers.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_printers $<
cc-printers-resources.h: printers.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_printers $<
@INTLTOOL_DESKTOP_RULE@
desktopdir = $(datadir)/applications
desktop_in_files = gnome-printers-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) printers.gresource.xml
-include $(top_srcdir)/git.mk
......@@ -20,6 +20,7 @@
#include <config.h>
#include "cc-printers-panel.h"
#include "cc-printers-resources.h"
#include <string.h>
#include <glib/gi18n-lib.h>
......@@ -2833,6 +2834,7 @@ cc_printers_panel_init (CcPrintersPanel *self)
guint builder_result;
priv = self->priv = PRINTERS_PANEL_PRIVATE (self);
g_resources_register (cc_printers_get_resource ());
/* initialize main data structure */
priv->builder = gtk_builder_new ();
......@@ -2870,9 +2872,9 @@ cc_printers_panel_init (CcPrintersPanel *self)
priv->preferred_drivers = NULL;
builder_result = gtk_builder_add_objects_from_file (priv->builder,
DATADIR"/printers.ui",
objects, &error);
builder_result = gtk_builder_add_objects_from_resource (priv->builder,
"/org/gnome/control-center/printers/printers.ui",
objects, &error);
if (builder_result == 0)
{
......
......@@ -441,9 +441,9 @@ pp_jobs_dialog_new (GtkWindow *parent,
dialog->builder = gtk_builder_new ();
dialog->parent = GTK_WIDGET (parent);
builder_result = gtk_builder_add_objects_from_file (dialog->builder,
DATADIR"/jobs-dialog.ui",
objects, &error);
builder_result = gtk_builder_add_objects_from_resource (dialog->builder,
"/org/gnome/control-center/printers/jobs-dialog.ui",
objects, &error);
if (builder_result == 0)
{
......
......@@ -267,9 +267,9 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
priv->builder = gtk_builder_new ();
builder_result = gtk_builder_add_objects_from_file (priv->builder,
DATADIR"/new-printer-dialog.ui",
objects, &error);
builder_result = gtk_builder_add_objects_from_resource (priv->builder,
"/org/gnome/control-center/printers/new-printer-dialog.ui",
objects, &error);
if (builder_result == 0)
{
......
......@@ -894,9 +894,9 @@ pp_options_dialog_new (GtkWindow *parent,
dialog->builder = gtk_builder_new ();
dialog->parent = GTK_WIDGET (parent);
builder_result = gtk_builder_add_objects_from_file (dialog->builder,
DATADIR"/options-dialog.ui",
objects, &error);
builder_result = gtk_builder_add_objects_from_resource (dialog->builder,
"/org/gnome/control-center/printers/options-dialog.ui",
objects, &error);
if (builder_result == 0)
{
......
......@@ -368,9 +368,9 @@ pp_ppd_selection_dialog_new (GtkWindow *parent,
dialog->builder = gtk_builder_new ();
dialog->parent = GTK_WIDGET (parent);
builder_result = gtk_builder_add_objects_from_file (dialog->builder,
DATADIR"/ppd-selection-dialog.ui",
objects, &error);
builder_result = gtk_builder_add_objects_from_resource (dialog->builder,
"/org/gnome/control-center/printers/ppd-selection-dialog.ui",
objects, &error);
if (builder_result == 0)
{
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/printers">
<file preprocess="xml-stripblanks">jobs-dialog.ui</file>
<file preprocess="xml-stripblanks">new-printer-dialog.ui</file>
<file preprocess="xml-stripblanks">options-dialog.ui</file>
<file preprocess="xml-stripblanks">ppd-selection-dialog.ui</file>
<file preprocess="xml-stripblanks">printers.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