[gtk/wip/sadiq/fixes: 36/36] docs: Fix inclusion of source files in tutorial



commit 6971e2923da515680147313057832cb74c608243
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Mon Sep 17 13:37:43 2018 +0530

    docs: Fix inclusion of source files in tutorial

 ...{getting_started.xml => getting_started.xml.in} | 42 +++++++++++-----------
 docs/reference/gtk/meson.build                     |  3 +-
 docs/reference/meson.build                         |  3 ++
 3 files changed, 25 insertions(+), 23 deletions(-)
---
diff --git a/docs/reference/gtk/getting_started.xml b/docs/reference/gtk/getting_started.xml.in
similarity index 92%
rename from docs/reference/gtk/getting_started.xml
rename to docs/reference/gtk/getting_started.xml.in
index 1808513419..0a6f99ca55 100644
--- a/docs/reference/gtk/getting_started.xml
+++ b/docs/reference/gtk/getting_started.xml.in
@@ -44,7 +44,7 @@
 
     <informalexample>
       <para>Create a new file with the following content named <filename>example-0.c.</filename></para>
-      <programlisting><xi:include href="../../../../examples/window-default.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@SRC_DIR@/examples/window-default.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </informalexample>
 
     <para>
@@ -153,7 +153,7 @@
     <example id="gtk-getting-started-hello-world">
       <title>Hello World in GTK+</title>
       <para>Create a new file with the following content named example-1.c.</para>
-      <programlisting><xi:include href="../../../../examples/hello-world.c" parse="text">
+      <programlisting><xi:include href="@SRC_DIR@/examples/hello-world.c" parse="text">
           <xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </example>
 
@@ -233,7 +233,7 @@
     <example id="gtk-getting-started-grid-packing">
       <title>Packing buttons</title>
       <para>Create a new file with the following content named example-2.c.</para>
-      <programlisting><xi:include href="../../../../examples/grid-packing.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@SRC_DIR@/examples/grid-packing.c" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </example>
     <para>
       You can compile the program above with GCC using:
@@ -257,9 +257,9 @@
     <example>
       <title>Packing buttons with GtkBuilder</title>
       <para>Create a new file with the following content named example-3.c.</para>
-      <programlisting><xi:include href="../../../../examples/builder.c" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@SRC_DIR@/examples/builder.c" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       <para>Create a new file with the following content named builder.ui.</para>
-      <programlisting><xi:include href="../../../../examples/builder.ui" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@SRC_DIR@/examples/builder.ui" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </example>
     <para>
       You can compile the program above with GCC using:
@@ -346,7 +346,7 @@
       of our application class.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application1/main.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application1/main.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>All the application logic is in the application class, which
@@ -364,7 +364,7 @@
       GIO <ulink 
url="https://developer.gnome.org/gio/2.36/GApplication.html#GApplication.description";>documentation</ulink>.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application1/exampleapp.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application1/exampleapp.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Another important class that is part of the application support
@@ -373,7 +373,7 @@
       window.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application1/exampleappwin.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application1/exampleappwin.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>As part of the initial setup of our application, we also
@@ -388,7 +388,7 @@
       </informalfigure>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application1/org.gtk.exampleapp.desktop" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application1/org.gtk.exampleapp.desktop" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Note that <replaceable>@<!-- -->bindir@</replaceable> needs to be replaced
@@ -420,7 +420,7 @@
       </para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application2/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application2/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>To make use of this file in our application, we revisit
@@ -460,7 +460,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
       </para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application2/exampleapp.gresource.xml" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application2/exampleapp.gresource.xml" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>This file has to be converted into a C source file that will be
@@ -599,7 +599,7 @@ example_app_window_open (ExampleAppWindow *win,
       in a ui file, and add it as a resource to our binary.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application4/app-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application4/app-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>To associate the app menu with the application, we have to call
@@ -698,7 +698,7 @@ example_app_class_init (ExampleAppClass *class)
       GSettings requires a schema that describes our settings:</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application5/org.gtk.exampleapp.gschema.xml" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application5/org.gtk.exampleapp.gschema.xml" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Before we can make use of this schema in our application,
@@ -747,13 +747,13 @@ example_app_window_init (ExampleAppWindow *win)
       <para>Lets start with the template.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application6/prefs.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application6/prefs.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Next comes the dialog subclass.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application6/exampleappprefs.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application6/exampleappprefs.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Now we revisit the <literal>preferences_activated(<!-- -->)</literal> function in our
@@ -805,7 +805,7 @@ preferences_activated (GSimpleAction *action,
       to slide out the search bar below the header bar.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application7/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application7/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Implementing the search needs quite a few code changes that
@@ -882,7 +882,7 @@ example_app_window_init (ExampleAppWindow *win)
       which demonstrates #GtkMenuButton, #GtkRevealer and #GtkListBox.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application8/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application8/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>The code to populate the sidebar with buttons for the words
@@ -893,7 +893,7 @@ example_app_window_init (ExampleAppWindow *win)
       ui file.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application8/gears-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application8/gears-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>To connect the menuitem to the show-words setting, we use
@@ -952,7 +952,7 @@ example_app_window_init (ExampleAppWindow *win)
       triggers the show-lines action:</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application9/gears-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application9/gears-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>To make this menu item do something, we create a property
@@ -1012,7 +1012,7 @@ example_app_window_init (ExampleAppWindow *win)
       be a direct child of the window, and set its type to be titlebar.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application10/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@SRC_DIR@/examples/application10/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>A small extra bonus of using a header bar is that we get
@@ -1068,7 +1068,7 @@ example_app_window_init (ExampleAppWindow *win)
     <example id="gtk-getting-started-drawing">
       <title>Drawing in response to input</title>
       <para>Create a new file with the following content named example-4.c.</para>
-      <programlisting><xi:include href="../../../../examples/drawing.c" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@SRC_DIR@/examples/drawing.c" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </example>
     <para>
       You can compile the program above with GCC using:
diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build
index e6948491e5..66dfc0291f 100644
--- a/docs/reference/gtk/meson.build
+++ b/docs/reference/gtk/meson.build
@@ -340,7 +340,6 @@ content_files = [
   'css-overview.xml',
   'css-properties.xml',
   'drawing-model.xml',
-  'getting_started.xml',
   'glossary.xml',
   'gtk4-broadwayd.xml',
   'gtk4-builder-tool.xml',
@@ -372,7 +371,6 @@ content_files = [
 expand_content_files = [
   'compiling.sgml',
   'drawing-model.xml',
-  'getting_started.xml',
   'glossary.xml',
   'input-handling.xml',
   'migrating-2to4.xml',
@@ -383,6 +381,7 @@ expand_content_files = [
 ]
 
 configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
+configure_file(input: 'getting_started.xml.in', output: 'getting_started.xml', configuration: src_dir_conf)
 
 types_conf = configuration_data()
 if os_win32
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 53458a6c90..d69068124e 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -12,6 +12,9 @@ docpath = join_paths(gtk_datadir, 'gtk-doc', 'html')
 version_conf = configuration_data()
 version_conf.set('GTK_VERSION', meson.project_version())
 
+src_dir_conf = configuration_data()
+src_dir_conf.set('SRC_DIR', meson.source_root())
+
 subdir('gdk')
 subdir('gsk')
 subdir('gtk')


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