Skip to content

Commit

Permalink
Update the UI to match current guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
maoschanz authored and pothos committed Jan 15, 2019
1 parent 97957f6 commit 922e0c1
Show file tree
Hide file tree
Showing 9 changed files with 740 additions and 722 deletions.
50 changes: 40 additions & 10 deletions src/disks/gduapplication.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -377,30 +394,43 @@ 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 }
};

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]);
}

/* ---------------------------------------------------------------------------------------------------- */
Expand Down
857 changes: 369 additions & 488 deletions src/disks/gduwindow.c

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/disks/gnome-disks.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
16 changes: 7 additions & 9 deletions src/disks/ui/app-menu.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">&lt;Primary&gt;q</attribute>
<attribute name="label" translatable="yes">_About Disks</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
Expand Down
218 changes: 4 additions & 214 deletions src/disks/ui/disks.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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 &amp; 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>
Loading

0 comments on commit 922e0c1

Please sign in to comment.