[gnome-disk-utility/udisks2-port] Add a "Format Disk" dialog



commit 3f5d0326b5f878a8ddd3c70cfa723c9d8df5da22
Author: David Zeuthen <davidz redhat com>
Date:   Mon Nov 14 12:00:11 2011 -0500

    Add a "Format Disk" dialog
    
     http://people.freedesktop.org/~david/gdu2-format-disk-1.png
     http://people.freedesktop.org/~david/gdu2-format-disk-2.png
     http://people.freedesktop.org/~david/gdu2-format-disk-3.png
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 data/ui/Makefile.am                  |    1 +
 data/ui/format-disk-dialog.ui        |  135 ++++++++++++++++++
 data/ui/palimpsest.ui                |    9 ++
 src/palimpsest/Makefile.am           |    1 +
 src/palimpsest/gduformatdiskdialog.c |  247 ++++++++++++++++++++++++++++++++++
 src/palimpsest/gduformatdiskdialog.h |   36 +++++
 src/palimpsest/gduwindow.c           |   44 +++++-
 7 files changed, 467 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index 3c21f6f..9952286 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -16,6 +16,7 @@ ui_DATA = 				\
 	smart-dialog.ui			\
 	create-partition-dialog.ui	\
 	filesystem-create.ui		\
+	format-disk-dialog.ui		\
 	$(NULL)
 
 clean-local :
diff --git a/data/ui/format-disk-dialog.ui b/data/ui/format-disk-dialog.ui
new file mode 100644
index 0000000..53ef032
--- /dev/null
+++ b/data/ui/format-disk-dialog.ui
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="format-disk-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="button2">
+                <property name="label" translatable="yes">_Format...</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="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">&lt;big&gt;Format Disk&lt;/big&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">12</property>
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">10</property>
+                <child>
+                  <object class="GtkComboBox" id="type-combobox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="id_column">0</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="GtkLabel" id="label5">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">_Partitioning:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">type-combobox</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>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button1</action-widget>
+      <action-widget response="-5">button2</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/data/ui/palimpsest.ui b/data/ui/palimpsest.ui
index cabbdfb..78d2edf 100644
--- a/data/ui/palimpsest.ui
+++ b/data/ui/palimpsest.ui
@@ -76,6 +76,15 @@
       </object>
     </child>
     <child>
+      <object class="GtkMenuItem" id="generic-menu-item-format-disk">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="use_action_appearance">False</property>
+        <property name="label" translatable="yes">Format Disk...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
       <object class="GtkSeparatorMenuItem" id="menuitem1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
diff --git a/src/palimpsest/Makefile.am b/src/palimpsest/Makefile.am
index e5fe658..0975e8c 100644
--- a/src/palimpsest/Makefile.am
+++ b/src/palimpsest/Makefile.am
@@ -40,6 +40,7 @@ palimpsest_SOURCES = 							\
 	gduformatvolumedialog.h		gduformatvolumedialog.c		\
 	gducreatepartitiondialog.h	gducreatepartitiondialog.c	\
 	gducreatefilesystemwidget.h	gducreatefilesystemwidget.c	\
+	gduformatdiskdialog.h		gduformatdiskdialog.c		\
 	$(enum_built_sources)						\
 	$(NULL)
 
