Skip to content

Commit

Permalink
stylistic changes following the merge of #65
Browse files Browse the repository at this point in the history
  • Loading branch information
maoschanz committed Nov 20, 2021
1 parent 5b4fa39 commit e6353e5
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 141 deletions.
26 changes: 11 additions & 15 deletions notes@maestroschan.fr/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ class NotesManager {
// notes need to be loaded first, thus doing the actual initilisation

// Initialisation of the signals connections
this._bindShortcut();
this._bindVisibilityShortcut();
this._bindLayerShortcut();
this._connectAllSignals();
}

_bindShortcut () {
this.USE_SHORTCUT = Convenience.getSettings().get_boolean('use-shortcut');
if (this.USE_SHORTCUT) {
_bindVisibilityShortcut () {
this.USE_VISIBILITY_SHORTCUT = Convenience.getSettings().get_boolean('use-shortcut');
if (this.USE_VISIBILITY_SHORTCUT) {
Main.wm.addKeybinding(
'notes-kb-shortcut',
Convenience.getSettings(),
Expand Down Expand Up @@ -182,18 +182,14 @@ class NotesManager {
//--------------------------------------------------------------------------

_toggleLayer () {
switch (SETTINGS.get_string('layout-position')) {
case 'above-all':
SETTINGS.set_string('layout-position', 'on-background');
break;
case 'on-background':
SETTINGS.set_string('layout-position', 'above-all');
break;
if(SETTINGS.get_string('layout-position') === 'above-all') {
SETTINGS.set_string('layout-position', 'on-background');
} else { // 'on-background':
SETTINGS.set_string('layout-position', 'above-all');
}
}

_toggleState () {

if(!this._notesLoaded) {
this._loadAllNotes();
}
Expand Down Expand Up @@ -284,10 +280,10 @@ class NotesManager {
}

_updateShortcut () {
if(this.USE_SHORTCUT) {
if(this.USE_VISIBILITY_SHORTCUT) {
Main.wm.removeKeybinding('notes-kb-shortcut');
}
this._bindShortcut();
this._bindVisibilityShortcut();
}

_updateLayerShortcut () {
Expand Down Expand Up @@ -354,7 +350,7 @@ class NotesManager {
n.destroy();
});

if(this.USE_SHORTCUT) {
if(this.USE_VISIBILITY_SHORTCUT) {
Main.wm.removeKeybinding('notes-kb-shortcut');
}
if(this.USE_LAYER_SHORTCUT) {
Expand Down
1 change: 0 additions & 1 deletion notes@maestroschan.fr/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ const NotesSettingsWidget = new GObject.Class({
this._hide_switch.sensitive = widget.active;
});


// Context: %s will be replaced with the default keyboard shortcut
let default_kbs_label2 = _("Default value is %s");
default_kbs_label2 = default_kbs_label2.replace('%s', "<Super><Alt>j");
Expand Down
228 changes: 105 additions & 123 deletions notes@maestroschan.fr/prefs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -91,35 +91,72 @@
<!-- </child> -->

<child>
<object class="GtkSeparator">
<object class="GtkLabel">
<property name="expand">False</property>
<property name="halign">end</property>
<!-- <property name="label" translatable="yes">Use a keyboard shortcut</property> -->
<property name="label" translatable="yes">Use a keyboard shortcut to toggle notes position</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">10</property>
<property name="width">2</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="keybinding_switch2">
<property name="expand">False</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>

<child>
<object class="GtkLabel">
<property name="halign">end</property>
<object class="GtkBox">
<property name="expand">False</property>
<property name="label" translatable="yes">Automatic focus</property>
<property name="halign">end</property>
<child>
<object class="GtkEntry" id="keybinding_entry2" />
</child>
<child>
<object class="GtkMenuButton">
<property name="tooltip-text" translatable="yes">Help</property>
<property name="popover">help-popover-1</property>
<child>
<object class="GtkBox">
<property name="spacing">2</property>
<child>
<object class="GtkImage">
<property name="icon-name">help-faq-symbolic</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="icon-name">pan-down-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
<style><class name="linked"/></style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">11</property>
<property name="top-attach">9</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="focus_switch">
<object class="GtkButton" id="keybinding_button2">
<property name="expand">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Apply</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
<property name="top-attach">9</property>
</packing>
</child>

Expand All @@ -129,170 +166,114 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">14</property>
<property name="top-attach">10</property>
<property name="width">2</property>
</packing>
</child>

<child>
<object class="GtkLabel">
<property name="expand">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Toggle notes layer</property>
<property name="tooltip_text" translatable="yes">Use a keyboard shortcut to toggle notes layer (toggle between "Above everything" and "On the background")</property>
<property name="expand">False</property>
<property name="label" translatable="yes">Automatic focus</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">15</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="expand">False</property>
<property name="halign">end</property>
<child>
<object class="GtkEntry" id="keybinding_entry2" />
</child>
<child>
<object class="GtkMenuButton">
<property name="tooltip-text" translatable="yes">Help</property>
<property name="popover">help-popover-1</property>
<child>
<object class="GtkBox">
<property name="spacing">2</property>
<child>
<object class="GtkImage">
<property name="icon-name">help-faq-symbolic</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="icon-name">pan-down-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
<style><class name="linked"/></style>
</object>
<object class="GtkSwitch" id="focus_switch">
<property name="expand">False</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">16</property>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
</packing>
</child>

<child>
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="halign">fill</property>
<child>
<object class="GtkButton" id="keybinding_button2">
<property name="expand">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Apply</property>
</object>
<packing>
<property name="position">1</property>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="keybinding_switch2">
<property name="expand">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
</object>
<packing>
<property name="position">2</property>
<property name="pack_type">end</property>
</packing>
</child>
<object class="GtkSeparator">
<property name="expand">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">16</property>
<property name="left-attach">0</property>
<property name="top-attach">15</property>
<property name="width">2</property>
</packing>
</child>

<child>
<object class="GtkLabel">
<property name="expand">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Toggle notes visibility</property>
<property name="tooltip_text" translatable="yes">Use a keyboard shortcut to toggle notes visibility (toggle between "Show" and "Hide")</property>
<!-- <property name="label" translatable="yes">Use a keyboard shortcut</property> -->
<property name="label" translatable="yes">Use a keyboard shortcut to toggle notes visibility</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">17</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="expand">False</property>
<property name="halign">end</property>
<child>
<object class="GtkEntry" id="keybinding_entry" />
</child>
<object class="GtkSwitch" id="keybinding_switch">
<property name="expand">False</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">17</property>
</packing>
</child>

<child>
<object class="GtkBox">
<property name="expand">False</property>
<property name="halign">end</property>
<child>
<object class="GtkEntry" id="keybinding_entry" />
</child>
<child>
<object class="GtkMenuButton">
<property name="tooltip-text" translatable="yes">Help</property>
<property name="popover">help-popover-1</property>
<child>
<object class="GtkMenuButton">
<property name="tooltip-text" translatable="yes">Help</property>
<property name="popover">help-popover-1</property>
<object class="GtkBox">
<property name="spacing">2</property>
<child>
<object class="GtkBox">
<property name="spacing">2</property>
<child>
<object class="GtkImage">
<property name="icon-name">help-faq-symbolic</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="icon-name">pan-down-symbolic</property>
</object>
</child>
<object class="GtkImage">
<property name="icon-name">help-faq-symbolic</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="icon-name">pan-down-symbolic</property>
</object>
</child>
</object>
</child>
<style><class name="linked"/></style>
</object>
</child>
<style><class name="linked"/></style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">18</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="halign">fill</property>
<child>
<object class="GtkButton" id="keybinding_button">
<property name="expand">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Apply</property>
</object>
<packing>
<property name="position">1</property>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="keybinding_switch">
<property name="expand">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
</object>
<packing>
<property name="position">2</property>
<property name="pack_type">end</property>
</packing>
</child>
<object class="GtkButton" id="keybinding_button">
<property name="expand">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Apply</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">18</property>
<property name="left-attach">1</property>
<property name="top-attach">18</property>
</packing>
</child>

<child>
<object class="GtkLabel">
<property name="halign">end</property>
Expand Down Expand Up @@ -804,3 +785,4 @@

</interface>


Loading

0 comments on commit e6353e5

Please sign in to comment.