Update the error enum and the gtk_recent_manager_add and

2006-05-11  Emmanuele Bassi  <ebassi@cvs.gnome.org>

	* gtk/tmpl/gtkrecentmanager.sgml: Update the error enum and the
	gtk_recent_manager_add and gtk_recent_manager_add_full parameters.

	* gtk/migrating-GtkRecentChooser.sgml: Mention
	gtk_recent_manager_get_default() and update the code examples.
This commit is contained in:
Emmanuele Bassi
2006-05-12 08:39:17 +00:00
committed by Emmanuele Bassi
parent f8cfd44ff8
commit dc918cbf75
3 changed files with 21 additions and 21 deletions

View File

@ -1,3 +1,11 @@
2006-05-11 Emmanuele Bassi <ebassi@cvs.gnome.org>
* gtk/tmpl/gtkrecentmanager.sgml: Update the error enum and the
gtk_recent_manager_add and gtk_recent_manager_add_full parameters.
* gtk/migrating-GtkRecentChooser.sgml: Mention
gtk_recent_manager_get_default() and update the code examples.
2006-05-09 Matthias Clasen <mclasen@redhat.com> 2006-05-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk-sections.txt: Add gtk_message_dialog_set_image. * gtk/gtk-sections.txt: Add gtk_message_dialog_set_image.

View File

@ -57,23 +57,23 @@
you of changes inside the list. you of changes inside the list.
</para> </para>
<para>
Usually, instead of creating a new #GtkRecentManager each time you
need it, you'll want to use the gtk_recent_manager_get_default()
function.
</para>
<para> <para>
To add a document to the list, you can use gtk_recent_manager_add_item(), To add a document to the list, you can use gtk_recent_manager_add_item(),
like: like:
<informalexample><programlisting> <informalexample><programlisting>
GtkRecentManager *manager; GtkRecentManager *manager;
GError *error = NULL;
manager = gtk_recent_manager_new (<!-- -->); manager = gtk_recent_manager_new (<!-- -->);
gtk_recent_manager_add_item (manager, document_uri, &amp;error); if (!gtk_recent_manager_add_item (manager, document_uri))
if (error)
{ {
g_warning ("Unable to add '%s' to the list of recently used documents: %s\n", /* warn about the error */
document_uri,
error->message);
g_error_free (error);
} }
g_object_unref (manager); g_object_unref (manager);
@ -85,7 +85,6 @@
<informalexample><programlisting> <informalexample><programlisting>
GtkRecentManager *manager; GtkRecentManager *manager;
GtkRecentData *recent_data; GtkRecentData *recent_data;
GError *error = NULL;
manager = gtk_recent_manager_new (<!-- -->); manager = gtk_recent_manager_new (<!-- -->);
@ -111,8 +110,7 @@
*/ */
recent_data-&amp;app_exec = g_strjoin (" ", g_get_prgname (<!-- -->), "--open-file", "%u", NULL); recent_data-&amp;app_exec = g_strjoin (" ", g_get_prgname (<!-- -->), "--open-file", "%u", NULL);
gtk_recent_manager_add_full (manager, document_uri, recent_data, &amp;error); if (!gtk_recent_manager_add_full (manager, document_uri, recent_data))
if (error)
{ {
/* warn about the error */ /* warn about the error */
} }
@ -130,8 +128,11 @@
around, so you must remember to free the data inside the list and then around, so you must remember to free the data inside the list and then
the list itself when you are done using it: the list itself when you are done using it:
<informalexample><programlisting> <informalexample><programlisting>
GtkRecentManager *manager;
GList *recent_items, *l; GList *recent_items, *l;
manager = gtk_recent_manager_get_default(<!-- -->);
recent_items = gtk_recent_manager_get_items (manager); recent_items = gtk_recent_manager_get_items (manager);
for (l = recent_items; l != NULL; l = l-&gt;next) for (l = recent_items; l != NULL; l = l-&gt;next)
{ {

View File

@ -29,15 +29,9 @@ file is as simple as:
<informalexample> <informalexample>
<programlisting> <programlisting>
GtkRecentManager *manager; GtkRecentManager *manager;
GError *error = NULL;
manager = gtk_recent_manager_get_default (); manager = gtk_recent_manager_get_default ();
gtk_recent_manager_add_item (manager, file_uri, &amp;error); gtk_recent_manager_add_item (manager, file_uri);
if (error)
{
g_warning ("Could not add the file: &percnt;s", error-&gt;message);
g_error_free (error);
}
</programlisting> </programlisting>
</informalexample> </informalexample>
@ -129,7 +123,6 @@ The #GQuark used for #GtkRecentManagerError errors.
@GTK_RECENT_MANAGER_ERROR_INVALID_MIME: @GTK_RECENT_MANAGER_ERROR_INVALID_MIME:
@GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING: @GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING:
@GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED: @GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED:
@GTK_RECENT_MANAGER_ERROR_BAD_EXEC_STRING:
@GTK_RECENT_MANAGER_ERROR_READ: @GTK_RECENT_MANAGER_ERROR_READ:
@GTK_RECENT_MANAGER_ERROR_WRITE: @GTK_RECENT_MANAGER_ERROR_WRITE:
@GTK_RECENT_MANAGER_ERROR_UNKNOWN: @GTK_RECENT_MANAGER_ERROR_UNKNOWN:
@ -175,7 +168,6 @@ The #GQuark used for #GtkRecentManagerError errors.
@manager: @manager:
@uri: @uri:
@error:
@Returns: @Returns:
@ -187,7 +179,6 @@ The #GQuark used for #GtkRecentManagerError errors.
@manager: @manager:
@uri: @uri:
@recent_data: @recent_data:
@error:
@Returns: @Returns: