New method to get a string representation of the image type.

* 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.

svn path=/trunk/; revision=27947
This commit is contained in:
Martin Nordholts 2009-01-25 19:21:52 +00:00
parent d5b91835fd
commit 3b79e36d30
4 changed files with 31 additions and 22 deletions

View File

@ -1,3 +1,13 @@
2009-01-25 Martin Nordholts <martinn@svn.gnome.org>
* 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.
2009-01-25 Martin Nordholts <martinn@svn.gnome.org>
* app/base/temp-buf.c (temp_buf_copy): Bail out if we fail to

View File

@ -3713,6 +3713,25 @@ gimp_image_position_vectors (GimpImage *image,
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,

View File

@ -544,6 +544,7 @@ gboolean gimp_image_position_vectors (GimpImage *image,
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,

View File

@ -218,28 +218,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
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 */