diff --git a/ChangeLog b/ChangeLog index e050ab19c6..ae48f609b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2008-03-28 Sven Neumann + + * 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 + + * 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 * plug-ins/common/pnm.c (load_image): changed message to say diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index f9052a0f7f..395582339d 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -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); diff --git a/app/dialogs/tips-dialog.c b/app/dialogs/tips-dialog.c index 65ec6ed4d7..f9275eb482 100644 --- a/app/dialogs/tips-dialog.c +++ b/app/dialogs/tips-dialog.c @@ -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 (_("The GIMP tips file is empty!")); + tip = gimp_tip_new (_("The GIMP tips file is empty!"), NULL); } else if (error->code == G_FILE_ERROR_NOENT) { - tip = gimp_tip_new (_("The GIMP tips file appears to be " - "missing!\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 (_("The GIMP tips file could not be " - "parsed:\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; diff --git a/app/dialogs/tips-parser.c b/app/dialogs/tips-parser.c index 1bc0d81b91..ad30f1b8a4 100644 --- a/app/dialogs/tips-parser.c +++ b/app/dialogs/tips-parser.c @@ -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, ""); + g_string_append (str, title); + g_string_append (str, ""); - 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; } diff --git a/app/dialogs/tips-parser.h b/app/dialogs/tips-parser.h index 5af10c0cc6..b77fb36235 100644 --- a/app/dialogs/tips-parser.h +++ b/app/dialogs/tips-parser.h @@ -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,