[Xfce4-commits] <thunar-volman:jannis/port-to-udev-etc> Make autoplaying audio CDs work again.

Jannis Pohlmann noreply at xfce.org
Thu Jan 21 00:22:01 CET 2010


Updating branch refs/heads/jannis/port-to-udev-etc
         to 8b1e82535b5ed8362c03eaeba445443d3dadbdc8 (commit)
       from ab91ea8a03eb03ecbe3cc729fb070b7101a253e4 (commit)

commit 8b1e82535b5ed8362c03eaeba445443d3dadbdc8
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Thu Jan 21 00:20:01 2010 +0100

    Make autoplaying audio CDs work again.

 thunar-volman/tvm-block-device.c |    2 +-
 thunar-volman/tvm-run.c          |   44 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/thunar-volman/tvm-block-device.c b/thunar-volman/tvm-block-device.c
index b10833c..7fae06e 100644
--- a/thunar-volman/tvm-block-device.c
+++ b/thunar-volman/tvm-block-device.c
@@ -89,7 +89,7 @@ tvm_block_device_added (GUdevClient   *client,
       else if (audio_tracks > 0)
         {
           /* TODO detect mixed CDs with audio AND data tracks */
-          g_debug ("  => audio CD");
+          return tvm_run_cd_player (client, device, channel, error);
         }
       else
         {
diff --git a/thunar-volman/tvm-run.c b/thunar-volman/tvm-run.c
index 9c3e1b5..ec8c3d3 100644
--- a/thunar-volman/tvm-run.c
+++ b/thunar-volman/tvm-run.c
@@ -120,6 +120,7 @@ tvm_run_burn_software (GUdevClient   *client,
   guint               n;
   gint                response;
 
+  g_return_val_if_fail (G_UDEV_IS_CLIENT (client), FALSE);
   g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
   g_return_val_if_fail (XFCONF_IS_CHANNEL (channel), FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -179,7 +180,7 @@ tvm_run_burn_software (GUdevClient   *client,
   if (command != NULL && *command != '\0')
     {
       /* try to execute the preferred burn software */
-      result = tvm_run_command (client, device, channel, command, NULL, NULL, error);
+      result = tvm_run_command (client, device, channel, command, error);
     }
   else
     {
@@ -196,6 +197,47 @@ tvm_run_burn_software (GUdevClient   *client,
 
 
 gboolean
+tvm_run_cd_player (GUdevClient   *client,
+                   GUdevDevice   *device,
+                   XfconfChannel *channel,
+                   GError       **error)
+{
+  gboolean result = FALSE;
+  gchar   *command;
+
+  g_return_val_if_fail (G_UDEV_IS_CLIENT (client), FALSE);
+  g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
+  g_return_val_if_fail (XFCONF_IS_CHANNEL (channel), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  /* check whether autoplaying audio CDs is enabled */
+  if (xfconf_channel_get_bool (channel, "/autoplay-audio-cds/enabled", FALSE))
+    {
+      /* determine the audio CD player command */
+      command = xfconf_channel_get_string (channel, "/autoplay-audio-cds/command", NULL);
+
+      /* check whether the command is set and non-empty */
+      if (command != NULL && *command != '\0')
+        {
+          /* try to lanuch the audio CD player */
+          result = tvm_run_command (client, device, channel, command, error);
+        }
+      else
+        {
+          g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+                       _("The CD player command may not be empty"));
+        }
+      
+      /* free the command string */
+      g_free (command);
+    }
+
+  return result;
+}
+
+
+
+gboolean
 tvm_run_command (GUdevClient   *client,
                  GUdevDevice   *device,
                  XfconfChannel *channel,



More information about the Xfce4-commits mailing list