[gnome-devel-docs] platform-demos: *.c.page, updated Forward to Continue
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] platform-demos: *.c.page, updated Forward to Continue
- Date: Wed, 8 Feb 2012 23:58:53 +0000 (UTC)
commit a1f8565554201ab5fe83ab207c7143dd4dd2c637
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date: Wed Feb 8 18:57:54 2012 -0500
platform-demos: *.c.page, updated Forward to Continue
This closes bug#664596.
platform-demos/C/guitar-tuner.c.page | 26 +++++++++++++-------------
platform-demos/C/image-viewer.c.page | 24 ++++++++++++------------
platform-demos/C/message-board.c.page | 16 ++++++++--------
platform-demos/C/photo-wall.c.page | 8 ++++----
4 files changed, 37 insertions(+), 37 deletions(-)
---
diff --git a/platform-demos/C/guitar-tuner.c.page b/platform-demos/C/guitar-tuner.c.page
index a59c119..5057607 100644
--- a/platform-demos/C/guitar-tuner.c.page
+++ b/platform-demos/C/guitar-tuner.c.page
@@ -4,9 +4,9 @@
<info>
<link type="guide" xref="index#c"/>
-
+
<desc>Use Gtk+ and GStreamer to build a simple guitar tuner application for GNOME. Shows off how to use the interface designer.</desc>
-
+
<revision pkgversion="0.1" version="0.1" date="2010-12-02" status="review"/>
<credit type="author">
<name>GNOME Documentation Project</name>
@@ -44,10 +44,10 @@
<p>Start Anjuta and click <guiseq><gui>File</gui><gui>New</gui><gui>Project</gui></guiseq> to open the project wizard.</p>
</item>
<item>
- <p>Choose <gui>Gtk+ (Simple)</gui> from the <gui>C</gui> tab, click <gui>Forward</gui>, and fill out your details on the next few pages. Use <file>guitar-tuner</file> as project name and directory.</p>
+ <p>Choose <gui>Gtk+ (Simple)</gui> from the <gui>C</gui> tab, click <gui>Continue</gui>, and fill out your details on the next few pages. Use <file>guitar-tuner</file> as project name and directory.</p>
</item>
<item>
- <p>Make sure that <gui>Configure external packages</gui> is selected. On the next page, select
+ <p>Make sure that <gui>Configure external packages</gui> is switched <gui>ON</gui>. On the next page, select
<em>gstreamer-0.10</em> from the list to include the GStreamer library in your project.</p>
</item>
<item>
@@ -62,7 +62,7 @@
<section id="build">
<title>Build the code for the first time</title>
<p>C is a rather verbose language, so don't be surprised that the file contains quite a lot of code. Most of it is template code. It loads an (empty) window from the user interface description file and shows it. More details are given below; skip this list if you understand the basics:</p>
-
+
<list>
<item>
<p>The three <code>#include</code> lines at the top include the <code>config</code> (useful autoconf build defines), <code>gtk</code> (user interface) and <code>gi18n</code> (internationalization) libraries. Functions from these libraries are used in the rest of the code.</p>
@@ -117,8 +117,8 @@ six strings) and the orientation to vertical.</p>
<section id="signal">
<title>Creating the signal handler</title>
<p>In the UI designer, you made it so that all of the buttons will call the same function, <gui>on_button_clicked</gui>, when they are clicked. We need to add that function in the source file.</p>
- <p>To do this, open <file>main.c</file> while the user interface file is still open. Switch to the <gui>Signals</gui> tab, which you already used to set the signal name. Now take the row where you set the
-<gui>clicked</gui> signal and drag it into to the source file at a
+ <p>To do this, open <file>main.c</file> while the user interface file is still open. Switch to the <gui>Signals</gui> tab, which you already used to set the signal name. Now take the row where you set the
+<gui>clicked</gui> signal and drag it into to the source file at a
position that is outside any function. The following code will be added to your source file:</p>
<code mime="text/x-csrc"><![CDATA[
void on_button_clicked (GtkWidget* button, gpointer user_data)
@@ -142,13 +142,13 @@ void on_button_clicked (GtkWidget* button, gpointer user_data)
<section id="pipeline">
<title>Set up the pipeline</title>
<p>In this simple example we will use a tone generator source called <code>audiotestsrc</code> and send the output to the default system sound device, <code>autoaudiosink</code>. We only need to configure the frequency of the tone generator; this is accessible through the <code>freq</code> property of <code>audiotestsrc</code>.</p>
-
+
<p>Insert the following line into <file>main.c</file>, just below the <code><![CDATA[#include <gtk/gtk.h>]]></code> line:</p>
<code mime="text/x-csrc"><![CDATA[#include <gst/gst.h>]]></code>
<p>This includes the GStreamer library. You also need to add a line to initialize GStreamer; put the following code on the line above the <code>gtk_init</code> call in the <code>main</code> function:</p>
<code><![CDATA[gst_init (&argc, &argv);]]></code>
<p>Then, copy the following function into <file>main.c</file> above the empty <code>on_button_clicked</code> function:</p>
- <code mime="text/x-csrc"><![CDATA[static void
+ <code mime="text/x-csrc"><![CDATA[static void
play_sound (gdouble frequency)
{
GstElement *source, *sink;
@@ -162,7 +162,7 @@ play_sound (gdouble frequency)
/* set frequency */
g_object_set (source, "freq", frequency, NULL);
-
+
gst_bin_add_many (GST_BIN (pipeline), source, sink, NULL);
gst_element_link (source, sink);
@@ -171,7 +171,7 @@ play_sound (gdouble frequency)
/* stop it after 500ms */
g_timeout_add (LENGTH, (GSourceFunc) pipeline_stop, pipeline);
}]]></code>
-
+
<steps>
<item>
<p>The first five lines create source and sink GStreamer elements (<code>GstElement</code>), and a pipeline element (which will be used as a container for the other two elements). The pipeline is given the name "note"; the source is named "source" and is set to the <code>audiotestsrc</code> source; and the sink is named "output" and set to the <code>autoaudiosink</code> sink (default sound card output).</p>
@@ -186,7 +186,7 @@ play_sound (gdouble frequency)
<p>Next, <code>gst_element_link</code> is used to connect the elements together, so the output of <code>source</code> (a tone) goes into the input of <code>sink</code> (which is then output to the sound card). <code>gst_element_set_state</code> is then used to start playback, by setting the state of the pipeline to playing (<code>GST_STATE_PLAYING</code>).</p>
</item>
</steps>
-
+
</section>
<section id="stop">
@@ -201,7 +201,7 @@ pipeline_stop (GstElement* pipeline)
{
gst_element_set_state (pipeline, GST_STATE_PAUSED);
g_object_unref (pipeline);
-
+
return FALSE;
}]]></code>
<p>The call to <code>gst_element_set_state</code> pauses the playback of the pipeline and <code>g_object_unref</code> unreferences the pipeline, destroying it and freeing its memory.</p>
diff --git a/platform-demos/C/image-viewer.c.page b/platform-demos/C/image-viewer.c.page
index 51fb7ef..e81d794 100644
--- a/platform-demos/C/image-viewer.c.page
+++ b/platform-demos/C/image-viewer.c.page
@@ -4,9 +4,9 @@
<info>
<link type="guide" xref="index#c"/>
-
+
<desc>A little bit more than a simple "Hello world" Gtk application.</desc>
-
+
<revision pkgversion="0.1" version="0.1" date="2011-03-18" status="review"/>
<credit type="author">
<name>GNOME Documentation Project</name>
@@ -15,7 +15,7 @@
<credit type="author">
<name>Johannes Schmid</name>
<email>jhs gnome org</email>
- </credit>
+ </credit>
</info>
<title>Image Viewer</title>
@@ -38,7 +38,7 @@
<p>Start Anjuta and click <guiseq><gui>File</gui><gui>New</gui><gui>Project</gui></guiseq> to open the project wizard.</p>
</item>
<item>
- <p>Choose <gui>Gtk+ (Simple)</gui> from the <gui>C</gui> tab, click <gui>Forward</gui>, and fill out your details on the next few pages. Use <file>image-viewer</file> as project name and directory.</p>
+ <p>Choose <gui>Gtk+ (Simple)</gui> from the <gui>C</gui> tab, click <gui>Continue</gui>, and fill out your details on the next few pages. Use <file>image-viewer</file> as project name and directory.</p>
</item>
<item>
<p>Make sure that <gui>Use GtkBuilder for user interface</gui> is disabled as we will
@@ -57,7 +57,7 @@
<section id="build">
<title>Build the code for the first time</title>
<p>C is a rather verbose language, so don't be surprised that the file contains quite a lot of code. Most of it is template code. It loads an (empty) window and shows it. More details are given below; skip this list if you understand the basics:</p>
-
+
<list>
<item>
<p>The three <code>#include</code> lines at the top include the <code>config</code> (useful autoconf build defines), <code>gtk</code> (user interface) and <code>gi18n</code> (internationalization) libraries. Functions from these libraries are used in the rest of the code.</p>
@@ -109,10 +109,10 @@ create_window (void)
/* Show open dialog when opening a file */
g_signal_connect (button, "clicked", G_CALLBACK (on_open_image), image);
-
+
/* Exit when the window is closed */
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
-
+
return window;
}
]]></code>
@@ -145,7 +145,7 @@ create_window (void)
<section id="image">
<title>Showing the image</title>
-<p>We will now define the signal handler for the <em>clicked</em> signal or the
+<p>We will now define the signal handler for the <em>clicked</em> signal or the
button we mentioned before. Add this code before the <code>create_window()</code>
method.</p>
<code mime="text/x-csrc"><![CDATA[
@@ -165,12 +165,12 @@ on_open_image (GtkButton* button, gpointer user_data)
gtk_file_filter_add_pixbuf_formats (filter);
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog),
filter);
-
+
switch (gtk_dialog_run (GTK_DIALOG (dialog)))
{
case GTK_RESPONSE_ACCEPT:
{
- gchar *filename =
+ gchar *filename =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
gtk_image_set_from_file (GTK_IMAGE (image), filename);
break;
@@ -183,11 +183,11 @@ on_open_image (GtkButton* button, gpointer user_data)
]]></code>
<p>This is a bit more complicated than anything we've attempted so far, so let's break it down:</p>
<list>
- <item><p>The first argument of the signal is always the widget that sent the signal. Sometimes
+ <item><p>The first argument of the signal is always the widget that sent the signal. Sometimes
other arguments related to the signal come after that, but <em>clicked</em> doesn't have any. Next is
the <code>user_data</code> argument which is a pointer to the data we passed when connecting the signal.
In this case it is our <code>GtkImage</code> object.</p>
- </item>
+ </item>
<item>
<p>The next interesting line is where the dialog for choosing the file is created using
<code>gtk_file_chooser_dialog_new</code>. The function takes the title of the dialog, the
diff --git a/platform-demos/C/message-board.c.page b/platform-demos/C/message-board.c.page
index f9e4b40..53a5909 100644
--- a/platform-demos/C/message-board.c.page
+++ b/platform-demos/C/message-board.c.page
@@ -3,18 +3,18 @@
id="message-board.c">
<info>
-
+
<link type="guide" xref="index#c"/>
-
+
<desc>A simple program using WebKitGTK+ and the DOM.</desc>
-
+
<revision pkgversion="0.1" version="0.1" date="2010-12-06" status="draft"/>
<credit type="author copyright">
<name>Shaun McCance</name>
<email>shaunm gnome org</email>
<years>2010</years>
</credit>
-
+
</info>
<title>Message Board</title>
@@ -53,16 +53,16 @@
<item><p>In Anjuta, click <guiseq><gui>File</gui><gui>New</gui>
<gui>Project</gui></guiseq> to open the new project assistant.</p></item>
<item><p>Select <gui>GTK+ (simple)</gui> on the <gui>C</gui> tab,
- and click <gui>Forward</gui>.</p></item>
+ and click <gui>Continue</gui>.</p></item>
<item><p>Fill out your details on the <gui>Basic information</gui> page.
Use <input>message-board</input> for the project name.
- Click <gui>Forward</gui>.</p></item>
- <item><p>Disable the <gui>Use GtkBuilder for user interface</gui> option as
+ Click <gui>Continue</gui>.</p></item>
+ <item><p>Disable the <gui>Use GtkBuilder for user interface</gui> option as
this tutorial builds the user-interface manually.</p>
</item>
<item><p>You need to tell Anjuta you're using WebKitGTK+ on this project.
On the <gui>Project options</gui> page, select <gui>Configure external
- packages</gui>. Click <gui>Forward</gui>. On the <gui>Configure external
+ packages</gui>. Click <gui>Continue</gui>. On the <gui>Configure external
packages</gui> page, check <gui>webkitgtk-3.0</gui>.</p></item>
</steps>
diff --git a/platform-demos/C/photo-wall.c.page b/platform-demos/C/photo-wall.c.page
index 61c0b07..c9a240f 100644
--- a/platform-demos/C/photo-wall.c.page
+++ b/platform-demos/C/photo-wall.c.page
@@ -48,7 +48,7 @@
<p>Start Anjuta and click <guiseq><gui>File</gui><gui>New</gui><gui>Project</gui></guiseq> to open the project wizard.</p>
</item>
<item>
- <p>Choose <gui>Gtk+ (simple)</gui> from the <gui>C</gui> tab, click <gui>Forward</gui>, and fill out your details on the next few pages. Use <file>photo-wall</file> as project name and directory.</p>
+ <p>Choose <gui>Gtk+ (simple)</gui> from the <gui>C</gui> tab, click <gui>Continue</gui>, and fill out your details on the next few pages. Use <file>photo-wall</file> as project name and directory.</p>
</item>
<item>
<p>Make sure that <gui>Use GtkBuilder for user interface</gui> is disabled as we will
@@ -120,7 +120,7 @@ static Position origin = {0, 0};
<section id="code">
<title>Jumping into the code</title>
<p>We will start by taking a look at the <code>main()</code> function as a whole. Then we'll discuss the other code sections in detail.
- Change the <file>src/main.c</file> to contain this <code>main()</code> function. You can delete the
+ Change the <file>src/main.c</file> to contain this <code>main()</code> function. You can delete the
<code>create_window()</code> function as we don't need it in this example.</p>
<code mime="text/x-csrc" style="numbered"><![CDATA[
int
@@ -227,7 +227,7 @@ load_image_path_names()
const gchar *filename = g_dir_read_name(dir);
while(filename)
{
- if(g_str_has_suffix(filename, ".jpg") || g_str_has_suffix(filename, ".png"))
+ if(g_str_has_suffix(filename, ".jpg") || g_str_has_suffix(filename, ".png"))
{
gchar *path = g_build_filename(IMAGE_DIR_PATH, filename, NULL);
img_path_list = g_slist_prepend(img_path_list, path);
@@ -367,7 +367,7 @@ foreach_set_focus_state(gpointer data, gpointer user_data)
<section id="run">
<title>Build and run the application</title>
- <p>All of the code should now be ready to go.
+ <p>All of the code should now be ready to go.
All you need now is some pictures to load. By default, the pictures are loaded from a <file>berlin_images</file> directory. If you want, you can change the <code>#define IMAGE_DIR_PATH</code> line near the top to refer to your photo directory, or create a <file>berlin_images</file> directory by clicking <guiseq><gui>Project</gui><gui>New Directory...</gui></guiseq> and creating a <file>berlin_images</file> directory as a subdirectory of the <file>photo-wall</file> directory. Make sure to put at least twelve images in the directory! <!--You can download the example images <link href="photo-wall/berlin_images/">here</link> (<link href="photo-wall/CREDITS">credits</link>).--></p>
<p>When you have done that, click <guiseq><gui>Build</gui><gui>Build Project</gui></guiseq> to build everything again, then <guiseq><gui>Run</gui><gui>Execute</gui></guiseq> to start the application.</p>
<p>If you haven't already done so, choose the <file>Debug/src/photo-wall</file> application in the dialog that appears. Finally, hit <gui>Run</gui> and enjoy!</p>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]