[easytag] Refactor ET_Set_Field_File_Tag_Picture()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Refactor ET_Set_Field_File_Tag_Picture()
- Date: Sun, 28 Dec 2014 14:32:52 +0000 (UTC)
commit 787810ab863d12ccf5f9dac3a2ec9692ddda606b
Author: David King <amigadave amigadave com>
Date: Sat Dec 27 22:25:14 2014 +0000
Refactor ET_Set_Field_File_Tag_Picture()
Rename to et_file_tag_set_picture(). Rather than handling a EtPicture
**, take a File_Tag and set the picture field appropriately.
src/et_core.c | 25 ++++++++++++++-----------
src/et_core.h | 2 +-
src/tag_area.c | 3 +--
3 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/src/et_core.c b/src/et_core.c
index bb59ac4..c221212 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -2808,26 +2808,29 @@ gboolean ET_Set_Field_File_Tag_Item (gchar **FileTagField, const gchar *value)
/*
- * Set the value of a field of a FileTag Picture item.
+ * et_file_tag_set_picture:
+ * @file_tag: the #File_Tag on which to set the image
+ * @pic: the image to set
+ *
+ * Set the images inside @file_tag to be @pic, freeing existing images as
+ * necessary. Copies @pic with et_picture_copy_all().
*/
-gboolean
-ET_Set_Field_File_Tag_Picture (EtPicture **FileTagField,
- const EtPicture *pic)
+void
+et_file_tag_set_picture (File_Tag *file_tag,
+ const EtPicture *pic)
{
- g_return_val_if_fail (FileTagField != NULL, FALSE);
+ g_return_if_fail (file_tag != NULL);
- if (*FileTagField != NULL)
+ if (file_tag->picture != NULL)
{
- et_picture_free ((EtPicture *)*FileTagField);
- *FileTagField = NULL;
+ et_picture_free (file_tag->picture);
+ file_tag->picture = NULL;
}
if (pic)
{
- *FileTagField = et_picture_copy_all (pic);
+ file_tag->picture = et_picture_copy_all (pic);
}
-
- return TRUE;
}
diff --git a/src/et_core.h b/src/et_core.h
index 757e37a..e72b2b9 100644
--- a/src/et_core.h
+++ b/src/et_core.h
@@ -298,7 +298,7 @@ gboolean ET_Copy_File_Tag_Item (const ET_File *ETFile, File_Tag *FileTag);
gboolean ET_Set_Field_File_Name_Item (gchar **FileNameField, gchar *value);
gboolean ET_Set_Filename_File_Name_Item (File_Name *FileName, const gchar *filename_utf8, const gchar
*filename);
gboolean ET_Set_Field_File_Tag_Item (gchar **FileTagField, const gchar *value);
-gboolean ET_Set_Field_File_Tag_Picture (EtPicture **FileTagField, const EtPicture *pic);
+void et_file_tag_set_picture (File_Tag *file_tag, const EtPicture *pic);
GList *ET_Displayed_File_List_First (void);
GList *ET_Displayed_File_List_Previous (void);
diff --git a/src/tag_area.c b/src/tag_area.c
index 0850c79..75bd70d 100644
--- a/src/tag_area.c
+++ b/src/tag_area.c
@@ -639,8 +639,7 @@ on_apply_to_selection (GObject *object,
etfile = (ET_File *)l->data;
FileTag = ET_File_Tag_Item_New();
ET_Copy_File_Tag_Item(etfile,FileTag);
- ET_Set_Field_File_Tag_Picture ((EtPicture **)&FileTag->picture,
- res);
+ et_file_tag_set_picture (FileTag, res);
ET_Manage_Changes_Of_File_Data(etfile,NULL,FileTag);
}
if (res)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]