1 Index: thunar-volman/tvm-camera-device.h
2 ===================================================================
3 --- thunar-volman/tvm-camera-device.h (revision 4898)
4 +++ thunar-volman/tvm-camera-device.h (working copy)
7 #include <thunar-volman/tvm-device.h>
12 gboolean tvm_camera_device_added (TvmPreferences *preferences,
13 LibHalContext *context,
15 const gchar *capability,
16 GError **error) G_GNUC_INTERNAL;
21 #endif /* !__TVM_CAMERA_DEVICE_H__ */
22 Index: thunar-volman/tvm-block-device.h
23 ===================================================================
24 --- thunar-volman/tvm-block-device.h (revision 4898)
25 +++ thunar-volman/tvm-block-device.h (working copy)
28 #include <thunar-volman/tvm-device.h>
33 gboolean tvm_block_device_added (TvmPreferences *preferences,
34 LibHalContext *context,
36 const gchar *capability,
37 GError **error) G_GNUC_INTERNAL;
42 #endif /* !__TVM_BLOCK_DEVICE_H__ */
43 Index: thunar-volman/tvm-input-device.h
44 ===================================================================
45 --- thunar-volman/tvm-input-device.h (revision 4898)
46 +++ thunar-volman/tvm-input-device.h (working copy)
49 #include <thunar-volman/tvm-device.h>
54 gboolean tvm_input_device_added (TvmPreferences *preferences,
55 LibHalContext *context,
57 const gchar *capability,
58 GError **error) G_GNUC_INTERNAL;
63 #endif /* !__TVM_INPUT_DEVICE_H__ */
64 Index: thunar-volman/tvm-preferences-dialog.h
65 ===================================================================
66 --- thunar-volman/tvm-preferences-dialog.h (revision 4898)
67 +++ thunar-volman/tvm-preferences-dialog.h (working copy)
70 #include <thunar-volman/tvm-preferences.h>
75 typedef struct _TvmPreferencesDialogClass TvmPreferencesDialogClass;
76 typedef struct _TvmPreferencesDialog TvmPreferencesDialog;
79 GtkWidget *tvm_preferences_dialog_new (void) G_GNUC_INTERNAL G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
84 #endif /* !__TVM_PREFERENCES_DIALOG_H__ */
85 Index: thunar-volman/tvm-device.h
86 ===================================================================
87 --- thunar-volman/tvm-device.h (revision 4898)
88 +++ thunar-volman/tvm-device.h (working copy)
91 #include <thunar-volman/tvm-preferences.h>
100 GError **error) G_GNUC_INTERNAL;
105 #endif /* !__TVM_DEVICE_H__ */
106 Index: thunar-volman/tvm-pda-device.h
107 ===================================================================
108 --- thunar-volman/tvm-pda-device.h (revision 4898)
109 +++ thunar-volman/tvm-pda-device.h (working copy)
112 #include <thunar-volman/tvm-device.h>
117 gboolean tvm_pda_device_added (TvmPreferences *preferences,
118 LibHalContext *context,
120 const gchar *capability,
121 GError **error) G_GNUC_INTERNAL;
126 #endif /* !__TVM_PDA_DEVICE_H__ */
127 Index: thunar-volman/tvm-command-entry.h
128 ===================================================================
129 --- thunar-volman/tvm-command-entry.h (revision 4898)
130 +++ thunar-volman/tvm-command-entry.h (working copy)
138 typedef struct _TvmCommandEntryClass TvmCommandEntryClass;
139 typedef struct _TvmCommandEntry TvmCommandEntry;
141 void tvm_command_entry_set_command (TvmCommandEntry *command_entry,
142 const gchar *command) G_GNUC_INTERNAL;
147 #endif /* !__TVM_COMMAND_ENTRY_H__ */
148 Index: thunar-volman/xfce-heading.h
149 ===================================================================
150 --- thunar-volman/xfce-heading.h (revision 4898)
151 +++ thunar-volman/xfce-heading.h (working copy)
159 typedef struct _XfceHeadingPrivate XfceHeadingPrivate;
160 typedef struct _XfceHeadingClass XfceHeadingClass;
162 void xfce_heading_set_title (XfceHeading *heading,
168 #endif /* !__XFCE_HEADING_H__ */
169 Index: thunar-volman/tvm-crypto-volume.c
170 ===================================================================
171 --- thunar-volman/tvm-crypto-volume.c (revision 0)
172 +++ thunar-volman/tvm-crypto-volume.c (revision 0)
176 + * Copyright (c) 2008 Benedikt Meurer <benny@xfce.org>.
177 + * Copyright (c) 2008 Colin Leroy <colin@colino.net>.
179 + * This program is free software; you can redistribute it and/or modify it
180 + * under the terms of the GNU General Public License as published by the Free
181 + * Software Foundation; either version 2 of the License, or (at your option)
182 + * any later version.
184 + * This program is distributed in the hope that it will be useful, but WITHOUT
185 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
186 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
189 + * You should have received a copy of the GNU General Public License along with
190 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
191 + * Place, Suite 330, Boston, MA 02111-1307 USA
194 +#ifdef HAVE_CONFIG_H
198 +#ifdef HAVE_SYS_TYPES_H
199 +#include <sys/types.h>
201 +#ifdef HAVE_SYS_STAT_H
202 +#include <sys/stat.h>
204 +#ifdef HAVE_SYS_WAIT_H
205 +#include <sys/wait.h>
208 +#ifdef HAVE_MEMORY_H
212 +#ifdef HAVE_STRING_H
217 +#include <dbus/dbus-glib-lowlevel.h>
218 +#include <thunar-volman/tvm-block-device.h>
219 +#include <thunar-volman/tvm-crypto-volume.h>
220 +#include <libhal-storage.h>
223 +tvm_crypto_volume_prompt_update_text (GtkEditable *editable,
229 + gchar **response = (gchar **)data;
230 + if (response == NULL)
233 + *response = gtk_editable_get_chars(editable, 0, -1);
236 +typedef struct _CryptoDialogValidate {
239 +} CryptoDialogValidate;
242 +tvm_crypto_volume_prompt_validate_text (GtkEntry *entry,
245 + CryptoDialogValidate *validate_data = (CryptoDialogValidate *)data;
246 + gtk_dialog_response(GTK_DIALOG(validate_data->dialog), validate_data->response);
250 +tvm_crypto_volume_hal_device_removed (LibHalContext *context,
253 + const gchar *dialog_udi;
254 + GtkWidget *dialog = libhal_ctx_get_user_data (context);
256 + /* check if the active UDI of the dialog was removed */
257 + dialog_udi = g_object_get_data (G_OBJECT (dialog), "udi");
258 + if (exo_str_is_equal (dialog_udi, udi))
260 + /* cancel the dialog */
261 + gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
266 + * tvm_crypto_volume_ask_password:
267 + * @context : a #LibHalContext.
268 + * @udi : the UDI of the device being added, which is watched for removal.
269 + * @icon : the icon or %NULL.
270 + * @title : the prompt title.
271 + * @response_text : the response text.
272 + * @visible : whether text typed should be visible.
273 + * @default_response : Which response to return on Enter.
274 + * @primary_text : the primary prompt text.
275 + * @secondary_text : the secondary prompt text.
276 + * @first_button_text : the first button text.
277 + * @... : %NULL-terminated list of button text, response id pairs.
279 + * Return value: the selected response.
282 +tvm_crypto_volume_ask_password (LibHalContext *context,
285 + const gchar *title,
286 + gchar **response_text,
288 + gint default_response,
289 + const gchar *primary_text,
290 + const gchar *secondary_text,
291 + const gchar *first_button_text,
303 + CryptoDialogValidate validate_data;
305 + g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), 0);
306 + g_return_val_if_fail (context != NULL, GTK_RESPONSE_CANCEL);
308 + /* allocate a new dialog */
309 + dialog = gtk_dialog_new ();
310 + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
311 + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
312 + g_object_set_data_full (G_OBJECT (dialog), "udi", g_strdup (udi), g_free);
313 + gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 6);
314 + gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
316 + /* setup the specified title */
317 + if (G_LIKELY (title != NULL))
318 + gtk_window_set_title (GTK_WINDOW (dialog), title);
320 + /* setup the specified buttons */
321 + if (G_LIKELY (first_button_text != NULL))
323 + va_start (args, first_button_text);
324 + for (response = va_arg (args, gint); first_button_text != NULL; )
326 + /* insert the button */
327 + gtk_dialog_add_button (GTK_DIALOG (dialog), first_button_text, response);
328 + first_button_text = va_arg (args, const gchar *);
329 + if (G_UNLIKELY (first_button_text == NULL))
331 + response = va_arg (args, gint);
336 + /* setup the hbox */
337 + hbox = gtk_hbox_new (FALSE, 12);
338 + gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
339 + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
340 + gtk_widget_show (hbox);
342 + /* setup the specified icon */
343 + if (G_LIKELY (icon != NULL))
345 + /* setup an image for the icon */
346 + image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_DIALOG);
347 + gtk_misc_set_alignment (GTK_MISC (image), 0.0f, 0.0f);
348 + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
349 + gtk_widget_show (image);
352 + /* setup the vbox */
353 + vbox = gtk_vbox_new (FALSE, 0);
354 + gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
355 + gtk_widget_show (vbox);
356 + g_object_set_data(G_OBJECT(dialog), "main_vbox", vbox);
358 + /* setup the primary text */
359 + label = gtk_label_new (primary_text);
360 + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
361 + gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
362 + gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
363 + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
364 + gtk_widget_show (label);
366 + /* setup the secondary text */
367 + if (G_LIKELY (secondary_text != NULL))
369 + label = gtk_label_new (secondary_text);
370 + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
371 + gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
372 + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
373 + gtk_widget_show (label);
374 + g_object_set_data(G_OBJECT(dialog), "secondary_text", label);
377 + entry = gtk_entry_new();
378 + gtk_entry_set_visibility(GTK_ENTRY(entry), visible);
379 + gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
380 + gtk_widget_show (entry);
381 + g_object_set_data(G_OBJECT(dialog), "pass_entry", entry);
383 + /* initialize D-Bus error */
384 + dbus_error_init (&derror);
386 + /* setup HAL to watch the UDI for removal */
387 + libhal_ctx_set_user_data (context, dialog);
388 + libhal_ctx_set_device_removed (context, tvm_crypto_volume_hal_device_removed);
389 + libhal_device_property_watch_all (context, &derror);
391 + /* setup handler for the entered text */
393 + *response_text = NULL;
394 + g_signal_connect_after(G_OBJECT(entry), "insert-text",
395 + G_CALLBACK(tvm_crypto_volume_prompt_update_text),
396 + (gpointer) response_text);
397 + validate_data.dialog = dialog;
398 + validate_data.response = default_response;
399 + g_signal_connect(G_OBJECT(entry), "activate",
400 + G_CALLBACK(tvm_crypto_volume_prompt_validate_text),
401 + (gpointer) &validate_data);
403 + /* run the dialog */
404 + response = gtk_dialog_run (GTK_DIALOG (dialog));
405 + gtk_widget_destroy(dialog);
408 + libhal_ctx_set_device_removed (context, NULL);
409 + libhal_ctx_set_user_data (context, NULL);
410 + dbus_error_free (&derror);
416 +progress_pulse(gpointer data)
418 + GtkProgressBar *progress = GTK_PROGRESS_BAR(data);
419 + g_return_val_if_fail(progress != NULL, FALSE);
421 + gtk_progress_bar_pulse(progress);
427 +tvm_crypto_volume_dbus_call_done (DBusPendingCall *call,
434 +tvm_crypto_volume_mount_install_crypto_volume (LibHalContext *context,
436 + LibHalVolume *volume,
437 + const gchar *password,
438 + gboolean *pass_error,
441 + gchar *plain_udi = NULL;
442 + DBusMessage *message = NULL;
443 + DBusMessage *result = NULL;
444 + DBusConnection *dbus_connection = NULL;
445 + DBusPendingCall *call = NULL;
447 + dbus_bool_t send_err;
448 + *pass_error = FALSE;
449 + GtkWidget *window = NULL;
450 + GtkWidget *label, *vbox, *hbox;
451 + GtkWidget *wait_progress;
454 + g_clear_error(error);
456 + window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
457 + gtk_container_set_border_width(GTK_CONTAINER(window), 8);
458 + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
459 + gtk_window_set_title(GTK_WINDOW(window), _("Encrypted volume"));
460 + gtk_window_set_modal(GTK_WINDOW(window), TRUE);
461 + gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
463 + vbox = gtk_vbox_new(FALSE, 6);
464 + hbox = gtk_hbox_new(FALSE, 6);
465 + image = gtk_image_new_from_icon_name ("gtk-dialog-authentication", GTK_ICON_SIZE_DIALOG);
466 + gtk_misc_set_alignment (GTK_MISC (image), 0.0f, 0.0f);
467 + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
468 + gtk_widget_show (image);
470 + label = gtk_label_new(_("<span weight=\"bold\" size=\"larger\">Mounting encrypted volume...</span>"));
471 + gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
472 + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
473 + gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, FALSE, 0);
475 + label = gtk_label_new(_("Setting up the crypto layer..."));
476 + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
477 + gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, FALSE, 0);
479 + wait_progress = gtk_progress_bar_new();
480 + gtk_box_pack_start(GTK_BOX(vbox), wait_progress, TRUE, FALSE, 0);
482 + gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
484 + gtk_container_add(GTK_CONTAINER(window), hbox);
485 + gtk_widget_show_all(hbox);
486 + animator_id = g_timeout_add(100, progress_pulse, wait_progress);
488 + gtk_widget_show_now(window);
490 + message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
491 + "org.freedesktop.Hal.Device.Volume.Crypto",
494 + if (G_UNLIKELY (message == NULL))
496 + /* out of memory */
497 +oom: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM, g_strerror (ENOMEM));
501 + if (!dbus_message_append_args (message,
502 + DBUS_TYPE_STRING, &password,
503 + DBUS_TYPE_INVALID)) {
504 + dbus_message_unref (message);
508 + dbus_error_init (&derror);
510 + dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
511 + if (G_UNLIKELY (dbus_connection == NULL))
513 + /* propagate the error */
514 + dbus_set_g_error (error, &derror);
518 + send_err = dbus_connection_send_with_reply (dbus_connection, message, &call, -1);
519 + if (G_UNLIKELY (send_err == FALSE))
521 + /* release the result */
522 + dbus_message_unref (message);
526 + dbus_pending_call_set_notify(call, tvm_crypto_volume_dbus_call_done, NULL, NULL);
529 + result = dbus_pending_call_steal_reply(call);
530 + /* release the message */
531 + dbus_message_unref (message);
533 + /* release the connection */
534 + dbus_connection_unref (dbus_connection);
536 + if (G_UNLIKELY (dbus_set_error_from_message(&derror, result)))
538 + /* try to translate the error appropriately */
539 + if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.PermissionDenied") == 0)
541 + /* TRANSLATORS: The user tried to setup a crypto layer (LUKS-encrpyted volume) but got Permission denied. */
542 + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("You are not privileged to setup the crypto layer"));
544 + else if (strcmp (derror.name, "org.freedesktop.Hal.Device.Volume.Crypto.SetupPasswordError") == 0)
546 + /* TRANSLATORS: The user tried to setup a crypto layer (LUKS-encrpyted volume) and typed the wrong password. */
547 + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Wrong password"));
548 + *pass_error = TRUE;
552 + /* no precise error message, use the HAL one */
553 + dbus_set_g_error (error, &derror);
556 + /* release the DBus error */
557 + dbus_error_free (&derror);
558 + dbus_message_unref (result);
564 + dbus_message_unref (result);
565 + plain_udi = libhal_volume_crypto_get_clear_volume_udi (context, volume);
569 + g_source_remove(animator_id);
570 + gtk_widget_destroy(window);
575 + * tvm_crypto_volume_setup:
576 + * @preferences : a #TvmPreferences.
577 + * @context : a #LibHalContext.
578 + * @udi : the HAL volume UDI of the newly added crypto volume.
579 + * @error : return location for errors or %NULL.
581 + * Tries to setup the crypto layer for the volume with the
584 + * Return value: %TRUE if handled, %FALSE if not handled or an
585 + * unrecoverable error occurred.
588 +tvm_crypto_volume_setup (TvmPreferences *preferences,
589 + LibHalContext *context,
593 + gchar *password = NULL;
594 + gboolean pass_error = FALSE;
595 + gint num_tries = 0;
596 + gchar *plain_udi = NULL;
597 + LibHalVolume *volume = NULL;
598 + gboolean result = FALSE;
600 + g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
601 + g_return_val_if_fail (TVM_IS_PREFERENCES (preferences), FALSE);
602 + g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
603 + g_return_val_if_fail (context != NULL, FALSE);
605 + volume = libhal_volume_from_udi (context, udi);
606 + g_return_val_if_fail(volume != NULL, FALSE);
607 + plain_udi = libhal_volume_crypto_get_clear_volume_udi (context, volume);
608 + if (plain_udi != NULL) {
609 + libhal_volume_free(volume);
610 + libhal_free_string(plain_udi);
614 + for (num_tries = 0; num_tries < 3; num_tries++) {
616 + response = tvm_crypto_volume_ask_password (context, udi, "gtk-dialog-authentication", _("Encrypted volume"),
617 + &password, FALSE, GTK_RESPONSE_OK,
618 + pass_error? _("<span weight=\"bold\" size=\"larger\">Wrong password.</span>")
619 + :_("<span weight=\"bold\" size=\"larger\">This volume is encrypted.</span>"),
620 + _("Please enter your password to decrypt and mount the volume."),
621 + _("Ig_nore"), GTK_RESPONSE_CANCEL,
622 + _("_Mount"), GTK_RESPONSE_OK,
624 + if (response == GTK_RESPONSE_CANCEL || response == GTK_RESPONSE_DELETE_EVENT) {
625 + g_clear_error(error);
627 + } else if (password) {
628 + plain_udi = tvm_crypto_volume_mount_install_crypto_volume(context, udi, volume, password, &pass_error, error);
631 + len = strlen(password);
632 + memset(password, 0, len);
633 + g_debug("zeroed password %p", password);
636 + if (*error != NULL && !pass_error) {
637 + /* display an error message to the user (exo-mount won't do it as it won't see the clear device */
638 + GtkWidget *message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
641 + "%s.", _("Failed to setup the encrypted volume"));
642 + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s.", (*error)->message);
643 + gtk_dialog_run (GTK_DIALOG (message));
644 + gtk_widget_destroy (message);
647 + if (plain_udi != NULL) {
648 + libhal_free_string(plain_udi);
657 Index: thunar-volman/tvm-printer-device.h
658 ===================================================================
659 --- thunar-volman/tvm-printer-device.h (revision 4898)
660 +++ thunar-volman/tvm-printer-device.h (working copy)
663 #include <thunar-volman/tvm-device.h>
668 gboolean tvm_printer_device_added (TvmPreferences *preferences,
669 LibHalContext *context,
671 const gchar *capability,
672 GError **error) G_GNUC_INTERNAL;
677 #endif /* !__TVM_PRINTER_DEVICE_H__ */
678 Index: thunar-volman/tvm-crypto-volume.h
679 ===================================================================
680 --- thunar-volman/tvm-crypto-volume.h (revision 0)
681 +++ thunar-volman/tvm-crypto-volume.h (revision 0)
685 + * Copyright (c) 2008 Benedikt Meurer <benny@xfce.org>.
686 + * Copyright (c) 2008 Colin Leroy <colin@colino.net>.
688 + * This program is free software; you can redistribute it and/or modify it
689 + * under the terms of the GNU General Public License as published by the Free
690 + * Software Foundation; either version 2 of the License, or (at your option)
691 + * any later version.
693 + * This program is distributed in the hope that it will be useful, but WITHOUT
694 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
695 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
698 + * You should have received a copy of the GNU General Public License along with
699 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
700 + * Place, Suite 330, Boston, MA 02111-1307 USA
703 +#ifndef __TVM_CRYPTO_VOLUME_H__
704 +#define __TVM_CRYPTO_VOLUME_H__
706 +#include <thunar-volman/tvm-device.h>
710 +gboolean tvm_crypto_volume_setup (TvmPreferences *preferences,
711 + LibHalContext *context,
713 + GError **error) G_GNUC_INTERNAL;
717 +#endif /* !__TVM_CRYPTO_VOLUME_H__ */
718 Index: thunar-volman/xfce-titled-dialog.h
719 ===================================================================
720 --- thunar-volman/xfce-titled-dialog.h (revision 4898)
721 +++ thunar-volman/xfce-titled-dialog.h (working copy)
729 typedef struct _XfceTitledDialogPrivate XfceTitledDialogPrivate;
730 typedef struct _XfceTitledDialogClass XfceTitledDialogClass;
732 void xfce_titled_dialog_set_subtitle (XfceTitledDialog *titled_dialog,
733 const gchar *subtitle);
738 #endif /* !__XFCE_TITLED_DIALOG_H__ */
739 Index: thunar-volman/tvm-preferences.h
740 ===================================================================
741 --- thunar-volman/tvm-preferences.h (revision 4898)
742 +++ thunar-volman/tvm-preferences.h (working copy)
750 typedef struct _TvmPreferencesClass TvmPreferencesClass;
751 typedef struct _TvmPreferences TvmPreferences;
754 TvmPreferences *tvm_preferences_get (void);
759 #endif /* !__TVM_PREFERENCES_H__ */
760 Index: thunar-volman/tvm-pango-extensions.h
761 ===================================================================
762 --- thunar-volman/tvm-pango-extensions.h (revision 4898)
763 +++ thunar-volman/tvm-pango-extensions.h (working copy)
766 #include <pango/pango.h>
771 PangoAttrList *tvm_pango_attr_list_big (void) G_GNUC_CONST G_GNUC_INTERNAL;
772 PangoAttrList *tvm_pango_attr_list_big_bold (void) G_GNUC_CONST G_GNUC_INTERNAL;
774 PangoAttrList *tvm_pango_attr_list_small_italic (void) G_GNUC_CONST G_GNUC_INTERNAL;
775 PangoAttrList *tvm_pango_attr_list_underline_single (void) G_GNUC_CONST G_GNUC_INTERNAL;
780 #endif /* !__TVM_PANGO_EXTENSIONS_H__ */
781 Index: thunar-volman/tvm-run.h
782 ===================================================================
783 --- thunar-volman/tvm-run.h (revision 4898)
784 +++ thunar-volman/tvm-run.h (working copy)
787 #include <thunar-volman/tvm-device.h>
792 gboolean tvm_run_cdburner (TvmPreferences *preferences,
793 LibHalContext *context,
795 const gchar *mount_point,
796 GError **error) G_GNUC_INTERNAL;
801 #endif /* !__TVM_RUN_H__ */
802 Index: thunar-volman/Makefile.am
803 ===================================================================
804 --- thunar-volman/Makefile.am (revision 4898)
805 +++ thunar-volman/Makefile.am (working copy)
807 tvm-camera-device.h \
808 tvm-command-entry.c \
809 tvm-command-entry.h \
810 + tvm-crypto-volume.c \
811 + tvm-crypto-volume.h \
815 Index: thunar-volman/tvm-prompt.h
816 ===================================================================
817 --- thunar-volman/tvm-prompt.h (revision 4898)
818 +++ thunar-volman/tvm-prompt.h (working copy)
821 #include <thunar-volman/tvm-device.h>
829 const gchar *first_button_text,
830 ...) G_GNUC_INTERNAL G_GNUC_NULL_TERMINATED;
835 #endif /* !__TVM_PROMPT_H__ */
836 Index: thunar-volman/tvm-block-device.c
837 ===================================================================
838 --- thunar-volman/tvm-block-device.c (revision 4898)
839 +++ thunar-volman/tvm-block-device.c (working copy)
843 - * Copyright (c) 2007 Benedikt Meurer <benny@xfce.org>.
844 + * Copyright (c) 2007-2008 Benedikt Meurer <benny@xfce.org>.
846 * This program is free software; you can redistribute it and/or modify it
847 * under the terms of the GNU General Public License as published by the Free
849 #include <dbus/dbus-glib-lowlevel.h>
851 #include <thunar-volman/tvm-block-device.h>
852 +#include <thunar-volman/tvm-crypto-volume.h>
853 #include <thunar-volman/tvm-prompt.h>
854 #include <thunar-volman/tvm-run.h>
859 gboolean has_filesystem;
860 + gboolean has_crypto;
864 @@ -749,20 +751,30 @@
865 libhal_free_string (storage_udi);
868 - /* make sure the volume has a mountable filesystem */
869 + /* determine the file system usage of the volume */
870 fsusage = libhal_device_get_property_string (context, udi, "volume.fsusage", NULL);
871 - has_filesystem = (G_LIKELY (fsusage && strcmp (fsusage, "filesystem") == 0));
872 + has_crypto = (G_UNLIKELY (fsusage != NULL && strcmp (fsusage, "crypto") == 0));
873 + has_filesystem = (G_LIKELY (fsusage != NULL && strcmp (fsusage, "filesystem") == 0));
874 libhal_free_string (fsusage);
875 - if (G_UNLIKELY (!has_filesystem))
878 - /* check if we should automount drives, otherwise, we're done here */
879 - g_object_get (G_OBJECT (preferences), "automount-drives", &automount, NULL);
880 - if (G_UNLIKELY (!automount))
882 + /* check if we have a crypto volume to setup here */
883 + if (G_UNLIKELY (has_crypto))
885 + /* try to setup the crypto volume */
886 + return tvm_crypto_volume_setup (preferences, context, udi, error);
888 + else if (G_LIKELY (has_filesystem))
890 + /* check if we should automount drives, otherwise, we're done here */
891 + g_object_get (G_OBJECT (preferences), "automount-drives", &automount, NULL);
892 + if (G_UNLIKELY (!automount))
895 - /* try to mount the block device */
896 - return tvm_block_device_mount (preferences, context, udi, error);
897 + /* try to mount the block device */
898 + return tvm_block_device_mount (preferences, context, udi, error);