Skip to content

Commit

Permalink
Rearrange the code in NoteBox
Browse files Browse the repository at this point in the history
to better differentiate public and private methods

issue #43
  • Loading branch information
maoschanz committed Jun 6, 2020
1 parent c454c27 commit 72d8464
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 200 deletions.
12 changes: 4 additions & 8 deletions notes@maestroschan.fr/extension.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ class NotesManager {
// Save all notes from the ALL_NOTES array to the disk
ALL_NOTES.forEach(function (n) {
if(n.actor != null) {
n.saveState();
n.saveText();
n.onlySave();
}
});
}
Expand Down Expand Up @@ -214,13 +213,10 @@ class NotesManager {
}

_hideNotes () {
ALL_NOTES.forEach(function (n) {
n.onlyHide();
});
this._onlyHideNotes();
ALL_NOTES.forEach(function (n) {
n.onlySave();
});
GLOBAL_ARE_VISIBLE = false;
}

_onlyHideNotes () {
Expand Down Expand Up @@ -302,13 +298,13 @@ class NotesManager {

_updateLayoutSetting () {
ALL_NOTES.forEach(function (n) {
n.remove_from_the_right_actor();
n.removeFromCorrectLayer();
});

Z_POSITION = SETTINGS.get_string('layout-position');

ALL_NOTES.forEach(function (n) {
n.load_in_the_right_actor();
n.loadIntoCorrectLayer();
});
}

Expand Down
14 changes: 7 additions & 7 deletions notes@maestroschan.fr/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const PRESET_COLORS = {

//------------------------------------------------------------------------------

class OptionsMenu {
class NoteOptionsMenu {
constructor (source) {
this.super_menu = new PopupMenu.PopupMenu(source.actor, 0.2, St.Side.LEFT);

Expand Down Expand Up @@ -230,18 +230,18 @@ class OptionsMenu {
}

_onBigger () {
this._source._note.crementFontSize(1);
this._source._note.changeFontSize(1);
}

_onSmaller () {
this._source._note.crementFontSize(-1);
this._source._note.changeFontSize(-1);
}
};
Signals.addSignalMethods(OptionsMenu.prototype);
Signals.addSignalMethods(NoteOptionsMenu.prototype);

//------------------------------------------------------------------------------

var RoundButton = class RoundButton {
var NoteRoundButton = class NoteRoundButton {
constructor (note, icon, accessibleName) {
this._note = note;
this.actor = new St.Button({
Expand Down Expand Up @@ -281,7 +281,7 @@ var RoundButton = class RoundButton {
popupMenu () {
this.actor.fake_release();
if (!this._menu) {
this._menu = new OptionsMenu(this);
this._menu = new NoteOptionsMenu(this);
this._menu.super_menu.connect('open-state-changed', (menu, isPoppedUp) => {
if (!isPoppedUp) {
this.actor.sync_hover();
Expand All @@ -295,7 +295,7 @@ var RoundButton = class RoundButton {
return false;
}
};
Signals.addSignalMethods(RoundButton.prototype);
Signals.addSignalMethods(NoteRoundButton.prototype);

//------------------------------------------------------------------------------

Loading

0 comments on commit 72d8464

Please sign in to comment.