Updating branch refs/heads/master
         to abd0435e70845797502da97dc74ab872f0d29b9a (commit)
       from 206f891a5ff8ffcbc656ad1df4a9e3681f7334c4 (commit)

commit abd0435e70845797502da97dc74ab872f0d29b9a
Author: Stefan Ott <[email protected]>
Date:   Fri May 20 05:44:56 2011 +0200

    The plugin now tries to auto-detect your radio device

 NEWS                       |    1 +
 panel-plugin/xfce4-radio.c |    9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index adc9d18..b83f704 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ v0.5.1 (UNRELEASED):
 =====================
  * You can now have a (more) graphical representation of the signal strength
    instead of the abused progress bar
+ * The plugin now tries to auto-detect your radio device
  * Dropped the ability to import old (< 0.4.0) configuration files
  * Small improvements to the tooltip
 
diff --git a/panel-plugin/xfce4-radio.c b/panel-plugin/xfce4-radio.c
index 1726995..730fd4b 100644
--- a/panel-plugin/xfce4-radio.c
+++ b/panel-plugin/xfce4-radio.c
@@ -717,7 +717,14 @@ plugin_control_new(XfcePanelPlugin *plugin)
 
        plugin_data->on = FALSE;
        plugin_data->freq = FREQ_INIT;
-       strcpy(plugin_data->device, "/dev/radio0");
+
+       // 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");
+       else
+               strcpy(plugin_data->device, "/dev/radio");
 
        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