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

network: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent db5aba75
......@@ -4,14 +4,17 @@ INCLUDES = \
$(PANEL_CFLAGS) \
$(NETWORK_PANEL_CFLAGS) \
$(NETWORK_MANAGER_CFLAGS) \
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
$(NULL)
noinst_LTLIBRARIES = libnetwork.la
BUILT_SOURCES = \
cc-network-resources.c \
cc-network-resources.h
libnetwork_la_SOURCES = \
$(BUILT_SOURCES) \
panel-common.c \
panel-common.h \
net-object.c \
......@@ -54,14 +57,11 @@ libnetwork_la_SOURCES = \
libnetwork_la_LIBADD = $(PANEL_LIBS) $(NETWORK_PANEL_LIBS) $(NETWORK_MANAGER_LIBS)
uidir = $(pkgdatadir)/ui
dist_ui_DATA = \
network-proxy.ui \
network-vpn.ui \
network-wifi.ui \
network-simple.ui \
network-mobile.ui \
network.ui
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/network.gresource.xml)
cc-network-resources.c: network.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_network $<
cc-network-resources.h: network.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_network $<
@INTLTOOL_DESKTOP_RULE@
......@@ -69,6 +69,7 @@ desktopdir = $(datadir)/applications
desktop_in_files = gnome-network-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) network.gresource.xml
-include $(top_srcdir)/git.mk
......@@ -24,6 +24,7 @@
#include <stdlib.h>
#include "cc-network-panel.h"
#include "cc-network-resources.h"
#include "nm-remote-settings.h"
#include "nm-client.h"
......@@ -1206,11 +1207,12 @@ cc_network_panel_init (CcNetworkPanel *panel)
GtkWidget *toplevel;
panel->priv = NETWORK_PANEL_PRIVATE (panel);
g_resources_register (cc_network_get_resource ());
panel->priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (panel->priv->builder,
GNOMECC_UI_DIR "/network.ui",
&error);
gtk_builder_add_from_resource (panel->priv->builder,
"/org/gnome/control-center/network/network.ui",
&error);
if (error != NULL) {
g_warning ("Could not load interface file: %s", error->message);
g_error_free (error);
......
......@@ -599,9 +599,9 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
device_mobile->priv = NET_DEVICE_MOBILE_GET_PRIVATE (device_mobile);
device_mobile->priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (device_mobile->priv->builder,
GNOMECC_UI_DIR "/network-mobile.ui",
&error);
gtk_builder_add_from_resource (device_mobile->priv->builder,
"/org/gnome/control-center/network/network-mobile.ui",
&error);
if (error != NULL) {
g_warning ("Could not load interface file: %s", error->message);
g_error_free (error);
......
......@@ -250,9 +250,9 @@ net_device_simple_init (NetDeviceSimple *device_simple)
device_simple->priv = NET_DEVICE_SIMPLE_GET_PRIVATE (device_simple);
device_simple->priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (device_simple->priv->builder,
GNOMECC_UI_DIR "/network-simple.ui",
&error);
gtk_builder_add_from_resource (device_simple->priv->builder,
"/org/gnome/control-center/network/network-simple.ui",
&error);
if (error != NULL) {
g_warning ("Could not load interface file: %s", error->message);
g_error_free (error);
......
......@@ -1999,9 +1999,9 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
device_wifi->priv = NET_DEVICE_WIFI_GET_PRIVATE (device_wifi);
device_wifi->priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (device_wifi->priv->builder,
GNOMECC_UI_DIR "/network-wifi.ui",
&error);
gtk_builder_add_from_resource (device_wifi->priv->builder,
"/org/gnome/control-center/network/network-wifi.ui",
&error);
if (error != NULL) {
g_warning ("Could not load interface file: %s", error->message);
g_error_free (error);
......
......@@ -307,9 +307,9 @@ net_proxy_init (NetProxy *proxy)
proxy->priv = NET_PROXY_GET_PRIVATE (proxy);
proxy->priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (proxy->priv->builder,
GNOMECC_UI_DIR "/network-proxy.ui",
&error);
gtk_builder_add_from_resource (proxy->priv->builder,
"/org/gnome/control-center/network/network-proxy.ui",
&error);
if (error != NULL) {
g_warning ("Could not load interface file: %s", error->message);
g_error_free (error);
......
......@@ -497,9 +497,9 @@ net_vpn_init (NetVpn *vpn)
vpn->priv = NET_VPN_GET_PRIVATE (vpn);
vpn->priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (vpn->priv->builder,
GNOMECC_UI_DIR "/network-vpn.ui",
&error);
gtk_builder_add_from_resource (vpn->priv->builder,
"/org/gnome/control-center/network/network-vpn.ui",
&error);
if (error != NULL) {
g_warning ("Could not load interface file: %s", error->message);
g_error_free (error);
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/network">
<file preprocess="xml-stripblanks">network.ui</file>
<file preprocess="xml-stripblanks">network-proxy.ui</file>
<file preprocess="xml-stripblanks">network-vpn.ui</file>
<file preprocess="xml-stripblanks">network-wifi.ui</file>
<file preprocess="xml-stripblanks">network-simple.ui</file>
<file preprocess="xml-stripblanks">network-mobile.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