gimp r25270 - in trunk: . app/dialogs



Author: neo
Date: Fri Mar 28 07:50:11 2008
New Revision: 25270
URL: http://svn.gnome.org/viewvc/gimp?rev=25270&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/app/dialogs/preferences-dialog.c
   trunk/app/dialogs/tips-dialog.c
   trunk/app/dialogs/tips-parser.c
   trunk/app/dialogs/tips-parser.h

Modified: trunk/app/dialogs/preferences-dialog.c
==============================================================================
--- trunk/app/dialogs/preferences-dialog.c	(original)
+++ trunk/app/dialogs/preferences-dialog.c	Fri Mar 28 07:50:11 2008
@@ -1812,9 +1812,6 @@
   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);

Modified: trunk/app/dialogs/tips-dialog.c
==============================================================================
--- trunk/app/dialogs/tips-dialog.c	(original)
+++ trunk/app/dialogs/tips-dialog.c	Fri Mar 28 07:50:11 2008
@@ -61,7 +61,6 @@
 {
   GimpGuiConfig *config;
   GtkWidget     *vbox;
-  GtkWidget     *vbox2;
   GtkWidget     *hbox;
   GtkWidget     *button;
   GtkWidget     *image;
@@ -85,33 +84,31 @@
 
           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 @@
   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;

Modified: trunk/app/dialogs/tips-parser.c
==============================================================================
--- trunk/app/dialogs/tips-parser.c	(original)
+++ trunk/app/dialogs/tips-parser.c	Fri Mar 28 07:50:11 2008
@@ -103,19 +103,33 @@
 
 
 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>");
+
+      if (format)
+        g_string_append (str, "\n\n");
+    }
 
-  tip = g_slice_new0 (GimpTip);
+  if (format)
+    {
+      va_list  args;
+
+      va_start (args, format);
+      g_string_append_vprintf (str, format, args);
+      va_end (args);
+    }
 
-  va_start (args, format);
-  tip->thetip = g_strdup_vprintf (format, args);
-  va_end (args);
+  tip->thetip = g_string_free (str, FALSE);
 
   return tip;
 }

Modified: trunk/app/dialogs/tips-parser.h
==============================================================================
--- trunk/app/dialogs/tips-parser.h	(original)
+++ trunk/app/dialogs/tips-parser.h	Fri Mar 28 07:50:11 2008
@@ -31,8 +31,9 @@
 };
 
 
-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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]