From fdd4aace440205b05c013dce834dc7b76a86ad16 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sat, 4 Jun 2016 22:33:18 +0100 Subject: [PATCH] Add support for Blu-ray media --- thunar-volman-settings/tvm-preferences-dialog.c | 6 ++-- thunar-volman/tvm-block-device.c | 41 +++++++++++++++---------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/thunar-volman-settings/tvm-preferences-dialog.c b/thunar-volman-settings/tvm-preferences-dialog.c index 62646f6..1aaa050 100644 --- a/thunar-volman-settings/tvm-preferences-dialog.c +++ b/thunar-volman-settings/tvm-preferences-dialog.c @@ -301,7 +301,7 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog) gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_widget_show (frame); - label = gtk_label_new (_("Video CDs/DVDs")); + label = gtk_label_new (_("Video CDs/DVDs/Blu-rays")); gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ()); gtk_frame_set_label_widget (GTK_FRAME (frame), label); gtk_widget_show (label); @@ -318,8 +318,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog) gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (image); - button = gtk_check_button_new_with_mnemonic (_("Play _video CDs and DVDs when " - "inserted")); + button = gtk_check_button_new_with_mnemonic (_("Play _video CDs, DVDs, and " + "Blu-rays when inserted")); xfconf_g_property_bind (channel, "/autoplay-video-cds/enabled", G_TYPE_BOOLEAN, button, "active"); gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, diff --git a/thunar-volman/tvm-block-device.c b/thunar-volman/tvm-block-device.c index edb6cad..7948e47 100644 --- a/thunar-volman/tvm-block-device.c +++ b/thunar-volman/tvm-block-device.c @@ -327,21 +327,22 @@ tvm_block_device_autorun (TvmContext *context, g_return_val_if_fail (G_IS_MOUNT (mount), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - /* check if autoplaying video CDs and DVDs is enabled */ + /* check if autoplaying optical video is enabled */ autoplay = xfconf_channel_get_bool (context->channel, "/autoplay-video-cds/enabled", FALSE); if (autoplay) { - /* check if we have a video CD or video DVD here */ + /* check if we have an optical video here */ if (tvm_file_test (mount, "vcd", G_FILE_TEST_IS_DIR) - || tvm_file_test (mount, "video_ts", G_FILE_TEST_IS_DIR)) + || tvm_file_test (mount, "video_ts", G_FILE_TEST_IS_DIR) + || tvm_file_test (mount, "bdmv", G_FILE_TEST_IS_DIR)) { - /* determine the autoplay command for video CDs/DVDs */ + /* determine the autoplay command for optical video */ autoplay_command = xfconf_channel_get_string (context->channel, "/autoplay-video-cds/command", "parole"); - /* try to spawn the preferred video CD/DVD player */ + /* try to spawn the preferred optical video player */ result = tvm_run_command (context, mount, autoplay_command, &err); /* free the command string */ @@ -596,8 +597,6 @@ tvm_block_device_mounted (TvmContext *context, const gchar *summary; const gchar *icon; const gchar *volume_name; - gboolean is_cdrom; - gboolean is_dvd; gchar *message; gchar *decoded_name; #endif @@ -608,18 +607,26 @@ tvm_block_device_mounted (TvmContext *context, g_return_if_fail (error == NULL || *error == NULL); #ifdef HAVE_LIBNOTIFY - /* distinguish between CDs and DVDs */ - is_cdrom = g_udev_device_get_property_as_boolean (context->device, "ID_CDROM_MEDIA_CD"); - is_dvd = g_udev_device_get_property_as_boolean (context->device, "ID_CDROM_MEDIA_DVD"); - - if (is_cdrom || is_dvd) + icon = "drive-optical"; + + /* distinguish between CDs, DVDs, Blu-rays */ + if (g_udev_device_get_property_as_boolean (context->device, "ID_CDROM_MEDIA_CD")) + { + /* generate notification info */ + summary = _("CD mounted"); + message = g_strdup (_("The CD was mounted automatically")); + } + else if (g_udev_device_get_property_as_boolean (context->device, "ID_CDROM_MEDIA_DVD")) + { + /* generate notification info */ + summary = _("DVD mounted"); + message = g_strdup (_("The DVD was mounted automatically")); + } + else if (g_udev_device_get_property_as_boolean (context->device, "ID_CDROM_MEDIA_BD")) { /* generate notification info */ - icon = "drive-optical"; - summary = is_cdrom ? _("CD mounted") : _("DVD mounted"); - message = g_strdup (is_cdrom - ? _("The CD was mounted automatically") - : _("The DVD was mounted automatically")); + summary = _("Blu-ray mounted"); + message = g_strdup (_("The Blu-ray was mounted automatically")); } else { -- 2.8.2