app/dialogs/tips-parser.[ch] improved the creation of fallback tips in

2008-03-28  Sven Neumann  <sven@gimp.org>

	* app/dialogs/tips-parser.[ch]
	* app/dialogs/tips-dialog.c: improved the creation of fallback
	tips in case of an error parsing the tips file.
	(tips_dialog_create): simplified dialog layout.
	
	* app/dialogs/preferences-dialog.c: removed the check button for
	the "show-tips" option.


svn path=/trunk/; revision=25270
This commit is contained in:
Sven Neumann 2008-03-28 07:50:11 +00:00 committed by Sven Neumann
parent 848a3e197f
commit 2206c6a8c3
5 changed files with 55 additions and 35 deletions

View File

@ -1,3 +1,21 @@
2008-03-28 Sven Neumann <sven@gimp.org>
* app/dialogs/tips-parser.[ch]
* app/dialogs/tips-dialog.c: improved the creation of fallback
tips in case of an error parsing the tips file.
(tips_dialog_create): simplified dialog layout.
* app/dialogs/preferences-dialog.c: removed the check button for
the "show-tips" option.
2008-03-28 Sven Neumann <sven@gimp.org>
* data/tips/gimp-tips.dtd
* data/tips/gimp-tips.xml.in
* app/dialogs/tips-parser.[ch]: reverted some of the changes from
yesterday. The simplification went too far and we inadvertently
lost an important feature.
2008-03-27 Sven Neumann <sven@gimp.org>
* plug-ins/common/pnm.c (load_image): changed message to say

View File

@ -1812,9 +1812,6 @@ prefs_dialog_new (Gimp *gimp,
prefs_check_button_add (object, "show-help-button",
_("Show help _buttons"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "show-tips",
_("Show tips on _startup"),
GTK_BOX (vbox2));
/* Help Browser */
vbox2 = prefs_frame_new (_("Help Browser"), GTK_CONTAINER (vbox), FALSE);

View File

@ -61,7 +61,6 @@ tips_dialog_create (Gimp *gimp)
{
GimpGuiConfig *config;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *image;
@ -85,33 +84,31 @@ tips_dialog_create (Gimp *gimp)
if (! error)
{
tip = gimp_tip_new (_("<b>The GIMP tips file is empty!</b>"));
tip = gimp_tip_new (_("The GIMP tips file is empty!"), NULL);
}
else if (error->code == G_FILE_ERROR_NOENT)
{
tip = gimp_tip_new (_("<b>The GIMP tips file appears to be "
"missing!</b>\n\n"
"There should be a file called '%s'. "
tip = gimp_tip_new (_("The GIMP tips file appears to be "
"missing!"),
_("There should be a file called '%s'. "
"Please check your installation."),
gimp_filename_to_utf8 (filename));
}
else
{
tip = gimp_tip_new (_("<b>The GIMP tips file could not be "
"parsed:</b>\n\n%s"),
error->message);
tip = gimp_tip_new (_("The GIMP tips file could not be parsed!"),
"%s", error->message);
}
tips = g_list_prepend (tips, tip);
g_error_free (error);
}
else if (error)
{
g_printerr ("Error while parsing '%s': %s\n",
filename, error->message);
g_error_free (error);
}
g_clear_error (&error);
g_free (filename);
}
@ -167,28 +164,21 @@ tips_dialog_create (Gimp *gimp)
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
vbox2 = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
gtk_widget_show (vbox2);
thetip_label = gtk_label_new (NULL);
gtk_label_set_selectable (GTK_LABEL (thetip_label), TRUE);
gtk_label_set_justify (GTK_LABEL (thetip_label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap (GTK_LABEL (thetip_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (thetip_label), 0.5, 0.5);
gtk_box_pack_start (GTK_BOX (vbox2), thetip_label, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), thetip_label, TRUE, TRUE, 0);
gtk_widget_show (thetip_label);
gtk_container_set_focus_chain (GTK_CONTAINER (vbox2), NULL);
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
gtk_widget_show (vbox2);
image = gtk_image_new_from_stock (GIMP_STOCK_INFO, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (vbox2), image, TRUE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);
gtk_container_set_focus_chain (GTK_CONTAINER (hbox), NULL);
tips_dialog_set_tip (current_tip->data);
return tips_dialog;

View File

@ -103,19 +103,33 @@ static const GMarkupParser markup_parser =
GimpTip *
gimp_tip_new (const gchar *format,
gimp_tip_new (const gchar *title,
const gchar *format,
...)
{
GimpTip *tip;
va_list args;
GimpTip *tip = g_slice_new0 (GimpTip);
GString *str = g_string_new (NULL);
g_return_val_if_fail (format != NULL, NULL);
if (title)
{
g_string_append (str, "<b>");
g_string_append (str, title);
g_string_append (str, "</b>");
tip = g_slice_new0 (GimpTip);
if (format)
g_string_append (str, "\n\n");
}
va_start (args, format);
tip->thetip = g_strdup_vprintf (format, args);
va_end (args);
if (format)
{
va_list args;
va_start (args, format);
g_string_append_vprintf (str, format, args);
va_end (args);
}
tip->thetip = g_string_free (str, FALSE);
return tip;
}

View File

@ -31,8 +31,9 @@ struct _GimpTip
};
GimpTip * gimp_tip_new (const gchar *format,
...) G_GNUC_PRINTF(1, 2);
GimpTip * gimp_tip_new (const gchar *title,
const gchar *format,
...) G_GNUC_PRINTF(2, 3);
void gimp_tip_free (GimpTip *tip);
GList * gimp_tips_from_file (const gchar *filename,