[gnome-disk-utility] Update the UI to match current guidelines
- From: Kai Lüke <kailueke src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Update the UI to match current guidelines
- Date: Tue, 15 Jan 2019 17:27:14 +0000 (UTC)
commit 922e0c1daea2778c5ff14546b0912ae9b30b6eda
Author: Maoschanz <rrroschan gmail com>
Date: Tue Jan 15 17:27:03 2019 +0000
Update the UI to match current guidelines
src/disks/gduapplication.c | 50 ++-
src/disks/gduwindow.c | 857 ++++++++++++++++--------------------
src/disks/gnome-disks.gresource.xml | 6 +-
src/disks/ui/app-menu.ui | 16 +-
src/disks/ui/disks.ui | 218 +--------
src/disks/ui/drive-menu.ui | 49 +++
src/disks/ui/headerbar.ui | 95 ++++
src/disks/ui/shortcuts.ui | 108 +++++
src/disks/ui/volume-menu.ui | 63 +++
9 files changed, 740 insertions(+), 722 deletions(-)
---
diff --git a/src/disks/gduapplication.c b/src/disks/gduapplication.c
index 5ca8657c..a319e394 100644
--- a/src/disks/gduapplication.c
+++ b/src/disks/gduapplication.c
@@ -315,6 +315,23 @@ attach_disk_image_activated (GSimpleAction *action,
gdu_window_show_attach_disk_image (app->window);
}
+static void
+shortcuts_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GduApplication *app = GDU_APPLICATION (user_data);
+ GtkWidget *dialog;
+
+ dialog = GTK_WIDGET (gdu_application_new_widget (app,
+ "shortcuts.ui",
+ "shortcuts",
+ NULL));
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (app->window));
+ gtk_widget_show_all (dialog);
+}
+
static void
about_activated (GSimpleAction *action,
GVariant *parameter,
@@ -377,8 +394,9 @@ static GActionEntry app_entries[] =
{
{ "new_disk_image", new_disk_image_activated, NULL, NULL, NULL },
{ "attach_disk_image", attach_disk_image_activated, NULL, NULL, NULL },
- { "about", about_activated, NULL, NULL, NULL },
+ { "shortcuts", shortcuts_activated, NULL, NULL, NULL },
{ "help", help_activated, NULL, NULL, NULL },
+ { "about", about_activated, NULL, NULL, NULL },
{ "quit", quit_activated, NULL, NULL, NULL }
};
@@ -386,21 +404,33 @@ static void
gdu_application_startup (GApplication *_app)
{
GduApplication *app = GDU_APPLICATION (_app);
- GMenuModel *app_menu;
- GtkBuilder *builder;
+ const gchar **it;
+ const gchar *action_accels[] = {
+ "win.open-drive-menu", "F10", NULL,
+ "win.open-volume-menu", "<Shift>F10", NULL,
+
+ "win.format-disk", "<Primary>D", NULL,
+ "win.restore-disk-image", "<Primary>R", NULL,
+ "win.view-smart", "<Primary>S", NULL,
+ "win.disk-settings", "<Primary>E", NULL,
+
+ "win.format-partition", "<Primary>P", NULL,
+
+ "app.new_disk_image", "<Primary>N", NULL,
+ "app.attach_disk_image", "<Primary>A", NULL,
+
+ "app.help", "F1", NULL,
+ "app.quit", "<Primary>Q", NULL,
+ NULL
+ };
if (G_APPLICATION_CLASS (gdu_application_parent_class)->startup != NULL)
G_APPLICATION_CLASS (gdu_application_parent_class)->startup (_app);
g_action_map_add_action_entries (G_ACTION_MAP (app), app_entries, G_N_ELEMENTS (app_entries), app);
- app_menu = G_MENU_MODEL (gdu_application_new_widget (app,
- "app-menu.ui",
- "app-menu",
- &builder));
- gtk_application_set_app_menu (GTK_APPLICATION (app), app_menu);
- g_object_unref (app_menu);
- g_clear_object (&builder);
+ for (it = action_accels; it[0] != NULL; it += g_strv_length ((gchar **)it) + 1)
+ gtk_application_set_accels_for_action (GTK_APPLICATION (app), it[0], &it[1]);
}
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 3b43bc32..f7b1d753 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -59,7 +59,7 @@ struct _GduWindow
GtkWidget *volume_grid;
- GtkWidget *toolbutton_generic_menu;
+ GtkWidget *toolbutton_volume_menu;
GtkWidget *toolbutton_partition_create;
GtkWidget *toolbutton_partition_delete;
GtkWidget *toolbutton_mount;
@@ -70,6 +70,8 @@ struct _GduWindow
GtkWidget *toolbutton_deactivate_swap;
GtkWidget *header;
+ GtkWidget *right_header;
+ GtkWidget *left_header;
GtkWidget *main_box;
GtkWidget *main_hpane;
@@ -77,44 +79,22 @@ struct _GduWindow
GtkWidget *device_tree_scrolledwindow;
GtkWidget *device_tree_treeview;
+ GtkWidget *devtab_app_menu_button;
GtkWidget *devtab_drive_loop_detach_button;
GtkWidget *devtab_drive_eject_button;
GtkWidget *devtab_drive_power_off_button;
- GtkWidget *devtab_drive_generic_button;
+ const gchar *icon_name;
+ GtkWidget *devtab_drive_menu_icon;
+ GtkWidget *devtab_drive_menu_button;
GtkWidget *devtab_table;
GtkWidget *devtab_drive_table;
GtkWidget *devtab_grid_hbox;
GtkWidget *devtab_volumes_label;
GtkWidget *devtab_grid_toolbar;
- GtkWidget *generic_drive_menu;
- GtkWidget *generic_drive_menu_item_format_disk;
- GtkWidget *generic_drive_menu_item_create_disk_image;
- GtkWidget *generic_drive_menu_item_restore_disk_image;
- GtkWidget *generic_drive_menu_item_benchmark;
- /* Drive-specific items */
- GtkWidget *generic_drive_menu_item_drive_sep_1;
- GtkWidget *generic_drive_menu_item_view_smart;
- GtkWidget *generic_drive_menu_item_disk_settings;
- GtkWidget *generic_drive_menu_item_drive_sep_2;
- GtkWidget *generic_drive_menu_item_standby_now;
- GtkWidget *generic_drive_menu_item_resume_now;
- GtkWidget *generic_drive_menu_item_power_off;
-
- GtkWidget *generic_menu;
- GtkWidget *generic_menu_item_configure_fstab;
- GtkWidget *generic_menu_item_configure_crypttab;
- GtkWidget *generic_menu_item_change_passphrase;
- GtkWidget *generic_menu_item_resize;
- GtkWidget *generic_menu_item_repair;
- GtkWidget *generic_menu_item_check;
- GtkWidget *generic_menu_item_separator;
- GtkWidget *generic_menu_item_edit_label;
- GtkWidget *generic_menu_item_edit_partition;
- GtkWidget *generic_menu_item_format_volume;
- GtkWidget *generic_menu_item_create_volume_image;
- GtkWidget *generic_menu_item_restore_volume_image;
- GtkWidget *generic_menu_item_benchmark;
+ GtkWidget *app_menu;
+ GtkWidget *drive_menu;
+ GtkWidget *volume_menu;
GtkWidget *devtab_loop_autoclear_switch;
@@ -140,7 +120,7 @@ static const struct {
goffset offset;
const gchar *name;
} widget_mapping[] = {
- {G_STRUCT_OFFSET (GduWindow, toolbutton_generic_menu), "toolbutton-generic-menu"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_volume_menu), "toolbutton-volume-menu"},
{G_STRUCT_OFFSET (GduWindow, toolbutton_partition_create), "toolbutton-partition-create"},
{G_STRUCT_OFFSET (GduWindow, toolbutton_partition_delete), "toolbutton-partition-delete"},
{G_STRUCT_OFFSET (GduWindow, toolbutton_mount), "toolbutton-mount"},
@@ -164,35 +144,6 @@ static const struct {
{G_STRUCT_OFFSET (GduWindow, devtab_loop_autoclear_switch), "devtab-loop-autoclear-switch"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu), "generic-drive-menu"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_format_disk), "generic-drive-menu-item-format-disk"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_create_disk_image),
"generic-drive-menu-item-create-disk-image"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_restore_disk_image),
"generic-drive-menu-item-restore-disk-image"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_benchmark), "generic-drive-menu-item-benchmark"},
- /* Drive-specific items */
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_drive_sep_1), "generic-drive-menu-item-drive-sep-1"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_view_smart), "generic-drive-menu-item-view-smart"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_disk_settings),
"generic-drive-menu-item-disk-settings"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_drive_sep_2), "generic-drive-menu-item-drive-sep-2"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_standby_now), "generic-drive-menu-item-standby-now"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_resume_now), "generic-drive-menu-item-resume-now"},
- {G_STRUCT_OFFSET (GduWindow, generic_drive_menu_item_power_off), "generic-drive-menu-item-power-off"},
-
- {G_STRUCT_OFFSET (GduWindow, generic_menu), "generic-menu"},
- {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_resize), "generic-menu-item-resize"},
- {G_STRUCT_OFFSET (GduWindow, generic_menu_item_check), "generic-menu-item-check"},
- {G_STRUCT_OFFSET (GduWindow, generic_menu_item_repair), "generic-menu-item-repair"},
- {G_STRUCT_OFFSET (GduWindow, generic_menu_item_separator), "generic-menu-item-separator"},
- {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"},
- {G_STRUCT_OFFSET (GduWindow, generic_menu_item_create_volume_image),
"generic-menu-item-create-volume-image"},
- {G_STRUCT_OFFSET (GduWindow, generic_menu_item_restore_volume_image),
"generic-menu-item-restore-volume-image"},
- {G_STRUCT_OFFSET (GduWindow, generic_menu_item_benchmark), "generic-menu-item-benchmark"},
-
{G_STRUCT_OFFSET (GduWindow, devtab_drive_job_label), "devtab-drive-job-label"},
{G_STRUCT_OFFSET (GduWindow, devtab_drive_job_grid), "devtab-drive-job-grid"},
{G_STRUCT_OFFSET (GduWindow, devtab_drive_job_progressbar), "devtab-drive-job-progressbar"},
@@ -288,7 +239,7 @@ static void update_all (GduWindow *window, gboolean is_delayed_job_update);
static void on_volume_grid_changed (GduVolumeGrid *grid,
gpointer user_data);
-static void on_generic_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_volume_menu_tool_button_clicked (GtkToolButton *button, gpointer user_data);
static void on_partition_create_tool_button_clicked (GtkToolButton *button, gpointer user_data);
static void on_partition_delete_tool_button_clicked (GtkToolButton *button, gpointer user_data);
static void on_mount_tool_button_clicked (GtkToolButton *button, gpointer user_data);
@@ -302,53 +253,77 @@ static void on_devtab_drive_loop_detach_button_clicked (GtkButton *button, gpoin
static void on_devtab_drive_eject_button_clicked (GtkButton *button, gpointer user_data);
static void on_devtab_drive_power_off_button_clicked (GtkButton *button, gpointer user_data);
-static void on_generic_drive_menu_item_view_smart (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_drive_menu_item_disk_settings (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_drive_menu_item_standby_now (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_drive_menu_item_resume_now (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_drive_menu_item_power_off (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_drive_menu_item_format_disk (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_drive_menu_item_create_disk_image (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_drive_menu_item_restore_disk_image (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_drive_menu_item_benchmark (GtkMenuItem *menu_item,
- gpointer user_data);
-
-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_drive_menu_open (GSimpleAction *action, GVariant *parameter, gpointer user_data);
+static void on_volume_menu_open (GSimpleAction *action, GVariant *parameter, gpointer user_data);
+
+static void on_drive_menu_item_view_smart (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_drive_menu_item_disk_settings (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_drive_menu_item_standby_now (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_drive_menu_item_resume_now (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_drive_menu_item_power_off (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_drive_menu_item_format_disk (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_drive_menu_item_create_disk_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_drive_menu_item_restore_disk_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_drive_menu_item_benchmark (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+
+static void on_volume_menu_item_configure_fstab (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_configure_crypttab (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_change_passphrase (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
#ifdef HAVE_UDISKS2_7_2
-static void on_generic_menu_item_resize (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_menu_item_repair (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_menu_item_check (GtkMenuItem *menu_item,
- gpointer user_data);
+static void on_volume_menu_item_resize (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_repair (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_check (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
#endif
-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,
- gpointer user_data);
-static void on_generic_menu_item_format_volume (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_menu_item_create_volume_image (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_menu_item_restore_volume_image (GtkMenuItem *menu_item,
- gpointer user_data);
-static void on_generic_menu_item_benchmark (GtkMenuItem *menu_item,
- gpointer user_data);
+static void on_volume_menu_item_edit_label (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_edit_partition (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_format_volume (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_create_volume_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_restore_volume_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void on_volume_menu_item_benchmark (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
static void on_devtab_loop_autoclear_switch_notify_active (GObject *object,
GParamSpec *pspec,
@@ -366,6 +341,36 @@ static gboolean on_activate_link (GtkLabel *label,
G_DEFINE_TYPE (GduWindow, gdu_window, GTK_TYPE_APPLICATION_WINDOW);
+static const GActionEntry actions[] = {
+ { "open-drive-menu", on_drive_menu_open },
+ { "open-volume-menu", on_volume_menu_open },
+
+ { "format-disk", on_drive_menu_item_format_disk },
+ { "create-disk-image", on_drive_menu_item_create_disk_image },
+ { "restore-disk-image", on_drive_menu_item_restore_disk_image },
+ { "benchmark-disk", on_drive_menu_item_benchmark },
+ { "view-smart", on_drive_menu_item_view_smart },
+ { "disk-settings", on_drive_menu_item_disk_settings },
+ { "standby-now", on_drive_menu_item_standby_now },
+ { "resume-now", on_drive_menu_item_resume_now },
+ { "power-off", on_drive_menu_item_power_off },
+
+ { "format-partition", on_volume_menu_item_format_volume },
+ { "edit-partition", on_volume_menu_item_edit_partition },
+ { "edit-label", on_volume_menu_item_edit_label },
+ { "change-passphrase", on_volume_menu_item_change_passphrase },
+#ifdef HAVE_UDISKS2_7_2
+ { "resize", on_volume_menu_item_resize },
+ { "check-fs", on_volume_menu_item_check },
+ { "repair-fs", on_volume_menu_item_repair },
+#endif
+ { "configure-fstab", on_volume_menu_item_configure_fstab },
+ { "configure-crypttab", on_volume_menu_item_configure_crypttab },
+ { "create-partition-image", on_volume_menu_item_create_volume_image },
+ { "restore-partition-image", on_volume_menu_item_restore_volume_image },
+ { "benchmark-partition", on_volume_menu_item_benchmark }
+};
+
static void
gdu_window_init (GduWindow *window)
{
@@ -378,7 +383,7 @@ static
gboolean
on_delete_event (GtkWidget *widget,
GdkEvent *event,
- gpointer user_data)
+ gpointer user_data)
{
return !gdu_application_should_exit (GDU_WINDOW (widget)->application);
}
@@ -467,43 +472,63 @@ update_for_show_flags (GduWindow *window,
gtk_widget_set_visible (window->toolbutton_lock,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_ENCRYPTED_LOCK);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_format_disk),
- show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_FORMAT_DISK);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_view_smart),
- show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_VIEW_SMART);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_disk_settings),
- show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_DISK_SETTINGS);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_create_disk_image),
- show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_CREATE_DISK_IMAGE);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_restore_disk_image),
- show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_RESTORE_DISK_IMAGE);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_benchmark),
- show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_BENCHMARK);
-
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_configure_fstab),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CONFIGURE_FSTAB);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_configure_crypttab),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CONFIGURE_CRYPTTAB);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_change_passphrase),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CHANGE_PASSPHRASE);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_resize),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_RESIZE);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_repair),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_REPAIR);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_check),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CHECK);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_edit_label),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_EDIT_LABEL);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_edit_partition),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_EDIT_PARTITION);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_format_volume),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_FORMAT_VOLUME);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_create_volume_image),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CREATE_VOLUME_IMAGE);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_restore_volume_image),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_RESTORE_VOLUME_IMAGE);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_benchmark),
- show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_BENCHMARK);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "format-disk")),
+ show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_FORMAT_DISK);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "view-smart")),
+ show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_VIEW_SMART);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "disk-settings")),
+ show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_DISK_SETTINGS);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "create-disk-image")),
+ show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_CREATE_DISK_IMAGE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "restore-disk-image")),
+ show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_RESTORE_DISK_IMAGE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "benchmark-disk")),
+ show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_BENCHMARK);
+
+
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "configure-fstab")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CONFIGURE_FSTAB);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "configure-crypttab")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CONFIGURE_CRYPTTAB);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "change-passphrase")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CHANGE_PASSPHRASE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "resize")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_RESIZE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "repair-fs")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_REPAIR);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "check-fs")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CHECK);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "edit-label")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_EDIT_LABEL);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "edit-partition")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_EDIT_PARTITION);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "format-partition")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_FORMAT_VOLUME);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "create-partition-image")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_CREATE_VOLUME_IMAGE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "restore-partition-image")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_RESTORE_VOLUME_IMAGE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
+ "benchmark-partition")),
+ show_flags->volume_menu & SHOW_FLAGS_VOLUME_MENU_BENCHMARK);
+
/* TODO: don't show the button bringing up the popup menu if it has no items */
}
@@ -868,9 +893,9 @@ init_css (GduWindow *window)
static gint
device_sort_function (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer user_data)
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ gpointer user_data)
{
gchar *sa, *sb;
gint ret;
@@ -988,79 +1013,79 @@ power_state_cell_func (GtkTreeViewColumn *column,
update_all (window, FALSE);
}
-/* TODO: load from .ui file */
static GtkWidget *
create_header (GduWindow *window)
{
GtkWidget *header;
- GtkWidget *button;
- GtkWidget *image;
-
- header = gtk_header_bar_new ();
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
-
- button = window->devtab_drive_generic_button = gtk_menu_button_new ();
- gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), window->generic_drive_menu);
- gtk_menu_button_set_direction (GTK_MENU_BUTTON (button), GTK_ARROW_NONE);
- gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
-
- button = window->devtab_drive_power_off_button = gtk_button_new ();
- image = gtk_image_new_from_icon_name ("system-shutdown-symbolic", GTK_ICON_SIZE_MENU);
- gtk_button_set_image (GTK_BUTTON (button), image);
- gtk_widget_set_tooltip_text (button, _("Power off this disk"));
- gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
-
- button = window->devtab_drive_eject_button = gtk_button_new ();
- image = gtk_image_new_from_icon_name ("media-eject-symbolic", GTK_ICON_SIZE_MENU);
- gtk_button_set_image (GTK_BUTTON (button), image);
- gtk_widget_set_tooltip_text (button, _("Eject this disk"));
- gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
-
- button = window->devtab_drive_loop_detach_button = gtk_button_new ();
- image = gtk_image_new_from_icon_name ("list-remove-symbolic", GTK_ICON_SIZE_MENU);
- gtk_button_set_image (GTK_BUTTON (button), image);
- gtk_widget_set_tooltip_text (button, _("Detach this loop device"));
- gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+ GMenuModel *model;
+ GError **error0 = NULL;
+ GError **error1 = NULL;
+ GError **error2 = NULL;
+
+ gtk_builder_add_from_resource (window->builder, "/org/gnome/Disks/ui/headerbar.ui", error0);
+ header = GTK_WIDGET (gtk_builder_get_object (window->builder, "headerbar-paned"));
+ window->right_header = GTK_WIDGET (gtk_builder_get_object (window->builder, "disks-main-headerbar"));
+ window->left_header = GTK_WIDGET (gtk_builder_get_object (window->builder, "disks-side-headerbar"));
+
+ window->devtab_drive_menu_button = GTK_WIDGET (gtk_builder_get_object (window->builder,
"drive-menu-button"));
+ window->devtab_app_menu_button = GTK_WIDGET (gtk_builder_get_object (window->builder, "app-menu-button"));
+ window->devtab_drive_power_off_button = GTK_WIDGET (gtk_builder_get_object (window->builder,
"power-off-disk-button"));
+ window->devtab_drive_eject_button = GTK_WIDGET (gtk_builder_get_object (window->builder,
"eject-disk-button"));
+ window->devtab_drive_loop_detach_button = GTK_WIDGET (gtk_builder_get_object (window->builder,
"detach-loop-device-button"));
+
+ gtk_builder_add_from_resource (window->builder, "/org/gnome/Disks/ui/drive-menu.ui", error1);
+ model = G_MENU_MODEL (gtk_builder_get_object (window->builder, "drive-menu"));
+ window->drive_menu = gtk_popover_new_from_model (window->devtab_drive_menu_button, model);
+ gtk_menu_button_set_popover (GTK_MENU_BUTTON (window->devtab_drive_menu_button), window->drive_menu);
+
+ gtk_builder_add_from_resource (window->builder, "/org/gnome/Disks/ui/app-menu.ui", error2);
+ model = G_MENU_MODEL (gtk_builder_get_object (window->builder, "app-menu"));
+ window->app_menu = gtk_popover_new_from_model (window->devtab_app_menu_button, model);
+ gtk_menu_button_set_popover (GTK_MENU_BUTTON (window->devtab_app_menu_button), window->app_menu);
return header;
}
-static gboolean
-in_desktop (const gchar *name)
-{
- const gchar *desktop_name_list;
- gchar **names;
- gboolean in_list = FALSE;
- gint i;
-
- desktop_name_list = g_getenv ("XDG_CURRENT_DESKTOP");
- if (!desktop_name_list)
- return FALSE;
-
- names = g_strsplit (desktop_name_list, ":", -1);
- for (i = 0; names[i] && !in_list; i++)
- {
- if (strcmp (names[i], name) == 0)
- in_list = TRUE;
- }
- g_strfreev (names);
-
- return in_list;
+static void
+gdu_window_update_decoration_layout (GObject *object,
+ GParamSpec *pspec,
+ GduWindow *window)
+{
+ gchar *layout_desc;
+ gchar **tokens;
+
+ g_object_get (gtk_settings_get_default (),
+ "gtk-decoration-layout", &layout_desc,
+ NULL);
+
+ tokens = g_strsplit (layout_desc, ":", 2);
+ if (tokens)
+ {
+ gchar *layout_headerbar;
+
+ layout_headerbar = g_strdup_printf ("%c%s", ':', tokens[1]);
+ gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (window->right_header), layout_headerbar);
+ gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (window->left_header), tokens[0]);
+
+ g_free (layout_headerbar);
+ g_strfreev (tokens);
+ }
+
+ g_free (layout_desc);
}
static void
gdu_window_constructed (GObject *object)
{
GduWindow *window = GDU_WINDOW (object);
- guint key;
- GdkModifierType mod;
- GtkAccelGroup *accelgroup;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
GtkStyleContext *context;
GList *children, *l;
guint n;
+ GtkBuilder *builder;
+ GMenuModel *model;
init_css (window);
@@ -1085,32 +1110,33 @@ gdu_window_constructed (GObject *object)
window->has_volume_job = FALSE;
window->delay_job_update_id = 0;
- window->header = create_header (window);
- if (!in_desktop ("Unity"))
- gtk_window_set_titlebar (GTK_WINDOW (window), window->header);
- else
- {
- gtk_box_pack_start (GTK_BOX (window->main_box),
- GTK_WIDGET (window->header),
- FALSE, TRUE, 0);
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (window->header),
- FALSE);
- context = gtk_widget_get_style_context (GTK_WIDGET (window->header));
- gtk_style_context_remove_class (context, "header-bar");
- gtk_style_context_add_class (context, "toolbar");
- gtk_style_context_add_class (context, "primary-toolbar");
- }
-
- gtk_widget_show_all (window->header);
-
g_object_ref (window->main_box);
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->main_box)), window->main_box);
gtk_container_add (GTK_CONTAINER (window), window->main_box);
g_object_unref (window->main_box);
+
+ /* build the headerbar */
+ window->header = create_header (window);
+ gtk_window_set_titlebar (GTK_WINDOW (window), window->header);
+
+ gtk_widget_show_all (window->header);
+
+ g_object_bind_property (window->header, "position",
+ window->main_hpane, "position",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+
gtk_window_set_title (GTK_WINDOW (window), _("Disks"));
- gtk_window_set_default_size (GTK_WINDOW (window), 800, 700);
+ gtk_window_set_default_size (GTK_WINDOW (window), 900, 600);
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
+ /* build the decorations */
+ gdu_window_update_decoration_layout (NULL, NULL, window);
+
+ g_signal_connect (gtk_settings_get_default (),
+ "notify::gtk-decoration-layout",
+ G_CALLBACK (gdu_window_update_decoration_layout),
+ window);
+
/* set up mnemonic */
gtk_window_add_mnemonic (GTK_WINDOW (window),
'd',
@@ -1249,10 +1275,16 @@ gdu_window_constructed (GObject *object)
gtk_widget_set_name (window->devtab_grid_toolbar, "devtab-grid-toolbar");
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+ builder = gtk_builder_new_from_resource ("/org/gnome/Disks/ui/volume-menu.ui");
+ model = G_MENU_MODEL (gtk_builder_get_object (GTK_BUILDER (builder), "volume-menu"));
+ window->volume_menu = gtk_popover_new_from_model (window->toolbutton_volume_menu, model);
+ gtk_popover_set_position (GTK_POPOVER (window->volume_menu), GTK_POS_BOTTOM);
+ g_object_unref (builder);
+
/* toolbar buttons */
- g_signal_connect (window->toolbutton_generic_menu,
+ g_signal_connect (window->toolbutton_volume_menu,
"clicked",
- G_CALLBACK (on_generic_tool_button_clicked),
+ G_CALLBACK (on_volume_menu_tool_button_clicked),
window);
g_signal_connect (window->toolbutton_partition_create,
"clicked",
@@ -1301,101 +1333,9 @@ gdu_window_constructed (GObject *object)
G_CALLBACK (on_devtab_drive_power_off_button_clicked),
window);
- /* drive menu */
- g_signal_connect (window->generic_drive_menu_item_view_smart,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_view_smart),
- window);
- g_signal_connect (window->generic_drive_menu_item_disk_settings,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_disk_settings),
- window);
- g_signal_connect (window->generic_drive_menu_item_standby_now,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_standby_now),
- window);
- g_signal_connect (window->generic_drive_menu_item_resume_now,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_resume_now),
- window);
- g_signal_connect (window->generic_drive_menu_item_power_off,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_power_off),
- window);
- g_signal_connect (window->generic_drive_menu_item_format_disk,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_format_disk),
- window);
- g_signal_connect (window->generic_drive_menu_item_create_disk_image,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_create_disk_image),
- window);
- g_signal_connect (window->generic_drive_menu_item_restore_disk_image,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_restore_disk_image),
- window);
- g_signal_connect (window->generic_drive_menu_item_benchmark,
- "activate",
- G_CALLBACK (on_generic_drive_menu_item_benchmark),
- window);
-
- /* volume menu */
- g_signal_connect (window->generic_menu_item_configure_fstab,
- "activate",
- G_CALLBACK (on_generic_menu_item_configure_fstab),
- window);
- g_signal_connect (window->generic_menu_item_configure_crypttab,
- "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);
-
-#ifdef HAVE_UDISKS2_7_2
- g_signal_connect (window->generic_menu_item_resize,
- "activate",
- G_CALLBACK (on_generic_menu_item_resize),
- window);
- g_signal_connect (window->generic_menu_item_repair,
- "activate",
- G_CALLBACK (on_generic_menu_item_repair),
- window);
- g_signal_connect (window->generic_menu_item_check,
- "activate",
- G_CALLBACK (on_generic_menu_item_check),
- window);
-#else
- gtk_widget_hide (window->generic_menu_item_resize);
- gtk_widget_hide (window->generic_menu_item_repair);
- gtk_widget_hide (window->generic_menu_item_check);
- gtk_widget_hide (window->generic_menu_item_separator);
-#endif
-
- g_signal_connect (window->generic_menu_item_edit_label,
- "activate",
- G_CALLBACK (on_generic_menu_item_edit_label),
- window);
- g_signal_connect (window->generic_menu_item_edit_partition,
- "activate",
- G_CALLBACK (on_generic_menu_item_edit_partition),
- window);
- g_signal_connect (window->generic_menu_item_format_volume,
- "activate",
- G_CALLBACK (on_generic_menu_item_format_volume),
- window);
- g_signal_connect (window->generic_menu_item_create_volume_image,
- "activate",
- G_CALLBACK (on_generic_menu_item_create_volume_image),
- window);
- g_signal_connect (window->generic_menu_item_restore_volume_image,
- "activate",
- G_CALLBACK (on_generic_menu_item_restore_volume_image),
- window);
- g_signal_connect (window->generic_menu_item_benchmark,
- "activate",
- G_CALLBACK (on_generic_menu_item_benchmark),
+ /* actions from both menus are connected here ; in a perfect world, buttons should to */
+ g_action_map_add_action_entries (G_ACTION_MAP (window),
+ actions, G_N_ELEMENTS (actions),
window);
/* loop's auto-clear switch */
@@ -1430,72 +1370,6 @@ gdu_window_constructed (GObject *object)
ensure_something_selected (window);
gtk_widget_grab_focus (window->device_tree_treeview);
update_all (window, FALSE);
-
- /* attach the generic menu to the toplevel window for correct placement */
- gtk_menu_attach_to_widget (GTK_MENU (window->generic_menu),
- GTK_WIDGET (window),
- NULL);
-
- /* TODO: would be better to have all this in the .ui file - no idea
- * why it doesn't work - accelerator support in GTK+ seems extremely
- * confusing and flaky :-(
- */
- accelgroup = gtk_accel_group_new ();
- gtk_window_add_accel_group (GTK_WINDOW (window), accelgroup);
-
- /* Translators: This is the short-cut to open the disks/drive gear menu */
- gtk_accelerator_parse (C_("accelerator", "F10"), &key, &mod);
- gtk_accel_map_add_entry ("<Disks>/DriveMenu", key, mod);
- gtk_widget_set_accel_path (window->devtab_drive_generic_button, "<Disks>/DriveMenu", accelgroup);
-
- /* Translators: This is the short-cut to format a disk.
- * The Ctrl modifier must not be translated or parsing will fail.
- * You can however change to another English modifier (e.g. <Shift>).
- */
- gtk_accelerator_parse (C_("accelerator", "<Ctrl>F"), &key, &mod);
- gtk_accel_map_add_entry ("<Disks>/DriveMenu/Format", key, mod);
- gtk_widget_set_accel_path (window->generic_drive_menu_item_format_disk, "<Disks>/DriveMenu/Format",
accelgroup);
-
- /* Translators: This is the short-cut to view SMART data for a disk.
- * The Ctrl modifier must not be translated or parsing will fail.
- * You can however change to another English modifier (e.g. <Shift>).
- */
- gtk_accelerator_parse (C_("accelerator", "<Ctrl>S"), &key, &mod);
- gtk_accel_map_add_entry ("<Disks>/DriveMenu/ViewSmart", key, mod);
- gtk_widget_set_accel_path (window->generic_drive_menu_item_view_smart, "<Disks>/DriveMenu/ViewSmart",
accelgroup);
-
- /* Translators: This is the short-cut to view the "Drive Settings" dialog for a hard disk.
- * The Ctrl modifier must not be translated or parsing will fail.
- * You can however change to another English modifier (e.g. <Shift>).
- */
- gtk_accelerator_parse (C_("accelerator", "<Ctrl>E"), &key, &mod);
- gtk_accel_map_add_entry ("<Disks>/DriveMenu/Settings", key, mod);
- gtk_widget_set_accel_path (window->generic_drive_menu_item_disk_settings, "<Disks>/DriveMenu/Settings",
accelgroup);
-
- /* Translators: This is the short-cut to open the volume gear menu.
- * The Shift modifier must not be translated or parsing will fail.
- * You can however change to another English modifier (e.g. <Ctrl>).
- */
- /* TODO: This results in
- *
- * Gtk-CRITICAL **: gtk_widget_set_accel_path: assertion 'GTK_WIDGET_GET_CLASS (widget)->activate_signal
!= 0' failed
- *
- * so comment it out for now.
- */
-#if 0
- gtk_accelerator_parse (C_("accelerator", "<Shift>F10"), &key, &mod);
- gtk_accel_map_add_entry ("<Disks>/VolumeMenu", key, mod);
- gtk_widget_set_accel_path (window->toolbutton_generic_menu, "<Disks>/VolumeMenu", accelgroup);
-#endif
-
-
- /* Translators: This is the short-cut to format a volume.
- * The Shift and Ctrl modifiers must not be translated or parsing will fail.
- * You can however change to other English modifiers.
- */
- gtk_accelerator_parse (C_("accelerator", "<Shift><Ctrl>F"), &key, &mod);
- gtk_accel_map_add_entry ("<Disks>/VolumeMenu/Format", key, mod);
- gtk_widget_set_accel_path (window->generic_menu_item_format_volume, "<Disks>/VolumeMenu/Format",
accelgroup);
}
static void
@@ -1960,7 +1834,7 @@ update_jobs (GduWindow *window,
drive_sensitivity = !gdu_application_has_running_job (window->application, window->current_object);
selected_volume_sensitivity = (!window->has_volume_job && !window->has_drive_job);
- gets_sensitive = (drive_sensitivity && !gtk_widget_get_sensitive (window->devtab_drive_generic_button))
+ gets_sensitive = (drive_sensitivity && !gtk_widget_get_sensitive (window->devtab_drive_menu_button))
|| (selected_volume_sensitivity && !gtk_widget_get_sensitive
(window->devtab_grid_toolbar));
/* delay for some milliseconds if change to sensitive or while a delay is pending */
@@ -1973,7 +1847,7 @@ update_jobs (GduWindow *window,
}
else
{
- gtk_widget_set_sensitive (window->devtab_drive_generic_button, drive_sensitivity);
+ gtk_widget_set_sensitive (window->devtab_drive_menu_button, drive_sensitivity);
gtk_widget_set_sensitive (window->devtab_drive_eject_button, drive_sensitivity);
gtk_widget_set_sensitive (window->devtab_drive_power_off_button, drive_sensitivity);
gtk_widget_set_sensitive (window->devtab_drive_loop_detach_button, drive_sensitivity);
@@ -2165,7 +2039,6 @@ update_device_page_for_drive (GduWindow *window,
const gchar *our_seat;
const gchar *serial;
GList *jobs;
- gchar *title = NULL;
//g_debug ("In update_device_page_for_drive() - selected=%s",
// object != NULL ? g_dbus_object_get_object_path (object) : "<nothing>");
@@ -2202,22 +2075,12 @@ update_device_page_for_drive (GduWindow *window,
g_free (s);
}
- if (!in_desktop ("Unity"))
- {
- gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), udisks_object_info_get_description (info));
- gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->header), str->str);
- }
- else
- {
- title = g_strdup_printf ("%s — %s", udisks_object_info_get_description (info), str->str);
- gtk_window_set_title (GTK_WINDOW (window), title);
-
- g_free (title);
- }
+ gtk_header_bar_set_title (GTK_HEADER_BAR (window->right_header), udisks_object_info_get_description
(info));
+ gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->right_header), str->str);
g_string_free (str, TRUE);
- gtk_widget_show (window->devtab_drive_generic_button);
+ gtk_widget_show (window->devtab_drive_menu_button);
str = g_string_new (NULL);
if (strlen (drive_vendor) == 0)
@@ -2334,7 +2197,6 @@ update_device_page_for_drive (GduWindow *window,
}
}
-
if (udisks_drive_get_can_power_off (drive))
{
show_flags->drive_menu |= SHOW_FLAGS_DRIVE_MENU_POWER_OFF;
@@ -2381,29 +2243,24 @@ update_device_page_for_drive (GduWindow *window,
show_flags->drive_buttons |= SHOW_FLAGS_DRIVE_BUTTONS_EJECT;
}
- /* Show Drive-specific items */
- gtk_widget_show (GTK_WIDGET (window->generic_drive_menu_item_drive_sep_1));
- gtk_widget_show (GTK_WIDGET (window->generic_drive_menu_item_view_smart));
- gtk_widget_show (GTK_WIDGET (window->generic_drive_menu_item_disk_settings));
- gtk_widget_show (GTK_WIDGET (window->generic_drive_menu_item_drive_sep_2));
+ /* Enable Drive-specific items */
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"view-smart")), TRUE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"disk-settings")), TRUE);
+
if (!(show_flags->drive_menu & (SHOW_FLAGS_DRIVE_MENU_STANDBY_NOW|SHOW_FLAGS_DRIVE_MENU_RESUME_NOW)))
{
/* no PM / safely-remove capabilities... only show "standby" greyed out */
- gtk_widget_show (GTK_WIDGET (window->generic_drive_menu_item_standby_now));
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_standby_now), FALSE);
}
else
{
/* Only show one of Standby and Resume (they are mutually exclusive) */
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_standby_now), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_resume_now), TRUE);
if (show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_STANDBY_NOW)
- gtk_widget_show (GTK_WIDGET (window->generic_drive_menu_item_standby_now));
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"standby-now")), TRUE);
else
- gtk_widget_show (GTK_WIDGET (window->generic_drive_menu_item_resume_now));
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"resume-now")), TRUE);
}
if (show_flags->drive_menu & SHOW_FLAGS_DRIVE_MENU_POWER_OFF)
- gtk_widget_show (GTK_WIDGET (window->generic_drive_menu_item_power_off));
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"power-off")), TRUE);
g_list_foreach (blocks, (GFunc) g_object_unref, NULL);
g_list_free (blocks);
@@ -2434,18 +2291,10 @@ update_device_page_for_loop (GduWindow *window,
info = udisks_client_get_object_info (window->client, object);
device_desc = get_device_file_for_display (block);
- if (!in_desktop ("Unity"))
- {
- gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), udisks_object_info_get_description (info));
- gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->header), device_desc);
- }
- else
- {
- title = g_strdup_printf ("%s — %s", udisks_object_info_get_description (info), device_desc);
- gtk_window_set_title (GTK_WINDOW (window), title);
- }
+ gtk_header_bar_set_title (GTK_HEADER_BAR (window->right_header), udisks_object_info_get_description
(info));
+ gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->right_header), device_desc);
- gtk_widget_show (window->devtab_drive_generic_button);
+ gtk_widget_show (window->devtab_drive_menu_button);
update_generic_drive_bits (window, block, NULL, show_flags, is_delayed_job_update);
@@ -2498,18 +2347,10 @@ update_device_page_for_fake_block (GduWindow *window,
info = udisks_client_get_object_info (window->client, object);
device_desc = get_device_file_for_display (block);
- if (!in_desktop ("Unity"))
- {
- gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), udisks_object_info_get_description (info));
- gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->header), device_desc);
- }
- else
- {
- title = g_strdup_printf ("%s — %s", udisks_object_info_get_description (info), device_desc);
- gtk_window_set_title (GTK_WINDOW (window), title);
- }
+ gtk_header_bar_set_title (GTK_HEADER_BAR (window->right_header), udisks_object_info_get_description
(info));
+ gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->right_header), device_desc);
- gtk_widget_show (window->devtab_drive_generic_button);
+ gtk_widget_show (window->devtab_drive_menu_button);
update_generic_drive_bits (window, block, NULL, show_flags, is_delayed_job_update);
@@ -3044,14 +2885,12 @@ update_device_page (GduWindow *window,
gtk_container_foreach (GTK_CONTAINER (window->devtab_drive_table), maybe_hide, window);
gtk_container_foreach (GTK_CONTAINER (window->devtab_table), maybe_hide, window);
- /* Hide all Drive-specific menu items - will be turned on again in update_device_page_for_drive() */
- gtk_widget_hide (GTK_WIDGET (window->generic_drive_menu_item_drive_sep_1));
- gtk_widget_hide (GTK_WIDGET (window->generic_drive_menu_item_view_smart));
- gtk_widget_hide (GTK_WIDGET (window->generic_drive_menu_item_disk_settings));
- gtk_widget_hide (GTK_WIDGET (window->generic_drive_menu_item_drive_sep_2));
- gtk_widget_hide (GTK_WIDGET (window->generic_drive_menu_item_standby_now));
- gtk_widget_hide (GTK_WIDGET (window->generic_drive_menu_item_resume_now));
- gtk_widget_hide (GTK_WIDGET (window->generic_drive_menu_item_power_off));
+ /* Disable all Drive-specific menu items - will be turned on again in update_device_page_for_drive() */
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"view-smart")), FALSE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"disk-settings")), FALSE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"standby-now")), FALSE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"resume-now")), FALSE);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window),
"power-off")), FALSE);
/* ensure grid is set to the right volumes */
device_page_ensure_grid (window);
@@ -3121,8 +2960,9 @@ update_device_page (GduWindow *window,
#ifdef HAVE_UDISKS2_7_2
static void
-on_generic_menu_item_resize (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_resize (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3218,8 +3058,9 @@ fs_repair_unmount_cb (GduWindow *window,
}
static void
-on_generic_menu_item_repair (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_repair (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
GtkWidget *message_dialog, *ok_button;
@@ -3335,8 +3176,9 @@ fs_check_unmount_cb (GduWindow *window,
}
static void
-on_generic_menu_item_check (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_check (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3370,8 +3212,35 @@ on_generic_menu_item_check (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_menu_item_edit_label (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_open (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GduWindow *window = GDU_WINDOW (user_data);
+
+ update_all (window, FALSE);
+ gtk_popover_popup (GTK_POPOVER (window->volume_menu));
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+on_drive_menu_open (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GduWindow *window = GDU_WINDOW (user_data);
+
+ update_all (window, FALSE);
+ gtk_popover_popup (GTK_POPOVER (window->drive_menu));
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+on_volume_menu_item_edit_label (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3384,8 +3253,9 @@ on_generic_menu_item_edit_label (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_menu_item_edit_partition (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_edit_partition (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3398,8 +3268,9 @@ on_generic_menu_item_edit_partition (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_menu_item_format_volume (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_format_volume (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3412,8 +3283,9 @@ on_generic_menu_item_format_volume (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_drive_menu_item_create_disk_image (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_create_disk_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3426,8 +3298,9 @@ on_generic_drive_menu_item_create_disk_image (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_drive_menu_item_restore_disk_image (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_restore_disk_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3440,8 +3313,9 @@ on_generic_drive_menu_item_restore_disk_image (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_drive_menu_item_benchmark (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_benchmark (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3454,8 +3328,9 @@ on_generic_drive_menu_item_benchmark (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_menu_item_create_volume_image (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_create_volume_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3468,8 +3343,9 @@ on_generic_menu_item_create_volume_image (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_menu_item_restore_volume_image (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_restore_volume_image (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3482,8 +3358,9 @@ on_generic_menu_item_restore_volume_image (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_menu_item_benchmark (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_benchmark (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3496,8 +3373,9 @@ on_generic_menu_item_benchmark (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_drive_menu_item_format_disk (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_format_disk (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3510,8 +3388,9 @@ on_generic_drive_menu_item_format_disk (GtkMenuItem *menu_item,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_menu_item_configure_fstab (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_configure_fstab (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3522,16 +3401,18 @@ on_generic_menu_item_configure_fstab (GtkMenuItem *menu_item,
}
static void
-on_generic_drive_menu_item_view_smart (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_view_smart (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
gdu_ata_smart_dialog_show (window, window->current_object);
}
static void
-on_generic_drive_menu_item_disk_settings (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_disk_settings (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
gdu_disk_settings_dialog_show (window, window->current_object);
@@ -3562,8 +3443,9 @@ ata_pm_standby_cb (GObject *source_object,
}
static void
-on_generic_drive_menu_item_standby_now (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_standby_now (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksDriveAta *ata;
@@ -3608,8 +3490,9 @@ ata_pm_wakeup_cb (GObject *source_object,
}
static void
-on_generic_drive_menu_item_resume_now (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_resume_now (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksDriveAta *ata;
@@ -3719,8 +3602,9 @@ do_power_off (GduWindow *window)
}
static void
-on_generic_drive_menu_item_power_off (GtkMenuItem *menu_item,
- gpointer user_data)
+on_drive_menu_item_power_off (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
do_power_off (window);
@@ -3737,8 +3621,9 @@ on_devtab_drive_power_off_button_clicked (GtkButton *button,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_menu_item_configure_crypttab (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_configure_crypttab (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3750,8 +3635,9 @@ on_generic_menu_item_configure_crypttab (GtkMenuItem *menu_item,
}
static void
-on_generic_menu_item_change_passphrase (GtkMenuItem *menu_item,
- gpointer user_data)
+on_volume_menu_item_change_passphrase (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -3821,17 +3707,12 @@ on_unmount_tool_button_clicked (GtkToolButton *button, gpointer user_data)
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_generic_tool_button_clicked (GtkToolButton *button, gpointer user_data)
+on_volume_menu_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
update_all (window, FALSE);
-
- gtk_menu_popup_at_widget (GTK_MENU (window->generic_menu),
- window->toolbutton_generic_menu,
- GDK_GRAVITY_SOUTH_WEST,
- GDK_GRAVITY_NORTH_WEST,
- NULL);
+ gtk_popover_popup (GTK_POPOVER (window->volume_menu));
}
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/disks/gnome-disks.gresource.xml b/src/disks/gnome-disks.gresource.xml
index 759f4c29..d9542c17 100644
--- a/src/disks/gnome-disks.gresource.xml
+++ b/src/disks/gnome-disks.gresource.xml
@@ -8,11 +8,13 @@
<file preprocess="xml-stripblanks">ui/create-confirm-page.ui</file>
<file preprocess="xml-stripblanks">ui/create-disk-image-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/create-filesystem-page.ui</file>
+ <file preprocess="xml-stripblanks">ui/create-format.ui</file>
<file preprocess="xml-stripblanks">ui/create-other-page.ui</file>
<file preprocess="xml-stripblanks">ui/create-partition-page.ui</file>
<file preprocess="xml-stripblanks">ui/create-password-page.ui</file>
<file preprocess="xml-stripblanks">ui/disk-settings-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/disks.ui</file>
+ <file preprocess="xml-stripblanks">ui/drive-menu.ui</file>
<file preprocess="xml-stripblanks">ui/edit-crypttab-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/edit-dos-partition-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/edit-filesystem-dialog.ui</file>
@@ -21,12 +23,14 @@
<file preprocess="xml-stripblanks">ui/edit-partition-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/erase-multiple-disks-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/format-disk-dialog.ui</file>
- <file preprocess="xml-stripblanks">ui/create-format.ui</file>
+ <file preprocess="xml-stripblanks">ui/headerbar.ui</file>
<file preprocess="xml-stripblanks">ui/new-disk-image-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/resize-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/restore-disk-image-dialog.ui</file>
+ <file preprocess="xml-stripblanks">ui/shortcuts.ui</file>
<file preprocess="xml-stripblanks">ui/smart-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/unlock-device-dialog.ui</file>
+ <file preprocess="xml-stripblanks">ui/volume-menu.ui</file>
<file>ui/gdu.css</file>
</gresource>
</gresources>
diff --git a/src/disks/ui/app-menu.ui b/src/disks/ui/app-menu.ui
index eea28864..668b6956 100644
--- a/src/disks/ui/app-menu.ui
+++ b/src/disks/ui/app-menu.ui
@@ -7,24 +7,22 @@
<attribute name="action">app.new_disk_image</attribute>
</item>
<item>
- <attribute name="label" translatable="yes">Attach Disk _Image…</attribute>
+ <attribute name="label" translatable="yes">_Attach Disk Image… (.iso, .img)</attribute>
<attribute name="action">app.attach_disk_image</attribute>
</item>
</section>
<section>
<item>
- <attribute name="action">app.help</attribute>
- <attribute name="label" translatable="yes">_Help</attribute>
- <attribute name="accel">F1</attribute>
+ <attribute name="action">app.shortcuts</attribute>
+ <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
</item>
<item>
- <attribute name="label" translatable="yes">_About</attribute>
- <attribute name="action">app.about</attribute>
+ <attribute name="action">app.help</attribute>
+ <attribute name="label" translatable="yes">_Help</attribute>
</item>
<item>
- <attribute name="label" translatable="yes">_Quit</attribute>
- <attribute name="action">app.quit</attribute>
- <attribute name="accel"><Primary>q</attribute>
+ <attribute name="label" translatable="yes">_About Disks</attribute>
+ <attribute name="action">app.about</attribute>
</item>
</section>
</menu>
diff --git a/src/disks/ui/disks.ui b/src/disks/ui/disks.ui
index 12824deb..8e04a4dc 100644
--- a/src/disks/ui/disks.ui
+++ b/src/disks/ui/disks.ui
@@ -13,10 +13,11 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkHPaned" id="main-hpane">
+ <object class="GtkPaned" id="main-hpane">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="position">250</property>
+ <property name="orientation">horizontal</property>
+ <property name="position">200</property>
<property name="position_set">True</property>
<child>
<object class="GtkScrolledWindow" id="device-tree-scrolledwindow">
@@ -789,7 +790,7 @@
</packing>
</child>
<child>
- <object class="GtkToolButton" id="toolbutton-generic-menu">
+ <object class="GtkToolButton" id="toolbutton-volume-menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Additional
partition options</property>
@@ -1161,215 +1162,4 @@
</object>
</child>
</object>
- <object class="GtkMenu" id="generic-drive-menu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-format-disk">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Format Disk…</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="menuitem4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-create-disk-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Create Disk Image…</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-restore-disk-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Restore Disk Image…</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-benchmark">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Benchmark Disk…</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="generic-drive-menu-item-drive-sep-1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-view-smart">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">SMART Data & Self-Tests…</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-disk-settings">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Drive Settings…</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="generic-drive-menu-item-drive-sep-2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-standby-now">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Standby Now</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-resume-now">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Wake-Up from Standby</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-drive-menu-item-power-off">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Power Off…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
- <object class="GtkMenu" id="generic-menu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-format-volume">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Format Partition…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="menuitem3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-edit-partition">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Edit Partition…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-edit-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Edit Filesystem…</property>
- <property name="use_underline">True</property>
- </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="label" translatable="yes">Change Passphrase…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="menuitem2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-resize">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Resize…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-check">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Check Filesystem…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-repair">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Repair Filesystem…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="generic-menu-item-separator">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-configure-fstab">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Edit Mount Options…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-configure-crypttab">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Edit Encryption Options…</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>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-create-volume-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Create Partition Image…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-restore-volume-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Restore Partition Image…</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="generic-menu-item-benchmark">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Benchmark Partition…</property>
- </object>
- </child>
- </object>
</interface>
diff --git a/src/disks/ui/drive-menu.ui b/src/disks/ui/drive-menu.ui
new file mode 100644
index 00000000..97505c26
--- /dev/null
+++ b/src/disks/ui/drive-menu.ui
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <menu id='drive-menu'>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Format _Disk…</attribute>
+ <attribute name="action">win.format-disk</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Create Disk Image…</attribute>
+ <attribute name="action">win.create-disk-image</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Restore Disk Image…</attribute>
+ <attribute name="action">win.restore-disk-image</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Benchmark Disk…</attribute>
+ <attribute name="action">win.benchmark-disk</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_SMART Data & Self-Tests…</attribute>
+ <attribute name="action">win.view-smart</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Drive S_ettings…</attribute>
+ <attribute name="action">win.disk-settings</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">S_tandby Now</attribute>
+ <attribute name="action">win.standby-now</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Wake-Up from Standby</attribute>
+ <attribute name="action">win.resume-now</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Power Off</attribute>
+ <attribute name="action">win.power-off</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
diff --git a/src/disks/ui/headerbar.ui b/src/disks/ui/headerbar.ui
new file mode 100644
index 00000000..c3012e57
--- /dev/null
+++ b/src/disks/ui/headerbar.ui
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.10 -->
+ <object class="GtkPaned" id="headerbar-paned">
+ <property name="orientation">horizontal</property>
+ <property name="position">200</property>
+ <child>
+ <object class="GtkHeaderBar" id="disks-side-headerbar">
+ <property name="can_focus">False</property>
+ <property name="title">Disks</property>
+ <property name="show-close-button">True</property>
+ <child>
+ <object class="GtkMenuButton" id="app-menu-button">
+ <property name="visible">True</property>
+ <property name="direction">none</property>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">False</property>
+ <!-- XXX -->
+ <!-- <property name="shrink">False</property> -->
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHeaderBar" id="disks-main-headerbar">
+ <property name="can_focus">False</property>
+ <property name="show-close-button">True</property>
+ <child>
+ <object class="GtkMenuButton" id="drive-menu-button">
+ <property name="visible">True</property>
+ <property name="tooltip-text" translatable="yes">Drive Options</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">view-more-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="power-off-disk-button">
+ <property name="visible">True</property>
+ <property name="tooltip-text" translatable="yes">Power off this disk</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">system-shutdown-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="eject-disk-button">
+ <property name="visible">True</property>
+ <property name="tooltip-text" translatable="yes">Eject this disk</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">media-eject-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="detach-loop-device-button">
+ <property name="visible">True</property>
+ <property name="tooltip-text" translatable="yes">Detach this loop device</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">list-remove-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/src/disks/ui/shortcuts.ui b/src/disks/ui/shortcuts.ui
new file mode 100644
index 00000000..b338253f
--- /dev/null
+++ b/src/disks/ui/shortcuts.ui
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkShortcutsWindow" id="shortcuts">
+ <property name="modal">True</property>
+ <child>
+ <object class="GtkShortcutsSection">
+ <property name="visible">True</property>
+ <property name="section-name">shortcuts</property>
+ <property name="max-height">10</property>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">General</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Create a new empty disk
image</property>
+ <property name="accelerator"><Primary>n</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Attach an existing disk
image</property>
+ <property name="accelerator"><Primary>a</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Help</property>
+ <property name="accelerator">F1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Quit</property>
+ <property name="accelerator"><Primary>q</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Drive</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Open the drive
menu</property>
+ <property name="accelerator">F10</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Format the
drive</property>
+ <property name="accelerator"><Primary>d</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Restore an image to the
disk</property>
+ <property name="accelerator"><Primary>r</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">SMART data</property>
+ <property name="accelerator"><Primary>s</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Drive settings</property>
+ <property name="accelerator"><Primary>e</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Partition</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Open the volume
menu</property>
+ <property name="accelerator"><Shift>F10</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Format the selected
volume</property>
+ <property name="accelerator"><Primary>p</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/src/disks/ui/volume-menu.ui b/src/disks/ui/volume-menu.ui
new file mode 100644
index 00000000..b780c544
--- /dev/null
+++ b/src/disks/ui/volume-menu.ui
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <menu id='volume-menu'>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Format _Partition…</attribute>
+ <attribute name="action">win.format-partition</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Edit Partition…</attribute>
+ <attribute name="action">win.edit-partition</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Edit _Filesystem…</attribute>
+ <attribute name="action">win.edit-label</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Change Pa_ssphrase…</attribute>
+ <attribute name="action">win.change-passphrase</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Resi_ze…</attribute>
+ <attribute name="action">win.resize</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">C_heck Filesystem…</attribute>
+ <attribute name="action">win.check-fs</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Rep_air Filesystem…</attribute>
+ <attribute name="action">win.repair-fs</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Edit _Mount Options…</attribute>
+ <attribute name="action">win.configure-fstab</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Edit Encr_yption Options…</attribute>
+ <attribute name="action">win.configure-crypttab</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Create Partition Image…</attribute>
+ <attribute name="action">win.create-partition-image</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Restore Partition Image…</attribute>
+ <attribute name="action">win.restore-partition-image</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Benchmark Partition…</attribute>
+ <attribute name="action">win.benchmark-partition</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]