summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis@xfce.org>2010-01-21 00:20:01 +0100
committerJannis Pohlmann <jannis@xfce.org>2010-01-21 00:20:01 +0100
commit8b1e82535b5ed8362c03eaeba445443d3dadbdc8 (patch)
treed280be2fa3cef70b59c2736aafc44d4392b7f8da
parentab91ea8a03eb03ecbe3cc729fb070b7101a253e4 (diff)
downloadthunar-volman-8b1e82535b5ed8362c03eaeba445443d3dadbdc8.tar.gz
Make autoplaying audio CDs work again.
-rw-r--r--thunar-volman/tvm-block-device.c2
-rw-r--r--thunar-volman/tvm-run.c44
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,