From 940126c427ac3b7289235ef5909b7f6453d22567 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sun, 31 Mar 2019 22:41:46 +0200 Subject: [PATCH] meson: fix code examples in the gtk docs build getting_started.xml uses relative paths for including code examples and for some reason the base path is different with meson than with autotools. Switch both autotools and meson to generate the file and insert the absolute source path instead. This also cleans up the content file list: the expand content files have to be in the content file list as well, so just append them there. --- .gitlab-ci/test-docker-autotools.sh | 3 +- configure.ac | 1 + docs/reference/gtk/Makefile.am | 6 +-- ...ing_started.xml => getting_started.xml.in} | 42 +++++++++---------- docs/reference/gtk/meson.build | 20 ++------- docs/reference/meson.build | 2 +- 6 files changed, 32 insertions(+), 42 deletions(-) rename docs/reference/gtk/{getting_started.xml => getting_started.xml.in} (92%) diff --git a/.gitlab-ci/test-docker-autotools.sh b/.gitlab-ci/test-docker-autotools.sh index 73d7e8a6f9..32d8cec1e0 100755 --- a/.gitlab-ci/test-docker-autotools.sh +++ b/.gitlab-ci/test-docker-autotools.sh @@ -11,5 +11,6 @@ cd _build ../autogen.sh \ --enable-cloudproviders \ --enable-broadway-backend \ - --enable-xinerama + --enable-xinerama \ + --enable-gtk-doc make -j8 diff --git a/configure.ac b/configure.ac index f700616649..5615ac7193 100644 --- a/configure.ac +++ b/configure.ac @@ -1983,6 +1983,7 @@ docs/reference/gdk/version.xml docs/reference/gtk/Makefile docs/reference/gtk/gtk3.types docs/reference/gtk/version.xml +docs/reference/gtk/getting_started.xml docs/reference/libgail-util/Makefile docs/reference/libgail-util/version.xml docs/tools/Makefile diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am index df9296fcbe..4e20337d7d 100644 --- a/docs/reference/gtk/Makefile.am +++ b/docs/reference/gtk/Makefile.am @@ -287,7 +287,7 @@ content_files = \ css-overview.xml \ css-properties.xml \ drawing-model.xml \ - getting_started.xml \ + $(builddir)/getting_started.xml \ glossary.xml \ gtk3-demo-application.xml \ gtk3-demo.xml \ @@ -324,7 +324,7 @@ content_files = \ expand_content_files = \ compiling.sgml \ drawing-model.xml \ - getting_started.xml \ + $(builddir)/getting_started.xml \ glossary.xml \ input-handling.xml \ migrating-2to3.xml \ @@ -496,7 +496,7 @@ endif include $(top_srcdir)/gtk-doc.make # Other files to distribute -EXTRA_DIST += version.xml.in gtk3.types.in +EXTRA_DIST += version.xml.in gtk3.types.in getting_started.xml.in ######################################################################## 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 30cd88387d..efa604c862 100644 --- a/docs/reference/gtk/getting_started.xml +++ b/docs/reference/gtk/getting_started.xml.in @@ -44,7 +44,7 @@ Create a new file with the following content named example-0.c. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT @@ -153,7 +153,7 @@ Hello World in GTK+ Create a new file with the following content named example-1.c. - + MISSING XINCLUDE CONTENT @@ -233,7 +233,7 @@ Packing buttons Create a new file with the following content named example-2.c. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT You can compile the program above with GCC using: @@ -257,9 +257,9 @@ Packing buttons with GtkBuilder Create a new file with the following content named example-3.c. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT Create a new file with the following content named builder.ui. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT You can compile the program above with GCC using: @@ -346,7 +346,7 @@ of our application class. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT All the application logic is in the application class, which @@ -364,7 +364,7 @@ GIO documentation. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT Another important class that is part of the application support @@ -373,7 +373,7 @@ window. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT As part of the initial setup of our application, we also @@ -388,7 +388,7 @@ - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT Note that @bindir@ needs to be replaced @@ -420,7 +420,7 @@ - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT To make use of this file in our application, we revisit @@ -460,7 +460,7 @@ example_app_window_class_init (ExampleAppWindowClass *class) - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT This file has to be converted into a C source file that will be @@ -598,7 +598,7 @@ example_app_window_open (ExampleAppWindow *win, in a ui file, and add it as a resource to our binary. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT To associate the app menu with the application, we have to call @@ -697,7 +697,7 @@ example_app_class_init (ExampleAppClass *class) GSettings requires a schema that describes our settings: - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT Before we can make use of this schema in our application, @@ -749,13 +749,13 @@ example_app_window_init (ExampleAppWindow *win) Lets start with the template. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT Next comes the dialog subclass. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT Now we revisit the preferences_activated() function in our @@ -807,7 +807,7 @@ preferences_activated (GSimpleAction *action, to slide out the search bar below the header bar. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT Implementing the search needs quite a few code changes that @@ -887,7 +887,7 @@ example_app_window_init (ExampleAppWindow *win) which demonstrates #GtkMenuButton, #GtkRevealer and #GtkListBox. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT The code to populate the sidebar with buttons for the words @@ -898,7 +898,7 @@ example_app_window_init (ExampleAppWindow *win) ui file. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT To connect the menuitem to the show-words setting, we use @@ -957,7 +957,7 @@ example_app_window_init (ExampleAppWindow *win) triggers the show-lines action: - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT To make this menu item do something, we create a property @@ -1017,7 +1017,7 @@ example_app_window_init (ExampleAppWindow *win) be a direct child of the window, and set its type to be titlebar. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT A small extra bonus of using a header bar is that we get @@ -1073,7 +1073,7 @@ example_app_window_init (ExampleAppWindow *win) Drawing in response to input Create a new file with the following content named example-4.c. - MISSING XINCLUDE CONTENT + MISSING XINCLUDE CONTENT You can compile the program above with GCC using: diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build index 3e8c50d971..892e272301 100644 --- a/docs/reference/gtk/meson.build +++ b/docs/reference/gtk/meson.build @@ -383,12 +383,8 @@ content_files = [ 'broadway.xml', 'broadwayd.xml', 'building.sgml', - 'compiling.sgml', 'css-overview.xml', 'css-properties.xml', - 'drawing-model.xml', - 'getting_started.xml', - 'glossary.xml', 'gtk3-demo-application.xml', 'gtk3-demo.xml', 'gtk3-icon-browser.xml', @@ -399,22 +395,11 @@ content_files = [ 'gtk-query-immodules-3.0.xml', 'gtk-query-settings.xml', 'gtk-update-icon-cache.xml', - 'input-handling.xml', - 'migrating-2to3.xml', - 'migrating-3xtoy.xml', - 'migrating-checklist.sgml', - 'migrating-GtkGrid.xml', - 'migrating-GtkStyleContext.xml', - 'migrating-smclient-GtkApplication.xml', - 'migrating-unique-GtkApplication.xml', 'mir.xml', 'osx.sgml', 'overview.xml', - 'question_index.sgml', 'resources.sgml', 'running.sgml', - 'text_widget.sgml', - 'tree_widget.sgml', 'visual_index.xml', 'wayland.xml', 'windows.sgml', @@ -424,7 +409,7 @@ content_files = [ expand_content_files = [ 'compiling.sgml', 'drawing-model.xml', - 'getting_started.xml', + join_paths(meson.current_build_dir(), 'getting_started.xml'), 'glossary.xml', 'input-handling.xml', 'migrating-2to3.xml', @@ -439,6 +424,8 @@ expand_content_files = [ 'tree_widget.sgml', ] +content_files += expand_content_files + types_conf = configuration_data() if os_win32 types_conf.set('DISABLE_ON_W32', '%') @@ -461,6 +448,7 @@ endif if get_option('documentation') 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) gnome.gtkdoc('gtk3', mode: 'none', diff --git a/docs/reference/meson.build b/docs/reference/meson.build index 23c4e22367..daec53a847 100644 --- a/docs/reference/meson.build +++ b/docs/reference/meson.build @@ -14,7 +14,7 @@ if get_option('documentation') version_conf.set('GTK_VERSION', meson.project_version()) src_dir_conf = configuration_data() - src_dir_conf.set('SRC_DIR', meson.source_root()) + src_dir_conf.set('abs_top_srcdir', meson.source_root()) endif subdir('gdk')