[gimp] app: Add and use gimp_image_is_dirty()
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp] app: Add and use gimp_image_is_dirty()
- Date: Fri, 3 Jul 2009 19:09:26 +0000 (UTC)
commit c181f4eb05543bf554a4f97a69e065e6efcbdec6
Author: Martin Nordholts <martinn src gnome org>
Date: Fri Jul 3 21:11:21 2009 +0200
app: Add and use gimp_image_is_dirty()
app/actions/file-commands.c | 5 +++--
app/core/gimpimage-undo.c | 3 ++-
app/core/gimpimage.c | 12 ++++++++++++
app/core/gimpimage.h | 1 +
app/dialogs/file-save-dialog.c | 2 +-
app/display/gimpdisplay-foreach.c | 10 ++++++----
app/display/gimpdisplayshell-close.c | 8 ++++----
app/display/gimpdisplayshell-title.c | 8 ++++----
app/pdb/image-cmds.c | 2 +-
tools/pdbgen/pdb/image.pdb | 2 +-
10 files changed, 35 insertions(+), 18 deletions(-)
---
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index a6d623d..5bf626a 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -232,7 +232,7 @@ file_save_cmd_callback (GtkAction *action,
case GIMP_SAVE_MODE_SAVE:
case GIMP_SAVE_MODE_SAVE_AND_CLOSE:
/* Only save if the image has been modified, or if it is new. */
- if ((image->dirty ||
+ if ((gimp_image_is_dirty (image) ||
! GIMP_GUI_CONFIG (image->gimp->config)->trust_dirty_flag) ||
uri == NULL)
{
@@ -309,7 +309,8 @@ file_save_cmd_callback (GtkAction *action,
}
if (save_mode == GIMP_SAVE_MODE_SAVE_AND_CLOSE &&
- saved && ! display->image->dirty)
+ saved &&
+ ! gimp_image_is_dirty (display->image))
{
gimp_display_close (display);
}
diff --git a/app/core/gimpimage-undo.c b/app/core/gimpimage-undo.c
index 3ea0e4f..ca89509 100644
--- a/app/core/gimpimage-undo.c
+++ b/app/core/gimpimage-undo.c
@@ -314,7 +314,8 @@ gimp_image_undo_can_compress (GimpImage *image,
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- if (image->dirty != 0 && ! gimp_undo_stack_peek (image->redo_stack))
+ if (gimp_image_is_dirty (image) &&
+ ! gimp_undo_stack_peek (image->redo_stack))
{
GimpUndo *undo = gimp_undo_stack_peek (image->undo_stack);
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index b38ee11..9a79828 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -2066,6 +2066,18 @@ gimp_image_clean_all (GimpImage *image)
}
/**
+ * gimp_image_is_dirty:
+ * @image:
+ *
+ * Returns: True if the image is dirty, false otherwise.
+ **/
+gint
+gimp_image_is_dirty (const GimpImage *image)
+{
+ return image->dirty != 0;
+}
+
+/**
* gimp_image_saved:
* @image:
* @uri:
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 85b63c8..b45c946 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -349,6 +349,7 @@ gint gimp_image_dirty (GimpImage *image,
gint gimp_image_clean (GimpImage *image,
GimpDirtyMask dirty_mask);
void gimp_image_clean_all (GimpImage *image);
+gint gimp_image_is_dirty (const GimpImage *image);
/* flush this image's displays */
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index 9ade2d8..a6427d7 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -260,7 +260,7 @@ file_save_dialog_response (GtkWidget *save_dialog,
display = GIMP_DISPLAY_SHELL (parent)->display;
- if (! display->image->dirty)
+ if (! gimp_image_is_dirty (display->image))
gimp_display_close (display);
}
}
diff --git a/app/display/gimpdisplay-foreach.c b/app/display/gimpdisplay-foreach.c
index 6993bfd..549dd3c 100644
--- a/app/display/gimpdisplay-foreach.c
+++ b/app/display/gimpdisplay-foreach.c
@@ -47,7 +47,7 @@ gimp_displays_dirty (Gimp *gimp)
{
GimpDisplay *display = list->data;
- if (display->image && display->image->dirty)
+ if (display->image && gimp_image_is_dirty (display->image))
return TRUE;
}
@@ -59,7 +59,8 @@ gimp_displays_image_dirty_callback (GimpImage *image,
GimpDirtyMask dirty_mask,
GimpContainer *container)
{
- if (image->dirty && image->disp_count > 0 &&
+ if (gimp_image_is_dirty (image) &&
+ image->disp_count > 0 &&
! gimp_container_have (container, GIMP_OBJECT (image)))
gimp_container_add (container, GIMP_OBJECT (image));
}
@@ -84,7 +85,7 @@ gimp_displays_image_clean_callback (GimpImage *image,
GimpDirtyMask dirty_mask,
GimpContainer *container)
{
- if (! image->dirty)
+ if (! gimp_image_is_dirty (image))
gimp_container_remove (container, GIMP_OBJECT (image));
}
@@ -130,7 +131,8 @@ gimp_displays_get_dirty_images (Gimp *gimp)
{
GimpImage *image = list->data;
- if (image->dirty && image->disp_count > 0)
+ if (gimp_image_is_dirty (image) &&
+ image->disp_count > 0)
gimp_container_add (container, GIMP_OBJECT (image));
}
diff --git a/app/display/gimpdisplayshell-close.c b/app/display/gimpdisplayshell-close.c
index 2764bf7..30e5431 100644
--- a/app/display/gimpdisplayshell-close.c
+++ b/app/display/gimpdisplayshell-close.c
@@ -84,10 +84,10 @@ gimp_display_shell_close (GimpDisplayShell *shell,
* it before nuking it--this only applies if its the last view
* to an image canvas. (a image with disp_count = 1)
*/
- if (! kill_it &&
- image &&
- image->disp_count == 1 &&
- image->dirty &&
+ if (! kill_it &&
+ image &&
+ image->disp_count == 1 &&
+ gimp_image_is_dirty (image) &&
shell->display->config->confirm_on_close)
{
/* If there's a save dialog active for this image, then raise it.
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index 8c4220e..f987e31 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -262,7 +262,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
i += print (title, title_len, i, "%%D");
break;
}
- if (image->dirty)
+ if (gimp_image_is_dirty (image))
title[i++] = format[1];
format++;
break;
@@ -274,18 +274,18 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
i += print (title, title_len, i, "%%C");
break;
}
- if (! image->dirty)
+ if (! gimp_image_is_dirty (image))
title[i++] = format[1];
format++;
break;
case 'B': /* dirty flag (long) */
- if (image->dirty)
+ if (gimp_image_is_dirty (image))
i += print (title, title_len, i, "%s", _("(modified)"));
break;
case 'A': /* clean flag (long) */
- if (! image->dirty)
+ if (! gimp_image_is_dirty (image))
i += print (title, title_len, i, "%s", _("(clean)"));
break;
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 740fb62..1342c8c 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -1675,7 +1675,7 @@ image_is_dirty_invoker (GimpProcedure *procedure,
if (success)
{
- dirty = (image->dirty != 0);
+ dirty = gimp_image_is_dirty (image);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index e9aade4..ffb1cee 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -1649,7 +1649,7 @@ HELP
%invoke = (
code => <<'CODE'
{
- dirty = (image->dirty != 0);
+ dirty = gimp_image_is_dirty (image);
}
CODE
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]