From eafb5fddf84324ebf6b0cc90422f10ee314b5b28 Mon Sep 17 00:00:00 2001 From: rbuj Date: Tue, 7 May 2019 00:05:26 +0200 Subject: capplets: Use gresources for UI files --- capplets/network/Makefile.am | 16 +++++++++------- capplets/network/mate-network-properties.c | 10 ++++------ .../network/org.mate.mcc.network.gresource.xml | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 capplets/network/org.mate.mcc.network.gresource.xml (limited to 'capplets/network') diff --git a/capplets/network/Makefile.am b/capplets/network/Makefile.am index 904d2e28..cb1671eb 100644 --- a/capplets/network/Makefile.am +++ b/capplets/network/Makefile.am @@ -3,24 +3,26 @@ cappletname = network bin_PROGRAMS = mate-network-properties +BUILT_SOURCES = mate-network-properties-resources.h mate-network-properties-resources.c +nodist_mate_network_properties_SOURCES = \ + $(BUILT_SOURCES) mate_network_properties_SOURCES = mate-network-properties.c mate_network_properties_LDADD = $(MATECC_CAPPLETS_LIBS) @INTLTOOL_DESKTOP_RULE@ -uidir = $(pkgdatadir)/ui -dist_ui_DATA = mate-network-properties.ui - desktopdir = $(datadir)/applications desktop_in_files = mate-network-properties.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) +mate-network-properties-resources.h mate-network-properties-resources.c: org.mate.mcc.network.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/org.mate.mcc.network.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name network $< + AM_CPPFLAGS = \ $(MATECC_CAPPLETS_CFLAGS) \ - -DMATELOCALEDIR="\"$(datadir)/locale\"" \ - -DMATECC_UI_DIR="\"$(uidir)\"" + -DMATELOCALEDIR="\"$(datadir)/locale\"" -CLEANFILES = $(MATECC_CAPPLETS_CLEANFILES) $(desktop_DATA) -EXTRA_DIST = $(desktop_in_files) +CLEANFILES = $(MATECC_CAPPLETS_CLEANFILES) $(desktop_DATA) $(BUILT_SOURCES) +EXTRA_DIST = mate-network-properties.ui $(desktop_in_files) org.mate.mcc.network.gresource.xml -include $(top_srcdir)/git.mk diff --git a/capplets/network/mate-network-properties.c b/capplets/network/mate-network-properties.c index 51a149dd..c2243fb3 100644 --- a/capplets/network/mate-network-properties.c +++ b/capplets/network/mate-network-properties.c @@ -80,8 +80,6 @@ enum { #define SOCKS_PROXY_HOST_KEY "host" #define SOCKS_PROXY_PORT_KEY "port" -#define MATECC_GNP_UI_FILE (MATECC_UI_DIR "/mate-network-properties.ui") - static GtkWidget *details_dialog = NULL; static GSList *ignore_hosts = NULL; static GtkTreeModel *model = NULL; @@ -276,8 +274,8 @@ cb_http_details_button_clicked (GtkWidget *button, } builder = gtk_builder_new (); - if (gtk_builder_add_objects_from_file (builder, MATECC_GNP_UI_FILE, - builder_widgets, &error) == 0) { + if (gtk_builder_add_objects_from_resource (builder, "/org/mate/mcc/network/mate-network-properties.ui", + builder_widgets, &error) == 0) { g_warning ("Could not load details dialog: %s", error->message); g_error_free (error); g_object_unref (builder); @@ -468,8 +466,8 @@ main (int argc, char **argv) gtk_init (&argc, &argv); builder = gtk_builder_new (); - if (gtk_builder_add_objects_from_file (builder, MATECC_GNP_UI_FILE, - builder_widgets, &error) == 0) { + if (gtk_builder_add_objects_from_resource (builder, "/org/mate/mcc/network/mate-network-properties.ui", + builder_widgets, &error) == 0) { g_warning ("Could not load main dialog: %s", error->message); g_error_free (error); diff --git a/capplets/network/org.mate.mcc.network.gresource.xml b/capplets/network/org.mate.mcc.network.gresource.xml new file mode 100644 index 00000000..84cefc59 --- /dev/null +++ b/capplets/network/org.mate.mcc.network.gresource.xml @@ -0,0 +1,22 @@ + + + + + mate-network-properties.ui + + -- cgit v1.2.1