1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Migrating from GnomeAbout to GtkAboutDialog: GTK+ 2 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 2 Reference Manual">
<link rel="up" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
<link rel="prev" href="gtk-migrating-GtkIconView.html" title="Migrating from GnomeIconList to GtkIconView">
<link rel="next" href="gtk-migrating-GtkColorButton.html" title="Migrating from GnomeColorPicker to GtkColorButton">
<meta name="generator" content="GTK-Doc V1.33.0 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="migrating.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gtk-migrating-GtkIconView.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtk-migrating-GtkColorButton.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="gtk-migrating-GtkAboutDialog"></a>Migrating from GnomeAbout to GtkAboutDialog</h2></div></div></div>
<p>
Since version 2.6, GTK+ provides the <a class="link" href="GtkAboutDialog.html" title="GtkAboutDialog"><span class="type">GtkAboutDialog</span></a> widget as a
replacement for the <span class="structname">GnomeAbout</span> dialog in
the libgnomeui library.
</p>
<p>
<a class="link" href="GtkAboutDialog.html" title="GtkAboutDialog"><span class="type">GtkAboutDialog</span></a> supports all features found in <span class="structname">GnomeAbout</span>.
The <span class="structname">GtkAboutDialog</span> API is bigger, since it follows
the GTK+ policy to have getters and setters for all widget properties,
but it isn't much more complex than <span class="structname">GnomeAbout</span>.
</p>
<p>
To convert an application that uses <span class="structname">GnomeAbout</span> to
<span class="structname">GtkAboutDialog</span>, as a first step, replace calls
like
</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">documentors</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">"Documenter 1"</span><span class="p">,</span>
<span class="s">"Documenter 2"</span><span class="p">,</span>
<span class="nb">NULL</span>
<span class="p">};</span>
<span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">documentors</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">"Author 1"</span><span class="p">,</span>
<span class="s">"Author 2"</span><span class="p">,</span>
<span class="nb">NULL</span>
<span class="p">};</span>
<span class="n">GtkWidget</span> <span class="o">*</span><span class="n">about</span> <span class="o">=</span> <span class="n">gnome_about_new</span> <span class="p">(</span><span class="s">"GNOME Test Program"</span><span class="p">,</span> <span class="n">VERSION</span><span class="p">,</span>
<span class="s">"(C) 1998-2001 The Free Software Foundation"</span><span class="p">,</span>
<span class="s">"Program to display GNOME functions."</span><span class="p">,</span>
<span class="n">authors</span><span class="p">,</span>
<span class="n">documenters</span><span class="p">,</span>
<span class="n">_</span><span class="p">(</span><span class="s">"translator-credits"</span><span class="p">),</span>
<span class="s">"logo.png"</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
by something like
</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="n">GdkPixbuf</span> <span class="o">*</span><span class="n">logo</span> <span class="o">=</span> <span class="n">gdk_pixbuf_new_from_file</span> <span class="p">(</span><span class="s">"logo.png"</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
<span class="n">GtkWidget</span> <span class="o">*</span><span class="n">about</span> <span class="o">=</span> <span class="n">g_object_new</span> <span class="p">(</span><span class="n">GTK_TYPE_ABOUT_DIALOG</span><span class="p">,</span>
<span class="s">"name"</span><span class="p">,</span> <span class="s">"GNOME Test Program"</span><span class="p">,</span>
<span class="s">"version"</span><span class="p">,</span> <span class="n">VERSION</span><span class="p">,</span>
<span class="s">"copyright"</span><span class="p">,</span> <span class="s">"(C) 1998-2001 The Free Software Foundation"</span><span class="p">,</span>
<span class="s">"comments"</span><span class="p">,</span> <span class="s">"Program to display GNOME functions."</span><span class="p">,</span>
<span class="s">"authors"</span><span class="p">,</span> <span class="n">authors</span><span class="p">,</span>
<span class="s">"documenters"</span><span class="p">,</span> <span class="n">documenters</span><span class="p">,</span>
<span class="s">"translator-credits"</span><span class="p">,</span> <span class="n">_</span><span class="p">(</span><span class="s">"translator-credits"</span><span class="p">),</span>
<span class="s">"logo"</span><span class="p">,</span> <span class="n">logo</span><span class="p">,</span>
<span class="nb">NULL</span><span class="p">);</span>
<span class="n">g_object_unref</span> <span class="p">(</span><span class="n">pixbuf</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
If the <code class="function">g_object_new()</code> construction scares you, you can also use
<a class="link" href="GtkAboutDialog.html#gtk-about-dialog-new" title="gtk_about_dialog_new ()"><code class="function">gtk_about_dialog_new()</code></a> to construct the dialog and then use the
setters for the individual properties.
</p>
<p>
Once you are done with the initial conversion, you may want to look into
using some of the features of <span class="structname">GtkAboutDialog</span>
which are not present in <span class="structname">GnomeAbout</span>.
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>
You can specify license information with the
<a class="link" href="GtkAboutDialog.html#GtkAboutDialog--license" title="The “license” property"><span class="type">“license”</span></a> property
</p></li>
<li class="listitem"><p>
You can add separate credits for artists with the
<a class="link" href="GtkAboutDialog.html#GtkAboutDialog--artists" title="The “artists” property"><span class="type">“artists”</span></a> property
</p></li>
<li class="listitem"><p>
You can add a pointer to the website of your application, using the
<a class="link" href="GtkAboutDialog.html#GtkAboutDialog--website" title="The “website” property"><span class="type">“website”</span></a> and <a class="link" href="GtkAboutDialog.html#GtkAboutDialog--website-label" title="The “website-label” property"><span class="type">“website-label”</span></a> properties.
</p></li>
<li class="listitem"><p>
If your credits contain email addresses or URLs, you can turn them
into clickable links using <a class="link" href="GtkAboutDialog.html#gtk-about-dialog-set-email-hook" title="gtk_about_dialog_set_email_hook ()"><code class="function">gtk_about_dialog_set_email_hook()</code></a> and
<a class="link" href="GtkAboutDialog.html#gtk-about-dialog-set-url-hook" title="gtk_about_dialog_set_url_hook ()"><code class="function">gtk_about_dialog_set_url_hook()</code></a>.
</p></li>
</ul></div>
<p>
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.0</div>
</body>
</html>
|