[easytag] Simplify core file list management
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Simplify core file list management
- Date: Wed, 25 Mar 2015 17:45:54 +0000 (UTC)
commit 46109b22591173b722a190a69151e855cea52227
Author: David King <amigadave amigadave com>
Date: Wed Mar 25 18:44:02 2015 +0100
Simplify core file list management
The ETFileList pointer in ET_Core always points to the first item, so
avoid calling g_list_first() on it unnecessarily.
src/application_window.c | 2 +-
src/easytag.c | 6 +-----
src/file_list.c | 5 ++---
src/load_files_dialog.c | 2 +-
src/playlist_dialog.c | 2 +-
src/search_dialog.c | 2 +-
src/tag_area.c | 2 +-
7 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index e4a8864..23c72e0 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -1444,7 +1444,7 @@ run_audio_player_using_directory (GError **error)
GList *file_list = NULL;
gboolean res;
- for (l = g_list_first (ETCore->ETFileList); l != NULL; l = g_list_next (l))
+ for (l = ETCore->ETFileList; l != NULL; l = g_list_next (l))
{
ET_File *etfile = (ET_File *)l->data;
const gchar *path = ((File_Name *)etfile->FileNameCur->data)->value;
diff --git a/src/easytag.c b/src/easytag.c
index 69c43b3..02bbe2d 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -95,13 +95,9 @@ void Action_Force_Saving_Selected_Files (void)
*/
gint Save_All_Files_With_Answer (gboolean force_saving_files)
{
- GList *etfilelist;
-
g_return_val_if_fail (ETCore != NULL && ETCore->ETFileList != NULL, FALSE);
- etfilelist = g_list_first (ETCore->ETFileList);
-
- return Save_List_Of_Files (etfilelist, force_saving_files);
+ return Save_List_Of_Files (ETCore->ETFileList, force_saving_files);
}
/*
diff --git a/src/file_list.c b/src/file_list.c
index a770226..43d665b 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -780,7 +780,7 @@ ET_Remove_File_From_File_List (ET_File *ETFile)
// Find the ETFileList containing the ETFile item
ETFileDisplayedList = g_list_find(g_list_first(ETCore->ETFileDisplayedList),ETFile);
- ETFileList = g_list_find(g_list_first(ETCore->ETFileList),ETFile);
+ ETFileList = g_list_find (ETCore->ETFileList, ETFile);
// Note : this ETFileList must be used only for ETCore->ETFileDisplayedList, and not
ETCore->ETFileDisplayed
if (ETCore->ETFileDisplayedList == ETFileDisplayedList)
@@ -802,8 +802,7 @@ ET_Remove_File_From_File_List (ET_File *ETFile)
}
/* Remove the file from the ETFileList list. */
- ETCore->ETFileList = g_list_remove (g_list_first (ETCore->ETFileList),
- ETFileList);
+ ETCore->ETFileList = g_list_remove (ETCore->ETFileList, ETFileList);
// Remove the file from the ETArtistAlbumList list
ET_Remove_File_From_Artist_Album_List(ETFile);
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index ef3ebc2..0db7227 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -515,7 +515,7 @@ Load_File_List (EtLoadFilesDialog *self)
gtk_list_store_clear(priv->load_file_name_model);
- for (l = g_list_first (ETCore->ETFileList); l != NULL; l = g_list_next (l))
+ for (l = ETCore->ETFileList; l != NULL; l = g_list_next (l))
{
etfile = (ET_File *)l->data;
filename_utf8 = g_path_get_basename(((File_Name *)etfile->FileNameNew->data)->value_utf8);
diff --git a/src/playlist_dialog.c b/src/playlist_dialog.c
index f28bf1e..73a53c8 100644
--- a/src/playlist_dialog.c
+++ b/src/playlist_dialog.c
@@ -142,7 +142,7 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
g_list_free_full (selfilelist, (GDestroyNotify)gtk_tree_path_free);
}else
{
- etfilelist = g_list_first(ETCore->ETFileList);
+ etfilelist = ETCore->ETFileList;
}
for (l = etfilelist; l != NULL; l = g_list_next (l))
diff --git a/src/search_dialog.c b/src/search_dialog.c
index 069cb87..0c551ad 100644
--- a/src/search_dialog.c
+++ b/src/search_dialog.c
@@ -406,7 +406,7 @@ Search_File (GtkWidget *search_button, gpointer user_data)
gtk_list_store_clear(priv->search_results_model);
gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,"");
- for (l = g_list_first (ETCore->ETFileList); l != NULL; l = g_list_next (l))
+ for (l = ETCore->ETFileList; l != NULL; l = g_list_next (l))
{
ETFile = (ET_File *)l->data;
diff --git a/src/tag_area.c b/src/tag_area.c
index 8ec2c99..e249663 100644
--- a/src/tag_area.c
+++ b/src/tag_area.c
@@ -386,7 +386,7 @@ on_apply_to_selection (GObject *object,
gint i = 0;
/* FIX ME!: see to fill also the Total Track (it's a good idea?) */
- etfilelistfull = g_list_first(ETCore->ETFileList);
+ etfilelistfull = ETCore->ETFileList;
/* Sort 'etfilelistfull' and 'etfilelist' in the same order. */
sort_mode = g_settings_get_enum (MainSettings, "sort-mode");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]