Commit def9909a authored by Bastien Nocera's avatar Bastien Nocera

Use GResource to load .ui files

parent 8e4caa88
......@@ -19,8 +19,10 @@ AM_CFLAGS = \
$(providerinfo_CFLAGS) \
$(libnautilusextension_CFLAGS)
BUILT_SOURCES = nautilus-ideviceinfo-resources.c nautilus-ideviceinfo-resources.h
noinst_LTLIBRARIES = libideviceinfo.la
libideviceinfo_la_SOURCES = ideviceinfo-property-page.c ideviceinfo-property-page.h rb-segmented-bar.h rb-segmented-bar.c
libideviceinfo_la_SOURCES = ideviceinfo-property-page.c ideviceinfo-property-page.h rb-segmented-bar.h rb-segmented-bar.c $(BUILT_SOURCES)
libideviceinfo_la_LIBADD = $(WIDGET_LIBS) $(libgpod_LIBS) $(libxml_LIBS)
noinst_PROGRAMS = test-property-tab test-rb-segmented-bar
......@@ -43,5 +45,11 @@ libnautilus_ideviceinfo_la_SOURCES = \
libnautilus_ideviceinfo_la_LDFLAGS = -module -avoid-version
libnautilus_ideviceinfo_la_LIBADD = $(libnautilusextension_LIBS) libideviceinfo.la
resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/nautilus-ideviceinfo.gresource.xml)
nautilus-ideviceinfo-resources.c: nautilus-ideviceinfo.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name nautilus_ideviceinfo $<
nautilus-ideviceinfo-resources.h: nautilus-ideviceinfo.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name nautilus_ideviceinfo $<
nautilus_extension_DATA = nautilus-ideviceinfo.ui
EXTRA_DIST=$(nautilus_extension_DATA)
EXTRA_DIST= $(resource_files) nautilus-ideviceinfo.gresource.xml
......@@ -27,6 +27,7 @@
#include <locale.h>
#include "ideviceinfo-property-page.h"
#include "nautilus-ideviceinfo-resources.h"
#include <libnautilus-extension/nautilus-property-page-provider.h>
......@@ -728,35 +729,33 @@ nautilus_ideviceinfo_page_init (NautilusIdeviceinfoPage *di)
{
GtkBuilder *builder;
GtkWidget *container;
GtkAlignment *align;
di->priv = G_TYPE_INSTANCE_GET_PRIVATE (di, NAUTILUS_TYPE_IDEVICEINFO_PAGE, NautilusIdeviceinfoPagePrivate);
builder = gtk_builder_new();
gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
gtk_builder_add_from_file (builder, UIFILE, NULL);
g_resources_register (nautilus_ideviceinfo_get_resource ());
gtk_builder_add_from_resource (builder, "/org/gnome/nautilus-ideviceinfo/nautilus-ideviceinfo.ui", NULL);
gtk_builder_connect_signals (builder, NULL);
container = GTK_WIDGET(gtk_builder_get_object(builder, "ideviceinfo"));
if (!container) {
g_object_unref (G_OBJECT(builder));
container = gtk_label_new(g_strdup_printf(_("There was an error loading '%s'.\nConsider reinstalling the application."), UIFILE));
} else {
GtkWidget *align;
g_assert (container);
di->priv->builder = builder;
g_object_ref (container);
di->priv->builder = builder;
g_object_ref (container);
/* Add segmented bar */
di->priv->segbar = rb_segmented_bar_new();
g_object_set(G_OBJECT(di->priv->segbar),
"show-reflection", TRUE,
"show-labels", TRUE,
NULL);
gtk_widget_show(di->priv->segbar);
/* Add segmented bar */
di->priv->segbar = rb_segmented_bar_new();
g_object_set(G_OBJECT(di->priv->segbar),
"show-reflection", TRUE,
"show-labels", TRUE,
NULL);
gtk_widget_show(di->priv->segbar);
align = GTK_ALIGNMENT(gtk_builder_get_object (di->priv->builder, "disk_usage"));
gtk_container_add(GTK_CONTAINER(align), di->priv->segbar);
align = GTK_WIDGET(gtk_builder_get_object (di->priv->builder, "disk_usage"));
gtk_container_add(GTK_CONTAINER(align), di->priv->segbar);
}
gtk_widget_show(container);
gtk_container_add(GTK_CONTAINER(di), container);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/nautilus-ideviceinfo">
<file preprocess="xml-stripblanks">nautilus-ideviceinfo.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