Commit 9b5ed5a2 authored by Jens Georg's avatar Jens Georg

Offer a way to hide bottom toolbar

Available in menu like sidebar and with <Ctrl>-F9 Shortcut (slightly following
GNOME Builder there)

Only for LibarayWindow. Fullscreen and Slideshow offer their own means of
(auto-)hiding the toolbar already.
Signed-off-by: Jens Georg's avatarJens Georg <mail@jensge.org>

https://bugzilla.gnome.org/show_bug.cgi?id=741962
parent 83e2e81d
......@@ -35,6 +35,12 @@
<description>True if the sidebar is to be displayed, false otherwise.</description>
</key>
<key name="display-toolbar" type="b">
<default>true</default>
<summary>display toolbar</summary>
<description>True if the bottom toolbar is to be displayed, false otherwise.</description>
</key>
<key name="display-search-bar" type="b">
<default>false</default>
<summary>display search bar</summary>
......
......@@ -36,6 +36,7 @@ public enum ConfigurableProperty {
DISPLAY_EVENT_COMMENTS,
DISPLAY_EXTENDED_PROPERTIES,
DISPLAY_SIDEBAR,
DISPLAY_TOOLBAR,
DISPLAY_SEARCH_BAR,
DISPLAY_PHOTO_RATINGS,
DISPLAY_PHOTO_TAGS,
......@@ -132,6 +133,9 @@ public enum ConfigurableProperty {
case DISPLAY_SIDEBAR:
return "DISPLAY_SIDEBAR";
case DISPLAY_TOOLBAR:
return "DISPLAY_TOOLBAR";
case DISPLAY_SEARCH_BAR:
return "DISPLAY_SEARCH_BAR";
......@@ -630,6 +634,28 @@ public abstract class ConfigurationFacade : Object {
}
}
//
// display toolbar
//
public virtual bool get_display_toolbar() {
try {
return get_engine().get_bool_property(ConfigurableProperty.DISPLAY_TOOLBAR);
} catch (ConfigurationError err) {
on_configuration_error(err);
return false;
}
}
public virtual void set_display_toolbar(bool display) {
try {
get_engine().set_bool_property(ConfigurableProperty.DISPLAY_TOOLBAR, display);
} catch (ConfigurationError err) {
on_configuration_error(err);
}
}
//
// display search & filter toolbar
//
......
......@@ -49,6 +49,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
schema_names[ConfigurableProperty.DISPLAY_BASIC_PROPERTIES] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.DISPLAY_EXTENDED_PROPERTIES] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.DISPLAY_SIDEBAR] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.DISPLAY_TOOLBAR] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.DISPLAY_SEARCH_BAR] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.DISPLAY_PHOTO_RATINGS] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.DISPLAY_PHOTO_TAGS] = UI_PREFS_SCHEMA_NAME;
......@@ -114,6 +115,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
key_names[ConfigurableProperty.DISPLAY_BASIC_PROPERTIES] = "display-basic-properties";
key_names[ConfigurableProperty.DISPLAY_EXTENDED_PROPERTIES] = "display-extended-properties";
key_names[ConfigurableProperty.DISPLAY_SIDEBAR] = "display-sidebar";
key_names[ConfigurableProperty.DISPLAY_TOOLBAR] = "display-toolbar";
key_names[ConfigurableProperty.DISPLAY_SEARCH_BAR] = "display-search-bar";
key_names[ConfigurableProperty.DISPLAY_PHOTO_RATINGS] = "display-photo-ratings";
key_names[ConfigurableProperty.DISPLAY_PHOTO_TAGS] = "display-photo-tags";
......
......@@ -392,7 +392,13 @@ public class LibraryWindow : AppWindow {
sidebar.label = _("S_idebar");
sidebar.tooltip = _("Display the sidebar");
actions += sidebar;
Gtk.ToggleActionEntry toolbar = { "CommonDisplayToolbar", null, TRANSLATABLE,
"<Ctrl>F9", TRANSLATABLE, on_display_toolbar, is_toolbar_visible() };
toolbar.label = _("T_oolbar");
toolbar.tooltip = _("Display the tool bar");
actions += toolbar;
return actions;
}
......@@ -837,7 +843,7 @@ public class LibraryWindow : AppWindow {
set_sidebar_visible(((Gtk.ToggleAction) action).get_active());
}
private void set_sidebar_visible(bool visible) {
sidebar_paned.set_visible(visible);
Config.Facade.get_instance().set_display_sidebar(visible);
......@@ -847,6 +853,22 @@ public class LibraryWindow : AppWindow {
return Config.Facade.get_instance().get_display_sidebar();
}
private void on_display_toolbar (Gtk.Action action) {
set_toolbar_visible ((action as Gtk.ToggleAction).get_active ());
}
private void set_toolbar_visible (bool visible) {
var toolbar = get_current_page ().get_toolbar ();
if (toolbar != null) {
toolbar.set_visible (visible);
}
Config.Facade.get_instance().set_display_toolbar (visible);
}
private bool is_toolbar_visible () {
return Config.Facade.get_instance ().get_display_toolbar ();
}
private void show_extended_properties() {
sync_extended_properties(true);
}
......@@ -1382,6 +1404,7 @@ public class LibraryWindow : AppWindow {
if (toolbar != null) {
right_vbox.add(toolbar);
toolbar.show_all();
toolbar.set_visible (this.is_toolbar_visible ());
}
page.ready();
......
......@@ -27,6 +27,7 @@
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<menuitem name="DisplayToolbar" action="CommonDisplayToolbar" />
<separator />
<menuitem name="ViewComment" action="ViewComment" />
<separator />
......
......@@ -28,6 +28,7 @@
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<menuitem name="DisplayToolbar" action="CommonDisplayToolbar" />
<separator />
<menuitem name="ViewTitle" action="ViewTitle" />
<separator />
......
......@@ -36,6 +36,7 @@
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<menuitem name="DisplayToolbar" action="CommonDisplayToolbar" />
<separator />
<menuitem name="ViewTitle" action="ViewTitle" />
<menuitem name="ViewComment" action="ViewComment" />
......
......@@ -29,6 +29,7 @@
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<menuitem name="DisplayToolbar" action="CommonDisplayToolbar" />
<separator />
<menu name="FilterPhotos" action="CommonFilterPhotos">
<menuitem name="DisplayFiveOrHigher" action="CommonDisplayFiveOrHigher" />
......
......@@ -35,6 +35,7 @@
<menuitem name="DisplayBasicProperties" action="CommonDisplayBasicProperties" />
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<menuitem name="DisplayToolbar" action="CommonDisplayToolbar" />
<separator />
<menuitem name="ViewRatings" action="ViewRatings" />
<separator />
......
......@@ -31,6 +31,7 @@
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<menuitem name="DisplayToolbar" action="CommonDisplayToolbar" />
<separator />
<menu name="FilterPhotos" action="CommonFilterPhotos">
<menuitem name="DisplayFiveOrHigher" action="CommonDisplayFiveOrHigher" />
......
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