GNOME Bugzilla – Bug 720364
Use GResource
Last modified: 2016-04-21 02:21:20 UTC
GResource allows for application resources to be bound into the executable itself: https://developer.gnome.org/gio/stable/gio-GResource.html This could make our life a lot easier, as today we install all the separate files to various locations as well as use some special logic to determine where they are located (when running out of the build directory vs. installed).
See also bug #713358, which would be fixed by using GResource.
Created attachment 325252 [details] [review] Remove an unused UI resource
Created attachment 325253 [details] [review] Add CMake macros for building resource source code
Created attachment 325254 [details] [review] Generate the GResource source code, include it building the app
Created attachment 325256 [details] [review] Load UI resources as GResources, not from the file system.
Adam, the four patches above convert Geary to use GResources for loading UI files. I'm keen to use Vala's GTK widget template attribute support for the port to Webkit2 (a'la this: https://blogs.gnome.org/tvb/2013/05/29/composite-templates-lands-in-vala/), this work is in support of that. There's more that could be done here - clean up error handing per Bug #713358, convert use of GtkBuilder to Vala attributes, use put the UI files in a dir hierarchy that mirrors the source, remove use of GTKUIManager, convert .glade to .ui files, but I think they are best done in other bugs.
Created attachment 325348 [details] [review] Enable use of GtkTemplate attributes in vala source files Final patch needed to actually be able to use GtkTemplate attributes in vala source files.
Mike, I applied your 5 patches and attempted to build, and got this: ==== CMake Error at ui/CMakeLists.txt:46 (file): file COPY cannot find "/home/adam/src/geary/build/.gresource.xml". CMake Error at ui/CMakeLists.txt:47 (file): file COPY cannot find "/home/adam/src/geary/ui/message-box.ui". ... -- Configuring incomplete, errors occurred! ==== Did you forget to commit one or more files?
Review of attachment 325348 [details] [review]: Patch is bogus - I'll need to respin this one, will do ASAP.
Created attachment 325626 [details] [review] Enable use of GtkTemplate attributes in vala source files Respun the last patch in the series. Note that this includes a GLib version bump, from 2.34 to 2.38. This affects Ubuntu Precise and Fedora <= 19 users. People on Precise had to install their own GLib anyway however since it only includes 2.32 and Fedora 19 has been unsupported since early 2015. Debian stable is unaffected and so is OpenSUSE 13.1 so I think it's reasonable. The current minimum Vala req is unaffected.
Thanks for the patch update. I just built with these patches and everything seems to work fine. I've pushed them all to master.