summaryrefslogtreecommitdiff
path: root/thunar-volman
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis@xfce.org>2010-07-21 12:25:46 +0200
committerJannis Pohlmann <jannis@xfce.org>2010-07-25 19:42:29 +0200
commit8761d7e17778886a60ce96dd6d736d5b9b0c147f (patch)
tree3a65f16b2b98f47d026bbe6629a4bc6820422285 /thunar-volman
parent1e50062cee660551c1c2759baf00dfd8aecc07f3 (diff)
downloadthunar-volman-8761d7e17778886a60ce96dd6d736d5b9b0c147f.tar.gz
Add function to run the default audio CD player.
Diffstat (limited to 'thunar-volman')
-rw-r--r--thunar-volman/tvm-run.c42
-rw-r--r--thunar-volman/tvm-run.h2
2 files changed, 41 insertions, 3 deletions
diff --git a/thunar-volman/tvm-run.c b/thunar-volman/tvm-run.c
index 112dfa1..a4bc67b 100644
--- a/thunar-volman/tvm-run.c
+++ b/thunar-volman/tvm-run.c
@@ -155,7 +155,6 @@ tvm_run_burn_software (TvmContext *context,
"ID_CDROM_MEDIA_DVD_PLUS_R",
"ID_CDROM_MEDIA_DVD_PLUS_RW",
};
- gboolean autoburn;
gboolean is_cd = FALSE;
gboolean is_dvd = FALSE;
gboolean result = FALSE;
@@ -168,8 +167,7 @@ tvm_run_burn_software (TvmContext *context,
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* abort without error if autoburning is turned off */
- autoburn = xfconf_channel_get_bool (context->channel, "/autoburn/enabled", FALSE);
- if (!autoburn)
+ if (!xfconf_channel_get_bool (context->channel, "/autoburn/enabled", FALSE))
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Autoburning of blank CDs and DVDs is disabled"));
@@ -242,3 +240,41 @@ tvm_run_burn_software (TvmContext *context,
return result;
}
+
+
+gboolean
+tvm_run_cd_player (TvmContext *context,
+ GError **error)
+{
+ gboolean result = FALSE;
+ gchar *command;
+
+ g_return_val_if_fail (context != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* check whether autoplaying audio CDs is enabled */
+ if (xfconf_channel_get_bool (context->channel, "/autoplay-audio-cds/enabled", FALSE))
+ {
+ /* determine the audio CD player command */
+ command = xfconf_channel_get_string (context->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 (context, NULL, command, error);
+ }
+ else
+ {
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("The CD player command is undefined"));
+ }
+
+ /* free the command string */
+ g_free (command);
+ }
+
+ return result;
+}
diff --git a/thunar-volman/tvm-run.h b/thunar-volman/tvm-run.h
index dc67d13..c3b472a 100644
--- a/thunar-volman/tvm-run.h
+++ b/thunar-volman/tvm-run.h
@@ -33,6 +33,8 @@ gboolean tvm_run_command (TvmContext *context,
GError **error);
gboolean tvm_run_burn_software (TvmContext *context,
GError **error);
+gboolean tvm_run_cd_player (TvmContext *context,
+ GError **error);
G_END_DECLS