Commit 5e173e14 authored by Stefano Facchini's avatar Stefano Facchini

Merge branch 'remove-app-menu' into 'master'

Remove App menu

See merge request GNOME/baobab!6
parents 7187afa0 49902fc7
......@@ -94,8 +94,11 @@ namespace Baobab {
}
Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
set_accels_for_action ("win.show-primary-menu", { "F10" });
set_accels_for_action ("win.scan-folder", { "<Primary>o" });
set_accels_for_action ("win.reload", { "<Primary>r" });
set_accels_for_action ("win.help", { "F1" });
set_accels_for_action ("app.quit", { "<Primary>q" });
}
protected override int handle_local_options (GLib.VariantDict options) {
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="primarymenu">
<section>
<item>
<attribute name="label" translatable="yes">Scan Folder…</attribute>
<attribute name="action">win.scan-folder</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">win.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About Disk Usage Analyzer</attribute>
<attribute name="action">win.about</attribute>
</item>
</section>
</menu>
<object class="GtkMenu" id="treeview_popup_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -39,15 +57,6 @@
<style>
<class name="titlebar"/>
</style>
<child>
<object class="GtkButton" id="scan_button">
<property name="action_name">win.scan-folder</property>
<property name="label" translatable="yes">Scan Folder…</property>
</object>
<packing>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkButton" id="back_button">
<property name="valign">center</property>
......@@ -88,6 +97,20 @@
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="menu_button">
<property name="valign">center</property>
<property name="menu_model">primarymenu</property>
<property name="action_name">win.show-primary-menu</property>
<property name="direction">none</property>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
<template class="BaobabWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Disk Usage Analyzer</property>
......
......@@ -29,12 +29,12 @@ namespace Baobab {
[GtkChild]
private Gtk.HeaderBar header_bar;
[GtkChild]
private Gtk.Button scan_button;
[GtkChild]
private Gtk.Button back_button;
[GtkChild]
private Gtk.Button reload_button;
[GtkChild]
private Gtk.MenuButton menu_button;
[GtkChild]
private Gtk.Stack main_stack;
[GtkChild]
private Gtk.Widget home_page;
......@@ -82,6 +82,7 @@ namespace Baobab {
static Gdk.Cursor busy_cursor;
private const GLib.ActionEntry[] action_entries = {
{ "show-primary-menu", on_show_primary_menu_activate, null, "false", null },
{ "show-home-page", on_show_home_page_activate },
{ "scan-folder", on_scan_folder_activate },
{ "reload", on_reload_activate },
......@@ -196,6 +197,11 @@ namespace Baobab {
show ();
}
void on_show_primary_menu_activate (SimpleAction action) {
var state = action.get_state ().get_boolean ();
action.set_state (new Variant.boolean (!state));
}
void on_show_home_page_activate () {
if (active_location != null && active_location.scanner != null) {
active_location.scanner.cancel ();
......@@ -493,7 +499,7 @@ namespace Baobab {
}
void set_ui_state (Gtk.Widget child, bool busy) {
scan_button.visible = (child == home_page);
menu_button.visible = (child == home_page);
reload_button.visible = (child == result_page);
back_button.visible = (child == result_page);
......
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">win.help</attribute>
<attribute name="accel">F1</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">win.about</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
<menu id="chartmenu">
<section>
<item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment