@@ -120,8 +120,10 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow {
120120 this . notify[" is-active" ]. connect (on_focus_changed);
121121
122122 // The application tells us the squiffly state has changed!
123+ on_scribbly_changed ();
123124 Application . gsettings. changed[" scribbly-mode-active" ]. connect (on_scribbly_changed);
124125
126+
125127 // Respect animation settings for showing ui elements
126128 if (Gtk . Settings . get_default (). gtk_enable_animations && (! Application . gsettings. get_boolean (" hide-bar" ))) {
127129 show. connect_after (delayed_show);
@@ -182,43 +184,45 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow {
182184 }
183185
184186 /**
185- * Handler for scribbly mode settings changed
187+ * Changes the stylesheet accents to the notes color
188+ * Add or remove the Redacted font if the setting is active
189+ */
190+ private void on_focus_changed () {
191+ debug (" Focus changed!" );
192+
193+ if (this . is_active) {
194+ var stylesheet = " io.elementary.stylesheet." + popover. color. to_string (). ascii_down ();
195+ gtk_settings. gtk_theme_name = stylesheet;
196+ }
197+ }
198+
199+ /**
200+ * Connect-disconnect the whole manage text being scribbled
186201 */
187202 private void on_scribbly_changed () {
188203 debug (" Scribbly mode changed!" );
189204
190205 if (Application . gsettings. get_boolean (" scribbly-mode-active" )) {
191- if (this . is_active == false ) {
192- this . add_css_class (" scribbly" );
193- }
206+ this . notify[" is-active" ]. connect (focus_scribble_unscribble);
194207
195208 } else {
196- if (this . is_active == false ) {
197- this . remove_css_class (" scribbly" );
198- }
209+ this . notify[" is-active" ]. disconnect (focus_scribble_unscribble);
210+ view. scribbly = false ;
199211 }
200212 }
201213
202214 /**
203- * Changes the stylesheet accents to the notes color
204- * Add or remove the Redacted font if the setting is active
215+ * Handler connected only when scribbly mode is active
216+ * It just hides or show depending on focus
205217 */
206- private void on_focus_changed () {
207- debug (" Focus changed!" );
218+ private void focus_scribble_unscribble () {
219+ debug (" Scribbly mode changed!" );
208220
209221 if (this . is_active) {
210- var stylesheet = " io.elementary.stylesheet." + popover. color. to_string (). ascii_down ();
211- gtk_settings. gtk_theme_name = stylesheet;
212- }
222+ view. scribbly = false ;
213223
214- if (Application . gsettings. get_boolean (" scribbly-mode-active" )) {
215- if (this . is_active) {
216- this . remove_css_class (" scribbly" );
217- } else {
218- this . add_css_class (" scribbly" );
219- }
220- } else if (" scribbly" in this . css_classes) {
221- this . remove_css_class (" scribbly" );
224+ } else {
225+ view. scribbly = true ;
222226 }
223227 }
224228
@@ -229,15 +233,13 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow {
229233 public NoteData packaged () {
230234 debug (" Packaging into a noteData…" );
231235
232- var content = this . view. textview. buffer. text;
233-
234236 int width ; int height;
235237 this . get_default_size (out width, out height);
236238
237239 var data = new NoteData (
238- view. editablelabel . text ,
240+ view. title ,
239241 popover. color,
240- content,
242+ view . content,
241243 popover. monospace,
242244 popover. zoom,
243245 width,
0 commit comments