[gnome-disk-utility/udisks2-port] Add a "Change Passphrase" dialog
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/udisks2-port] Add a "Change Passphrase" dialog
- Date: Wed, 7 Dec 2011 17:03:54 +0000 (UTC)
commit 291fe7806e20b9cd6b7ea08072ddf49f29a43a69
Author: David Zeuthen <davidz redhat com>
Date: Wed Dec 7 12:03:37 2011 -0500
Add a "Change Passphrase" dialog
http://people.freedesktop.org/~david/gdu2-change-passphrase.png
Signed-off-by: David Zeuthen <davidz redhat com>
data/ui/Makefile.am | 1 +
data/ui/change-passphrase-dialog.ui | 268 ++++++++++++++++++++++++++++
data/ui/palimpsest.ui | 9 +
src/palimpsest/Makefile.am | 1 +
src/palimpsest/gduchangepassphrasedialog.c | 199 +++++++++++++++++++++
src/palimpsest/gduchangepassphrasedialog.h | 36 ++++
src/palimpsest/gduwindow.c | 36 ++++-
7 files changed, 545 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index 50a8fd3..29e885b 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -19,6 +19,7 @@ ui_DATA = \
format-disk-dialog.ui \
create-disk-image-dialog.ui \
restore-disk-image-dialog.ui \
+ change-passphrase-dialog.ui \
$(NULL)
clean-local :
diff --git a/data/ui/change-passphrase-dialog.ui b/data/ui/change-passphrase-dialog.ui
new file mode 100644
index 0000000..5d300af
--- /dev/null
+++ b/data/ui/change-passphrase-dialog.ui
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkDialog" id="change-passphrase-dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="start_copying_button">
+ <property name="label" translatable="yes">C_hange...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><big>Change Passphrase</big></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">24</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">10</property>
+ <child>
+ <object class="GtkLabel" id="existing-passphrase-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Existing Passphrase:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">existing-passphrase-entry</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="existing-passphrase-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Enter passphrase used to protect the data</property>
+ <property name="tooltip_text" translatable="yes">Enter passphrase used to protect the data</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">â</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show-passphrase-checkbutton">
+ <property name="label" translatable="yes">_Show Passphrases</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="no_show_all">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Check this box to see the passphrases entered above</property>
+ <property name="tooltip_text" translatable="yes">Check this box to see the passphrases entered above</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="passphrase-strength-box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="confirm-passphrase-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Confirm passphrase entered above</property>
+ <property name="tooltip_text" translatable="yes">Confirm passphrase entered above</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">â</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="passphrase-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Enter passphrase used to protect the data</property>
+ <property name="tooltip_text" translatable="yes">Enter passphrase used to protect the data</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">â</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="confirm-passphrase-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">C_onfirm Passphrase:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">confirm-passphrase-entry</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="passphrase-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">New _Passphrase:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">passphrase-entry</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">12</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">button1</action-widget>
+ <action-widget response="-5">start_copying_button</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/data/ui/palimpsest.ui b/data/ui/palimpsest.ui
index 642b5e1..911907f 100644
--- a/data/ui/palimpsest.ui
+++ b/data/ui/palimpsest.ui
@@ -155,6 +155,15 @@
</object>
</child>
<child>
+ <object class="GtkMenuItem" id="generic-menu-item-change-passphrase">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Change Passphrase...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
<object class="GtkMenuItem" id="generic-menu-item-create-volume-image">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/src/palimpsest/Makefile.am b/src/palimpsest/Makefile.am
index 8b5ca93..21525b4 100644
--- a/src/palimpsest/Makefile.am
+++ b/src/palimpsest/Makefile.am
@@ -45,6 +45,7 @@ palimpsest_SOURCES = \
gdurestorediskimagedialog.h gdurestorediskimagedialog.c \
gdupasswordstrengthwidget.h gdupasswordstrengthwidget.c \
gduestimator.h gduestimator.c \
+ gduchangepassphrasedialog.h gduchangepassphrasedialog.c \
$(enum_built_sources) \
$(NULL)
diff --git a/src/palimpsest/gduchangepassphrasedialog.c b/src/palimpsest/gduchangepassphrasedialog.c
new file mode 100644
index 0000000..f9ce61e
--- /dev/null
+++ b/src/palimpsest/gduchangepassphrasedialog.c
@@ -0,0 +1,199 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2008-2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <davidz redhat com>
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+#include "gduapplication.h"
+#include "gduwindow.h"
+#include "gduchangepassphrasedialog.h"
+#include "gdupasswordstrengthwidget.h"
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+
+typedef struct
+{
+ GduWindow *window;
+ UDisksObject *object;
+ UDisksEncrypted *encrypted;
+
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+
+ GtkWidget *existing_passphrase_entry;
+ GtkWidget *passphrase_entry;
+ GtkWidget *confirm_passphrase_entry;
+ GtkWidget *show_passphrase_checkbutton;
+ GtkWidget *passphrase_strengh_box;
+ GtkWidget *passphrase_strengh_widget;
+
+} ChangePassphraseData;
+
+static void
+change_passphrase_data_free (ChangePassphraseData *data)
+{
+ g_object_unref (data->window);
+ g_object_unref (data->object);
+ g_object_unref (data->encrypted);
+ if (data->dialog != NULL)
+ {
+ gtk_widget_hide (data->dialog);
+ gtk_widget_destroy (data->dialog);
+ }
+ if (data->builder != NULL)
+ g_object_unref (data->builder);
+ g_free (data);
+}
+
+static void
+populate (ChangePassphraseData *data)
+{
+ g_object_bind_property (data->show_passphrase_checkbutton,
+ "active",
+ data->existing_passphrase_entry,
+ "visibility",
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (data->show_passphrase_checkbutton,
+ "active",
+ data->passphrase_entry,
+ "visibility",
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (data->show_passphrase_checkbutton,
+ "active",
+ data->confirm_passphrase_entry,
+ "visibility",
+ G_BINDING_SYNC_CREATE);
+}
+
+static void
+update (ChangePassphraseData *data)
+{
+ gboolean can_proceed = FALSE;
+ const gchar *existing_passphrase;
+ const gchar *passphrase;
+ const gchar *confirm_passphrase;
+
+ existing_passphrase = gtk_entry_get_text (GTK_ENTRY (data->existing_passphrase_entry));
+ passphrase = gtk_entry_get_text (GTK_ENTRY (data->passphrase_entry));
+ confirm_passphrase = gtk_entry_get_text (GTK_ENTRY (data->confirm_passphrase_entry));
+
+ gdu_password_strength_widget_set_password (GDU_PASSWORD_STRENGTH_WIDGET (data->passphrase_strengh_widget),
+ passphrase);
+
+ if (strlen (existing_passphrase) > 0 && strlen (passphrase) > 0 &&
+ g_strcmp0 (passphrase, confirm_passphrase) == 0)
+ can_proceed = TRUE;
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, can_proceed);
+}
+
+static void
+on_property_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ ChangePassphraseData *data = user_data;
+ update (data);
+}
+
+static void
+change_passphrase_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ ChangePassphraseData *data = user_data;
+ GError *error;
+
+ error = NULL;
+ if (!udisks_encrypted_call_change_passphrase_finish (UDISKS_ENCRYPTED (source_object),
+ res,
+ &error))
+ {
+ gdu_window_show_error (data->window, _("Error changing passphrase"), error);
+ g_error_free (error);
+ }
+ change_passphrase_data_free (data);
+}
+
+void
+gdu_change_passphrase_dialog_show (GduWindow *window,
+ UDisksObject *object)
+{
+ ChangePassphraseData *data;
+ gint response;
+
+ data = g_new0 (ChangePassphraseData, 1);
+ data->window = g_object_ref (window);
+ data->object = g_object_ref (object);
+ data->encrypted = udisks_object_get_encrypted (object);
+ g_assert (data->encrypted != NULL);
+
+ data->dialog = gdu_application_new_widget (gdu_window_get_application (window),
+ "change-passphrase-dialog.ui",
+ "change-passphrase-dialog",
+ &data->builder);
+
+ data->existing_passphrase_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "existing-passphrase-entry"));
+ g_signal_connect (data->existing_passphrase_entry, "notify::text", G_CALLBACK (on_property_changed), data);
+
+ data->passphrase_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "passphrase-entry"));
+ g_signal_connect (data->passphrase_entry, "notify::text", G_CALLBACK (on_property_changed), data);
+
+ data->confirm_passphrase_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "confirm-passphrase-entry"));
+ g_signal_connect (data->confirm_passphrase_entry, "notify::text", G_CALLBACK (on_property_changed), data);
+ data->show_passphrase_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "show-passphrase-checkbutton"));
+ g_signal_connect (data->show_passphrase_checkbutton, "notify::active", G_CALLBACK (on_property_changed), data);
+
+ data->passphrase_strengh_box = GTK_WIDGET (gtk_builder_get_object (data->builder, "passphrase-strength-box"));
+ data->passphrase_strengh_widget = gdu_password_strength_widget_new ();
+ gtk_widget_set_tooltip_markup (data->passphrase_strengh_widget,
+ _("The strength of the passphrase"));
+ gtk_box_pack_start (GTK_BOX (data->passphrase_strengh_box), data->passphrase_strengh_widget,
+ TRUE, TRUE, 0);
+
+
+ gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (window));
+ gtk_dialog_set_default_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK);
+
+ populate (data);
+ update (data);
+
+ gtk_widget_show_all (data->dialog);
+
+ response = gtk_dialog_run (GTK_DIALOG (data->dialog));
+ gtk_widget_hide (data->dialog);
+ if (response == GTK_RESPONSE_OK)
+ {
+ udisks_encrypted_call_change_passphrase (data->encrypted,
+ gtk_entry_get_text (GTK_ENTRY (data->existing_passphrase_entry)),
+ gtk_entry_get_text (GTK_ENTRY (data->passphrase_entry)),
+ g_variant_new ("a{sv}", NULL), /* options */
+ NULL, /* GCancellable */
+ change_passphrase_cb,
+ data);
+ }
+ else
+ {
+ change_passphrase_data_free (data);
+ }
+}
diff --git a/src/palimpsest/gduchangepassphrasedialog.h b/src/palimpsest/gduchangepassphrasedialog.h
new file mode 100644
index 0000000..6b06736
--- /dev/null
+++ b/src/palimpsest/gduchangepassphrasedialog.h
@@ -0,0 +1,36 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2008-2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <davidz redhat com>
+ */
+
+#ifndef __GDU_CHANGE_PASSPHRASE_DIALOG_H__
+#define __GDU_CHANGE_PASSPHRASE_DIALOG_H__
+
+#include <gtk/gtk.h>
+#include "gdutypes.h"
+
+G_BEGIN_DECLS
+
+void gdu_change_passphrase_dialog_show (GduWindow *window,
+ UDisksObject *object);
+
+G_END_DECLS
+
+#endif /* __GDU_CHANGE_PASSPHRASE_DIALOG_H__ */
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index cc2bac2..9ef9d1b 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -48,6 +48,7 @@
#include "gduformatdiskdialog.h"
#include "gducreatediskimagedialog.h"
#include "gdurestorediskimagedialog.h"
+#include "gduchangepassphrasedialog.h"
/* Keep in sync with tabs in palimpsest.ui file */
typedef enum
@@ -109,6 +110,7 @@ struct _GduWindow
GtkWidget *generic_menu_item_drive_separator;
GtkWidget *generic_menu_item_configure_fstab;
GtkWidget *generic_menu_item_configure_crypttab;
+ GtkWidget *generic_menu_item_change_passphrase;
GtkWidget *generic_menu_item_edit_label;
GtkWidget *generic_menu_item_edit_partition;
GtkWidget *generic_menu_item_format_volume;
@@ -157,6 +159,7 @@ static const struct {
{G_STRUCT_OFFSET (GduWindow, generic_menu_item_drive_separator), "generic-menu-item-drive-separator"},
{G_STRUCT_OFFSET (GduWindow, generic_menu_item_configure_fstab), "generic-menu-item-configure-fstab"},
{G_STRUCT_OFFSET (GduWindow, generic_menu_item_configure_crypttab), "generic-menu-item-configure-crypttab"},
+ {G_STRUCT_OFFSET (GduWindow, generic_menu_item_change_passphrase), "generic-menu-item-change-passphrase"},
{G_STRUCT_OFFSET (GduWindow, generic_menu_item_edit_label), "generic-menu-item-edit-label"},
{G_STRUCT_OFFSET (GduWindow, generic_menu_item_edit_partition), "generic-menu-item-edit-partition"},
{G_STRUCT_OFFSET (GduWindow, generic_menu_item_format_volume), "generic-menu-item-format-volume"},
@@ -197,11 +200,12 @@ typedef enum
SHOW_FLAGS_POPUP_MENU_FORMAT_DISK = (1<<23),
SHOW_FLAGS_POPUP_MENU_CONFIGURE_FSTAB = (1<<24),
SHOW_FLAGS_POPUP_MENU_CONFIGURE_CRYPTTAB = (1<<25),
- SHOW_FLAGS_POPUP_MENU_EDIT_LABEL = (1<<26),
- SHOW_FLAGS_POPUP_MENU_EDIT_PARTITION = (1<<27),
- SHOW_FLAGS_POPUP_MENU_FORMAT_VOLUME = (1<<28),
- SHOW_FLAGS_POPUP_MENU_CREATE_VOLUME_IMAGE = (1<<29),
- SHOW_FLAGS_POPUP_MENU_RESTORE_VOLUME_IMAGE = (1<<30),
+ SHOW_FLAGS_POPUP_MENU_CHANGE_PASSPHRASE = (1<<26),
+ SHOW_FLAGS_POPUP_MENU_EDIT_LABEL = (1<<27),
+ SHOW_FLAGS_POPUP_MENU_EDIT_PARTITION = (1<<28),
+ SHOW_FLAGS_POPUP_MENU_FORMAT_VOLUME = (1<<29),
+ SHOW_FLAGS_POPUP_MENU_CREATE_VOLUME_IMAGE = (1<<30),
+ SHOW_FLAGS_POPUP_MENU_RESTORE_VOLUME_IMAGE = (1<<31),
} ShowFlags;
static void setup_device_page (GduWindow *window, UDisksObject *object);
@@ -228,6 +232,8 @@ static void on_generic_menu_item_configure_fstab (GtkMenuItem *menu_item,
gpointer user_data);
static void on_generic_menu_item_configure_crypttab (GtkMenuItem *menu_item,
gpointer user_data);
+static void on_generic_menu_item_change_passphrase (GtkMenuItem *menu_item,
+ gpointer user_data);
static void on_generic_menu_item_edit_label (GtkMenuItem *menu_item,
gpointer user_data);
static void on_generic_menu_item_edit_partition (GtkMenuItem *menu_item,
@@ -381,6 +387,8 @@ update_for_show_flags (GduWindow *window,
show_flags & SHOW_FLAGS_POPUP_MENU_CONFIGURE_FSTAB);
gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_configure_crypttab),
show_flags & SHOW_FLAGS_POPUP_MENU_CONFIGURE_CRYPTTAB);
+ gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_change_passphrase),
+ show_flags & SHOW_FLAGS_POPUP_MENU_CHANGE_PASSPHRASE);
gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_edit_label),
show_flags & SHOW_FLAGS_POPUP_MENU_EDIT_LABEL);
gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_edit_partition),
@@ -1036,6 +1044,10 @@ gdu_window_constructed (GObject *object)
"activate",
G_CALLBACK (on_generic_menu_item_configure_crypttab),
window);
+ g_signal_connect (window->generic_menu_item_change_passphrase,
+ "activate",
+ G_CALLBACK (on_generic_menu_item_change_passphrase),
+ window);
g_signal_connect (window->generic_menu_item_edit_label,
"activate",
G_CALLBACK (on_generic_menu_item_edit_label),
@@ -2078,6 +2090,7 @@ update_device_page_for_block (GduWindow *window,
SET_MARKUP_FLAGS_NONE);
*show_flags |= SHOW_FLAGS_POPUP_MENU_CONFIGURE_CRYPTTAB;
+ *show_flags |= SHOW_FLAGS_POPUP_MENU_CHANGE_PASSPHRASE;
}
s = calculate_configuration_for_display (block, *show_flags);
@@ -2469,6 +2482,19 @@ on_generic_menu_item_configure_crypttab (GtkMenuItem *menu_item,
gdu_crypttab_dialog_show (window, object);
}
+static void
+on_generic_menu_item_change_passphrase (GtkMenuItem *menu_item,
+ gpointer user_data)
+{
+ GduWindow *window = GDU_WINDOW (user_data);
+ UDisksObject *object;
+
+ object = gdu_volume_grid_get_selected_device (GDU_VOLUME_GRID (window->volume_grid));
+ if (object == NULL)
+ object = gdu_volume_grid_get_block_object (GDU_VOLUME_GRID (window->volume_grid));
+ gdu_change_passphrase_dialog_show (window, object);
+}
+
/* ---------------------------------------------------------------------------------------------------- */
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]