[easytag/wip/application-window: 27/28] Launch default audio player for selected files



commit 8ed138ad32ce854195b2712cbdaef7c1523909d6
Author: David King <amigadave amigadave com>
Date:   Sat Jul 5 22:35:38 2014 +0100

    Launch default audio player for selected files

 src/browser.c |   30 +++++++++++++++---------------
 src/misc.c    |    2 +-
 src/misc.h    |    1 +
 3 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index 6536fb2..170bc63 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -329,7 +329,7 @@ et_browser_run_player_for_album_list (EtBrowser *self)
     GtkTreeIter iter;
     GtkTreeSelection *selection;
     GList *l;
-    GList *path_list = NULL;
+    GList *file_list = NULL;
 
     priv = et_browser_get_instance_private (self);
 
@@ -347,13 +347,13 @@ et_browser_run_player_for_album_list (EtBrowser *self)
     {
         ET_File *etfile = (ET_File *)l->data;
         gchar *path = ((File_Name *)etfile->FileNameCur->data)->value;
-        path_list = g_list_prepend (path_list, path);
+        file_list = g_list_prepend (file_list, g_file_new_for_path (path));
     }
 
-    path_list = g_list_reverse (path_list);
+    file_list = g_list_reverse (file_list);
 
-    et_run_program (AUDIO_FILE_PLAYER, path_list);
-    g_list_free (path_list);
+    et_run_audio_player (file_list);
+    g_list_free_full (file_list, g_object_unref);
 }
 
 void
@@ -363,7 +363,7 @@ et_browser_run_player_for_artist_list (EtBrowser *self)
     GtkTreeIter iter;
     GtkTreeSelection *selection;
     GList *l, *m;
-    GList *path_list = NULL;
+    GList *file_list = NULL;
 
     priv = et_browser_get_instance_private (self);
 
@@ -382,14 +382,14 @@ et_browser_run_player_for_artist_list (EtBrowser *self)
         {
             ET_File *etfile = (ET_File *)m->data;
             gchar *path = ((File_Name *)etfile->FileNameCur->data)->value;
-            path_list = g_list_prepend (path_list, path);
+            file_list = g_list_prepend (file_list, g_file_new_for_path (path));
         }
     }
 
-    path_list = g_list_reverse (path_list);
+    file_list = g_list_reverse (file_list);
 
-    et_run_program (AUDIO_FILE_PLAYER, path_list);
-    g_list_free (path_list);
+    et_run_audio_player (file_list);
+    g_list_free_full (file_list, g_object_unref);
 }
 
 void
@@ -398,7 +398,7 @@ et_browser_run_player_for_selection (EtBrowser *self)
     EtBrowserPrivate *priv;
     GList *selfilelist = NULL;
     GList *l;
-    GList *path_list = NULL;
+    GList *file_list = NULL;
     GtkTreeSelection *selection;
 
     priv = et_browser_get_instance_private (self);
@@ -410,13 +410,13 @@ et_browser_run_player_for_selection (EtBrowser *self)
     {
         ET_File *etfile = et_browser_get_et_file_from_path (self, l->data);
         gchar *path = ((File_Name *)etfile->FileNameCur->data)->value;
-        path_list = g_list_prepend (path_list, path);
+        file_list = g_list_prepend (file_list, g_file_new_for_path (path));
     }
 
-    path_list = g_list_reverse (path_list);
+    file_list = g_list_reverse (file_list);
 
-    et_run_program (AUDIO_FILE_PLAYER, path_list);
-    g_list_free (path_list);
+    et_run_audio_player (file_list);
+    g_list_free_full (file_list, g_object_unref);
     g_list_free_full (selfilelist, (GDestroyNotify)gtk_tree_path_free);
 }
 
diff --git a/src/misc.c b/src/misc.c
index 1d03e38..decb403 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -737,7 +737,7 @@ static void Open_File_Selection_Window (GtkWidget *entry, gchar *title, GtkFileC
 
 
 
-static void
+void
 et_run_audio_player (GList *files)
 {
     GFileInfo *info;
diff --git a/src/misc.h b/src/misc.h
index ec4496f..34b72c1 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -71,6 +71,7 @@ goffset et_get_file_size (const gchar *filename);
 
 gint Combo_Alphabetic_Sort (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data);
 
+void et_run_audio_player (GList *files);
 gboolean et_run_program (const gchar *program_name, GList *args_list);
 
 void File_Selection_Window_For_File      (GtkWidget *entry);


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