[Pkg-utopia-commits] r248 - packages/unstable/gnome-volume-manager/debian/patches
Sjoerd Simons
sjoerd@costa.debian.org
Wed, 22 Jun 2005 09:47:32 +0000
Author: sjoerd
Date: 2005-06-22 09:47:31 +0000 (Wed, 22 Jun 2005)
New Revision: 248
Added:
packages/unstable/gnome-volume-manager/debian/patches/06_pmount_crypt.patch
packages/unstable/gnome-volume-manager/debian/patches/07_dialogs_info.patch
packages/unstable/gnome-volume-manager/debian/patches/08_photographss_typo.patch
Log:
New nice patches from martin
Added: packages/unstable/gnome-volume-manager/debian/patches/06_pmount_crypt.patch
===================================================================
--- packages/unstable/gnome-volume-manager/debian/patches/06_pmount_crypt.patch 2005-06-22 09:35:20 UTC (rev 247)
+++ packages/unstable/gnome-volume-manager/debian/patches/06_pmount_crypt.patch 2005-06-22 09:47:31 UTC (rev 248)
@@ -0,0 +1,197 @@
+diff -ruN gnome-volume-manager-1.3.1-old/configure.in gnome-volume-manager-1.3.1/configure.in
+--- gnome-volume-manager-1.3.1-old/configure.in 2005-03-31 18:27:06.000000000 +0200
++++ gnome-volume-manager-1.3.1/configure.in 2005-06-02 16:49:38.000000000 +0200
+@@ -82,7 +82,7 @@
+ AC_PROG_INTLTOOL([0.27.2])
+ AM_GLIB_GNU_GETTEXT
+
+-PKG_CHECK_MODULES(GVM, libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.0 gtk+-2.0 >= 2.6.0)
++PKG_CHECK_MODULES(GVM, libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.0 gtk+-2.0 >= 2.6.0 libgksuui1.0 >= 1.0.0)
+ AC_SUBST(GVM_CFLAGS)
+ AC_SUBST(GVM_LIBS)
+
+diff -ruN gnome-volume-manager-1.3.1-old/src/manager.c gnome-volume-manager-1.3.1/src/manager.c
+--- gnome-volume-manager-1.3.1-old/src/manager.c 2005-06-02 16:48:57.000000000 +0200
++++ gnome-volume-manager-1.3.1/src/manager.c 2005-06-02 16:49:11.000000000 +0200
+@@ -22,6 +22,8 @@
+ #include <dbus/dbus-glib.h>
+ #include <libhal.h>
+ #include <signal.h>
++#include <libgksuui1.0/gksuui.h>
++#include <sys/wait.h>
+
+ #include "gvm.h"
+
+@@ -599,6 +601,139 @@
+ }
+
+ /*
++ * gvm_device_mount_finished - called back when mount finished.
++ *
++ * This needs to close the pid, remove the FIFO (if given, that applies to
++ * encrypted devices) and display an error message if the mount failed.
++ */
++void
++gvm_device_mount_finished (GPid pid, gint status, const char* fifoname)
++{
++ g_spawn_close_pid (pid);
++
++ dbg ("gvm_device_mount_finished: mount process %i returned with %i\n", pid,
++ status);
++
++ if (fifoname)
++ unlink (fifoname);
++
++ if (!WIFEXITED(status)) {
++ warn (BIN_MOUNT " did not exit normally\n");
++ return;
++ }
++
++ /* if we have an encryption secret, we display an error message
++ * if the mount failed. */
++ if (WEXITSTATUS(status) && fifoname) {
++ GtkMessageDialog *dialog;
++ dialog = gtk_message_dialog_new (NULL, 0,
++ GTK_MESSAGE_ERROR,
++ GTK_BUTTONS_CLOSE,
++ _("Could not mount encrypted device. Did you supply a wrong passphrase?"));
++ gtk_widget_show (GTK_WIDGET(dialog));
++ g_signal_connect_swapped (dialog, "response",
++ G_CALLBACK (gtk_widget_destroy), dialog);
++ }
++}
++
++/*
++ * gvm_device_mount_encrypted_pwd_callback - Called from
++ * gvm_device_mount_encrypted after the password dialog finished. Use BIN_MOUNT
++ * to mount an encrypted given device.
++ */
++static void
++gvm_device_mount_encrypted_pwd_callback (GksuuiDialog* dialog, gint response,
++ char *udi)
++{
++ char *argv[5] = {BIN_MOUNT, udi, "--passphrase", NULL, NULL};
++ GError *error = NULL;
++ char* fifoname = NULL;
++ FILE* fifo = NULL;
++ GPid mount_pid;
++ char* passphrase = NULL;
++
++ if (!udi) {
++ warn ("gvm_device_mount_encrypted_pwd_callback: udi == NULL!\n");
++ return;
++ }
++ if (!dialog) {
++ warn ("gvm_device_mount_encrypted_pwd_callback: dialog == NULL!\n");
++ return;
++ }
++
++ /* Check whether we got a passphrase */
++ if (response == GTK_RESPONSE_OK)
++ passphrase = gksuui_dialog_get_password (dialog);
++ gtk_widget_destroy (GTK_WIDGET (dialog));
++ if (!passphrase)
++ return;
++
++ /* Create a private temporary FIFO */
++ for (;;) {
++ fifoname = tmpnam(NULL);
++ if (!fifoname) {
++ warn ("gvm_device_mount_encrypted: cannot create a temporary name\n");
++ return;
++ }
++
++ int result = mkfifo (fifoname, 0700);
++ if (result == 0)
++ break;
++ if (errno != EEXIST) {
++ warn ("gvm_device_mount_encrypted: cannot create fifo: %s\n",
++ strerror (errno));
++ return;
++ }
++ }
++ argv[3] = fifoname;
++
++ /* Call the mount process asynchronously */
++ if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL,
++ NULL, &mount_pid, &error)) {
++ warn ("gvm_device_mount_encrypted: could not execute " BIN_MOUNT ": %s\n",
++ error->message);
++ return;
++ }
++
++ /* When mounting finishes, call the clean up and error handling
++ * callback. */
++ g_child_watch_add (mount_pid, gvm_device_mount_finished, fifoname);
++
++ /* now the mount process runs, write the secret into the FIFO;
++ * this blocks until the pmount child opens the fifo */
++ fifo = fopen (fifoname, "w");
++ if (fifo)
++ fputs (passphrase, fifo);
++ else {
++ warn ("gvm_device_mount_encrypted: cannot open fifo: %s\n",
++ strerror (errno));
++ unlink (fifoname);
++ }
++ free (passphrase);
++ fclose (fifo);
++ free (udi);
++}
++
++/*
++ * gvm_device_mount_encrypted - create a passphrase dialog for an encrypted
++ * dialog and set up gvm_device_mount_encrypted_pwd_callback() as a callback.
++ *
++ * @return TRUE iff the mount was succesful
++ */
++static void
++gvm_device_mount_encrypted (const char *udi)
++{
++ GksuuiDialog *dialog = GKSUUI_DIALOG (gksuui_dialog_new());
++ gtk_window_set_title (GTK_WINDOW(dialog), _("Encrypted volume detected"));
++ gksuui_dialog_set_message (dialog, _("A passphrase is required to decrypt this volume"));
++
++ g_signal_connect (dialog, "response",
++ G_CALLBACK (gvm_device_mount_encrypted_pwd_callback), g_strdup (udi));
++
++ gtk_widget_show_all (GTK_WIDGET(dialog));
++}
++
++/*
+ * gvm_device_mount - use BIN_MOUNT to mount the given device.
+ *
+ * @return TRUE iff the mount was succesful
+@@ -615,6 +750,14 @@
+ return FALSE;
+ }
+
++ /* Check for encrypted device */
++ if (libhal_device_property_exists (hal_ctx, udi, "volume.fsusage", NULL) &&
++ g_strcasecmp(libhal_device_get_property_string (hal_ctx, udi,
++ "volume.fsusage", NULL), "crypto") == 0) {
++ dbg ("encrypted volume found\n");
++ gvm_device_mount_encrypted (udi);
++ }
++
+ argv[0] = BIN_MOUNT;
+ argv[1] = udi;
+ argv[2] = NULL;
+@@ -1300,11 +1443,15 @@
+ /* only mount if the block device got a sensible filesystem */
+ if (!libhal_device_property_exists (ctx, udi,
+ "volume.fsusage",
+- NULL) ||
++ NULL) || (
++ strcmp (libhal_device_get_property_string (ctx, udi,
++ "volume.fsusage",
++ NULL),
++ "filesystem") != 0 &&
+ strcmp (libhal_device_get_property_string (ctx, udi,
+ "volume.fsusage",
+ NULL),
+- "filesystem") != 0)
++ "crypto") != 0))
+ continue;
+
+ device_file = libhal_device_get_property_string (ctx, udi,
Added: packages/unstable/gnome-volume-manager/debian/patches/07_dialogs_info.patch
===================================================================
--- packages/unstable/gnome-volume-manager/debian/patches/07_dialogs_info.patch 2005-06-22 09:35:20 UTC (rev 247)
+++ packages/unstable/gnome-volume-manager/debian/patches/07_dialogs_info.patch 2005-06-22 09:47:31 UTC (rev 248)
@@ -0,0 +1,39 @@
+diff -ruN gnome-volume-manager-1.3.1-old/src/manager.c gnome-volume-manager-1.3.1/src/manager.c
+--- gnome-volume-manager-1.3.1-old/src/manager.c 2005-05-31 13:42:18.000000000 +0200
++++ gnome-volume-manager-1.3.1/src/manager.c 2005-05-31 13:43:31.000000000 +0200
+@@ -340,7 +340,7 @@
+ gboolean retval;
+
+ askme = gtk_message_dialog_new (NULL,
+- 0, GTK_MESSAGE_WARNING,
++ 0, GTK_MESSAGE_INFO,
+ GTK_BUTTONS_NONE,
+ _("Run command from inserted media?"));
+
+@@ -440,7 +440,7 @@
+
+ if (config.autophoto) {
+ retval=TRUE;
+- askme = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING,
++ askme = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO,
+ GTK_BUTTONS_NONE,
+ _("Import photos from device?"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (askme),
+@@ -488,7 +488,7 @@
+ dbg ("Camera detected: %s\n", udi);
+
+ if (config.autophoto) {
+- askme = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING,
++ askme = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO,
+ GTK_BUTTONS_NONE,
+ _("Import photos from camera?"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (askme),
+@@ -771,7 +771,7 @@
+ GtkWidget *askme;
+
+ askme = gtk_message_dialog_new (NULL, 0,
+- GTK_MESSAGE_WARNING,
++ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_NONE,
+ _("Browse files or play tracks from disc?"));
+
Added: packages/unstable/gnome-volume-manager/debian/patches/08_photographss_typo.patch
===================================================================
--- packages/unstable/gnome-volume-manager/debian/patches/08_photographss_typo.patch 2005-06-22 09:35:20 UTC (rev 247)
+++ packages/unstable/gnome-volume-manager/debian/patches/08_photographss_typo.patch 2005-06-22 09:47:31 UTC (rev 248)
@@ -0,0 +1,60 @@
+diff -ruN gnome-volume-manager-1.3.1-old/po/cs.po gnome-volume-manager-1.3.1/po/cs.po
+--- gnome-volume-manager-1.3.1-old/po/cs.po 2005-03-31 18:27:06.000000000 +0200
++++ gnome-volume-manager-1.3.1/po/cs.po 2005-05-31 13:49:36.000000000 +0200
+@@ -296,7 +296,7 @@
+ #: src/manager.c:378
+ msgid ""
+ "There are photos on the plugged-in camera. Would you like to import these "
+-"photographss into your album?"
++"photographs into your album?"
+ msgstr "Na vašem připojeném fotoaparátu jsou fotografie. Chcete tyto fotografie importovat do vašeho alba?"
+
+ #: src/manager.c:584
+diff -ruN gnome-volume-manager-1.3.1-old/po/en_CA.po gnome-volume-manager-1.3.1/po/en_CA.po
+--- gnome-volume-manager-1.3.1-old/po/en_CA.po 2005-03-31 18:27:06.000000000 +0200
++++ gnome-volume-manager-1.3.1/po/en_CA.po 2005-05-31 13:49:36.000000000 +0200
+@@ -296,7 +296,7 @@
+ #: ../src/manager.c:378
+ msgid ""
+ "There are photos on the plugged-in camera. Would you like to import these "
+-"photographss into your album?"
++"photographs into your album?"
+ msgstr ""
+ "There are photos on the plugged-in camera. Would you like to import these "
+ "photographs into your album?"
+diff -ruN gnome-volume-manager-1.3.1-old/po/nb.po gnome-volume-manager-1.3.1/po/nb.po
+--- gnome-volume-manager-1.3.1-old/po/nb.po 2005-03-31 18:27:06.000000000 +0200
++++ gnome-volume-manager-1.3.1/po/nb.po 2005-05-31 13:49:36.000000000 +0200
+@@ -284,7 +284,7 @@
+ #: ../src/manager.c:378
+ msgid ""
+ "There are photos on the plugged-in camera. Would you like to import these "
+-"photographss into your album?"
++"photographs into your album?"
+ msgstr ""
+ "Det finnes bilder på kameraet som ble koblet til. Vil du importere disse "
+ "bildene til ditt fotoalbum?"
+diff -ruN gnome-volume-manager-1.3.1-old/po/no.po gnome-volume-manager-1.3.1/po/no.po
+--- gnome-volume-manager-1.3.1-old/po/no.po 2005-03-31 18:27:06.000000000 +0200
++++ gnome-volume-manager-1.3.1/po/no.po 2005-05-31 13:49:36.000000000 +0200
+@@ -284,7 +284,7 @@
+ #: ../src/manager.c:378
+ msgid ""
+ "There are photos on the plugged-in camera. Would you like to import these "
+-"photographss into your album?"
++"photographs into your album?"
+ msgstr ""
+ "Det finnes bilder på kameraet som ble koblet til. Vil du importere disse "
+ "bildene til ditt fotoalbum?"
+diff -ruN gnome-volume-manager-1.3.1-old/src/manager.c gnome-volume-manager-1.3.1/src/manager.c
+--- gnome-volume-manager-1.3.1-old/src/manager.c 2005-05-31 13:48:33.000000000 +0200
++++ gnome-volume-manager-1.3.1/src/manager.c 2005-05-31 13:49:06.000000000 +0200
+@@ -495,7 +495,7 @@
+ "%s",
+ _("There are photos on the plugged-in camera. "
+ "Would you like to import these "
+- "photographss into your album?"));
++ "photographs into your album?"));
+ gtk_dialog_add_buttons (GTK_DIALOG (askme),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ _("_Import Photos"), IMPORT,