[easytag] Split ET_File_Info off to a separate file



commit e8d9f1ba1526c12ff474b55616f363e36d2d34b3
Author: David King <amigadave amigadave com>
Date:   Fri Feb 13 17:22:22 2015 +0000

    Split ET_File_Info off to a separate file

 Makefile.am      |    2 ++
 src/core_types.h |   19 -------------------
 src/file.c       |   32 +-------------------------------
 src/file.h       |    2 +-
 src/file_info.c  |   42 ++++++++++++++++++++++++++++++++++++++++++
 src/file_info.h  |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/file_list.c  |    2 +-
 7 files changed, 97 insertions(+), 52 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 3c4acd1..3b3b948 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,7 @@ easytag_SOURCES = \
        src/file.c \
        src/file_area.c \
        src/file_description.c \
+       src/file_info.c \
        src/file_list.c \
        src/file_tag.c \
        src/load_files_dialog.c \
@@ -110,6 +111,7 @@ easytag_headers = \
        src/file.h \
        src/file_area.h \
        src/file_description.h \
+       src/file_info.h \
        src/file_list.h \
        src/file_tag.h \
        src/genres.h \
diff --git a/src/core_types.h b/src/core_types.h
index 856b05f..c07693a 100644
--- a/src/core_types.h
+++ b/src/core_types.h
@@ -71,25 +71,6 @@ typedef enum
 } ET_Tag_Type;
 
 /*
- * Structure containing informations of the header of file
- * Nota: This struct was copied from an "MP3 structure", and will change later.
- */
-typedef struct
-{
-    gint version;               /* Version of bitstream (mpeg version for mp3, encoder version for ogg) */
-    gint mpeg25;                /* Version is MPEG 2.5? */
-    gsize layer; /* "MP3 data" */
-    gint bitrate;               /* Bitrate (kb/s) */
-    gboolean variable_bitrate;  /* Is a VBR file? */
-    gint samplerate;            /* Samplerate (Hz) */
-    gint mode;                  /* Stereo, ... or channels for ogg */
-    goffset size;               /* The size of file (in bytes) */
-    gint duration;              /* The duration of file (in seconds) */
-    gchar *mpc_profile;         /* MPC data */
-    gchar *mpc_version;         /* MPC data : encoder version  (also for Speex) */
-} ET_File_Info;
-
-/*
  * EtFileHeaderFields:
  * @description: a description of the file type, such as MP3 File
  * @version_label: the label for the encoder version, such as MPEG
diff --git a/src/file.c b/src/file.c
index 299041d..96ec534 100644
--- a/src/file.c
+++ b/src/file.c
@@ -71,7 +71,6 @@
 static gboolean ET_Free_File_Name_List            (GList *FileNameList);
 static gboolean ET_Free_File_Tag_List (GList *FileTagList);
 static void ET_Free_File_Name_Item (File_Name *FileName);
-static gboolean ET_Free_File_Info_Item (ET_File_Info *ETFileInfo);
 
 static void ET_Initialize_File_Name_Item (File_Name *FileName);
 
@@ -105,19 +104,6 @@ File_Name *ET_File_Name_Item_New (void)
 }
 
 /*
- * Create a new File_Info structure
- */
-ET_File_Info *
-ET_File_Info_Item_New (void)
-{
-    ET_File_Info *ETFileInfo;
-
-    ETFileInfo = g_slice_new0 (ET_File_Info);
-
-    return ETFileInfo;
-}
-
-/*
  * Create a new ET_File structure
  */
 ET_File *
@@ -1054,7 +1040,7 @@ ET_Free_File_List_Item (ET_File *ETFile)
         /* Frees infos of ETFileInfo */
         if (ETFile->ETFileInfo)
         {
-            ET_Free_File_Info_Item (ETFile->ETFileInfo);
+            et_file_info_free (ETFile->ETFileInfo);
         }
 
         g_free(ETFile->ETFileExtension);
@@ -1120,22 +1106,6 @@ ET_Free_File_Tag_List (GList *FileTagList)
 }
 
 
