mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
Markup fixes.
2004-11-04 Matthias Clasen <mclasen@redhat.com> * gtk/tmpl/gtkaboutdialog.sgml: * gtk/migrating-GtkColorButton.sgml: * gtk/migrating-GtkIconView.sgml: * gtk/migrating-GtkAboutDialog.sgml: Markup fixes.
This commit is contained in:
parent
9222438f4f
commit
d882420be6
@ -1,3 +1,10 @@
|
||||
2004-11-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/tmpl/gtkaboutdialog.sgml:
|
||||
* gtk/migrating-GtkColorButton.sgml:
|
||||
* gtk/migrating-GtkIconView.sgml:
|
||||
* gtk/migrating-GtkAboutDialog.sgml: Markup fixes.
|
||||
|
||||
2004-11-04 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtk-docs.sgml:
|
||||
|
@ -3,21 +3,23 @@
|
||||
<title>Migrating from GnomeAbout to GtkAboutDialog</title>
|
||||
|
||||
<para>
|
||||
Since version 2.6, GTK+ provides the <link linkend="GtkIconView">GtkAboutDialog</link>
|
||||
widget as a replacement for the GnomeAbout dialog in the libgnomeui library.
|
||||
views.
|
||||
Since version 2.6, GTK+ provides the <link
|
||||
linkend="GtkIconView">GtkAboutDialog</link> widget as a replacement for
|
||||
the <structname>GnomeAbout</structname> dialog in the libgnomeui library.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<link linkend="GtkIconView">GtkAboutDialog</link> supports all features found in
|
||||
GnomeAbout. The GtkAboutDialog 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 GnomeAbout.
|
||||
<link linkend="GtkIconView">GtkAboutDialog</link> supports all features
|
||||
found in <structname>GnomeAbout</structname>. The
|
||||
<structname>GtkAboutDialog</structname> 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 <structname>GnomeAbout</structname>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To convert an application that uses GnomeAbout to <link linkend="GtkIconView">GtkAboutDialog</link>,
|
||||
as a first step, replace calls like
|
||||
To convert an application that uses <structname>GnomeAbout</structname> to
|
||||
<structname>GtkAboutDialog</structname>, as a first step, replace calls
|
||||
like
|
||||
<informalexample><programlisting>
|
||||
const gchar *documentors[] = {
|
||||
"Documenter 1",
|
||||
@ -60,12 +62,13 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once you are done with the initial conversion, you may want to look into using some of the
|
||||
features of <link linkend="GtkIconView">GtkAboutDialog</link> which are not present in GnomeAbout.
|
||||
Once you are done with the initial conversion, you may want to look into
|
||||
using some of the features of <structname>GtkAboutDialog</structname>
|
||||
which are not present in <structname>GnomeAbout</structname>.
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
You can specify license information
|
||||
with the <link linkend="GtkAboutDialog--license">license</link> property
|
||||
You can specify license information with the
|
||||
<link linkend="GtkAboutDialog--license">license</link> property
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
You can add separate credits for artists with the
|
||||
@ -74,11 +77,12 @@
|
||||
<listitem><para>
|
||||
You can add a pointer to the website of your application, using the
|
||||
<link linkend="GtkAboutDialog--website">website</link> and
|
||||
<link linkend="GtkAboutDialog--website-label">website-label</link> properties.
|
||||
<link linkend="GtkAboutDialog--website-label">website-label</link>
|
||||
properties.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
If your credits contain email addresses or urls, you can turn them into clickable
|
||||
links using
|
||||
If your credits contain email addresses or URLs, you can turn them
|
||||
into clickable links using
|
||||
<link linkend="gtk-about-dialog-set-email-hook"><function>gtk_about_dialog_set_email_hook()</function></link> and
|
||||
<link linkend="gtk-about-dialog-set-url-hook"><function>gtk_about_dialog_set_url_hook()</function></link>.
|
||||
</para></listitem>
|
||||
|
@ -4,14 +4,18 @@
|
||||
|
||||
<para>
|
||||
Since version 2.6, GTK+ provides the <link linkend="GtkColorButton">GtkColorButton</link>
|
||||
widget as a replacement for the GnomeColorPicker widget in the libgnomeui library.
|
||||
widget as a replacement for the <structname>GnomeColorPicker</structname>
|
||||
widget in the libgnomeui
|
||||
library.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Porting an application from GnomeColorPicker to <link linkend="GtkColorButton">GtkColorButton</link>
|
||||
is very simple. <link linkend="GtkColorButton">GtkColorButton</link> doesn't support dithering
|
||||
(since it is rarely needed on modern hardware), and it doesn't have setters and getters to set the
|
||||
color from floating point or integer components. So instead of
|
||||
Porting an application from <structname>GnomeColorPicker</structname> to
|
||||
<structname>GtkColorButton</structname> is very simple.
|
||||
<structname>GtkColorButton</structname> doesn't support dithering
|
||||
(since it is rarely needed on modern hardware), and it doesn't have
|
||||
setters and getters to set the color from floating point or integer
|
||||
components. So instead of
|
||||
<informalexample><programlisting>
|
||||
guint red, green, blue, alpha;
|
||||
/* ... */
|
||||
@ -21,14 +25,16 @@
|
||||
<informalexample><programlisting>
|
||||
GdkColor color;
|
||||
|
||||
color.red = red << 8;
|
||||
color.green = green << 8;
|
||||
color.blue = blue << 8;
|
||||
gtk_color_button_set_color (color_picker, &color);
|
||||
gtk_color_button_set_alpha (color_picker, alpha << 8);
|
||||
color.red = red << 8;
|
||||
color.green = green << 8;
|
||||
color.blue = blue << 8;
|
||||
gtk_color_button_set_color (color_picker, &color);
|
||||
gtk_color_button_set_alpha (color_picker, alpha << 8);
|
||||
</programlisting></informalexample>
|
||||
and similarly for the setters taking other number formats. For gnome_color_picker_set_i16() no conversion
|
||||
is needed, for gome_color_picker_set_d(), you need to convert the color components like this:
|
||||
and similarly for the setters taking other number formats. For
|
||||
<function>gnome_color_picker_set_i16()</function> no conversion is needed,
|
||||
for <function>gnome_color_picker_set_d()</function>, you need to convert
|
||||
the color components like this:
|
||||
<informalexample><programlisting>
|
||||
color.red = (guint16) (red * 65535.0 + 0.5);
|
||||
color.green = (guint16) (green * 65535.0 + 0.5);
|
||||
|
@ -3,27 +3,32 @@
|
||||
<title>Migrating from GnomeIconList to GtkIconView</title>
|
||||
|
||||
<para>
|
||||
Since version 2.6, GTK+ provides the <link linkend="GtkIconView">GtkIconView</link>
|
||||
widget. It is similar in functionality to the GnomeIconList widget in the libgnomeui
|
||||
library, both widgets provide a way to lay out named icons in a grid. The distinctive
|
||||
feature of the GTK+ widget is that it follows the model-view pattern, allowing
|
||||
it to share the actual data (i.e. the names and images of the icons) with other
|
||||
views.
|
||||
Since version 2.6, GTK+ provides the <link
|
||||
linkend="GtkIconView">GtkIconView</link>
|
||||
widget. It is similar in functionality to the
|
||||
<structname>GnomeIconList</structname> widget in the
|
||||
libgnomeui library, both widgets provide a way to lay out named icons in
|
||||
a grid. The distinctive feature of the GTK+ widget is that it follows the
|
||||
model-view pattern, allowing it to share the actual data (i.e. the names
|
||||
and images of the icons) with other views.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<link linkend="GtkIconView">GtkIconView</link> currently doesn't support some features
|
||||
found in GnomeIconList. Icons can not be positioned freely, the spacing is not customizable,
|
||||
and it is not possible to edit the names of icons.
|
||||
<link linkend="GtkIconView">GtkIconView</link> currently doesn't support
|
||||
some features found in <structname>GnomeIconList</structname>. Icons can
|
||||
not be positioned freely, the spacing is not customizable, and it is not
|
||||
possible to edit the names of icons.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To convert an application that uses GnomeIconList to
|
||||
<link linkend="GtkIconView">GtkIconView</link>, the first step is to organize your data
|
||||
in a <link linkend="GtkTreeModel">GtkTreeModel</link>. GnomeIconList lets you directly
|
||||
insert data with gnome_icon_list_insert() and gnome_icon_list_insert_pixbuf() and their
|
||||
append variants. So, if you previously had a function to fill your icon list similar
|
||||
to this one:
|
||||
To convert an application that uses <structname>GnomeIconList</structname>
|
||||
to <link linkend="GtkIconView">GtkIconView</link>, the first step is to
|
||||
organize your data in a <link linkend="GtkTreeModel">GtkTreeModel</link>.
|
||||
<structname>GnomeIconList</structname> lets you directly insert data with
|
||||
<function>gnome_icon_list_insert()</function> and
|
||||
<function>gnome_icon_list_insert_pixbuf()</function> and their
|
||||
append variants. So, if you previously had a function to fill your icon
|
||||
list similar to this one:
|
||||
<informalexample><programlisting>
|
||||
void
|
||||
fill_icon_list (GnomeIconList *icon_list)
|
||||
@ -34,7 +39,8 @@
|
||||
/* more icons ... */
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
you will have to create a tree model, attach your icon view to it, and fill the model:
|
||||
you will have to create a tree model, attach your icon view to it, and
|
||||
fill the model:
|
||||
<informalexample><programlisting>
|
||||
enum {
|
||||
PIXBUF_COLUMN,
|
||||
@ -88,15 +94,19 @@
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
This example uses a <link linkend="GtkListStore">GtkListStore</link> as
|
||||
model, but part of the elegance of the model-view pattern is that you can easily
|
||||
use another tree model implementation, or even write your own custom tree model.
|
||||
model, but part of the elegance of the model-view pattern is that you can
|
||||
easily use another tree model implementation, or even write your own
|
||||
custom tree model.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Your application may make use of extra data attached to the icons in the
|
||||
GnomeIconList via gnome_icon_list_set_icon_data() and gnome_icon_list_get_icon_data().
|
||||
With <link linkend="GtkIconView">GtkIconView</link> such data is most conveniently
|
||||
stored in an extra column in the tree model, so you would call a function like
|
||||
<structname>GnomeIconList</structname> via
|
||||
<function>gnome_icon_list_set_icon_data()</function> and
|
||||
<function>gnome_icon_list_get_icon_data()</function>. With
|
||||
<link linkend="GtkIconView">GtkIconView</link> such data is most
|
||||
conveniently stored in an extra column in the tree model, so you would
|
||||
call a function like
|
||||
<informalexample><programlisting>
|
||||
void
|
||||
set_icon_data (GtkIconView *icon_view,
|
||||
@ -113,20 +123,27 @@
|
||||
DATA_COLUMN, data, -1);
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
assuming that your tree model has a DATA_COLUMN of type G_TYPE_POINTER.
|
||||
assuming that your tree model has a <literal>DATA_COLUMN</literal> of type
|
||||
<literal>G_TYPE_POINTER</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
There is a number of minor API differences between GnomeIconList and GtkIconView:
|
||||
There is a number of minor API differences between
|
||||
<structname>GnomeIconList</structname> and
|
||||
<structname>GtkIconView</structname>:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
GnomeIconListMode is replaced by the orientation property of GtkIconView
|
||||
<typename>GnomeIconListMode</typename> is replaced by the
|
||||
<link linkend="GtkIconView--orientation">orientation</link>
|
||||
property of <structname>GtkIconView</structname>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
GtkIconView can not be frozen in the same was as GnomeIconList with
|
||||
gnome_icon_list_freeze() and gnome_icon_list_thaw(). Instead you can
|
||||
replace the whole model of a GtkIconView, instead of doing many small
|
||||
changes to the existing model.
|
||||
<structname>GtkIconView</structname> can not be frozen in the same
|
||||
way as <structname>GnomeIconList</structname> can with
|
||||
<function>gnome_icon_list_freeze()</function> and
|
||||
<function>gnome_icon_list_thaw()</function>. Instead you can
|
||||
replace the whole model of a <structname>GtkIconView</structname>,
|
||||
instead of doing many small changes to the existing model.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
@ -19,7 +19,7 @@ supports this by offering global hooks, which are called when the user
|
||||
clicks on a link or email address, see gtk_about_dialog_set_email_hook()
|
||||
and gtk_about_dialog_set_url_hook(). Email addresses in the
|
||||
authors, documenters and artists properties are recognized by looking for
|
||||
<literal><user@<!-- -->host</replaceable>></literal>, URLs are
|
||||
<literal><user@<!-- -->host></literal>, URLs are
|
||||
recognized by looking for <literal>http://url</literal>, with
|
||||
<literal>url</literal> extending to the next space, tab or line break.
|
||||
</para>
|
||||
|
Loading…
Reference in New Issue
Block a user