[gnome-disk-utility] Rework RAID menu on overlay toolbar
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Rework RAID menu on overlay toolbar
- Date: Tue, 27 Nov 2012 17:05:44 +0000 (UTC)
commit bb279ac1f34b80a09b77dfbaacb2de30487c1992
Author: David Zeuthen <zeuthen gmail com>
Date: Tue Nov 27 12:05:24 2012 -0500
Rework RAID menu on overlay toolbar
Signed-off-by: David Zeuthen <zeuthen gmail com>
data/ui/disks.ui | 56 ++++++++++++++++++++++++++++---------------------
src/disks/gduwindow.c | 54 ++++++++++++++---------------------------------
2 files changed, 48 insertions(+), 62 deletions(-)
---
diff --git a/data/ui/disks.ui b/data/ui/disks.ui
index 1d57b6f..9dbab48 100644
--- a/data/ui/disks.ui
+++ b/data/ui/disks.ui
@@ -1883,32 +1883,15 @@
</object>
</child>
</object>
- <object class="GtkMenu" id="ms-raid-menu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="ms-raid-menu-item-create">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Create New RAID Arrayâ</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="ms-raid-menu-item-add-to">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Add To Existing RAID Arrayâ</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
<object class="GtkWindow" id="overlay-toolbar-dummy-window">
<property name="can_focus">False</property>
<child>
<object class="GtkToolbar" id="overlay-toolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="toolbar_style">icons</property>
+ <property name="show_arrow">False</property>
+ <property name="icon_size">1</property>
<style>
<class name="osd"/>
</style>
@@ -1943,10 +1926,35 @@
<property name="position">0</property>
</packing>
</child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparatorToolItem" id="toolbutton3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolItem" id="overlay-toolbar-center">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="box3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkMenuButton" id="overlay-toolbar-raid-button">
- <property name="menu">ms-raid-menu</property>
- <property name="label" translatable="yes">RAID</property>
+ <object class="GtkButton" id="overlay-toolbar-create-raid-button">
+ <property name="label" translatable="yes">Create RAID</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -1954,7 +1962,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index c504c42..b74552c 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -63,9 +63,7 @@ struct _GduWindow
GtkWidget *overlay_toolbar;
GtkWidget *overlay_toolbar_erase_button;
- GtkWidget *overlay_toolbar_raid_button;
- GtkWidget *ms_raid_menu_item_create;
- GtkWidget *ms_raid_menu_item_add_to;
+ GtkWidget *overlay_toolbar_create_raid_button;
GtkWidget *main_hpane;
GtkWidget *details_notebook;
@@ -173,9 +171,7 @@ static const struct {
{G_STRUCT_OFFSET (GduWindow, toolbutton_generic_menu), "toolbutton-generic-menu"},
{G_STRUCT_OFFSET (GduWindow, overlay_toolbar), "overlay-toolbar"},
{G_STRUCT_OFFSET (GduWindow, overlay_toolbar_erase_button), "overlay-toolbar-erase-button"},
- {G_STRUCT_OFFSET (GduWindow, overlay_toolbar_raid_button), "overlay-toolbar-raid-button"},
- {G_STRUCT_OFFSET (GduWindow, ms_raid_menu_item_create), "ms-raid-menu-item-create"},
- {G_STRUCT_OFFSET (GduWindow, ms_raid_menu_item_add_to), "ms-raid-menu-item-add-to"},
+ {G_STRUCT_OFFSET (GduWindow, overlay_toolbar_create_raid_button), "overlay-toolbar-create-raid-button"},
{G_STRUCT_OFFSET (GduWindow, main_hpane), "main-hpane"},
{G_STRUCT_OFFSET (GduWindow, device_tree_overlay), "device-tree-overlay"},
@@ -426,14 +422,11 @@ static gboolean on_activate_link (GtkLabel *label,
const gchar *uri,
gpointer user_data);
-static void on_overlay_toolbar_erase_button_clicked (GtkButton *menu_item,
+static void on_overlay_toolbar_erase_button_clicked (GtkButton *button,
gpointer user_data);
-static void on_ms_raid_menu_item_add_to_activated (GtkMenuItem *menu_item,
- gpointer user_data);
-
-static void on_ms_raid_menu_item_create_activated (GtkMenuItem *menu_item,
- gpointer user_data);
+static void on_overlay_toolbar_create_raid_button_clicked (GtkButton *button,
+ gpointer user_data);
G_DEFINE_TYPE (GduWindow, gdu_window, GTK_TYPE_APPLICATION_WINDOW);
@@ -1591,14 +1584,10 @@ gdu_window_constructed (GObject *object)
G_CALLBACK (on_overlay_toolbar_erase_button_clicked),
window);
- /* multiple-selection RAID menu */
- g_signal_connect (window->ms_raid_menu_item_add_to,
- "activate",
- G_CALLBACK (on_ms_raid_menu_item_add_to_activated),
- window);
- g_signal_connect (window->ms_raid_menu_item_create,
- "activate",
- G_CALLBACK (on_ms_raid_menu_item_create_activated),
+ /* Create RAID array */
+ g_signal_connect (window->overlay_toolbar_create_raid_button,
+ "clicked",
+ G_CALLBACK (on_overlay_toolbar_create_raid_button_clicked),
window);
ensure_something_selected (window);
@@ -4704,17 +4693,14 @@ update_for_multi_selection (GduWindow *window, ShowFlags *show_flags)
gtk_widget_show (window->overlay_toolbar_erase_button);
- /* RAID requires at all disks are the same size */
- if (gdu_util_is_same_size (selected_blocks, &disk_size))
+ /* Createing a RAID array requires at all disks are the same size and that there are at least two of them */
+ if (gdu_util_is_same_size (selected_blocks, &disk_size) && num_blocks >= 2)
{
- gtk_widget_show (window->overlay_toolbar_raid_button);
- /* TODO: check that appropriate RAID array exist and size is right before setting this to TRUE */
- gtk_widget_set_sensitive (window->ms_raid_menu_item_add_to, TRUE);
- gtk_widget_set_sensitive (window->ms_raid_menu_item_create, num_blocks > 1);
+ gtk_widget_show (window->overlay_toolbar_create_raid_button);
}
else
{
- gtk_widget_hide (window->overlay_toolbar_raid_button);
+ gtk_widget_hide (window->overlay_toolbar_create_raid_button);
}
}
else
@@ -4729,7 +4715,7 @@ update_for_multi_selection (GduWindow *window, ShowFlags *show_flags)
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_overlay_toolbar_erase_button_clicked (GtkButton *menu_item,
+on_overlay_toolbar_erase_button_clicked (GtkButton *button,
gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
@@ -4745,16 +4731,8 @@ on_overlay_toolbar_erase_button_clicked (GtkButton *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_ms_raid_menu_item_add_to_activated (GtkMenuItem *menu_item,
- gpointer user_data)
-{
- GduWindow *window = GDU_WINDOW (user_data);
- g_print ("TODO: add to RAID array %p\n", window);
-}
-
-static void
-on_ms_raid_menu_item_create_activated (GtkMenuItem *menu_item,
- gpointer user_data)
+on_overlay_toolbar_create_raid_button_clicked (GtkButton *button,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
GList *selected_blocks;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]