Commit f5609d89 authored by Wolfgang Steitz's avatar Wolfgang Steitz Committed by Jim Nelson

Remeber "pin toolbar" state in fullscreen: Closes bgo#719111

parent 35632da1
......@@ -142,6 +142,12 @@
<summary>photo thumbnail scale</summary>
<description>The scale of photo thumbnails, ranging from 72 to 360.</description>
</key>
<key name="pin-toolbar-state" type="b">
<default>false</default>
<summary>pin toolbar state</summary>
<description>Pin toolbar in fullscreen, or not.</description>
</key>
<key name="background-color" type="s">
<default>'#444'</default>
......
......@@ -16,7 +16,7 @@ public class FullscreenWindow : PageWindow {
private bool waiting_for_invoke = false;
private time_t left_toolbar_time = 0;
private bool switched_to = false;
private bool is_toolbar_dismissal_enabled = true;
private bool is_toolbar_dismissal_enabled;
public FullscreenWindow(Page page) {
set_current_page(page);
......@@ -45,9 +45,13 @@ public class FullscreenWindow : PageWindow {
move(monitor.x, monitor.y);
set_border_width(0);
// restore pin state
is_toolbar_dismissal_enabled = Config.Facade.get_instance().get_pin_toolbar_state();
pin_button.set_label(_("Pin Toolbar"));
pin_button.set_tooltip_text(_("Pin the toolbar open"));
pin_button.set_active(!is_toolbar_dismissal_enabled);
pin_button.clicked.connect(update_toolbar_dismissal);
close_button.set_tooltip_text(_("Leave fullscreen"));
......@@ -150,6 +154,7 @@ public class FullscreenWindow : PageWindow {
}
private void on_close() {
Config.Facade.get_instance().set_pin_toolbar_state(is_toolbar_dismissal_enabled);
hide_toolbar();
toolbar_window = null;
......
......@@ -59,6 +59,7 @@ public enum ConfigurableProperty {
LIBRARY_WINDOW_WIDTH,
MODIFY_ORIGINALS,
PHOTO_THUMBNAIL_SCALE,
PIN_TOOLBAR_STATE,
PRINTING_CONTENT_HEIGHT,
PRINTING_CONTENT_LAYOUT,
PRINTING_CONTENT_PPI,
......@@ -202,6 +203,9 @@ public enum ConfigurableProperty {
case PHOTO_THUMBNAIL_SCALE:
return "PHOTO_THUMBNAIL_SCALE";
case PIN_TOOLBAR_STATE:
return "PIN_TOOLBAR_STATE";
case PRINTING_CONTENT_HEIGHT:
return "PRINTING_CONTENT_HEIGHT";
......@@ -900,7 +904,27 @@ public abstract class ConfigurationFacade : Object {
on_configuration_error(err);
}
}
//
// pin toolbar state
//
public virtual bool get_pin_toolbar_state() {
try {
return get_engine().get_bool_property(ConfigurableProperty.PIN_TOOLBAR_STATE);
} catch (ConfigurationError err) {
on_configuration_error(err);
return false;
}
}
public virtual void set_pin_toolbar_state(bool state) {
try {
get_engine().set_bool_property(ConfigurableProperty.PIN_TOOLBAR_STATE, state);
} catch (ConfigurationError err) {
on_configuration_error(err);
}
}
//
// last crop height
//
......
......@@ -72,6 +72,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
schema_names[ConfigurableProperty.LIBRARY_WINDOW_WIDTH] = WINDOW_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.MODIFY_ORIGINALS] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.PHOTO_THUMBNAIL_SCALE] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.PIN_TOOLBAR_STATE] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.PRINTING_CONTENT_HEIGHT] = PRINTING_SCHEMA_NAME;
schema_names[ConfigurableProperty.PRINTING_CONTENT_LAYOUT] = PRINTING_SCHEMA_NAME;
schema_names[ConfigurableProperty.PRINTING_CONTENT_PPI] = PRINTING_SCHEMA_NAME;
......@@ -134,6 +135,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
key_names[ConfigurableProperty.LIBRARY_WINDOW_WIDTH] = "library-width";
key_names[ConfigurableProperty.MODIFY_ORIGINALS] = "modify-originals";
key_names[ConfigurableProperty.PHOTO_THUMBNAIL_SCALE] = "photo-thumbnail-scale";
key_names[ConfigurableProperty.PIN_TOOLBAR_STATE] = "pin-toolbar-state";
key_names[ConfigurableProperty.PRINTING_CONTENT_HEIGHT] = "content-height";
key_names[ConfigurableProperty.PRINTING_CONTENT_LAYOUT] = "content-layout";
key_names[ConfigurableProperty.PRINTING_CONTENT_PPI] = "content-ppi";
......
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