diff --git a/src/palimpsest/gduformatdiskdialog.c b/src/palimpsest/gduformatdiskdialog.c
new file mode 100644
index 0000000..59ef9a7
--- /dev/null
+++ b/src/palimpsest/gduformatdiskdialog.c
@@ -0,0 +1,247 @@
+/* -*- 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 "gduformatdiskdialog.h"
+#include "gduvolumegrid.h"
+#include "gduutils.h"
+#include "gducreatefilesystemwidget.h"
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+enum
+{
+  MODEL_COLUMN_ID,
+  MODEL_COLUMN_MARKUP,
+  MODEL_COLUMN_SEPARATOR,
+  MODEL_N_COLUMNS,
+};
+
+typedef struct
+{
+  GduWindow *window;
+  UDisksObject *object;
+  UDisksBlock *block;
+  UDisksDrive *drive;
+
+  GtkBuilder *builder;
+  GtkWidget *dialog;
+  GtkWidget *type_combobox;
+} FormatDiskData;
+
+static void
+format_disk_data_free (FormatDiskData *data)
+{
+  g_object_unref (data->window);
+  g_object_unref (data->object);
+  g_object_unref (data->block);
+  g_clear_object (&data->drive);
+  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
+format_disk_update (FormatDiskData *data)
+{
+}
+
+static void
+on_property_changed (GObject     *object,
+                     GParamSpec  *pspec,
+                     gpointer     user_data)
+{
+  FormatDiskData *data = user_data;
+  format_disk_update (data);
+}
+
+static gboolean
+separator_func (GtkTreeModel *model,
+                GtkTreeIter *iter,
+                gpointer data)
+{
+  gboolean is_separator;
+  gtk_tree_model_get (model, iter,
+                      MODEL_COLUMN_SEPARATOR, &is_separator,
+                      -1);
+  return is_separator;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+format_disk_populate (FormatDiskData *data)
+{
+  GtkListStore *model;
+  GtkCellRenderer *renderer;
+  gchar *s;
+
+  model = gtk_list_store_new (MODEL_N_COLUMNS,
+                              G_TYPE_STRING,
+                              G_TYPE_STRING,
+                              G_TYPE_BOOLEAN);
+  gtk_combo_box_set_model (GTK_COMBO_BOX (data->type_combobox), GTK_TREE_MODEL (model));
+  g_object_unref (model);
+
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (data->type_combobox), renderer, FALSE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (data->type_combobox), renderer,
+                                  "markup", MODEL_COLUMN_MARKUP,
+                                  NULL);
+
+  gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (data->type_combobox),
+                                        separator_func,
+                                        data,
+                                        NULL); /* GDestroyNotify */
+
+  /* MBR */
+  s = g_strdup_printf ("%s <span foreground=\"#555555\" size=\"small\">(%s)</span>",
+                       _("Compatible with all systems and devices"),
+                       _("MBR / DOS"));
+  gtk_list_store_insert_with_values (model, NULL /* out_iter */, G_MAXINT, /* position */
+                                     MODEL_COLUMN_ID, "dos", MODEL_COLUMN_MARKUP, s, -1);
+  g_free (s);
+
+  /* GPT */
+  s = g_strdup_printf ("%s <span foreground=\"#555555\" size=\"small\">(%s)</span>",
+                       _("Compatible with modern systems and hard disks > 2TB"),
+                       _("GPT"));
+  gtk_list_store_insert_with_values (model, NULL /* out_iter */, G_MAXINT, /* position */
+                                     MODEL_COLUMN_ID, "gpt", MODEL_COLUMN_MARKUP, s, -1);
+  g_free (s);
+
+  /* separator */
+  gtk_list_store_insert_with_values (model, NULL /* out_iter */, G_MAXINT, /* position */
+                                     MODEL_COLUMN_SEPARATOR, TRUE, -1);
+
+
+  /* Empty */
+  s = g_strdup_printf ("%s <span foreground=\"#555555\" size=\"small\">(%s)</span>",
+                       _("No partitioning"),
+                       _("Empty"));
+  gtk_list_store_insert_with_values (model, NULL /* out_iter */, G_MAXINT, /* position */
+                                     MODEL_COLUMN_ID, "empty", MODEL_COLUMN_MARKUP, s, -1);
+  g_free (s);
+
+
+  /* Default to MBR for removable drives < 2TB... GPT otherwise */
+  if (data->drive != NULL &&
+      udisks_drive_get_removable (data->drive) &&
+      udisks_drive_get_size (data->drive) < 2 * 1000L*1000L*1000L*1000L)
+    {
+      gtk_combo_box_set_active_id (GTK_COMBO_BOX (data->type_combobox), "dos");
+    }
+  else
+    {
+      gtk_combo_box_set_active_id (GTK_COMBO_BOX (data->type_combobox), "gpt");
+    }
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+format_cb (GObject      *source_object,
+           GAsyncResult *res,
+           gpointer      user_data)
+{
+  FormatDiskData *data = user_data;
+  GError *error;
+
+  error = NULL;
+  if (!udisks_block_call_format_finish (UDISKS_BLOCK (source_object),
+                                        res,
+                                        &error))
+    {
+      gdu_window_show_error (data->window, _("Error formatting disk"), error);
+      g_error_free (error);
+    }
+  format_disk_data_free (data);
+}
+
+void
+gdu_format_disk_dialog_show (GduWindow    *window,
+                               UDisksObject *object)
+{
+  FormatDiskData *data;
+  gint response;
+
+  data = g_new0 (FormatDiskData, 1);
+  data->window = g_object_ref (window);
+  data->object = g_object_ref (object);
+  data->block = udisks_object_get_block (object);
+  g_assert (data->block != NULL);
+  data->drive = udisks_client_get_drive_for_block (gdu_window_get_client (window), data->block);
+
+  data->dialog = gdu_application_new_widget (gdu_window_get_application (window),
+                                             "format-disk-dialog.ui",
+                                             "format-disk-dialog",
+                                             &data->builder);
+  data->type_combobox = GTK_WIDGET (gtk_builder_get_object (data->builder, "type-combobox"));
+  g_signal_connect (data->type_combobox, "notify::active", G_CALLBACK (on_property_changed), data);
+
+  gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (window));
+  gtk_dialog_set_default_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK);
+
+  format_disk_populate (data);
+  format_disk_update (data);
+
+  gtk_widget_show_all (data->dialog);
+  gtk_widget_grab_focus (data->type_combobox);
+
+  response = gtk_dialog_run (GTK_DIALOG (data->dialog));
+  if (response == GTK_RESPONSE_OK)
+    {
+      const gchar *partition_table_type;
+
+      partition_table_type = gtk_combo_box_get_active_id (GTK_COMBO_BOX (data->type_combobox));
+
+      gtk_widget_hide (data->dialog);
+      if (!gdu_window_show_confirmation (window,
+                                         _("Are you sure you want to format the disk?"),
+                                         _("All data on the volume will be lost"),
+                                         _("_Format")))
+        goto out;
+
+      udisks_block_call_format (data->block,
+                                partition_table_type,
+                                g_variant_new ("a{sv}", NULL), /* options */
+                                NULL, /* GCancellable */
+                                format_cb,
+                                data);
+      return;
+    }
+
+ out:
+  format_disk_data_free (data);
+}
diff --git a/src/palimpsest/gduformatdiskdialog.h b/src/palimpsest/gduformatdiskdialog.h
new file mode 100644
index 0000000..5e28473
--- /dev/null
+++ b/src/palimpsest/gduformatdiskdialog.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_FORMAT_DISK_DIALOG_H__
+#define __GDU_FORMAT_DISK_DIALOG_H__
+
+#include <gtk/gtk.h>
+#include "gdutypes.h"
+
+G_BEGIN_DECLS
+
+void     gdu_format_disk_dialog_show (GduWindow    *window,
+                                      UDisksObject *object);
+
+G_END_DECLS
+
+#endif /* __GDU_FORMAT_DISK_DIALOG_H__ */
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index 321e789..f202053 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -45,6 +45,7 @@
 #include "gduunlockdialog.h"
 #include "gduformatvolumedialog.h"
 #include "gducreatepartitiondialog.h"
