gimp r27947 - in trunk: . app/core app/display



Author: martinn
Date: Sun Jan 25 19:21:52 2009
New Revision: 27947
URL: http://svn.gnome.org/viewvc/gimp?rev=27947&view=rev

Log:
* app/core/gimpimage.[ch] (gimp_image_get_type_string): New method
to get a string representation of the image type.

* app/display/gimpdisplayshell-title.c
(gimp_display_shell_format_title): Ask the GimpImage for an image
type string instead of making assumptions about its
implementation.


Modified:
   trunk/ChangeLog
   trunk/app/core/gimpimage.c
   trunk/app/core/gimpimage.h
   trunk/app/display/gimpdisplayshell-title.c

Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c	(original)
+++ trunk/app/core/gimpimage.c	Sun Jan 25 19:21:52 2009
@@ -3713,6 +3713,25 @@
   return TRUE;
 }
 
+const gchar *
+gimp_image_get_type_string (GimpImage *image)
+{
+  gboolean empty = gimp_image_is_empty (image);
+
+  switch (gimp_image_base_type (image))
+    {
+    case GIMP_RGB:
+      return empty ? _("RGB-empty") : _("RGB");
+    case GIMP_GRAY:
+      return empty ? _("grayscale-empty") : _("grayscale");
+    case GIMP_INDEXED:
+      return empty ? _("indexed-empty") : _("indexed");
+    default:
+      return "unkown";
+      break;
+    }
+}
+
 gboolean
 gimp_image_layer_boundary (const GimpImage  *image,
                            BoundSeg        **segs,

Modified: trunk/app/core/gimpimage.h
==============================================================================
--- trunk/app/core/gimpimage.h	(original)
+++ trunk/app/core/gimpimage.h	Sun Jan 25 19:21:52 2009
@@ -544,6 +544,7 @@
                                                   gint                new_index,
                                                   gboolean            push_undo,
                                                   const gchar        *undo_desc);
+const gchar   * gimp_image_get_type_string       (GimpImage          *image);
 
 gboolean        gimp_image_layer_boundary        (const GimpImage    *image,
                                                   BoundSeg          **segs,

Modified: trunk/app/display/gimpdisplayshell-title.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-title.c	(original)
+++ trunk/app/display/gimpdisplayshell-title.c	Sun Jan 25 19:21:52 2009
@@ -218,28 +218,7 @@
               break;
 
             case 't': /* type */
-              {
-                const gchar *image_type_str = NULL;
-                gboolean     empty          = gimp_image_is_empty (image);
-
-                switch (gimp_image_base_type (image))
-                  {
-                  case GIMP_RGB:
-                    image_type_str = empty ? _("RGB-empty") : _("RGB");
-                    break;
-                  case GIMP_GRAY:
-                    image_type_str = empty ? _("grayscale-empty") : _("grayscale");
-                    break;
-                  case GIMP_INDEXED:
-                    image_type_str = empty ? _("indexed-empty") : _("indexed");
-                    break;
-                  default:
-                    g_assert_not_reached ();
-                    break;
-                  }
-
-                i += print (title, title_len, i, "%s", image_type_str);
-              }
+              i += print (title, title_len, i, "%s", gimp_image_get_type_string (image));
               break;
 
             case 's': /* user source zoom factor */



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