[gnome-devel-docs] Use application/xml for xml code highlighting



commit 698b845fb50e982a95ef248115fa56b142c9a600
Author: Jeremy Bicha <jbicha ubuntu com>
Date:   Wed Aug 15 16:06:49 2012 -0400

    Use application/xml for xml code highlighting

 platform-demos/C/filechooserdialog.py.page   |    3 +-
 platform-demos/C/filechooserdialog.vala.page |    2 +-
 platform-demos/C/menubar.py.page             |   34 ++++++++++++++-----------
 platform-demos/C/menubar.vala.page           |   19 +++++++-------
 platform-demos/C/toolbar_builder.py.page     |    2 +-
 platform-demos/C/toolbar_builder.vala.page   |    2 +-
 6 files changed, 33 insertions(+), 29 deletions(-)
---
diff --git a/platform-demos/C/filechooserdialog.py.page b/platform-demos/C/filechooserdialog.py.page
index d260355..52f1429 100644
--- a/platform-demos/C/filechooserdialog.py.page
+++ b/platform-demos/C/filechooserdialog.py.page
@@ -43,7 +43,7 @@
   
   <section id="xml">
   <title>XML file which creates the app-menu</title>
-  <code mime="text" style="numbered"><xi:include href="samples/filechooserdialog.ui" parse="text"><xi:fallback/></xi:include></code>
+  <code mime="application/xml" style="numbered"><xi:include href="samples/filechooserdialog.ui" parse="text"><xi:fallback/></xi:include></code>
   </section>
   
   <section id="code">
@@ -76,7 +76,6 @@
     <item><p><link href="http://developer.gnome.org/gio/stable/GFile.html";>GFile</link></p></item>
     <item><p><link href="http://developer.gnome.org/gio/stable/GSimpleAction.html";>GSimpleAction</link></p></item>
     <item><p><link href="http://developer.gnome.org/gtk3/stable/GtkBuilder.html";>GtkBuilder</link></p></item>
-    <item><p><link href="http://developer.gnome.org/gio/stable/GFile.html";>GFile</link></p></item>    
   </list>
   </section>
 </page>
diff --git a/platform-demos/C/filechooserdialog.vala.page b/platform-demos/C/filechooserdialog.vala.page
index 1e0fbda..e03f2ef 100644
--- a/platform-demos/C/filechooserdialog.vala.page
+++ b/platform-demos/C/filechooserdialog.vala.page
@@ -25,7 +25,7 @@
   <p>This example demonstrates how the FileChooserDialog can be used. It is incorporated into a very simple text editor application.  All the <link xref="menubar.vala#win-app">actions</link>, including the "open", "save" and "save-as" commands can be found in the <link xref="gmenu.vala">app-menu</link>.  Here, the app-menu is created using an XML UI file, which is then imported into the application using Gtk.Builder.</p>
   </section>
   <section id="xml"><title>XML UI file which creates the app-menu</title>
-<code mime="text" style="numbered"><xi:include href="samples/filechooserdialog.ui" parse="text"><xi:fallback/></xi:include></code>
+<code mime="application/xml" style="numbered"><xi:include href="samples/filechooserdialog.ui" parse="text"><xi:fallback/></xi:include></code>
   </section>
   <section id="vala-code"><title>Vala Code</title>
   <code mime="text/x-vala" style="numbered"><xi:include href="samples/filechooserdialog.vala" parse="text"><xi:fallback/></xi:include></code>
diff --git a/platform-demos/C/menubar.py.page b/platform-demos/C/menubar.py.page
index 19bea1c..19487a2 100644
--- a/platform-demos/C/menubar.py.page
+++ b/platform-demos/C/menubar.py.page
@@ -34,11 +34,11 @@
    <steps>
      <item><p>Create <file>menubar.ui</file> using your favorite text editor.</p></item>
      <item><p>Enter the following line at the top of the file:</p>