+#include "gduformatdiskdialog.h"
 
 /* Keep in sync with tabs in palimpsest.ui file */
 typedef enum
@@ -99,6 +100,7 @@ struct _GduWindow
 
   GtkWidget *generic_menu;
   GtkWidget *generic_menu_item_view_smart;
+  GtkWidget *generic_menu_item_format_disk;
   GtkWidget *generic_menu_item_configure_fstab;
   GtkWidget *generic_menu_item_configure_crypttab;
   GtkWidget *generic_menu_item_edit_label;
@@ -140,6 +142,7 @@ static const struct {
   {G_STRUCT_OFFSET (GduWindow, devtab_toolbar_deactivate_swap_button), "devtab-action-deactivate-swap"},
   {G_STRUCT_OFFSET (GduWindow, generic_menu), "generic-menu"},
   {G_STRUCT_OFFSET (GduWindow, generic_menu_item_view_smart), "generic-menu-item-view-smart"},
+  {G_STRUCT_OFFSET (GduWindow, generic_menu_item_format_disk), "generic-menu-item-format-disk"},
   {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_edit_label), "generic-menu-item-edit-label"},
@@ -175,11 +178,12 @@ typedef enum
   SHOW_FLAGS_ENCRYPTED_LOCK_BUTTON   = (1<<9),
 
   SHOW_FLAGS_POPUP_MENU_VIEW_SMART         = (1<<20),
