After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720364 - Use GResource
Use GResource
Status: RESOLVED FIXED
Product: geary
Classification: Other
Component: build
master
Other Linux
: Normal normal
: 0.11.0
Assigned To: Geary Maintainers
Geary Maintainers
Depends on:
Blocks: geary-wk2
 
 
Reported: 2013-12-12 23:15 UTC by Jim Nelson
Modified: 2016-04-21 02:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove an unused UI resource (4.48 KB, patch)
2016-04-03 09:30 UTC, Michael Gratton
none Details | Review
Add CMake macros for building resource source code (65.73 KB, patch)
2016-04-03 09:31 UTC, Michael Gratton
none Details | Review
Generate the GResource source code, include it building the app (3.79 KB, patch)
2016-04-03 09:32 UTC, Michael Gratton
none Details | Review
Load UI resources as GResources, not from the file system. (5.89 KB, patch)
2016-04-03 09:33 UTC, Michael Gratton
none Details | Review
Enable use of GtkTemplate attributes in vala source files (2.63 KB, patch)
2016-04-04 14:51 UTC, Michael Gratton
none Details | Review
Enable use of GtkTemplate attributes in vala source files (2.92 KB, patch)
2016-04-09 07:04 UTC, Michael Gratton
none Details | Review

Description Jim Nelson 2013-12-12 23:15:30 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).
Comment 1 Jim Nelson 2014-02-17 22:01:53 UTC
See also bug #713358, which would be fixed by using GResource.
Comment 2 Michael Gratton 2016-04-03 09:30:51 UTC
Created attachment 325252 [details] [review]
Remove an unused UI resource
Comment 3 Michael Gratton 2016-04-03 09:31:40 UTC
Created attachment 325253 [details] [review]
Add CMake macros for building resource source code
Comment 4 Michael Gratton 2016-04-03 09:32:50 UTC
Created attachment 325254 [details] [review]
Generate the GResource source code, include it building the app
Comment 5 Michael Gratton 2016-04-03 09:33:21 UTC
Created attachment 325256 [details] [review]
Load UI resources as GResources, not from the file system.
Comment 6 Michael Gratton 2016-04-03 09:44:46 UTC
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.
Comment 7 Michael Gratton 2016-04-04 14:51:02 UTC
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.
Comment 8 Adam Dingle 2016-04-05 16:56:24 UTC
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?
Comment 9 Michael Gratton 2016-04-05 21:25:53 UTC
Review of attachment 325348 [details] [review]:

Patch is bogus - I'll need to respin this one, will do ASAP.
Comment 10 Michael Gratton 2016-04-09 07:04:12 UTC
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.
Comment 11 Adam Dingle 2016-04-09 21:34:53 UTC
Thanks for the patch update.  I just built with these patches and everything seems to work fine.  I've pushed them all to master.