Commit 51785c1d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/core/gimpdocumentlist.[ch] added "Gimp" pointers so we don't need to

2003-01-24  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdocumentlist.[ch]
	* app/core/gimpimagefile.[ch]: added "Gimp" pointers so we don't
	need to use "the_gimp" from "app_procs.h".

	* app/core/core-types.h
	* app/core/gimp.c
	* app/gui/file-open-dialog.c
	* tools/pdbgen/pdb/fileops.pdb: changed accordingly.

	* app/pdb/fileops_cmds.c: regenerated.
parent 27ce1d42
2003-01-24 Michael Natterer <mitch@gimp.org>
* app/core/gimpdocumentlist.[ch]
* app/core/gimpimagefile.[ch]: added "Gimp" pointers so we don't
need to use "the_gimp" from "app_procs.h".
* app/core/core-types.h
* app/core/gimp.c
* app/gui/file-open-dialog.c
* tools/pdbgen/pdb/fileops.pdb: changed accordingly.
* app/pdb/fileops_cmds.c: regenerated.
2003-01-23 Sven Neumann <sven@gimp.org>
 
* modules/cdisplay_colorblind.c: use bpl (line pitch) when
......
......@@ -125,7 +125,7 @@ typedef struct _GimpPaintInfo GimpPaintInfo;
typedef struct _GimpToolInfo GimpToolInfo; /*< proxy-include >*/
typedef struct _GimpImagefile GimpImagefile;
typedef struct _GimpList GimpDocumentList;
typedef struct _GimpDocumentList GimpDocumentList;
/* drawable objects */
......
......@@ -244,7 +244,7 @@ gimp_init (Gimp *gimp)
gimp->standard_tool_info = NULL;
gimp->documents = gimp_document_list_new ();
gimp->documents = gimp_document_list_new (gimp);
gimp->have_current_cut_buffer = FALSE;
......
......@@ -34,17 +34,18 @@
#include "config/gimpconfig.h"
#include "config/gimpscanner.h"
#include "gimp.h"
#include "gimpdocumentlist.h"
#include "gimpimagefile.h"
static void gimp_document_list_config_iface_init (gpointer iface,
gpointer iface_data);
static gboolean gimp_document_list_serialize (GObject *list,
static gboolean gimp_document_list_serialize (GObject *object,
gint fd,
gint indent_level,
gpointer data);
static gboolean gimp_document_list_deserialize (GObject *list,
static gboolean gimp_document_list_deserialize (GObject *object,
GScanner *scanner,
gint nest_level,
gpointer data);
......@@ -102,7 +103,7 @@ gimp_document_list_config_iface_init (gpointer iface,
}
static gboolean
gimp_document_list_serialize (GObject *document_list,
gimp_document_list_serialize (GObject *object,
gint fd,
gint indent_level,
gpointer data)
......@@ -112,7 +113,7 @@ gimp_document_list_serialize (GObject *document_list,
str = g_string_new (NULL);
for (list = GIMP_LIST (document_list)->list; list; list = list->next)
for (list = GIMP_LIST (object)->list; list; list = list->next)
{
gchar *escaped;
......@@ -130,13 +131,16 @@ gimp_document_list_serialize (GObject *document_list,
}
static gboolean
gimp_document_list_deserialize (GObject *document_list,
gimp_document_list_deserialize (GObject *object,
GScanner *scanner,
gint nest_level,
gpointer data)
{
GTokenType token;
gint size;
GimpDocumentList *document_list;
GTokenType token;
gint size;
document_list = GIMP_DOCUMENT_LIST (object);
size = GPOINTER_TO_INT (data);
......@@ -168,7 +172,7 @@ gimp_document_list_deserialize (GObject *document_list,
break;
}
imagefile = gimp_imagefile_new (uri);
imagefile = gimp_imagefile_new (document_list->gimp, uri);
if (size > 0)
gimp_imagefile_update (imagefile, size);
......@@ -197,16 +201,20 @@ gimp_document_list_deserialize (GObject *document_list,
}
GimpContainer *
gimp_document_list_new (void)
gimp_document_list_new (Gimp *gimp)
{
GObject *document_list;
GimpDocumentList *document_list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
document_list = g_object_new (GIMP_TYPE_DOCUMENT_LIST,
"name", "document_list",
"children_type", GIMP_TYPE_IMAGEFILE,
"policy", GIMP_CONTAINER_POLICY_STRONG,
NULL);
document_list->gimp = gimp;
return GIMP_CONTAINER (document_list);
}
......@@ -231,7 +239,7 @@ gimp_document_list_add_uri (GimpDocumentList *document_list,
}
else
{
imagefile = gimp_imagefile_new (uri);
imagefile = gimp_imagefile_new (document_list->gimp, uri);
gimp_container_add (container, GIMP_OBJECT (imagefile));
g_object_unref (imagefile);
}
......
......@@ -29,11 +29,23 @@
#define GIMP_IS_DOCUMENT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DOCUMENT_LIST))
typedef struct _GimpListClass GimpDocumentListClass;
typedef struct _GimpDocumentListClass GimpDocumentListClass;
struct _GimpDocumentList
{
GimpList parent_instance;
Gimp *gimp;
};
struct _GimpDocumentListClass
{
GimpListClass parent_class;
};
GType gimp_document_list_get_type (void) G_GNUC_CONST;
GimpContainer * gimp_document_list_new (void);
GimpContainer * gimp_document_list_new (Gimp *gimp);
GimpImagefile * gimp_document_list_add_uri (GimpDocumentList *document_list,
const gchar *uri);
......
......@@ -63,8 +63,6 @@
#include "file/file-open.h"
#include "app_procs.h"
#include "libgimp/gimpintl.h"
......@@ -227,6 +225,7 @@ gimp_imagefile_class_init (GimpImagefileClass *klass)
static void
gimp_imagefile_init (GimpImagefile *imagefile)
{
imagefile->gimp = NULL;
imagefile->state = GIMP_IMAGEFILE_STATE_UNKNOWN;
imagefile->image_mtime = 0;
imagefile->image_size = -1;
......@@ -251,15 +250,20 @@ gimp_imagefile_finalize (GObject *object)
}
GimpImagefile *
gimp_imagefile_new (const gchar *uri)
gimp_imagefile_new (Gimp *gimp,
const gchar *uri)
{
GimpImagefile *imagefile;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
imagefile = GIMP_IMAGEFILE (g_object_new (GIMP_TYPE_IMAGEFILE, NULL));
if (uri)
gimp_object_set_name (GIMP_OBJECT (imagefile), uri);
imagefile->gimp = gimp;
return imagefile;
}
......@@ -327,7 +331,7 @@ gimp_imagefile_update (GimpImagefile *imagefile,
GimpImagefile *documents_imagefile;
documents_imagefile = (GimpImagefile *)
gimp_container_get_child_by_name (the_gimp->documents, uri);
gimp_container_get_child_by_name (imagefile->gimp->documents, uri);
if (GIMP_IS_IMAGEFILE (documents_imagefile) &&
(documents_imagefile != imagefile))
......@@ -376,7 +380,7 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
if (! file_exists)
return;
gimage = file_open_image (the_gimp,
gimage = file_open_image (imagefile->gimp,
uri,
uri,
NULL,
......@@ -484,9 +488,8 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (GIMP_IS_GIMP (gimage->gimp), FALSE);
thumb_size = gimage->gimp->config->thumbnail_size;
thumb_size = imagefile->gimp->config->thumbnail_size;
g_return_val_if_fail (thumb_size <= 256, FALSE);
......
......@@ -60,6 +60,8 @@ struct _GimpImagefile
{
GimpViewable parent_instance;
Gimp *gimp;
GimpImagefileState state;
time_t image_mtime;
......@@ -84,7 +86,8 @@ struct _GimpImagefileClass
GType gimp_imagefile_get_type (void) G_GNUC_CONST;
GimpImagefile * gimp_imagefile_new (const gchar *uri);
GimpImagefile * gimp_imagefile_new (Gimp *gimp,
const gchar *uri);
void gimp_imagefile_update (GimpImagefile *imagefile,
gint thumb_size);
void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
......
......@@ -273,7 +273,7 @@ file_open_dialog_create (Gimp *gimp,
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
open_options_imagefile = gimp_imagefile_new (NULL);
open_options_imagefile = gimp_imagefile_new (gimp, NULL);
open_options_preview =
gimp_preview_new (GIMP_VIEWABLE (open_options_imagefile),
......@@ -415,7 +415,8 @@ file_open_selchanged_callback (GtkTreeSelection *sel,
}
static void
file_open_create_thumbnail (const gchar *filename,
file_open_create_thumbnail (Gimp *gimp,
const gchar *filename,
GimpThumbnailSize size,
gboolean always_create)
{
......@@ -427,7 +428,7 @@ file_open_create_thumbnail (const gchar *filename,
uri = g_filename_to_uri (filename, NULL, NULL);
imagefile = gimp_imagefile_new (uri);
imagefile = gimp_imagefile_new (gimp, uri);
if (always_create)
{
......@@ -505,7 +506,8 @@ file_open_create_thumbnails (GtkWidget *open_dialog,
g_main_context_iteration (NULL, FALSE);
}
file_open_create_thumbnail (selections[i],
file_open_create_thumbnail (gimp,
selections[i],
gimp->config->thumbnail_size,
always_create);
......@@ -535,7 +537,8 @@ file_open_create_thumbnails (GtkWidget *open_dialog,
g_main_context_iteration (NULL, FALSE);
}
file_open_create_thumbnail (selections[0],
file_open_create_thumbnail (gimp,
selections[0],
gimp->config->thumbnail_size,
always_create);
......
......@@ -273,7 +273,7 @@ file_open_dialog_create (Gimp *gimp,
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
open_options_imagefile = gimp_imagefile_new (NULL);
open_options_imagefile = gimp_imagefile_new (gimp, NULL);
open_options_preview =
gimp_preview_new (GIMP_VIEWABLE (open_options_imagefile),
......@@ -415,7 +415,8 @@ file_open_selchanged_callback (GtkTreeSelection *sel,
}
static void
file_open_create_thumbnail (const gchar *filename,
file_open_create_thumbnail (Gimp *gimp,
const gchar *filename,
GimpThumbnailSize size,
gboolean always_create)
{
......@@ -427,7 +428,7 @@ file_open_create_thumbnail (const gchar *filename,
uri = g_filename_to_uri (filename, NULL, NULL);
imagefile = gimp_imagefile_new (uri);
imagefile = gimp_imagefile_new (gimp, uri);
if (always_create)
{
......@@ -505,7 +506,8 @@ file_open_create_thumbnails (GtkWidget *open_dialog,
g_main_context_iteration (NULL, FALSE);
}
file_open_create_thumbnail (selections[i],
file_open_create_thumbnail (gimp,
selections[i],
gimp->config->thumbnail_size,
always_create);
......@@ -535,7 +537,8 @@ file_open_create_thumbnails (GtkWidget *open_dialog,
g_main_context_iteration (NULL, FALSE);
}
file_open_create_thumbnail (selections[0],
file_open_create_thumbnail (gimp,
selections[0],
gimp->config->thumbnail_size,
always_create);
......
......@@ -363,7 +363,7 @@ file_save_thumbnail_invoker (Gimp *gimp,
if (success)
{
imagefile = gimp_imagefile_new (uri);
imagefile = gimp_imagefile_new (gimp, uri);
success = gimp_imagefile_save_thumbnail (imagefile, gimage);
g_object_unref (imagefile);
}
......
......@@ -263,7 +263,7 @@ HELP
if (success)
{
imagefile = gimp_imagefile_new (uri);
imagefile = gimp_imagefile_new (gimp, uri);
success = gimp_imagefile_save_thumbnail (imagefile, gimage);
g_object_unref (imagefile);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment