@@ -33,15 +33,15 @@ public class Badger.MainWindow : Gtk.Window {
3333
3434 construct {
3535 Intl . setlocale ();
36- settings = new GLib .Settings (" com.github.elfenware.badger.state" );
36+ settings = new GLib .Settings (" com.github.elfenware.badger.timers" );
37+
38+ // We cannot resize window if it is allowed to change
39+ set_size_request (12 , 12 );
40+ set_resizable (false );
3741
38- set_default_size (
39- settings. get_int (" window-width" ),
40- settings. get_int (" window-height" )
41- );
4242
43- set_title (_( " Badger" ) );
44- Gtk . Label title_widget = new Gtk .Label (_( " Badger " ));
43+ set_title (" Badger" );
44+ Gtk . Label title_widget = new Gtk .Label (this . get_title ( ));
4545 title_widget. add_css_class (Granite . STYLE_CLASS_TITLE_LABEL );
4646
4747 this . headerbar = new Gtk .HeaderBar ();
@@ -59,33 +59,31 @@ public class Badger.MainWindow : Gtk.Window {
5959
6060 set_child (handle);
6161
62- var global_switch = new GLib .Settings (" com.github.elfenware.badger.timers" );
62+ // Avoid showing the window without content despite toggle off.
63+ main. revealer. reveal_child = settings. get_boolean (" all" );
6364
64- // Resize window when content gets hidden
65- global_switch. notify[" all" ]. connect (() = > {
66- if (global_switch. get_boolean (" all" ) == false ) {
67- this . height_request = 0 ;
68- this . default_height = 0 ;
69- print (" eugh" );
70- }
71- });
65+ // Resize window accordingly to state of global switch
66+ settings. changed[" all" ]. connect ( on_toggle_changed);
7267
73- // save state
68+ // Avoid a bug whence reopened windows cannot be closed
7469 close_request. connect (e = > {
7570 return before_destroy ();
7671 });
7772 }
7873
74+ private void on_toggle_changed () {
75+ debug (" \n Toggle changed!" );
76+ main. revealer. reveal_child = settings. get_boolean (" all" );
7977
80- // save state
81- private bool before_destroy () {
82- int width, height;
83-
84- get_default_size (out width, out height);
85-
86- settings. set_int (" window-width" , width);
87- settings. set_int (" window-height" , height);
78+ if (! settings. get_boolean (" all" )) {
79+ debug (" \n Toggle is off! Resizing window" );
80+ set_size_request (12 , 12 );
81+ queue_resize ();
82+ }
83+ }
8884
85+ // Avoid a bug whence reopened windows cannot be closed
86+ private bool before_destroy () {
8987 hide ();
9088 return true ;
9189 }
0 commit comments