-  SHOW_FLAGS_POPUP_MENU_CONFIGURE_FSTAB    = (1<<21),
-  SHOW_FLAGS_POPUP_MENU_CONFIGURE_CRYPTTAB = (1<<22),
-  SHOW_FLAGS_POPUP_MENU_EDIT_LABEL         = (1<<23),
-  SHOW_FLAGS_POPUP_MENU_EDIT_PARTITION     = (1<<24),
-  SHOW_FLAGS_POPUP_MENU_FORMAT_VOLUME      = (1<<25),
+  SHOW_FLAGS_POPUP_MENU_FORMAT_DISK        = (1<<21),
+  SHOW_FLAGS_POPUP_MENU_CONFIGURE_FSTAB    = (1<<22),
+  SHOW_FLAGS_POPUP_MENU_CONFIGURE_CRYPTTAB = (1<<23),
+  SHOW_FLAGS_POPUP_MENU_EDIT_LABEL         = (1<<24),
+  SHOW_FLAGS_POPUP_MENU_EDIT_PARTITION     = (1<<25),
+  SHOW_FLAGS_POPUP_MENU_FORMAT_VOLUME      = (1<<26),
 } ShowFlags;
 
 static void setup_device_page (GduWindow *window, UDisksObject *object);
@@ -212,6 +216,8 @@ static void on_generic_menu_item_edit_partition (GtkMenuItem *menu_item,
                                                  gpointer   user_data);
 static void on_generic_menu_item_format_volume (GtkMenuItem *menu_item,
                                                 gpointer   user_data);
+static void on_generic_menu_item_format_disk (GtkMenuItem *menu_item,
+                                              gpointer   user_data);
 
 G_DEFINE_TYPE (GduWindow, gdu_window, GTK_TYPE_WINDOW);
 
@@ -315,6 +321,8 @@ update_for_show_flags (GduWindow *window,
 
   gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_view_smart),
                             show_flags & SHOW_FLAGS_POPUP_MENU_VIEW_SMART);
+  gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_format_disk),
+                            show_flags & SHOW_FLAGS_POPUP_MENU_FORMAT_DISK);
   gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_configure_fstab),
                             show_flags & SHOW_FLAGS_POPUP_MENU_CONFIGURE_FSTAB);
   gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_configure_crypttab),
@@ -939,6 +947,10 @@ gdu_window_constructed (GObject *object)
                     "activate",
                     G_CALLBACK (on_generic_menu_item_view_smart),
                     window);
+  g_signal_connect (window->generic_menu_item_format_disk,
+                    "activate",
+                    G_CALLBACK (on_generic_menu_item_format_disk),
+                    window);
   g_signal_connect (window->generic_menu_item_configure_fstab,
                     "activate",
                     G_CALLBACK (on_generic_menu_item_configure_fstab),
@@ -1735,7 +1747,11 @@ update_device_page_for_block (GduWindow          *window,
 
   /* TODO: don't show on CD-ROM drives or RO media etc. */
   if (udisks_block_get_size (block) > 0)
-    *show_flags |= SHOW_FLAGS_POPUP_MENU_FORMAT_VOLUME;
+    {
+      /* TODO: if not partitioned, don't show FORMAT_DISK on non-partitionable media like floppy disks */
+      *show_flags |= SHOW_FLAGS_POPUP_MENU_FORMAT_DISK;
+      *show_flags |= SHOW_FLAGS_POPUP_MENU_FORMAT_VOLUME;
+    }
 
   if (partition != NULL)
     *show_flags |= SHOW_FLAGS_PARTITION_DELETE_BUTTON;
@@ -1972,6 +1988,8 @@ update_device_page_for_free_space (GduWindow          *window,
   UDisksPartitionTable *table;
   const gchar *table_type = NULL;
 
+  *show_flags |= SHOW_FLAGS_POPUP_MENU_FORMAT_DISK;
+
   //g_debug ("In update_device_page_for_free_space() - size=%" G_GUINT64_FORMAT " selected=%s",
   //         size,
   //         object != NULL ? g_dbus_object_get_object_path (object) : "<nothing>");
@@ -2214,6 +2232,20 @@ on_generic_menu_item_format_volume (GtkMenuItem *menu_item,
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
+on_generic_menu_item_format_disk (GtkMenuItem *menu_item,
+                                  gpointer   user_data)
+{
+  GduWindow *window = GDU_WINDOW (user_data);
+  UDisksObject *object;
+
+  object = gdu_volume_grid_get_block_object (GDU_VOLUME_GRID (window->volume_grid));
+  g_assert (object != NULL);
+  gdu_format_disk_dialog_show (window, object);
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
 on_generic_menu_item_configure_fstab (GtkMenuItem *menu_item,
                                       gpointer   user_data)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]