summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2009-04-20 17:39:32 +0200
committerTomas Bzatek <tbzatek@redhat.com>2009-04-27 15:05:23 +0200
commit583f116fb93fcfecd94f97a2d928cf2e6b9f62bf (patch)
tree3c056d13a15608bc133f94adedb87b2f49d58ddc
parent532699a271252700d677e9e3d74997e7684a9077 (diff)
downloadgnome-disk-utility-583f116fb93fcfecd94f97a2d928cf2e6b9f62bf.tar.gz
gnome-disk-utility-583f116fb93fcfecd94f97a2d928cf2e6b9f62bf.tar.xz
gnome-disk-utility-583f116fb93fcfecd94f97a2d928cf2e6b9f62bf.zip
add "Open Disk Utility" button
-rw-r--r--src/gdu-format-tool/TODO2
-rw-r--r--src/gdu-format-tool/format-window.c28
2 files changed, 29 insertions, 1 deletions
diff --git a/src/gdu-format-tool/TODO b/src/gdu-format-tool/TODO
index 41a960a..f470f3f 100644
--- a/src/gdu-format-tool/TODO
+++ b/src/gdu-format-tool/TODO
@@ -13,7 +13,7 @@ Short-term:
DONE - get rid of the Revert button
- call luks_lock() beside unmount, that would allow formatting active LUKS devices
- install to libexec
- - add Palimpsest button
+ DONE - add Palimpsest button
Standalone mode:
DONE - refresh volume selector on hotplug/unplug
diff --git a/src/gdu-format-tool/format-window.c b/src/gdu-format-tool/format-window.c
index 318107c..fd469bc 100644
--- a/src/gdu-format-tool/format-window.c
+++ b/src/gdu-format-tool/format-window.c
@@ -35,6 +35,8 @@
#include "format-window.h"
#include "format-window-operation.h"
+#define DISK_MANAGEMENT_UTILITY "palimpsest"
+
/* ---------------------------------------------------------------------------------------------------- */
@@ -103,6 +105,7 @@ update_ui_controls (FormatDialogPrivate *priv)
gtk_widget_set_sensitive (priv->controls_box, sensitive);
gtk_dialog_set_response_sensitive (priv->dialog, GTK_RESPONSE_OK, sensitive && gtk_combo_box_get_active (GTK_COMBO_BOX (priv->part_type_combo_box)) >= 0);
+ gtk_dialog_set_response_sensitive (priv->dialog, GTK_RESPONSE_ACCEPT, ! priv->job_running);
if (device != NULL)
g_object_unref (device);
@@ -238,7 +241,23 @@ set_new_presentable (FormatDialogPrivate *priv, GduPresentable *presentable)
}
}
+/* ---------------------------------------------------------------------------------------------------- */
+static void
+spawn_palimpsest (FormatDialogPrivate *priv)
+{
+ char *argv[] = { DISK_MANAGEMENT_UTILITY, NULL, NULL };
+ GduDevice *device;
+
+ device = gdu_presentable_get_device (priv->presentable);
+ if (device) {
+ argv[1] = g_strdup_printf ("--show-drive=%s", gdu_device_get_device_file (device));
+ g_object_unref (device);
+ }
+
+ g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
+ g_free (argv[1]);
+}
/* ---------------------------------------------------------------------------------------------------- */
@@ -282,6 +301,11 @@ format_dialog_got_response (GtkDialog *dialog,
if (response_id == GTK_RESPONSE_OK) {
do_format (priv);
}
+ else
+ if (response_id == GTK_RESPONSE_ACCEPT) {
+ spawn_palimpsest (priv);
+ nautilus_gdu_destroy (priv);
+ }
else {
if (priv->job_running) {
cancel_operation (priv);
@@ -316,6 +340,7 @@ nautilus_gdu_spawn_dialog (GduPresentable *presentable)
GtkDialog *dialog;
GtkWidget *content_area;
FormatDialogPrivate *priv;
+ GtkWidget *button;
g_return_if_fail (presentable != NULL);
@@ -341,6 +366,9 @@ nautilus_gdu_spawn_dialog (GduPresentable *presentable)
_("_Format"), GTK_RESPONSE_OK,
NULL);
priv->close_button = gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+ button = gtk_dialog_add_button (dialog, _("Open Disk Utility"), GTK_RESPONSE_ACCEPT);
+ gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (gtk_dialog_get_action_area (dialog)), button, TRUE);
+ gtk_widget_set_tooltip_text (button, _("Format volume using the Palimpsest Disk Utility"));
gtk_dialog_set_default_response (dialog, GTK_RESPONSE_CLOSE);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));