From d147bdf584d2f174e5e3d8081b1ecc470dcab635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Sun, 30 Apr 2017 17:07:17 +0200 Subject: Do not compile the GResource to C but create bundle instead. Load it in GsmApplication. Install it in .../share/gnome-system-monitor. https://bugzilla.gnome.org/show_bug.cgi?id=779812 --- src/Makefile.am | 12 ++++++++---- src/application.cpp | 9 +++++++++ src/application.h | 1 + src/legacy/Makefile.am | 15 +-------------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 0d8c4fa..52dfeaa 100644 --- src/Makefile.am +++ src/Makefile.am @@ -3,6 +3,7 @@ AM_CPPFLAGS = \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DGSM_LIBEXEC_DIR=\""$(pkglibexecdir)"\" \ + -DGSM_RESOURCE_FILE=\""$(gsmsharedir)/$(gsmshare_DATA)"\" \ $(GSM_CFLAGS) \ $(SYSTEMD_CFLAGS) \ $(WNCK_CFLAGS) @@ -44,9 +45,7 @@ gnome_system_monitor_SOURCES = \ $(gnome_system_monitor_cpp_files) \ main.cpp -# See legacy/Makefile.am for explanation LDADD = \ - legacy/gsm-resources.o \ legacy/libgsmlegacy.la \ $(GSM_LIBS) \ $(SYSTEMD_LIBS) \ @@ -64,8 +63,13 @@ gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml) dist_noinst_DATA = \ $(gsettings_in_file) -EXTRA_DIST = \ - gsm.gresource.xml +gsm.gresource: $(top_srcdir)/src/gsm.gresource.xml $(shell glib-compile-resources --sourcedir=$(top_srcdir) --generate-dependencies $(top_srcdir)/src/gsm.gresource.xml) + $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(top_srcdir) $(top_srcdir)/src/gsm.gresource.xml + + +gsmsharedir = $(datadir)/@PACKAGE@ +gsmshare_DATA = \ + gsm.gresource CLEANFILES = \ $(gsettings_SCHEMAS) diff --git a/src/application.cpp b/src/application.cpp index d5a5e57..eb66e58 100644 --- src/application.cpp +++ src/application.cpp @@ -364,6 +364,8 @@ void GsmApplication::on_startup() { Gtk::Application::on_startup(); + load_resources (); + Glib::RefPtr action; action = Gio::SimpleAction::create("quit"); @@ -416,3 +418,10 @@ void GsmApplication::on_startup() gtk_widget_show (GTK_WIDGET (main_window)); } + +void GsmApplication::load_resources() +{ + auto res = Gio::Resource::create_from_file(GSM_RESOURCE_FILE); + res->register_global(); +} + diff --git a/src/application.h b/src/application.h index 5542de4..50550d6 100644 --- src/application.h +++ src/application.h @@ -187,6 +187,7 @@ class GsmApplication : public Gtk::Application, private procman::NonCopyable { private: void load_settings(); + void load_resources(); void on_preferences_activate(const Glib::VariantBase&); void on_lsof_activate(const Glib::VariantBase&); diff --git a/src/legacy/Makefile.am b/src/legacy/Makefile.am index 8b557d0..8af126f 100644 --- src/legacy/Makefile.am +++ src/legacy/Makefile.am @@ -5,12 +5,6 @@ AM_CPPFLAGS = \ $(SYSTEMD_CFLAGS) \ $(WNCK_CFLAGS) -# Build the file here to have the proper CFLAGS but manually link the -# file from above otherwise (and I don't understand why) the linker is -# not able to load the objects. even when referencing it, even -# gsm_get_resource so it's also not getting the ELF section. -BUILT_SOURCES = gsm-resources.c - libgsmlegacy_c_files = \ e_date.c \ gsm_color_button.c \ @@ -22,15 +16,8 @@ libgsmlegacy_h_files = \ noinst_LTLIBRARIES = libgsmlegacy.la libgsmlegacy_la_SOURCES = \ $(libgsmlegacy_c_files) \ - $(libgsmlegacy_h_files) \ - $(BUILT_SOURCES) - -gsm-resources.c: $(top_srcdir)/src/gsm.gresource.xml $(shell glib-compile-resources --sourcedir=$(top_srcdir) --generate-dependencies $(top_srcdir)/src/gsm.gresource.xml) - $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(top_srcdir) --generate-source $(top_srcdir)/src/gsm.gresource.xml - + $(libgsmlegacy_h_files) -CLEANFILES = \ - $(BUILT_SOURCES) -include $(top_srcdir)/git.mk -- cgit v0.12