[easytag/wip/glist: 6/10] Refactor list handling in browser.c



commit 35e903ba41abbe4457b091b18820e15256ff8038
Author: David King <amigadave amigadave com>
Date:   Wed May 22 20:12:58 2013 +0100

    Refactor list handling in browser.c

 src/browser.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index 12afc3d..cba633b 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -955,10 +955,8 @@ Browser_List_Row_Selected (GtkTreeSelection *selection, gpointer data)
      * After a file is deleted, this function is called :
      * So we must handle the situation if no rows are selected
      */
-    if (g_list_length(selectedRows) == 0)
+    if (!selectedRows)
     {
-        g_list_foreach(selectedRows, (GFunc) gtk_tree_path_free, NULL);
-        g_list_free(selectedRows);
         return;
     }
 
@@ -977,8 +975,7 @@ Browser_List_Row_Selected (GtkTreeSelection *selection, gpointer data)
         Action_Select_Nth_File_By_Etfile(LastBrowserListETFileSelected);
     }
 
-    g_list_foreach(selectedRows, (GFunc) gtk_tree_path_free, NULL);
-    g_list_free(selectedRows);
+    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
 }
 
 /*
@@ -1232,8 +1229,8 @@ void Browser_List_Refresh_File_In_List (ET_File *ETFile)
                 }
             }
         }
-        g_list_foreach(selectedRow, (GFunc) gtk_tree_path_free, NULL);
-        g_list_free(selectedRow);
+
+        g_list_free_full (selectedRow, (GDestroyNotify)gtk_tree_path_free);
     }
 
     // 3/3. Fails, now we browse the full list to find it
@@ -4174,8 +4171,7 @@ Run_Program_With_Selected_Files (GtkWidget *combobox)
 
     program_ran = Run_Program(program_name,args_list);
 
-    g_list_foreach(selected_paths, (GFunc)gtk_tree_path_free, NULL);
-    g_list_free(selected_paths);
+    g_list_free_full (selected_paths, (GDestroyNotify)gtk_tree_path_free);
     g_list_free(args_list);
 
     if (program_ran)


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