-/*
- * Frees a File_Info item.
- */
-static gboolean
-ET_Free_File_Info_Item (ET_File_Info *ETFileInfo)
-{
-    g_return_val_if_fail (ETFileInfo != NULL, FALSE);
-
-    g_free(ETFileInfo->mpc_profile);
-    g_free(ETFileInfo->mpc_version);
-
-    g_slice_free (ET_File_Info, ETFileInfo);
-    return TRUE;
-}
-
-
 /*********************
  * Copying functions *
  *********************/
diff --git a/src/file.h b/src/file.h
index ef41d0b..8eaf789 100644
--- a/src/file.h
+++ b/src/file.h
@@ -25,6 +25,7 @@ G_BEGIN_DECLS
 
 #include "core_types.h"
 #include "file_description.h"
+#include "file_info.h"
 #include "file_tag.h"
 
 /*
@@ -75,7 +76,6 @@ typedef struct
 gboolean ET_Check_If_File_Is_Saved (const ET_File *ETFile);
 
 ET_File * ET_File_Item_New (void);
-ET_File_Info * ET_File_Info_Item_New (void);
 File_Name * ET_File_Name_Item_New (void);
 void ET_Free_File_List_Item (ET_File *ETFile);
 
diff --git a/src/file_info.c b/src/file_info.c
new file mode 100644
index 0000000..088256c
--- /dev/null
+++ b/src/file_info.c
@@ -0,0 +1,42 @@
+/* EasyTAG - tag editor for audio files
+ * Copyright (C) 2015  David King <amigadave amigadave com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "file_info.h"
+
+/*
+ * Create a new File_Info structure
+ */
+ET_File_Info *
+et_file_info_new (void)
+{
+    return g_slice_new0 (ET_File_Info);
+}
+
+/*
+ * Frees a File_Info item.
+ */
+void
+et_file_info_free (ET_File_Info *file_info)
+{
+    g_return_if_fail (file_info != NULL);
+
+    g_free (file_info->mpc_profile);
+    g_free (file_info->mpc_version);
+
+    g_slice_free (ET_File_Info, file_info);
+}
diff --git a/src/file_info.h b/src/file_info.h
new file mode 100644
index 0000000..8e52322
--- /dev/null
+++ b/src/file_info.h
@@ -0,0 +1,50 @@
+/* EasyTAG - tag editor for audio files
+ * Copyright (C) 2015  David King <amigadave amigadave com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef ET_FILE_INFO_H_
+#define ET_FILE_INFO_H_
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/*
+ * Structure containing informations of the header of file
+ * Nota: This struct was copied from an "MP3 structure", and will change later.
+ */
+typedef struct
+{
+    gint version;               /* Version of bitstream (mpeg version for mp3, encoder version for ogg) */
+    gint mpeg25;                /* Version is MPEG 2.5? */
+    gsize layer; /* "MP3 data" */
+    gint bitrate;               /* Bitrate (kb/s) */
+    gboolean variable_bitrate;  /* Is a VBR file? */
+    gint samplerate;            /* Samplerate (Hz) */
+    gint mode;                  /* Stereo, ... or channels for ogg */
+    goffset size;               /* The size of file (in bytes) */
+    gint duration;              /* The duration of file (in seconds) */
+    gchar *mpc_profile;         /* MPC data */
+    gchar *mpc_version;         /* MPC data : encoder version  (also for Speex) */
+} ET_File_Info;
+
+ET_File_Info * et_file_info_new (void);
+void et_file_info_free (ET_File_Info *file_info);
+
+G_END_DECLS
+
+#endif /* !ET_FILE_INFO_H_ */
diff --git a/src/file_list.c b/src/file_list.c
index a50a46a..93c0059 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -334,7 +334,7 @@ et_file_list_add (GList *file_list,
     }
 
     /* Fill the ET_File_Info structure */
-    ETFileInfo = ET_File_Info_Item_New ();
+    ETFileInfo = et_file_info_new ();
 
     switch (description->FileType)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]