Updating branch refs/heads/master
         to 52411aa69a5600a59df0713b90fd3b0dd31fb17b (commit)
       from 1b1b94237d237897782c4a93529c953d81d535f5 (commit)

commit 52411aa69a5600a59df0713b90fd3b0dd31fb17b
Author: Stefan Ott <[email protected]>
Date:   Sun May 22 13:00:59 2011 +0200

    Use the new radio device detection functionality during initialization

 panel-plugin/xfce4-radio.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index 96c1925..92ae9d6 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -766,12 +766,24 @@ plugin_control_new(XfcePanelPlugin *plugin)
        plugin_data->freq = FREQ_INIT;
 
        // try to auto-detect the radio device
-       if (!access("/dev/radio", R_OK))
-               strcpy(plugin_data->device, "/dev/radio");
-       else if (!access("/dev/radio0", R_OK))
-               strcpy(plugin_data->device, "/dev/radio0");
+       GList *tuners = NULL;
+       tuners = radio_find_tuners(tuners);
+
+       if (g_list_length(tuners) > 0)
+       {
+               GList *tuner = g_list_first(tuners);
+               strcpy(plugin_data->device, tuner->data);
+
+               // free the list elements
+               for (tuner = tuners; tuner; tuner = tuner->next)
+                       g_free(tuner->data);
+       }
        else
+       {
+               // some default value
                strcpy(plugin_data->device, "/dev/radio");
+       }
+       g_list_free(tuners);
 
        plugin_data->show_signal = TRUE;
        plugin_data->show_signal_graphical = FALSE;
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to