-           <code mime="text"><![CDATA[
+           <code mime="application/xml"><![CDATA[
 <?xml version="1.0"? encoding="UTF-8"?>]]></code>
      </item>
     <item><p>We want to create the interface which will contain our menubar and it's submenus.  Our menubar will contain <gui>File</gui>, <gui>Edit</gui>, <gui>Choices</gui> and <gui>Help</gui> submenus. We add the following XML code to the file:</p>
-    <code mime="text"><xi:include href="samples/menubar_basis.ui" parse="text"><xi:fallback/></xi:include></code>
+    <code mime="application/xml"><xi:include href="samples/menubar_basis.ui" parse="text"><xi:fallback/></xi:include></code>
      </item>
      <item><p>Now we will create the .py file and use GtkBuilder to import the <file>menubar.ui</file> we just created.</p></item>
    </steps>
@@ -52,7 +52,10 @@ Now run the python application. It should look like the picture at the top of th
 
 <section id="xml2"> <title>Add items to the menus</title>
 <p>We start off by adding 2 menuitems to the <gui>File</gui> menu: <gui>New</gui> and <gui>Quit</gui>.  We do this by adding a <code>section</code> to the the <code>File</code> submenu with these items. The <file>menubar.ui</file> should look like this  (lines 6 to 13 inclusive comprise the newly added section):</p>
-      <code mime="text" style="numbered"><![CDATA[
+
+   <listing>
+      <title>menubar.ui</title>
+      <code mime="application/xml" style="numbered"><![CDATA[
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <menu id="menubar">
@@ -78,6 +81,7 @@ Now run the python application. It should look like the picture at the top of th
     </submenu>
   </menu>
 </interface>]]></code>
+</listing>
 
   <p>Following this pattern, you can now add a <code>Copy</code> and a <code>Paste</code> item to the <code>Edit</code> submenu, and an <code>About</code> item to the <code>Help</code> submenu.</p>
 
@@ -87,17 +91,17 @@ Now run the python application. It should look like the picture at the top of th
     <title>Setup actions</title>
 
     <p>We now create the actions for "New" and "Quit" connected to a callback function in the Python file; for instance we create "new" as:</p>
-    <code>
+    <code mime="text/x-python">
 new_action = Gio.SimpleAction.new("new", None)
 new_action.connect("activate", self.new_callback)</code>
 
     <p>And we create the callback function of "new" as</p>
-    <code>
+    <code mime="text/x-python">
 def new_callback(self, action, parameter):
     print "You clicked \"New\""</code>
 
     <p>Now, in the XML file, we we connect the menu items to the actions in the XML file by adding the "action" attribute:</p>
-    <code><![CDATA[
+    <code mime="text/x-python"><![CDATA[
 <item>
   <attribute name="label">New</attribute>
   <attribute name="action">app.new</attribute>
@@ -106,7 +110,7 @@ def new_callback(self, action, parameter):
     <p>Note that for an action that is relative to the application, we use the prefix <code>app.</code>; for actions that are relative to the window we use the prefix <code>win.</code>.</p>
 
     <p>Finally, in the Python file, we add the action to the application or to the window - so for instance <code>app.new</code> will be added to the application in the method <code>do_startup(self)</code> as</p>
-    <code>
+    <code mime="text/x-python">
 self.add_action(new_action)</code>
 
   </section>
@@ -125,14 +129,14 @@ self.add_action(new_action)</code>
     <p>Lines 30 to 80 inclusive of the <link xref="menubar.py#xml-code" /> demonstrate the XML code used to create the UI for <gui>Choices</gui> menu.</p>
 
     <p>The actions created so far are <em>stateless</em>, that is they do not retain or depend on a state given by the action itself. The actions we need to create for the Choices submenu, on the other hand, are <em>stateful</em>. An example of creation of a stateful action is:</p>
-    <code>
+    <code mime="text/x-python">
 shape_action = Gio.SimpleAction.new_stateful("shape", GLib.VariantType.new('s'), GLib.Variant.new_string('line'))</code>
 
     <p>where the variables of the method are: name, parameter type (in this case, a string - see <link href="http://developer.gnome.org/glib/unstable/glib-GVariantType.html";>here</link> for a complete list of character meanings), initial state (in this case, 'line' - in case of a <code>True</code> boolean value it should be <code>Glib.Variant.new_boolean(True)</code>, and so on, see <link href="http://developer.gnome.org/glib/unstable/glib-GVariant.html";>here</link> for a complete list)</p>
 
     <p>After creating the stateful SimpleAction we connect it to the callback function and we add it to the window (or the application, if it is the case), as before:</p>
 
-    <code>
+    <code mime="text/x-python">
 shape_action.connect("activate", self.shape_callback)
 self.add_action(shape_action)</code>
 
@@ -140,7 +144,7 @@ self.add_action(shape_action)</code>
 
   <section id="xml-code">
     <title>Complete XML UI file for this example</title>
-    <code mime="text" style="numbered"><xi:include href="samples/menubar.ui" parse="text"><xi:fallback/></xi:include></code>
+    <code mime="application/xml" style="numbered"><xi:include href="samples/menubar.ui" parse="text"><xi:fallback/></xi:include></code>
   </section>
 
   <section id="python-code">
@@ -153,9 +157,9 @@ self.add_action(shape_action)</code>
    <p>The mnemonics are visible when you press the <key>Alt</key> key.  Pressing <keyseq><key>Alt</key><key>F</key></keyseq> will open the <gui>File</gui> menu.</p>
 
     <p>Accelerators  can be explicitly added in the UI definitions.  For example, it is common to be able to quit an application by pressing <keyseq><key>Ctrl</key><key>Q</key></keyseq> or to save a file by pressing <keyseq><key>Ctrl</key><key>S</key></keyseq>.  To add an accelerator to the UI definition, you simply need add an "accel" attribute to the item.</p>
-<p><code mime="text"><![CDATA[<attribute name="accel">&lt;Primary&gt;q</attribute>]]></code> will create the <keyseq><key>Ctrl</key><key>Q</key></keyseq> sequence when added to the <code>Quit</code> label item.  Here, "Primary" refers to the <key>Ctrl</key> key on a PC or the <key>â</key> key on a Mac.</p>
+<p><code mime="application/xml"><![CDATA[<attribute name="accel">&lt;Primary&gt;q</attribute>]]></code> will create the <keyseq><key>Ctrl</key><key>Q</key></keyseq> sequence when added to the <code>Quit</code> label item.  Here, "Primary" refers to the <key>Ctrl</key> key on a PC or the <key>â</key> key on a Mac.</p>
 
-  <code mime="text"><![CDATA[
+  <code mime="application/xml"><![CDATA[
 <item>
   <attribute name="label">_Quit</attribute>
   <attribute name="action">app.quit</attribute>
@@ -167,9 +171,9 @@ self.add_action(shape_action)</code>
    <p>
    Since GNOME applications are being translated into <link href="http://l10n.gnome.org/languages/";>many languages</link>, it is important that the strings in your application are translable.  To make a label translatable, simple set <code>translatable="yes"</code>:
    </p>
-   <p>
-     <code mime="text"><![CDATA[<attribute name="label" translatable="yes">Quit</attribute>]]></code>
-  </p>
+
+     <code mime="application/xml"><![CDATA[<attribute name="label" translatable="yes">Quit</attribute>]]></code>
+
   </section>
   <section id="references">
     <title>API References</title>
diff --git a/platform-demos/C/menubar.vala.page b/platform-demos/C/menubar.vala.page
index 2f517c0..24eb7ea 100644
--- a/platform-demos/C/menubar.vala.page
+++ b/platform-demos/C/menubar.vala.page
@@ -4,6 +4,7 @@
       type="guide" style="task"
       id="menubar.vala">
   <info>
+  <title type="text">MenuBar (Vala)</title>
   <link type="guide" xref="beginner.vala#menu-combo-toolbar"/>
   <link type="seealso" xref="aboutdialog.vala"/>
   <link type="seealso" xref="gmenu.vala"/>
@@ -29,17 +30,17 @@
    <steps>
      <item><p>Create <file>menubar.ui</file> using your favorite text editor.</p></item>
      <item><p>Enter the following line at the top of the file:</p>
-           <code mime="text"><![CDATA[
+           <code mime="application/xml"><![CDATA[
 <?xml version="1.0"? encoding="UTF-8"?>]]></code>
      </item>
     <item><p>We want to create the interface which will contain our menubar and it's submenus.  Our menubar will contain <gui>File</gui>, <gui>Edit</gui>, <gui>Choices</gui> and <gui>Help</gui> submenus. We add the following XML code to the file:</p>
-    <code mime="text"><xi:include href="samples/menubar_basis.ui" parse="text"><xi:fallback/></xi:include></code>
+    <code mime="application/xml"><xi:include href="samples/menubar_basis.ui" parse="text"><xi:fallback/></xi:include></code>
      </item>
      <item><p>Now we will create the .vala file and use GtkBuilder to import the <file>menubar.ui</file> we just created.</p></item>
    </steps>
    </section>
    <section id="basis"> <title>Add the MenuBar to the window using GtkBuilder</title>
-<code mime="text/x-vala"><xi:include href="samples/menubar_basis.vala" parse="text"><xi:fallback/></xi:include></code>
+<code mime="text/x-csharp"><xi:include href="samples/menubar_basis.vala" parse="text"><xi:fallback/></xi:include></code>
 <p>
 Now, compile the vala file, and run it. The application should look like the picture at the top of this page.</p>
 </section>
@@ -48,7 +49,7 @@ Now, compile the vala file, and run it. The application should look like the pic
 
 <section id="xml2"> <title>Add items to the menus</title>
 <p>We start off by adding 2 menuitems to the <gui>File</gui> menu: <gui>New</gui> and <gui>Quit</gui>.  We do this by adding a <code>section</code> to the the <code>File</code> submenu with these items. The <file>menubar.ui</file> should look like this  (lines 6 to 13 inclusive comprise the newly added section):</p>
-      <code mime="text" style="numbered"><![CDATA[
+      <code mime="application/xml" style="numbered"><![CDATA[
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <menu id="menubar">
@@ -114,7 +115,7 @@ void quit_cb (SimpleAction action, Variant? parameter) {
 }</code>
  </item>
   <item><p>And lastly, we connect the menu items to the actions in the XML file by adding the "action" attribute:</p>
-    <code mime="text"><![CDATA[
+    <code mime="application/xml"><![CDATA[
 <item>
   <attribute name="label">New</attribute>
   <attribute name="action">app.new</attribute>
@@ -150,7 +151,7 @@ void quit_cb (SimpleAction action, Variant? parameter) {
 </section>
 
   <section id="xml-code"><title>Complete XML UI file for this example</title>
-<code mime="text" style="numbered"><xi:include href="samples/menubar.ui" parse="text"><xi:fallback/></xi:include></code>
+<code mime="application/xml" style="numbered"><xi:include href="samples/menubar.ui" parse="text"><xi:fallback/></xi:include></code>
   </section>
   <section id="vala-code"><title>Complete Vala file for this example</title>
 <code mime="text/x-vala" style="numbered"><xi:include href="samples/menubar.vala" parse="text"><xi:fallback/></xi:include></code>
@@ -164,9 +165,9 @@ void quit_cb (SimpleAction action, Variant? parameter) {
 
   <section id="accelerators"><title>Accelerators</title>
     <p>Accelerators  can be explicitly added in the UI definitions.  For example, it is common to be able to quit an application by pressing <keyseq><key>Ctrl</key><key>Q</key></keyseq> or to save a file by pressing <keyseq><key>Ctrl</key><key>S</key></keyseq>.  To add an accelerator to the UI definition, you simply need add an "accel" attribute to the item.</p>
-<p><code mime="text"><![CDATA[<attribute name="accel">&lt;Primary&gt;q</attribute>]]></code> will create the <keyseq><key>Ctrl</key><key>Q</key></keyseq> sequence when added to the <code>Quit</code> label item.  Here, "Primary" refers to the <key>Ctrl</key> key on a PC or the <key>â</key> key on a Mac.</p>
+<p><code mime="application/xml"><![CDATA[<attribute name="accel">&lt;Primary&gt;q</attribute>]]></code> will create the <keyseq><key>Ctrl</key><key>Q</key></keyseq> sequence when added to the <code>Quit</code> label item.  Here, "Primary" refers to the <key>Ctrl</key> key on a PC or the <key>â</key> key on a Mac.</p>
 
-  <code mime="text"><![CDATA[
+  <code mime="application/xml"><![CDATA[
 <item>
   <attribute name="label">_Quit</attribute>
   <attribute name="action">app.quit</attribute>
@@ -179,7 +180,7 @@ void quit_cb (SimpleAction action, Variant? parameter) {
    Since GNOME applications are being translated into <link href="http://l10n.gnome.org/languages/";>many languages</link>, it is important that the strings in your application are translable.  To make a label translatable, simple set <code>translatable="yes"</code>:
    </p>
    <p>
-     <code mime="text"><![CDATA[<attribute name="label" translatable="yes">Quit</attribute>]]></code>
+     <code mime="application/xml"><![CDATA[<attribute name="label" translatable="yes">Quit</attribute>]]></code>
   </p>
   </section>
   <section id="documentation"><title>Relevant API documentation</title>
diff --git a/platform-demos/C/toolbar_builder.py.page b/platform-demos/C/toolbar_builder.py.page
index 5e9ba2e..dfed4f9 100644
--- a/platform-demos/C/toolbar_builder.py.page
+++ b/platform-demos/C/toolbar_builder.py.page
@@ -153,7 +153,7 @@
   <p>If you do not add this, the program will still work fine.  The resulting toolbar will however look slightly different then the screenshot at the top of this page.</p>
    </item>
 </steps>
-  <code mime="text" style="numbered"><xi:include href="samples/toolbar_builder.ui" parse="text"><xi:fallback/></xi:include></code>
+  <code mime="application/xml" style="numbered"><xi:include href="samples/toolbar_builder.ui" parse="text"><xi:fallback/></xi:include></code>
 
 </section>
 
diff --git a/platform-demos/C/toolbar_builder.vala.page b/platform-demos/C/toolbar_builder.vala.page
index 36876d3..33e2675 100644
--- a/platform-demos/C/toolbar_builder.vala.page
+++ b/platform-demos/C/toolbar_builder.vala.page
@@ -137,7 +137,7 @@
   <p>If you do not add this, the program will still work fine.  The resulting toolbar will however look slightly different then the screenshot at the top of this page.</p>
    </item>
 </steps>
-  <code mime="text" style="numbered"><xi:include href="samples/toolbar_builder.ui" parse="text"><xi:fallback/></xi:include></code>
+  <code mime="application/xml" style="numbered"><xi:include href="samples/toolbar_builder.ui" parse="text"><xi:fallback/></xi:include></code>
 
   <p>We now create the code below, which adds the toolbar from the file we just created.</p>
 <code mime="text/x-vala" style="numbered"><xi:include href="samples/toolbar_builder.vala" parse="text"><xi:fallback/></xi:include></code>



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