[geary] Enable use of GtkTemplate attributes in vala source files.



commit 119f939ec8f2c9e56e7d2a58ce8b3960db11fc90
Author: Michael James Gratton <mike vee net>
Date:   Sat Apr 9 16:25:26 2016 +1000

    Enable use of GtkTemplate attributes in vala source files.
    
    * src/CMakeLists.txt: Bump target GLib to min required for
      GtkTemplate. Pass resources XML file to valac.
    
    * ui/CMakeLists.txt: Copy both the generated resources XML file and the
      resources themselves to the CMake binary directory, since valac expects
      the UI files to be in the same directory as the resource XML.
    
    * debian/control: Chase GLib version bump.

 debian/control     |    2 +-
 src/CMakeLists.txt |    7 +++++--
 ui/CMakeLists.txt  |   13 +++++++++++++
 3 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/debian/control b/debian/control
index 5efff61..122173b 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Jim Nelson <jim yorba org>
 Build-Depends: debhelper (>= 8),
  libgee-0.8-dev,
- libglib2.0-dev (>= 2.34.0),
+ libglib2.0-dev (>= 2.38.0),
  libgtk-3-dev (>= 3.10.0),
  libnotify-dev (>=0.7.5),
  libcanberra-dev (>= 0.28),
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d59d558..e8ab356 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -538,7 +538,7 @@ else ()
     )
 endif ()
 
-set(TARGET_GLIB 2.34)
+set(TARGET_GLIB 2.38)
 
 pkg_check_modules(DEPS REQUIRED
     gthread-2.0
@@ -658,6 +658,9 @@ add_custom_command(
 
 # Geary client app
 #################################################
+set_property(SOURCE ${RESOURCES_C} PROPERTY GENERATED TRUE)
+set_property(SOURCE ${RESOURCES_XML} PROPERTY GENERATED TRUE)
+
 vala_precompile(GEARY_VALA_C geary
     ${CLIENT_SRC}
 PACKAGES
@@ -669,9 +672,9 @@ CUSTOM_VAPIS
 OPTIONS
     ${VALAC_OPTIONS}
     --vapidir=${CMAKE_BINARY_DIR}/src
+    --gresources=${RESOURCES_XML}
 )
 
-set_property(SOURCE ${RESOURCES_C} PROPERTY GENERATED TRUE)
 add_executable(geary ${GEARY_VALA_C} ${RESOURCES_C})
 target_link_libraries(geary m ${DEPS_LIBRARIES} gthread-2.0 geary-static)
 install(TARGETS geary RUNTIME DESTINATION bin)
diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt
index 4aa4c82..7133c51 100644
--- a/ui/CMakeLists.txt
+++ b/ui/CMakeLists.txt
@@ -40,4 +40,17 @@ compile_gresources(
 add_custom_target(resource_h ALL DEPENDS ${RESOURCES_H})
 add_custom_target(resource_c ALL DEPENDS ${RESOURCES_C})
 
+# Work around valac wanting the resource files to be in the same
+# directory as the XML file.
+add_custom_target(resource_copy ALL
+    mkdir -p ${CMAKE_BINARY_DIR}/ui
+  COMMAND
+    cp ${RESOURCES_XML} ${CMAKE_BINARY_DIR}/ui
+  COMMAND
+    cp ${CMAKE_SOURCE_DIR}/ui/*.glade ${CMAKE_SOURCE_DIR}/ui/*.interface ${CMAKE_SOURCE_DIR}/ui/*.ui 
${CMAKE_BINARY_DIR}/ui
+)
+add_dependencies(resource_copy resource_c)
+
+# Export the file names so they can be used in the source build
 set(RESOURCES_C ${RESOURCES_C} PARENT_SCOPE)
+set(RESOURCES_XML "${CMAKE_BINARY_DIR}/ui/.gresource.xml" PARENT_SCOPE)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]