Skip to content

Commit

Permalink
Save Right and Left Sidebar width in GSettings. Closes #53
Browse files Browse the repository at this point in the history
  • Loading branch information
Alecaddd committed Sep 30, 2018
1 parent 38f84ac commit 65dd0aa
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
12 changes: 12 additions & 0 deletions schemas/com.github.alecaddd.akira.gschema.xml
Expand Up @@ -24,6 +24,18 @@
<description>The saved height of the window. Must be greater than 800, or it will not take effect.</description>
</key>

<key name="right-paned" type="i">
<default>220</default>
<summary>The saved width of the right panel.</summary>
<description>The saved width of the right panel. Must be greater than 220, or it will not take effect.</description>
</key>

<key name="left-paned" type="i">
<default>220</default>
<summary>The saved width of the left panel.</summary>
<description>The saved width of the left panel. Must be greater than 220, or it will not take effect.</description>
</key>

<key name="dark-theme" type="b">
<default>false</default>
<summary>Use dark theme</summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Layouts/LeftSideBar.vala
Expand Up @@ -37,7 +37,7 @@ public class Akira.Layouts.LeftSideBar : Gtk.Grid {

construct {
get_style_context ().add_class ("sidebar-l");
width_request = 220;
width_request = settings.left_paned;

var label = new Gtk.Label ("Sidebar L");
label.halign = Gtk.Align.CENTER;
Expand Down
2 changes: 1 addition & 1 deletion src/Layouts/RightSideBar.vala
Expand Up @@ -48,7 +48,7 @@ public class Akira.Layouts.RightSideBar : Gtk.Grid {

construct {
get_style_context ().add_class ("sidebar-r");
width_request = 220;
width_request = settings.right_paned;

var pane = new Gtk.Paned (Gtk.Orientation.VERTICAL);
pane.expand = true;
Expand Down
2 changes: 2 additions & 0 deletions src/Services/Settings.vala
Expand Up @@ -23,6 +23,8 @@ public class Akira.Services.Settings : Granite.Services.Settings {
public int pos_y { get; set; }
public int window_width { get; set; default = 1000; }
public int window_height { get; set; default = 600; }
public int right_paned { get; set; default = 220; }
public int left_paned { get; set; default = 220; }
public bool dark_theme { get; set; }
public bool show_label { get; set; }
public bool open_quick { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion src/Window.vala
Expand Up @@ -122,7 +122,9 @@ public class Akira.Window : Gtk.ApplicationWindow {
settings.pos_x = x;
settings.pos_y = y;
settings.window_width = width;
settings.window_height = height;
settings.window_height = height;
settings.right_paned = main_window.right_sidebar.get_allocated_width ();
settings.left_paned = main_window.left_sidebar.get_allocated_width ();
}

public void show_app () {
Expand Down

0 comments on commit 65dd0aa

Please sign in to comment.