mirror of https://github.com/GNOME/gimp.git
split code to get the page name into a utility function.
2007-05-17 Sven Neumann <sven@gimp.org> * plug-ins/common/tiff-load.c: split code to get the page name into a utility function. svn path=/trunk/; revision=22527
This commit is contained in:
parent
50ce4e92f6
commit
5ba374ee58
|
@ -1,3 +1,8 @@
|
||||||
|
2007-05-17 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* plug-ins/common/tiff-load.c: split code to get the page name
|
||||||
|
into a utility function.
|
||||||
|
|
||||||
2007-05-17 Sven Neumann <sven@gimp.org>
|
2007-05-17 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpdockbook.c (gimp_dockbook_init): unset show-border.
|
* app/widgets/gimpdockbook.c (gimp_dockbook_init): unset show-border.
|
||||||
|
|
|
@ -381,6 +381,22 @@ tiff_error (const gchar *module,
|
||||||
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, ap);
|
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns a pointer into the TIFF */
|
||||||
|
static const gchar *
|
||||||
|
tiff_get_page_name (TIFF *tif)
|
||||||
|
{
|
||||||
|
static gchar *name;
|
||||||
|
|
||||||
|
if (TIFFGetField (tif, TIFFTAG_PAGENAME, &name) &&
|
||||||
|
g_utf8_validate (name, -1, NULL))
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
load_dialog (TIFF *tif,
|
load_dialog (TIFF *tif,
|
||||||
TiffSelectedPages *pages)
|
TiffSelectedPages *pages)
|
||||||
|
@ -423,18 +439,11 @@ load_dialog (TIFF *tif,
|
||||||
|
|
||||||
for (i = 0; i < pages->n_pages; i++)
|
for (i = 0; i < pages->n_pages; i++)
|
||||||
{
|
{
|
||||||
gchar *name;
|
const gchar *name = tiff_get_page_name (tif);
|
||||||
|
|
||||||
if (! TIFFGetField (tif, TIFFTAG_PAGENAME, &name) ||
|
|
||||||
! g_utf8_validate (name, -1, NULL))
|
|
||||||
{
|
|
||||||
name = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
gimp_page_selector_set_page_label (GIMP_PAGE_SELECTOR (selector), i, name);
|
gimp_page_selector_set_page_label (GIMP_PAGE_SELECTOR (selector),
|
||||||
|
i, name);
|
||||||
g_free (name);
|
|
||||||
|
|
||||||
TIFFReadDirectory (tif);
|
TIFFReadDirectory (tif);
|
||||||
}
|
}
|
||||||
|
@ -507,7 +516,7 @@ load_image (const gchar *filename,
|
||||||
GimpParasite *parasite;
|
GimpParasite *parasite;
|
||||||
guint16 tmp;
|
guint16 tmp;
|
||||||
|
|
||||||
gchar *name;
|
const gchar *name;
|
||||||
|
|
||||||
GList *images_list = NULL, *images_list_temp;
|
GList *images_list = NULL, *images_list_temp;
|
||||||
gint li;
|
gint li;
|
||||||
|
@ -883,11 +892,7 @@ load_image (const gchar *filename,
|
||||||
channel = g_new0 (channel_data, extra + 1);
|
channel = g_new0 (channel_data, extra + 1);
|
||||||
|
|
||||||
/* try and use layer name from tiff file */
|
/* try and use layer name from tiff file */
|
||||||
if (! TIFFGetField (tif, TIFFTAG_PAGENAME, &name) ||
|
name = tiff_get_page_name (tif);
|
||||||
! g_utf8_validate (name, -1, NULL))
|
|
||||||
{
|
|
||||||
name = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
|
@ -897,6 +902,8 @@ load_image (const gchar *filename,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
if (ilayer == 0)
|
if (ilayer == 0)
|
||||||
name = g_strdup (_("Background"));
|
name = g_strdup (_("Background"));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue