Commit 9a6fa02e authored by Ash Balgimbayev's avatar Ash Balgimbayev Committed by Lucas Beeler

Allows the user to show & hide the sidebar. Closes #5346.

parent 81260109
......@@ -29,6 +29,12 @@
<description>True if the extended properties window is to be displayed, false otherwise.</description>
</key>
<key name="display-sidebar" type="b">
<default>true</default>
<summary>display sidebar</summary>
<description>True if the sidebar is to be displayed, false otherwise.</description>
</key>
<key name="display-photo-titles" type="b">
<default>false</default>
<summary>display photo titles</summary>
......
......@@ -32,6 +32,7 @@ public enum ConfigurableProperty {
DIRECT_WINDOW_WIDTH,
DISPLAY_BASIC_PROPERTIES,
DISPLAY_EXTENDED_PROPERTIES,
DISPLAY_SIDEBAR,
DISPLAY_PHOTO_RATINGS,
DISPLAY_PHOTO_TAGS,
DISPLAY_PHOTO_TITLES,
......@@ -117,6 +118,9 @@ public enum ConfigurableProperty {
case DISPLAY_EXTENDED_PROPERTIES:
return "DISPLAY_EXTENDED_PROPERTIES";
case DISPLAY_SIDEBAR:
return "DISPLAY_SIDEBAR";
case DISPLAY_PHOTO_RATINGS:
return "DISPLAY_PHOTO_RATINGS";
......@@ -557,6 +561,27 @@ public abstract class ConfigurationFacade : Object {
}
}
//
// display sidebar
//
public virtual bool get_display_sidebar() {
try {
return get_engine().get_bool_property(ConfigurableProperty.DISPLAY_SIDEBAR);
} catch (ConfigurationError err) {
on_configuration_error(err);
return false;
}
}
public virtual void set_display_sidebar(bool display) {
try {
get_engine().set_bool_property(ConfigurableProperty.DISPLAY_SIDEBAR, display);
} catch (ConfigurationError err) {
on_configuration_error(err);
}
}
//
// display photo ratings
//
......
......@@ -45,6 +45,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
schema_names[ConfigurableProperty.DIRECT_WINDOW_WIDTH] = WINDOW_PREFS_SCHEMA_NAME;
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_PHOTO_RATINGS] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.DISPLAY_PHOTO_TAGS] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.DISPLAY_PHOTO_TITLES] = UI_PREFS_SCHEMA_NAME;
......@@ -103,6 +104,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
key_names[ConfigurableProperty.DIRECT_WINDOW_WIDTH] = "direct-width";
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_PHOTO_RATINGS] = "display-photo-ratings";
key_names[ConfigurableProperty.DISPLAY_PHOTO_TAGS] = "display-photo-tags";
key_names[ConfigurableProperty.DISPLAY_PHOTO_TITLES] = "display-photo-titles";
......
......@@ -397,6 +397,12 @@ public class LibraryWindow : AppWindow {
searchbar.tooltip = _("Display the search bar");
actions += searchbar;
Gtk.ToggleActionEntry sidebar = { "CommonDisplaySidebar", null, TRANSLATABLE,
"F9", TRANSLATABLE, on_display_sidebar, is_sidebar_visible() };
sidebar.label = _("S_idebar");
sidebar.tooltip = _("Display the sidebar");
actions += sidebar;
return actions;
}
......@@ -502,6 +508,9 @@ public class LibraryWindow : AppWindow {
init_view_filter(current_page);
toggle_search_bar(should_show_search_bar(), current_page);
// Sidebar
set_sidebar_visible(is_sidebar_visible());
}
public static LibraryWindow get_app() {
......@@ -832,6 +841,20 @@ public class LibraryWindow : AppWindow {
search_actions.reset();
}
private void on_display_sidebar(Gtk.Action action) {
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);
}
private bool is_sidebar_visible() {
return Config.Facade.get_instance().get_display_sidebar();
}
private void show_extended_properties() {
sync_extended_properties(true);
}
......
......@@ -26,6 +26,7 @@
<menuitem name="DisplayBasicProperties" action="CommonDisplayBasicProperties" />
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<separator />
<menu name="SortEvents" action="CommonSortEvents">
<menuitem name="SortEventsAscending" action="CommonSortEventsAscending" />
......
......@@ -27,6 +27,7 @@
<menuitem name="DisplayBasicProperties" action="CommonDisplayBasicProperties" />
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<separator />
<menuitem name="ViewTitle" action="ViewTitle" />
<separator />
......
......@@ -35,6 +35,7 @@
<menuitem name="DisplayBasicProperties" action="CommonDisplayBasicProperties" />
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<separator />
<menuitem name="ViewTitle" action="ViewTitle" />
<menuitem name="ViewTags" action="ViewTags" />
......
......@@ -28,6 +28,7 @@
<menuitem name="DisplayBasicProperties" action="CommonDisplayBasicProperties" />
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<separator />
<menu name="FilterPhotos" action="CommonFilterPhotos">
<menuitem name="DisplayFiveOrHigher" action="CommonDisplayFiveOrHigher" />
......
......@@ -34,6 +34,7 @@
<menu name="ViewMenu" action="ViewMenu">
<menuitem name="DisplayBasicProperties" action="CommonDisplayBasicProperties" />
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<separator />
<menuitem name="ViewRatings" action="ViewRatings" />
<separator />
......
......@@ -30,6 +30,7 @@
<menuitem name="DisplayBasicProperties" action="CommonDisplayBasicProperties" />
<menuitem name="DisplayExtendedProperties" action="CommonDisplayExtendedProperties" />
<menuitem name="DisplaySearchbar" action="CommonDisplaySearchbar" />
<menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
<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