[gnome-text-editor: 1/3] help: initial setup for writing mallard help




commit 2f0113355836e8c8d28057121f6a33324264d4bf
Author: Günther Wagner <info gunibert de>
Date:   Wed Jul 21 21:29:26 2021 +0200

    help: initial setup for writing mallard help
    
    This is a basic setup to show the application help with F1 in yelp.

 help/C/basics-open-file.page          |  16 ++++++++++
 help/C/index.page                     |  40 ++++++++++++++++++++++++
 help/C/legal.xml                      |   6 ++++
 help/C/media/org.gnome.TextEditor.svg |  57 ++++++++++++++++++++++++++++++++++
 help/C/media/search-recent.png        | Bin 0 -> 26267 bytes
 help/meson.build                      |  14 +++++++++
 meson.build                           |   1 +
 src/editor-application-actions.c      |  16 ++++++++++
 src/editor-application.c              |   2 ++
 9 files changed, 152 insertions(+)
---
diff --git a/help/C/basics-open-file.page b/help/C/basics-open-file.page
new file mode 100644
index 0000000..807b438
--- /dev/null
+++ b/help/C/basics-open-file.page
@@ -0,0 +1,16 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:its="http://www.w3.org/2005/11/its";
+      type="topic" style="task"
+      id="basics-open-file">
+  <info>
+    <link type="guide" xref="index#basics"/>
+  </info>
+
+  <title>
+    Open a file in GNOME Text Editor
+  </title>
+
+  <p>To open a file in GNOME Text Editor use <gui>Open</gui> in the Headerbar
+  and <gui>Browse Files...</gui> or the shortcut <keyseq><key>Ctrl</key><key>O</key></keyseq>.
+  </p>
+</page>
diff --git a/help/C/index.page b/help/C/index.page
new file mode 100644
index 0000000..27b426e
--- /dev/null
+++ b/help/C/index.page
@@ -0,0 +1,40 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:its="http://www.w3.org/2005/11/its";
+      type="guide" style="2column"
+      id="index">
+
+  <info>
+    <title type='link' role="trail">GNOME Text Editor</title>
+    <title type="link">GNOME Text Editor</title>
+    <title type="text">GNOME Text Editor</title>
+    <revision version="0.1" date="2021-07-21" status="draft"/>
+    <revision pkgversion="40" date="2021-07-21" status="review"/>
+
+    <credit type="author copyright">
+      <name>Christian Hergert</name>
+      <email its:translate="no">chergert gnome org</email>
+      <years>2021</years>
+    </credit>
+    <credit type="editor">
+      <name>Günther Wagner</name>
+      <email its:translate="no">info gunibert de</email>
+      <years>2021</years>
+    </credit>
+
+    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/>
+
+    <desc>Use <app>GNOME Text Editor</app> to edit text files.</desc>
+  </info>
+
+  <title>
+    <media type="image" its:translate="no" mime="image/svg+xml" height="48px" width="48px" 
src="media/org.gnome.TextEditor.svg" />
+    GNOME Text Editor
+  </title>
+
+  <section id="basics">
+    <title>Basics</title>
+    <links type="topic"/>
+  </section>
+
+</page>
+
diff --git a/help/C/legal.xml b/help/C/legal.xml
new file mode 100644
index 0000000..09cd8c8
--- /dev/null
+++ b/help/C/legal.xml
@@ -0,0 +1,6 @@
+<license xmlns="http://projectmallard.org/1.0/";
+         href="http://creativecommons.org/licenses/by-sa/3.0/";>
+  <p>This work is licensed under a
+  <link href="http://creativecommons.org/licenses/by-sa/3.0/";>Creative Commons
+  Attribution-ShareAlike 3.0 Unported License</link>.</p>
+</license>
diff --git a/help/C/media/org.gnome.TextEditor.svg b/help/C/media/org.gnome.TextEditor.svg
new file mode 100644
index 0000000..b843f7e
--- /dev/null
+++ b/help/C/media/org.gnome.TextEditor.svg
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink";>
+    <linearGradient id="a" gradientTransform="matrix(-1 0 0 -1 135.999985 -173.999998)" 
gradientUnits="userSpaceOnUse" x1="27.99999" x2="115.999992" y1="-276" y2="-276">
+        <stop offset="0" stop-color="#c0bfbc"/>
+        <stop offset="0.0454545" stop-color="#ffffff"/>
+        <stop offset="0.0909091" stop-color="#deddda"/>
+        <stop offset="0.909091" stop-color="#deddda"/>
+        <stop offset="0.954545" stop-color="#ffffff"/>
+        <stop offset="1" stop-color="#c0bfbc"/>
+    </linearGradient>
+    <clipPath id="b">
+        <path d="m 88 94 h 20 v 20 h -20 z m 0 0"/>
+    </clipPath>
+    <clipPath id="c">
+        <path d="m 108 94 l -20 20 h -5.714844 v -25.714844 h 25.714844 z m 0 0"/>
+    </clipPath>
+    <linearGradient id="d" gradientTransform="matrix(0 0.178571 0.178571 0 84.428574 42.571447)" 
gradientUnits="userSpaceOnUse" x1="344" x2="340" y1="76" y2="72">
+        <stop offset="0" stop-color="#d5d3cf"/>
+        <stop offset="1" stop-color="#ffffff"/>
+    </linearGradient>
+    <linearGradient id="e" gradientUnits="userSpaceOnUse">
+        <stop offset="0" stop-color="#fc9a91"/>
+        <stop offset="1" stop-color="#cb2b31"/>
+    </linearGradient>
+    <linearGradient id="f" gradientTransform="matrix(0.6 0.6 0.707107 -0.707107 295.740141 128.474214)" 
x1="-253.630356" x2="-230.060135" xlink:href="#e" y1="-56.517502" y2="-56.517502"/>
+    <linearGradient id="g" gradientTransform="matrix(0.6 0.6 0.707107 -0.707107 294.325928 129.888428)" 
x1="-253.630356" x2="-230.060135" xlink:href="#e" y1="-56.517502" y2="-56.517502"/>
+    <linearGradient id="h" gradientTransform="matrix(0.390307 -0.130102 0.130102 -0.390307 -2.964383 
65.147882)" gradientUnits="userSpaceOnUse" x1="181.677414" x2="143.24614" y1="-139.479385" y2="-101.048103">
+        <stop offset="0" stop-color="#d0bb8e"/>
+        <stop offset="1" stop-color="#ffffff"/>
+    </linearGradient>
+    <linearGradient id="i" gradientTransform="matrix(0.6 0.6 0.707107 -0.707107 294.32593 129.888425)" 
gradientUnits="userSpaceOnUse" x1="-230.060135" x2="-253.630356" y1="-64.517509" y2="-64.517509">
+        <stop offset="0" stop-color="#c0bfbc"/>
+        <stop offset="0.223152" stop-color="#9a9996"/>
+        <stop offset="0.743841" stop-color="#d6d5d2"/>
+        <stop offset="1" stop-color="#f6f5f4"/>
+    </linearGradient>
+    <path d="m 100 120 h -72 c -4.417969 0 -8 -3.582031 -8 -8 v -14.25 c 0 -4.417969 3.582031 -8 8 -8 h 72 c 
4.417969 0 8 3.582031 8 8 v 14.25 c 0 4.417969 -3.582031 8 -8 8 z m 0 0" fill="#1a5fb4"/>
+    <path d="m 100 118 h -72 c -4.417969 0 -8 -3.582031 -8 -8 v -24 c 0 -4.417969 3.582031 -8 8 -8 h 72 c 
4.417969 0 8 3.582031 8 8 v 24 c 0 4.417969 -3.582031 8 -8 8 z m 0 0" fill="url(#a)"/>
+    <path d="m 98.875 114 h -69.75 c -5.039062 0 -9.125 -4.085938 -9.125 -9.125 v -87.875 c 0 -5.039062 
4.085938 -9.125 9.125 -9.125 h 69.75 c 5.039062 0 9.125 4.085938 9.125 9.125 v 87.875 c 0 5.039062 -4.085938 
9.125 -9.125 9.125 z m 0 0" fill="#f6f5f4"/>
+    <g clip-path="url(#b)">
+        <g clip-path="url(#c)">
+            <path d="m 88 102 v 9.714844 c 0 4.417968 3.582031 8 8 8 h 9.714844 c 4.417968 0 8 -3.582032 8 
-8 v -9.714844 c 0 -4.417969 -3.582032 -8 -8 -8 h -9.714844 c -4.417969 0 -8 3.582031 -8 8 z m 0 0" 
fill="url(#d)"/>
+        </g>
+    </g>
+    <path d="m 29.125 9.875 c -5.054688 0 -9.125 4.070312 -9.125 9.125 v 5 h 85.324219 c 0.929687 0 1.828125 
-0.140625 2.675781 -0.398438 v -4.601562 c 0 -5.054688 -4.070312 -9.125 -9.125 -9.125 z m 0 0" 
fill="#1a5fb4"/>
+    <path d="m 29.125 7.875 c -5.054688 0 -9.125 4.070312 -9.125 9.125 v 5 h 85.324219 c 0.929687 0 1.828125 
-0.140625 2.675781 -0.398438 v -4.601562 c 0 -5.054688 -4.070312 -9.125 -9.125 -9.125 z m 0 0" 
fill="#3584e4"/>
+    <path d="m 48 52 v 6 h -20 v -26 h 72 v 20 z m 0 0" fill="#deddda"/>
+    <path d="m 80 76 v 6 h -52 v -18 h 72 v 12 z m 0 0" fill="#deddda"/>
+    <path d="m 42.34375 80.34375 l 11.3125 11.3125 l 59.597656 -59.597656 l -11.3125 -11.3125 z m 0 0" 
fill="#ff881e"/>
+    <path d="m 50.777344 88.878906 l 4.242187 4.242188 l 59.597657 -59.597656 l -4.242188 -4.242188 z m 0 0" 
fill="#e66100"/>
+    <path d="m 45.121094 83.222656 l -4.242188 -4.242187 l 59.597656 -59.597657 l 4.242188 4.242188 z m 0 0" 
fill="#ffb367"/>
+    <path d="m 96.527344 23.332031 l 14.140625 14.140625 l 5.65625 -5.65625 l -14.140625 -14.140625 z m 0 0" 
fill="url(#f)"/>
+    <path d="m 116.324219 31.816406 c 3.90625 -3.90625 3.90625 -10.238281 0 -14.140625 c -3.902344 -3.90625 
-10.234375 -3.90625 -14.140625 0 c -3.90625 3.902344 -3.90625 10.234375 0 14.140625 s 10.238281 3.90625 
14.140625 0 z m 0 0" fill="url(#g)"/>
+    <path d="m 38 96 l 17.070312 -2.929688 l -14.140624 -14.140624 z m 0 0" fill="url(#h)"/>
+    <path d="m 38 96 l 7.414062 -1.273438 l -6.140624 -6.140624 z m 0 0" fill="#3d3846"/>
+    <path d="m 93.699219 26.160156 l 14.140625 14.140625 l 5.65625 -5.65625 l -14.140625 -14.140625 z m 0 0" 
fill="url(#i)"/>
+</svg>
diff --git a/help/C/media/search-recent.png b/help/C/media/search-recent.png
new file mode 100644
index 0000000..0480d3b
Binary files /dev/null and b/help/C/media/search-recent.png differ
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..90a63bd
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,14 @@
+pages = [
+  'index.page',
+  'basics-open-file.page',
+  'legal.xml',
+]
+
+media = [
+  'media/search-recent.png',
+  'media/org.gnome.TextEditor.svg',
+]
+
+gnome.yelp(meson.project_name(),
+  sources: pages,
+)
diff --git a/meson.build b/meson.build
index 64b1065..6ec0070 100644
--- a/meson.build
+++ b/meson.build
@@ -156,6 +156,7 @@ endforeach
 
 subdir('data')
 subdir('src')
+subdir('help')
 subdir('po')
 
 configure_file(
diff --git a/src/editor-application-actions.c b/src/editor-application-actions.c
index cc55998..41f68aa 100644
--- a/src/editor-application-actions.c
+++ b/src/editor-application-actions.c
@@ -138,6 +138,21 @@ editor_application_actions_about_cb (GSimpleAction *action,
   gtk_window_present (GTK_WINDOW (dialog));
 }
 
+static void
+editor_application_actions_help_cb (GSimpleAction *action,
+                                    GVariant      *param,
+                                    gpointer       user_data)
+{
+  EditorApplication *self = user_data;
+  EditorWindow *window;
+
+  g_assert (EDITOR_IS_APPLICATION (self));
+
+  window = editor_application_get_current_window (self);
+
+  gtk_show_uri (GTK_WINDOW (window), "help:gnome-text-editor", GDK_CURRENT_TIME);
+}
+
 static void
 editor_application_actions_quit_cb (GObject      *object,
                                     GAsyncResult *result,
@@ -217,6 +232,7 @@ _editor_application_actions_init (EditorApplication *self)
     { "new-window", editor_application_actions_new_window_cb },
     { "preferences", editor_application_actions_preferences_cb },
     { "about", editor_application_actions_about_cb },
+    { "help", editor_application_actions_help_cb },
     { "quit", editor_application_actions_quit },
   };
 
diff --git a/src/editor-application.c b/src/editor-application.c
index 3d2042c..f1031b2 100644
--- a/src/editor-application.c
+++ b/src/editor-application.c
@@ -177,6 +177,7 @@ editor_application_startup (GApplication *application)
   g_autoptr(GtkCssProvider) font_css_provider = NULL;
   GtkSettings *gtk_settings;
   static const gchar *quit_accels[] = { "<Primary>Q", NULL };
+  static const gchar *help_accels[] = { "F1", NULL };
 
   g_assert (EDITOR_IS_APPLICATION (self));
 
@@ -185,6 +186,7 @@ editor_application_startup (GApplication *application)
   adw_init ();
 
   gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.quit", quit_accels);
+  gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.help", help_accels);
 
   _editor_application_actions_init (self);
 


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