Commit 0a3e0b0d authored by Andreas Brauchli's avatar Andreas Brauchli Committed by Jens Georg

map: add menu entry to show/hide the map

Bind the show/hide map menu action to the keyboard shortcut F10
Add help documentation for the map widget
parent 65fb8089
......@@ -42,6 +42,12 @@
<description>True if the bottom toolbar is to be displayed, false otherwise.</description>
</key>
<key name="display-map-widget" type="b">
<default>true</default>
<summary>display map widget</summary>
<description>True if the map widget is to be displayed, false otherwise.</description>
</key>
<key name="display-search-bar" type="b">
<default>false</default>
<summary>display search bar</summary>
......
......@@ -123,6 +123,11 @@
<attribute name="accel">&lt;Primary&gt;F9</attribute>
<attribute name="action">win.CommonDisplayToolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Map Overview</attribute>
<attribute name="accel">F10</attribute>
<attribute name="action">win.CommonDisplayMap</attribute>
</item>
</section>
<section>
<item>
......
......@@ -95,6 +95,11 @@
<attribute name="accel">&lt;Primary&gt;F9</attribute>
<attribute name="action">win.CommonDisplayToolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Map Overview</attribute>
<attribute name="accel">F10</attribute>
<attribute name="action">win.CommonDisplayMap</attribute>
</item>
</section>
<section>
<item>
......
......@@ -98,6 +98,11 @@
<attribute name="accel">&lt;Primary&gt;F9</attribute>
<attribute name="action">win.CommonDisplayToolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Map Overview</attribute>
<attribute name="accel">F10</attribute>
<attribute name="action">win.CommonDisplayMap</attribute>
</item>
</section>
<section>
<item>
......
......@@ -123,6 +123,11 @@
<attribute name="accel">&lt;Primary&gt;F9</attribute>
<attribute name="action">win.CommonDisplayToolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Map Overview</attribute>
<attribute name="accel">F10</attribute>
<attribute name="action">win.CommonDisplayMap</attribute>
</item>
</section>
<section>
<item>
......
......@@ -102,6 +102,11 @@
<attribute name="accel">&lt;Primary&gt;F9</attribute>
<attribute name="action">win.CommonDisplayToolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Map Overview</attribute>
<attribute name="accel">F10</attribute>
<attribute name="action">win.CommonDisplayMap</attribute>
</item>
</section>
<section>
<submenu>
......
......@@ -114,6 +114,11 @@
<attribute name="accel">&lt;Primary&gt;F9</attribute>
<attribute name="action">win.CommonDisplayToolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Map Overview</attribute>
<attribute name="accel">F10</attribute>
<attribute name="action">win.CommonDisplayMap</attribute>
</item>
</section>
<section>
<item>
......
......@@ -123,6 +123,11 @@
<attribute name="accel">&lt;Primary&gt;F9</attribute>
<attribute name="action">win.CommonDisplayToolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Map Overview</attribute>
<attribute name="accel">F10</attribute>
<attribute name="action">win.CommonDisplayMap</attribute>
</item>
</section>
<section>
<item>
......
......@@ -111,6 +111,11 @@
<attribute name="accel">&lt;Primary&gt;F9</attribute>
<attribute name="action">win.CommonDisplayToolbar</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Map Overview</attribute>
<attribute name="accel">F10</attribute>
<attribute name="action">win.CommonDisplayMap</attribute>
</item>
</section>
<section>
<submenu>
......
......@@ -13,6 +13,8 @@
<p>The Basic Information pane appears at the bottom of the sidebar, and displays a brief summary of the photos you've selected. If no photos are selected, it displays a summary of the entire collection. You can toggle the display of this pane using the <guiseq><gui>View</gui><gui>Basic Information</gui></guiseq> command.</p>
<p>The map pane appears at the bottom of the sidebar as part of the Basic Information pane, and displays an overview map the photos you've selected. If no photos are selected, it displays an overview of the entire collection. You can toggle the display of this pane using the <guiseq><gui>View</gui><gui>Show Map</gui></guiseq> command. Note that the map will only show when the Basic Information pane is displayed.</p>
<p>The floating Extended Information window displays more information about the selected photo. The <guiseq><gui>View</gui><gui>Extended Information</gui></guiseq> command or <keyseq><key>Ctrl</key><key>Shift</key><key>X</key></keyseq> toggles the display of this window.</p>
</page>
......
......@@ -310,6 +310,7 @@ private class MapWidget : Gtk.Bin {
private const uint DEFAULT_ZOOM_LEVEL = 8;
private static MapWidget instance = null;
private bool hide_map = false;
private GtkChamplain.Embed gtk_champlain_widget = new GtkChamplain.Embed();
private Champlain.View map_view = null;
......@@ -368,6 +369,17 @@ private class MapWidget : Gtk.Bin {
Gtk.drag_finish(context, success, false, time);
}
public new void set_visible(bool visible) {
/* hides Gtk.Widget.set_visible */
hide_map = !visible;
base.set_visible(visible);
}
public override void show_all() {
if (!hide_map)
base.show_all();
}
public void set_page(Page page) {
bool page_changed = false;
if (this.page != page) {
......
......@@ -39,6 +39,7 @@ public enum ConfigurableProperty {
DISPLAY_EXTENDED_PROPERTIES,
DISPLAY_SIDEBAR,
DISPLAY_TOOLBAR,
DISPLAY_MAP_WIDGET,
DISPLAY_SEARCH_BAR,
DISPLAY_PHOTO_RATINGS,
DISPLAY_PHOTO_TAGS,
......@@ -150,7 +151,10 @@ public enum ConfigurableProperty {
case DISPLAY_TOOLBAR:
return "DISPLAY_TOOLBAR";
case DISPLAY_MAP_WIDGET:
return "DISPLAY_MAP_WIDGET";
case DISPLAY_SEARCH_BAR:
return "DISPLAY_SEARCH_BAR";
......@@ -722,7 +726,6 @@ public abstract class ConfigurationFacade : Object {
on_configuration_error(err);
}
}
//
// display toolbar
......@@ -745,6 +748,26 @@ public abstract class ConfigurationFacade : Object {
}
}
//
// display map widget
//
public virtual bool get_display_map_widget() {
try {
return get_engine().get_bool_property(ConfigurableProperty.DISPLAY_MAP_WIDGET);
} catch (ConfigurationError err) {
on_configuration_error(err);
return false;
}
}
public virtual void set_display_map_widget(bool display) {
try {
get_engine().set_bool_property(ConfigurableProperty.DISPLAY_MAP_WIDGET, display);
} catch (ConfigurationError err) {
on_configuration_error(err);
}
}
//
// display search & filter toolbar
//
......
......@@ -48,6 +48,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
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_MAP_WIDGET] = 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;
......@@ -122,6 +123,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
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_MAP_WIDGET] = "display-map-widget";
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";
......
......@@ -299,6 +299,7 @@ public class LibraryWindow : AppWindow {
{ "CommonDisplaySearchbar", null, null, "false", on_display_searchbar },
{ "CommonDisplaySidebar", on_action_toggle, null, "true", on_display_sidebar },
{ "CommonDisplayToolbar", null, null, "true", on_display_toolbar },
{ "CommonDisplayMap", on_action_toggle, null, "true", on_display_map_widget },
{ "CommonSortEvents", on_action_radio, "s", "'ascending'", on_events_sort_changed }
};
......@@ -311,6 +312,7 @@ public class LibraryWindow : AppWindow {
lookup_action ("CommonDisplaySearchbar").change_state (Config.Facade.get_instance().get_display_search_bar());
lookup_action ("CommonDisplaySidebar").change_state (is_sidebar_visible ());
lookup_action ("CommonDisplayToolbar").change_state (is_toolbar_visible ());
lookup_action ("CommonDisplayMap").change_state (is_map_widget_visible ());
}
protected override void switched_pages(Page? old_page, Page? new_page) {
......@@ -770,6 +772,21 @@ public class LibraryWindow : AppWindow {
return Config.Facade.get_instance ().get_display_toolbar ();
}
private void on_display_map_widget (GLib.SimpleAction action, Variant variant) {
set_map_widget_visible (variant.get_boolean ());
action.set_state (variant);
}
private void set_map_widget_visible(bool visible) {
MapWidget.get_instance().set_visible(visible);
Config.Facade.get_instance().set_display_map_widget(visible);
}
private bool is_map_widget_visible() {
return Config.Facade.get_instance().get_display_map_widget();
}
public void enqueue_batch_import(BatchImport batch_import, bool allow_user_cancel) {
library_branch.import_queue_entry.enqueue_and_schedule(batch_import, allow_user_cancel);
}
......
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