Skip to content

Commit 96168f8

Browse files
committed
use a bind
1 parent 37e9645 commit 96168f8

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/MainWindow.vala

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace jorts {
4444
private jorts.StickyView view;
4545
private Gtk.HeaderBar headerbar;
4646
private Gtk.ActionBar actionbar;
47+
private Gtk.Revealer swoosh;
4748

4849
private Gtk.Button new_item;
4950
private Gtk.Button delete_item;
@@ -251,7 +252,6 @@ namespace jorts {
251252

252253
actionbar.pack_end (app_button);
253254
actionbar.pack_end (emoji_button);
254-
on_hidebar_changed();
255255

256256
// Define the grid
257257
var mainbox = new Gtk.Box (Gtk.Orientation.VERTICAL,0);
@@ -260,6 +260,15 @@ namespace jorts {
260260
var handle = new Gtk.WindowHandle () {
261261
child = actionbar
262262
};
263+
264+
265+
var swoosh = new Gtk.Revealer() {
266+
child = handle
267+
};
268+
swoosh.set_transition_type (Gtk.RevealerTransitionType.SLIDE_DOWN);
269+
270+
271+
//on_hidebar_changed();
263272

264273
mainbox.append(handle);
265274
set_child (mainbox);
@@ -269,20 +278,15 @@ namespace jorts {
269278
/* CONNECTS */
270279
/*****************************************/
271280

272-
// Save when the window is closed
273-
//this.close_request.connect (() => {
274-
// ((Application)this.application).save_to_stash ();
275-
// return false;
276-
//});
277-
278281
// Use the color theme of this sticky note when focused
279282
this.notify["is-active"].connect(on_focus_changed);
280283

281284
//The application tells us the squiffly state has changed!
282285
Application.gsettings.changed["scribbly-mode-active"].connect (on_scribbly_changed);
283286

284287
//The application tells us the squiffly state has changed!
285-
Application.gsettings.changed["hide-bar"].connect (on_hidebar_changed);
288+
Application.gsettings.bind ("hide-bar", swoosh, "reveal_child", SettingsBindFlags.INVERT_BOOLEAN);
289+
//Application.gsettings.changed["hide-bar"].connect (on_hidebar_changed);
286290

287291
gtk_settings.notify["enable-animations"].connect (on_reduceanimation_changed);
288292

@@ -358,14 +362,7 @@ namespace jorts {
358362

359363
// Called when the window is-active property changes
360364
public void on_hidebar_changed() {
361-
362-
if (Application.gsettings.get_boolean ("hide-bar")) {
363-
this.actionbar.hide();
364-
//this.headerbar.set_show_title_buttons(false);
365-
} else {
366-
this.actionbar.show();
367-
//this.headerbar.set_show_title_buttons(true);
368-
}
365+
this.swoosh.reveal_child = (Application.gsettings.get_boolean ("hide-bar") == false);
369366
}
370367

371368
// Called when the window is-active property changes

0 commit comments

Comments
 (0)