app: move all GimpImagefile members to private
This commit is contained in:
@ -268,7 +268,7 @@ documents_recreate_preview_cmd_callback (GtkAction *action,
|
|||||||
{
|
{
|
||||||
gimp_imagefile_create_thumbnail (imagefile,
|
gimp_imagefile_create_thumbnail (imagefile,
|
||||||
context, NULL,
|
context, NULL,
|
||||||
imagefile->gimp->config->thumbnail_size,
|
context->gimp->config->thumbnail_size,
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,8 +291,9 @@ static void
|
|||||||
documents_remove_dangling_foreach (GimpImagefile *imagefile,
|
documents_remove_dangling_foreach (GimpImagefile *imagefile,
|
||||||
GimpContainer *container)
|
GimpContainer *container)
|
||||||
{
|
{
|
||||||
if (gimp_thumbnail_peek_image (imagefile->thumbnail) ==
|
GimpThumbnail *thumbnail = gimp_imagefile_get_thumbnail (imagefile);
|
||||||
GIMP_THUMB_STATE_NOT_FOUND)
|
|
||||||
|
if (gimp_thumbnail_peek_image (thumbnail) == GIMP_THUMB_STATE_NOT_FOUND)
|
||||||
{
|
{
|
||||||
const gchar *uri = gimp_object_get_name (imagefile);
|
const gchar *uri = gimp_object_get_name (imagefile);
|
||||||
|
|
||||||
|
@ -56,6 +56,23 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GimpImagefilePrivate GimpImagefilePrivate;
|
||||||
|
|
||||||
|
struct _GimpImagefilePrivate
|
||||||
|
{
|
||||||
|
Gimp *gimp;
|
||||||
|
|
||||||
|
GimpThumbnail *thumbnail;
|
||||||
|
|
||||||
|
gchar *description;
|
||||||
|
gboolean static_desc;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define GET_PRIVATE(imagefile) G_TYPE_INSTANCE_GET_PRIVATE (imagefile, \
|
||||||
|
GIMP_TYPE_IMAGEFILE, \
|
||||||
|
GimpImagefilePrivate)
|
||||||
|
|
||||||
|
|
||||||
static void gimp_imagefile_finalize (GObject *object);
|
static void gimp_imagefile_finalize (GObject *object);
|
||||||
|
|
||||||
static void gimp_imagefile_name_changed (GimpObject *object);
|
static void gimp_imagefile_name_changed (GimpObject *object);
|
||||||
@ -131,16 +148,18 @@ gimp_imagefile_class_init (GimpImagefileClass *klass)
|
|||||||
gimp_thumb_init (creator, NULL);
|
gimp_thumb_init (creator, NULL);
|
||||||
|
|
||||||
g_free (creator);
|
g_free (creator);
|
||||||
|
|
||||||
|
g_type_class_add_private (klass, sizeof (GimpImagefilePrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_imagefile_init (GimpImagefile *imagefile)
|
gimp_imagefile_init (GimpImagefile *imagefile)
|
||||||
{
|
{
|
||||||
imagefile->gimp = NULL;
|
GimpImagefilePrivate *private = GET_PRIVATE (imagefile);
|
||||||
imagefile->thumbnail = gimp_thumbnail_new ();
|
|
||||||
imagefile->description = NULL;
|
|
||||||
|
|
||||||
g_signal_connect_object (imagefile->thumbnail, "notify",
|
private->thumbnail = gimp_thumbnail_new ();
|
||||||
|
|
||||||
|
g_signal_connect_object (private->thumbnail, "notify",
|
||||||
G_CALLBACK (gimp_imagefile_notify_thumbnail),
|
G_CALLBACK (gimp_imagefile_notify_thumbnail),
|
||||||
imagefile, G_CONNECT_SWAPPED);
|
imagefile, G_CONNECT_SWAPPED);
|
||||||
}
|
}
|
||||||
@ -148,20 +167,20 @@ gimp_imagefile_init (GimpImagefile *imagefile)
|
|||||||
static void
|
static void
|
||||||
gimp_imagefile_finalize (GObject *object)
|
gimp_imagefile_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GimpImagefile *imagefile = GIMP_IMAGEFILE (object);
|
GimpImagefilePrivate *private = GET_PRIVATE (object);
|
||||||
|
|
||||||
if (imagefile->description)
|
if (private->description)
|
||||||
{
|
{
|
||||||
if (! imagefile->static_desc)
|
if (! private->static_desc)
|
||||||
g_free (imagefile->description);
|
g_free (private->description);
|
||||||
|
|
||||||
imagefile->description = NULL;
|
private->description = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imagefile->thumbnail)
|
if (private->thumbnail)
|
||||||
{
|
{
|
||||||
g_object_unref (imagefile->thumbnail);
|
g_object_unref (private->thumbnail);
|
||||||
imagefile->thumbnail = NULL;
|
private->thumbnail = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
@ -177,7 +196,7 @@ gimp_imagefile_new (Gimp *gimp,
|
|||||||
|
|
||||||
imagefile = g_object_new (GIMP_TYPE_IMAGEFILE, NULL);
|
imagefile = g_object_new (GIMP_TYPE_IMAGEFILE, NULL);
|
||||||
|
|
||||||
imagefile->gimp = gimp;
|
GET_PRIVATE (imagefile)->gimp = gimp;
|
||||||
|
|
||||||
if (uri)
|
if (uri)
|
||||||
gimp_object_set_name (GIMP_OBJECT (imagefile), uri);
|
gimp_object_set_name (GIMP_OBJECT (imagefile), uri);
|
||||||
@ -185,13 +204,21 @@ gimp_imagefile_new (Gimp *gimp,
|
|||||||
return imagefile;
|
return imagefile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GimpThumbnail *
|
||||||
|
gimp_imagefile_get_thumbnail (GimpImagefile *imagefile)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), NULL);
|
||||||
|
|
||||||
|
return GET_PRIVATE (imagefile)->thumbnail;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_imagefile_set_mime_type (GimpImagefile *imagefile,
|
gimp_imagefile_set_mime_type (GimpImagefile *imagefile,
|
||||||
const gchar *mime_type)
|
const gchar *mime_type)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile));
|
g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile));
|
||||||
|
|
||||||
g_object_set (imagefile->thumbnail,
|
g_object_set (GET_PRIVATE (imagefile)->thumbnail,
|
||||||
"image-mimetype", mime_type,
|
"image-mimetype", mime_type,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@ -199,20 +226,23 @@ gimp_imagefile_set_mime_type (GimpImagefile *imagefile,
|
|||||||
void
|
void
|
||||||
gimp_imagefile_update (GimpImagefile *imagefile)
|
gimp_imagefile_update (GimpImagefile *imagefile)
|
||||||
{
|
{
|
||||||
|
GimpImagefilePrivate *private;
|
||||||
gchar *uri;
|
gchar *uri;
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile));
|
g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile));
|
||||||
|
|
||||||
|
private = GET_PRIVATE (imagefile);
|
||||||
|
|
||||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (imagefile));
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (imagefile));
|
||||||
|
|
||||||
g_object_get (imagefile->thumbnail,
|
g_object_get (private->thumbnail,
|
||||||
"image-uri", &uri,
|
"image-uri", &uri,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (uri)
|
if (uri)
|
||||||
{
|
{
|
||||||
GimpImagefile *documents_imagefile = (GimpImagefile *)
|
GimpImagefile *documents_imagefile = (GimpImagefile *)
|
||||||
gimp_container_get_child_by_name (imagefile->gimp->documents, uri);
|
gimp_container_get_child_by_name (private->gimp->documents, uri);
|
||||||
|
|
||||||
if (documents_imagefile != imagefile &&
|
if (documents_imagefile != imagefile &&
|
||||||
GIMP_IS_IMAGEFILE (documents_imagefile))
|
GIMP_IS_IMAGEFILE (documents_imagefile))
|
||||||
@ -229,6 +259,7 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
|
|||||||
gint size,
|
gint size,
|
||||||
gboolean replace)
|
gboolean replace)
|
||||||
{
|
{
|
||||||
|
GimpImagefilePrivate *private;
|
||||||
GimpThumbnail *thumbnail;
|
GimpThumbnail *thumbnail;
|
||||||
GimpThumbState image_state;
|
GimpThumbState image_state;
|
||||||
|
|
||||||
@ -239,7 +270,9 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
|
|||||||
if (size < 1)
|
if (size < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
thumbnail = imagefile->thumbnail;
|
private = GET_PRIVATE (imagefile);
|
||||||
|
|
||||||
|
thumbnail = private->thumbnail;
|
||||||
|
|
||||||
gimp_thumbnail_set_uri (thumbnail,
|
gimp_thumbnail_set_uri (thumbnail,
|
||||||
gimp_object_get_name (imagefile));
|
gimp_object_get_name (imagefile));
|
||||||
@ -260,14 +293,14 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
|
|||||||
|
|
||||||
g_object_ref (imagefile);
|
g_object_ref (imagefile);
|
||||||
|
|
||||||
image = file_open_thumbnail (imagefile->gimp, context, progress,
|
image = file_open_thumbnail (private->gimp, context, progress,
|
||||||
thumbnail->image_uri, size,
|
thumbnail->image_uri, size,
|
||||||
&mime_type, &width, &height,
|
&mime_type, &width, &height,
|
||||||
&type, &num_layers, NULL);
|
&type, &num_layers, NULL);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
gimp_thumbnail_set_info (imagefile->thumbnail,
|
gimp_thumbnail_set_info (private->thumbnail,
|
||||||
mime_type, width, height,
|
mime_type, width, height,
|
||||||
type, num_layers);
|
type, num_layers);
|
||||||
}
|
}
|
||||||
@ -275,14 +308,14 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
|
|||||||
{
|
{
|
||||||
GimpPDBStatusType status;
|
GimpPDBStatusType status;
|
||||||
|
|
||||||
image = file_open_image (imagefile->gimp, context, progress,
|
image = file_open_image (private->gimp, context, progress,
|
||||||
thumbnail->image_uri,
|
thumbnail->image_uri,
|
||||||
thumbnail->image_uri,
|
thumbnail->image_uri,
|
||||||
FALSE, NULL, GIMP_RUN_NONINTERACTIVE,
|
FALSE, NULL, GIMP_RUN_NONINTERACTIVE,
|
||||||
&status, &mime_type, NULL);
|
&status, &mime_type, NULL);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
gimp_thumbnail_set_info_from_image (imagefile->thumbnail,
|
gimp_thumbnail_set_info_from_image (private->thumbnail,
|
||||||
mime_type, image);
|
mime_type, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +339,7 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
|
|||||||
|
|
||||||
if (! success)
|
if (! success)
|
||||||
{
|
{
|
||||||
gimp_message_literal (imagefile->gimp,
|
gimp_message_literal (private->gimp,
|
||||||
G_OBJECT (progress), GIMP_MESSAGE_ERROR,
|
G_OBJECT (progress), GIMP_MESSAGE_ERROR,
|
||||||
error->message);
|
error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
@ -326,6 +359,7 @@ gimp_imagefile_create_thumbnail_weak (GimpImagefile *imagefile,
|
|||||||
gint size,
|
gint size,
|
||||||
gboolean replace)
|
gboolean replace)
|
||||||
{
|
{
|
||||||
|
GimpImagefilePrivate *private;
|
||||||
GimpImagefile *local;
|
GimpImagefile *local;
|
||||||
const gchar *uri;
|
const gchar *uri;
|
||||||
|
|
||||||
@ -334,11 +368,13 @@ gimp_imagefile_create_thumbnail_weak (GimpImagefile *imagefile,
|
|||||||
if (size < 1)
|
if (size < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
private = GET_PRIVATE (imagefile);
|
||||||
|
|
||||||
uri = gimp_object_get_name (imagefile);
|
uri = gimp_object_get_name (imagefile);
|
||||||
if (! uri)
|
if (! uri)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
local = gimp_imagefile_new (imagefile->gimp, uri);
|
local = gimp_imagefile_new (private->gimp, uri);
|
||||||
|
|
||||||
g_object_add_weak_pointer (G_OBJECT (imagefile), (gpointer) &imagefile);
|
g_object_add_weak_pointer (G_OBJECT (imagefile), (gpointer) &imagefile);
|
||||||
|
|
||||||
@ -364,17 +400,20 @@ gimp_imagefile_create_thumbnail_weak (GimpImagefile *imagefile,
|
|||||||
gboolean
|
gboolean
|
||||||
gimp_imagefile_check_thumbnail (GimpImagefile *imagefile)
|
gimp_imagefile_check_thumbnail (GimpImagefile *imagefile)
|
||||||
{
|
{
|
||||||
|
GimpImagefilePrivate *private;
|
||||||
gint size;
|
gint size;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), FALSE);
|
||||||
|
|
||||||
size = imagefile->gimp->config->thumbnail_size;
|
private = GET_PRIVATE (imagefile);
|
||||||
|
|
||||||
|
size = private->gimp->config->thumbnail_size;
|
||||||
|
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
GimpThumbState state;
|
GimpThumbState state;
|
||||||
|
|
||||||
state = gimp_thumbnail_check_thumb (imagefile->thumbnail, size);
|
state = gimp_thumbnail_check_thumb (private->thumbnail, size);
|
||||||
|
|
||||||
return (state == GIMP_THUMB_STATE_OK);
|
return (state == GIMP_THUMB_STATE_OK);
|
||||||
}
|
}
|
||||||
@ -387,6 +426,7 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
|
|||||||
const gchar *mime_type,
|
const gchar *mime_type,
|
||||||
GimpImage *image)
|
GimpImage *image)
|
||||||
{
|
{
|
||||||
|
GimpImagefilePrivate *private;
|
||||||
gint size;
|
gint size;
|
||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -394,11 +434,13 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
|
|||||||
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), FALSE);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||||
|
|
||||||
size = imagefile->gimp->config->thumbnail_size;
|
private = GET_PRIVATE (imagefile);
|
||||||
|
|
||||||
|
size = private->gimp->config->thumbnail_size;
|
||||||
|
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
gimp_thumbnail_set_info_from_image (imagefile->thumbnail,
|
gimp_thumbnail_set_info_from_image (private->thumbnail,
|
||||||
mime_type, image);
|
mime_type, image);
|
||||||
|
|
||||||
success = gimp_imagefile_save_thumb (imagefile,
|
success = gimp_imagefile_save_thumb (imagefile,
|
||||||
@ -406,7 +448,7 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
|
|||||||
&error);
|
&error);
|
||||||
if (! success)
|
if (! success)
|
||||||
{
|
{
|
||||||
gimp_message_literal (imagefile->gimp, NULL, GIMP_MESSAGE_ERROR,
|
gimp_message_literal (private->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||||
error->message);
|
error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
@ -415,26 +457,31 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* private functions */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_imagefile_name_changed (GimpObject *object)
|
gimp_imagefile_name_changed (GimpObject *object)
|
||||||
{
|
{
|
||||||
GimpImagefile *imagefile = GIMP_IMAGEFILE (object);
|
GimpImagefilePrivate *private = GET_PRIVATE (object);
|
||||||
|
|
||||||
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
if (GIMP_OBJECT_CLASS (parent_class)->name_changed)
|
||||||
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
GIMP_OBJECT_CLASS (parent_class)->name_changed (object);
|
||||||
|
|
||||||
gimp_thumbnail_set_uri (imagefile->thumbnail, gimp_object_get_name (object));
|
gimp_thumbnail_set_uri (private->thumbnail, gimp_object_get_name (object));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_imagefile_info_changed (GimpImagefile *imagefile)
|
gimp_imagefile_info_changed (GimpImagefile *imagefile)
|
||||||
{
|
{
|
||||||
if (imagefile->description)
|
GimpImagefilePrivate *private = GET_PRIVATE (imagefile);
|
||||||
{
|
|
||||||
if (! imagefile->static_desc)
|
|
||||||
g_free (imagefile->description);
|
|
||||||
|
|
||||||
imagefile->description = NULL;
|
if (private->description)
|
||||||
|
{
|
||||||
|
if (! private->static_desc)
|
||||||
|
g_free (private->description);
|
||||||
|
|
||||||
|
private->description = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_emit (imagefile, gimp_imagefile_signals[INFO_CHANGED], 0);
|
g_signal_emit (imagefile, gimp_imagefile_signals[INFO_CHANGED], 0);
|
||||||
@ -470,7 +517,8 @@ gimp_imagefile_get_description (GimpViewable *viewable,
|
|||||||
gchar **tooltip)
|
gchar **tooltip)
|
||||||
{
|
{
|
||||||
GimpImagefile *imagefile = GIMP_IMAGEFILE (viewable);
|
GimpImagefile *imagefile = GIMP_IMAGEFILE (viewable);
|
||||||
GimpThumbnail *thumbnail = imagefile->thumbnail;
|
GimpImagefilePrivate *private = GET_PRIVATE (imagefile);
|
||||||
|
GimpThumbnail *thumbnail = private->thumbnail;
|
||||||
gchar *basename;
|
gchar *basename;
|
||||||
|
|
||||||
if (! thumbnail->image_uri)
|
if (! thumbnail->image_uri)
|
||||||
@ -514,36 +562,39 @@ gimp_imagefile_get_description (GimpViewable *viewable,
|
|||||||
const gchar *
|
const gchar *
|
||||||
gimp_imagefile_get_desc_string (GimpImagefile *imagefile)
|
gimp_imagefile_get_desc_string (GimpImagefile *imagefile)
|
||||||
{
|
{
|
||||||
|
GimpImagefilePrivate *private;
|
||||||
GimpThumbnail *thumbnail;
|
GimpThumbnail *thumbnail;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), NULL);
|
||||||
|
|
||||||
if (imagefile->description)
|
private = GET_PRIVATE (imagefile);
|
||||||
return (const gchar *) imagefile->description;
|
|
||||||
|
|
||||||
thumbnail = imagefile->thumbnail;
|
if (private->description)
|
||||||
|
return (const gchar *) private->description;
|
||||||
|
|
||||||
|
thumbnail = private->thumbnail;
|
||||||
|
|
||||||
switch (thumbnail->image_state)
|
switch (thumbnail->image_state)
|
||||||
{
|
{
|
||||||
case GIMP_THUMB_STATE_UNKNOWN:
|
case GIMP_THUMB_STATE_UNKNOWN:
|
||||||
imagefile->description = NULL;
|
private->description = NULL;
|
||||||
imagefile->static_desc = TRUE;
|
private->static_desc = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_THUMB_STATE_FOLDER:
|
case GIMP_THUMB_STATE_FOLDER:
|
||||||
imagefile->description = (gchar *) _("Folder");
|
private->description = (gchar *) _("Folder");
|
||||||
imagefile->static_desc = TRUE;
|
private->static_desc = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_THUMB_STATE_SPECIAL:
|
case GIMP_THUMB_STATE_SPECIAL:
|
||||||
imagefile->description = (gchar *) _("Special File");
|
private->description = (gchar *) _("Special File");
|
||||||
imagefile->static_desc = TRUE;
|
private->static_desc = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_THUMB_STATE_NOT_FOUND:
|
case GIMP_THUMB_STATE_NOT_FOUND:
|
||||||
imagefile->description =
|
private->description =
|
||||||
(gchar *) g_strerror (thumbnail->image_not_found_errno);
|
(gchar *) g_strerror (thumbnail->image_not_found_errno);
|
||||||
imagefile->static_desc = TRUE;
|
private->static_desc = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -643,12 +694,12 @@ gimp_imagefile_get_desc_string (GimpImagefile *imagefile)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
imagefile->description = g_string_free (str, FALSE);
|
private->description = g_string_free (str, FALSE);
|
||||||
imagefile->static_desc = FALSE;
|
private->static_desc = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (const gchar *) imagefile->description;
|
return (const gchar *) private->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPixbuf *
|
static GdkPixbuf *
|
||||||
@ -656,7 +707,8 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile,
|
|||||||
gint width,
|
gint width,
|
||||||
gint height)
|
gint height)
|
||||||
{
|
{
|
||||||
GimpThumbnail *thumbnail = imagefile->thumbnail;
|
GimpImagefilePrivate *private = GET_PRIVATE (imagefile);
|
||||||
|
GimpThumbnail *thumbnail = private->thumbnail;
|
||||||
GdkPixbuf *pixbuf = NULL;
|
GdkPixbuf *pixbuf = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gint size = MAX (width, height);
|
gint size = MAX (width, height);
|
||||||
@ -677,7 +729,7 @@ gimp_imagefile_load_thumb (GimpImagefile *imagefile,
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
gimp_message (imagefile->gimp, NULL, GIMP_MESSAGE_ERROR,
|
gimp_message (private->gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||||
_("Could not open thumbnail '%s': %s"),
|
_("Could not open thumbnail '%s': %s"),
|
||||||
thumbnail->thumb_filename, error->message);
|
thumbnail->thumb_filename, error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
@ -737,7 +789,8 @@ gimp_imagefile_save_thumb (GimpImagefile *imagefile,
|
|||||||
gboolean replace,
|
gboolean replace,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpThumbnail *thumbnail = imagefile->thumbnail;
|
GimpImagefilePrivate *private = GET_PRIVATE (imagefile);
|
||||||
|
GimpThumbnail *thumbnail = private->thumbnail;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
|
@ -43,11 +43,6 @@ typedef struct _GimpImagefileClass GimpImagefileClass;
|
|||||||
struct _GimpImagefile
|
struct _GimpImagefile
|
||||||
{
|
{
|
||||||
GimpViewable parent_instance;
|
GimpViewable parent_instance;
|
||||||
|
|
||||||
Gimp *gimp;
|
|
||||||
GimpThumbnail *thumbnail;
|
|
||||||
gchar *description;
|
|
||||||
gboolean static_desc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpImagefileClass
|
struct _GimpImagefileClass
|
||||||
@ -62,6 +57,9 @@ GType gimp_imagefile_get_type (void) G_GNUC_CONST;
|
|||||||
|
|
||||||
GimpImagefile * gimp_imagefile_new (Gimp *gimp,
|
GimpImagefile * gimp_imagefile_new (Gimp *gimp,
|
||||||
const gchar *uri);
|
const gchar *uri);
|
||||||
|
|
||||||
|
GimpThumbnail * gimp_imagefile_get_thumbnail (GimpImagefile *imagefile);
|
||||||
|
|
||||||
void gimp_imagefile_set_mime_type (GimpImagefile *imagefile,
|
void gimp_imagefile_set_mime_type (GimpImagefile *imagefile,
|
||||||
const gchar *mime_type);
|
const gchar *mime_type);
|
||||||
void gimp_imagefile_update (GimpImagefile *imagefile);
|
void gimp_imagefile_update (GimpImagefile *imagefile);
|
||||||
|
@ -378,7 +378,8 @@ gimp_thumb_box_new (GimpContext *context)
|
|||||||
G_CALLBACK (gimp_thumb_box_imagefile_info_changed),
|
G_CALLBACK (gimp_thumb_box_imagefile_info_changed),
|
||||||
box);
|
box);
|
||||||
|
|
||||||
g_signal_connect (box->imagefile->thumbnail, "notify::thumb-state",
|
g_signal_connect (gimp_imagefile_get_thumbnail (box->imagefile),
|
||||||
|
"notify::thumb-state",
|
||||||
G_CALLBACK (gimp_thumb_box_thumb_state_notify),
|
G_CALLBACK (gimp_thumb_box_thumb_state_notify),
|
||||||
box);
|
box);
|
||||||
|
|
||||||
@ -547,7 +548,7 @@ static void
|
|||||||
gimp_thumb_box_create_thumbnails (GimpThumbBox *box,
|
gimp_thumb_box_create_thumbnails (GimpThumbBox *box,
|
||||||
gboolean force)
|
gboolean force)
|
||||||
{
|
{
|
||||||
Gimp *gimp = box->imagefile->gimp;
|
Gimp *gimp = box->context->gimp;
|
||||||
GimpProgress *progress = GIMP_PROGRESS (box);
|
GimpProgress *progress = GIMP_PROGRESS (box);
|
||||||
GimpFileDialog *dialog = NULL;
|
GimpFileDialog *dialog = NULL;
|
||||||
GtkWidget *toplevel;
|
GtkWidget *toplevel;
|
||||||
@ -679,7 +680,7 @@ gimp_thumb_box_create_thumbnail (GimpThumbBox *box,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
thumb = box->imagefile->thumbnail;
|
thumb = gimp_imagefile_get_thumbnail (box->imagefile);
|
||||||
|
|
||||||
basename = file_utils_uri_display_basename (uri);
|
basename = file_utils_uri_display_basename (uri);
|
||||||
gtk_label_set_text (GTK_LABEL (box->filename), basename);
|
gtk_label_set_text (GTK_LABEL (box->filename), basename);
|
||||||
@ -701,8 +702,8 @@ gimp_thumb_box_create_thumbnail (GimpThumbBox *box,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
|
gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
|
||||||
{
|
{
|
||||||
Gimp *gimp = box->imagefile->gimp;
|
Gimp *gimp = box->context->gimp;
|
||||||
GimpThumbnail *thumb = box->imagefile->thumbnail;
|
GimpThumbnail *thumb = gimp_imagefile_get_thumbnail (box->imagefile);
|
||||||
const gchar *uri = gimp_object_get_name (box->imagefile);
|
const gchar *uri = gimp_object_get_name (box->imagefile);
|
||||||
|
|
||||||
box->idle_id = 0;
|
box->idle_id = 0;
|
||||||
|
@ -158,6 +158,7 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
|
|||||||
{
|
{
|
||||||
GdkScreen *screen = gtk_widget_get_screen (widget);
|
GdkScreen *screen = gtk_widget_get_screen (widget);
|
||||||
GtkIconTheme *icon_theme = gtk_icon_theme_get_for_screen (screen);
|
GtkIconTheme *icon_theme = gtk_icon_theme_get_for_screen (screen);
|
||||||
|
GimpThumbnail *thumbnail = gimp_imagefile_get_thumbnail (imagefile);
|
||||||
GdkPixbuf *pixbuf = NULL;
|
GdkPixbuf *pixbuf = NULL;
|
||||||
|
|
||||||
if (! gimp_object_get_name (imagefile))
|
if (! gimp_object_get_name (imagefile))
|
||||||
@ -198,9 +199,9 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
|
|||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! pixbuf && imagefile->thumbnail->image_mimetype)
|
if (! pixbuf && thumbnail->image_mimetype)
|
||||||
{
|
{
|
||||||
pixbuf = get_icon_for_mime_type (imagefile->thumbnail->image_mimetype,
|
pixbuf = get_icon_for_mime_type (thumbnail->image_mimetype,
|
||||||
size);
|
size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +209,7 @@ gimp_view_renderer_imagefile_get_icon (GimpImagefile *imagefile,
|
|||||||
{
|
{
|
||||||
const gchar *icon_name = GTK_STOCK_FILE;
|
const gchar *icon_name = GTK_STOCK_FILE;
|
||||||
|
|
||||||
if (imagefile->thumbnail->image_state == GIMP_THUMB_STATE_FOLDER)
|
if (thumbnail->image_state == GIMP_THUMB_STATE_FOLDER)
|
||||||
icon_name = GTK_STOCK_DIRECTORY;
|
icon_name = GTK_STOCK_DIRECTORY;
|
||||||
|
|
||||||
pixbuf = gtk_icon_theme_load_icon (icon_theme,
|
pixbuf = gtk_icon_theme_load_icon (icon_theme,
|
||||||
|
Reference in New Issue
Block a user