[gnome-control-center] network: use a GResource for GtkBuilder UI definition
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: use a GResource for GtkBuilder UI definition
- Date: Mon, 7 Jan 2013 10:05:24 +0000 (UTC)
commit 57de0ab01986a79c8431c4514a80211dbf646d8b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 4 15:34:11 2013 +0100
network: use a GResource for GtkBuilder UI definition
https://bugzilla.gnome.org/show_bug.cgi?id=691132
panels/network/Makefile.am | 23 ++++++++++++-----------
panels/network/cc-network-panel.c | 8 +++++---
panels/network/net-device-mobile.c | 6 +++---
panels/network/net-device-simple.c | 6 +++---
panels/network/net-device-wifi.c | 6 +++---
panels/network/net-proxy.c | 6 +++---
panels/network/net-vpn.c | 6 +++---
panels/network/network.gresource.xml | 11 +++++++++++
8 files changed, 43 insertions(+), 29 deletions(-)
---
diff --git a/panels/network/Makefile.am b/panels/network/Makefile.am
index 3ee94bf..2e07282 100644
--- a/panels/network/Makefile.am
+++ b/panels/network/Makefile.am
@@ -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
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index bf48559..dbf02fb 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -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);
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 38a2ee9..1952718 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -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);
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index fbd9a1e..98c9744 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -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);
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 278991a..545b563 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -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);
diff --git a/panels/network/net-proxy.c b/panels/network/net-proxy.c
index 8d1bf78..5e8505b 100644
--- a/panels/network/net-proxy.c
+++ b/panels/network/net-proxy.c
@@ -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);
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index 828acab..7cfaa7a 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -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);
diff --git a/panels/network/network.gresource.xml b/panels/network/network.gresource.xml
new file mode 100644
index 0000000..b0b8f1c
--- /dev/null
+++ b/panels/network/network.gresource.xml
@@ -0,0 +1,11 @@
+<?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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]