From c1689cac756cab9e11db35a50f1889d4eced8040 Mon Sep 17 00:00:00 2001 From: abakkk Date: Tue, 1 Sep 2020 13:43:30 +0200 Subject: [PATCH] rework prefs, settings, locales Although there is a lot of changes, nothing is important. --- area.js | 2 +- extension.js | 4 +- helper.js | 80 ++- locale/draw-on-your-screen.pot | 73 ++- menu.js | 26 +- prefs.js | 375 +++++++------- schemas/gschemas.compiled | Bin 6985 -> 6977 bytes ...extensions.draw-on-your-screen.gschema.xml | 472 ++++++++---------- 8 files changed, 501 insertions(+), 531 deletions(-) diff --git a/area.js b/area.js index 06198bd..d58c65f 100644 --- a/area.js +++ b/area.js @@ -223,7 +223,7 @@ var DrawingArea = new Lang.Class({ this.squareAreaSize = Math.max(64, Me.drawingSettings.get_uint('square-area-size')); } - this.areaBackgroundColor = getClutterColorFromString(Me.drawingSettings.get_string('area-background-color'), 'BLACK'); + this.areaBackgroundColor = getClutterColorFromString(Me.drawingSettings.get_string('background-color'), 'BLACK'); this.gridColor = getClutterColorFromString(Me.drawingSettings.get_string('grid-color'), 'GRAY'); if (Me.drawingSettings.get_boolean('grid-line-auto')) { diff --git a/extension.js b/extension.js index 2f2e52b..64499ff 100644 --- a/extension.js +++ b/extension.js @@ -101,7 +101,7 @@ const AreaManager = new Lang.Class({ Shell.ActionMode.ALL, this.toggleModal.bind(this)); - Main.wm.addKeybinding('erase-drawing', + Main.wm.addKeybinding('erase-drawings', Me.settings, Meta.KeyBindingFlags.NONE, Shell.ActionMode.ALL, @@ -524,7 +524,7 @@ const AreaManager = new Lang.Class({ this.toggleDrawing(); Main.wm.removeKeybinding('toggle-drawing'); Main.wm.removeKeybinding('toggle-modal'); - Main.wm.removeKeybinding('erase-drawing'); + Main.wm.removeKeybinding('erase-drawings'); this.removeAreas(); if (this.indicator) this.indicator.disable(); diff --git a/helper.js b/helper.js index 7ed108d..176ddfe 100644 --- a/helper.js +++ b/helper.js @@ -38,12 +38,7 @@ const GS_VERSION = Config.PACKAGE_VERSION; const HELPER_ANIMATION_TIME = 0.25; const MEDIA_KEYS_SCHEMA = 'org.gnome.settings-daemon.plugins.media-keys'; -const MEDIA_KEYS_KEYS = { - 'screenshot': "Screenshot", - 'screenshot-clip': "Screenshot to clipboard", - 'area-screenshot': "Area screenshot", - 'area-screenshot-clip': "Area screenshot to clipboard" -}; +const MEDIA_KEYS_KEYS = ['screenshot', 'screenshot-clip', 'area-screenshot', 'area-screenshot-clip']; // DrawingHelper provides the "help osd" (Ctrl + F1) // It uses the same texts as in prefs @@ -92,55 +87,58 @@ var DrawingHelper = new Lang.Class({ this.add_actor(this.vbox); this.vbox.add_child(new St.Label({ text: _("Global") })); - for (let settingKey in Prefs.GLOBAL_KEYBINDINGS) { - let hbox = new St.BoxLayout({ vertical: false }); - if (settingKey.indexOf('-separator-') != -1) { - this.vbox.add_child(hbox); - continue; - } + for (let settingKey of Prefs.GLOBAL_KEYBINDINGS) { if (!Me.settings.get_strv(settingKey)[0]) continue; - let [keyval, mods] = Gtk.accelerator_parse(Me.settings.get_strv(settingKey)[0]); - hbox.add_child(new St.Label({ text: _(Prefs.GLOBAL_KEYBINDINGS[settingKey]) })); - hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true })); - this.vbox.add_child(hbox); - } - - this.vbox.add_child(new St.Label({ text: _("Internal") })); - - for (let i = 0; i < Prefs.OTHER_SHORTCUTS.length; i++) { - if (Prefs.OTHER_SHORTCUTS[i].desc.indexOf('-separator-') != -1) { - this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' })); - continue; - } + let hbox = new St.BoxLayout({ vertical: false }); - hbox.add_child(new St.Label({ text: _(Prefs.OTHER_SHORTCUTS[i].desc) })); - hbox.add_child(new St.Label({ text: Prefs.OTHER_SHORTCUTS[i].shortcut, x_expand: true })); - hbox.get_children()[0].get_clutter_text().set_use_markup(true); + let [keyval, mods] = Gtk.accelerator_parse(Me.settings.get_strv(settingKey)[0]); + hbox.add_child(new St.Label({ text: Me.settings.settings_schema.get_key(settingKey).get_summary() })); + hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true })); this.vbox.add_child(hbox); } this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' })); + this.vbox.add_child(new St.Label({ text: _("Internal") })); - for (let settingKey in Prefs.INTERNAL_KEYBINDINGS) { - if (settingKey.indexOf('-separator-') != -1) { + Prefs.OTHER_SHORTCUTS.forEach((object, index) => { + if (index) this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' })); - continue; + + for (let key in object) { + let hbox = new St.BoxLayout({ vertical: false }); + hbox.add_child(new St.Label({ text: _(key) })); + hbox.add_child(new St.Label({ text: object[key], x_expand: true })); + hbox.get_children()[0].get_clutter_text().set_use_markup(true); + this.vbox.add_child(hbox); } - let hbox = new St.BoxLayout({ vertical: false }); - if (!Me.internalShortcutSettings.get_strv(settingKey)[0]) - continue; - let [keyval, mods] = Gtk.accelerator_parse(Me.internalShortcutSettings.get_strv(settingKey)[0]); - hbox.add_child(new St.Label({ text: _(Prefs.INTERNAL_KEYBINDINGS[settingKey]) })); - hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true })); - this.vbox.add_child(hbox); - } + }); + + this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' })); + + Prefs.INTERNAL_KEYBINDINGS.forEach((object, index) => { + if (index) + this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' })); + + for (let settingKey of object) { + if (!Me.internalShortcutSettings.get_strv(settingKey)[0]) + continue; + + let hbox = new St.BoxLayout({ vertical: false }); + let [keyval, mods] = Gtk.accelerator_parse(Me.internalShortcutSettings.get_strv(settingKey)[0]); + hbox.add_child(new St.Label({ text: Me.internalShortcutSettings.settings_schema.get_key(settingKey).get_summary() })); + hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true })); + this.vbox.add_child(hbox); + } + }); let mediaKeysSettings; try { mediaKeysSettings = Convenience.getSettings(MEDIA_KEYS_SCHEMA); } catch(e) { return; } + + this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' })); this.vbox.add_child(new St.Label({ text: _("System") })); - for (let settingKey in MEDIA_KEYS_KEYS) { + for (let settingKey of MEDIA_KEYS_KEYS) { if (!mediaKeysSettings.settings_schema.has_key(settingKey)) continue; let shortcut = GS_VERSION < '3.33.0' ? mediaKeysSettings.get_string(settingKey) : mediaKeysSettings.get_strv(settingKey)[0]; @@ -148,7 +146,7 @@ var DrawingHelper = new Lang.Class({ continue; let [keyval, mods] = Gtk.accelerator_parse(shortcut); let hbox = new St.BoxLayout({ vertical: false }); - hbox.add_child(new St.Label({ text: _(MEDIA_KEYS_KEYS[settingKey]) })); + hbox.add_child(new St.Label({ text: mediaKeysSettings.settings_schema.get_key(settingKey).get_summary() })); hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true })); this.vbox.add_child(hbox); } diff --git a/locale/draw-on-your-screen.pot b/locale/draw-on-your-screen.pot index 833681d..e279645 100644 --- a/locale/draw-on-your-screen.pot +++ b/locale/draw-on-your-screen.pot @@ -53,6 +53,9 @@ msgstr "" msgid "Palettes" msgstr "" +msgid "Color palettes" +msgstr "" + msgid "The palettes of drawing colors" msgstr "" @@ -80,6 +83,9 @@ msgstr "" msgid "Square area size" msgstr "" +msgid "Automatic square area size" +msgstr "" + msgid "Compute the size of the square area from the screen size" msgstr "" @@ -95,12 +101,21 @@ msgstr "" msgid "Grid overlay line" msgstr "" +msgid "Automatic grid overlay line" +msgstr "" + msgid "Compute the lengths from the screen size" msgstr "" +msgid "Grid overlay line spacing" +msgstr "" + msgid "The line width in pixels" msgstr "" +msgid "Grid overlay line width" +msgstr "" + msgid "The gap between lines in pixels" msgstr "" @@ -116,12 +131,21 @@ msgstr "" msgid "Dash array" msgstr "" +msgid "Automatic dash array" +msgstr "" + msgid "Compute the lengths from the line width" msgstr "" +msgid "Dash array on" +msgstr "" + msgid "The dash length in pixels" msgstr "" +msgid "Dash array off" +msgstr "" + msgid "The gap between the dashes in pixels" msgstr "" @@ -233,7 +257,7 @@ msgstr "" msgid "Internal" msgstr "" -msgid "(in drawing mode)" +msgid "In drawing mode" msgstr "" msgid "Undo last brushstroke" @@ -248,34 +272,61 @@ msgstr "" msgid "Smooth last brushstroke" msgstr "" -msgid "Select line" +msgid "Select color 1" msgstr "" -msgid "Select ellipse" +msgid "Select color 2" msgstr "" -msgid "Select rectangle" +msgid "Select color 3" msgstr "" -msgid "Select polygon" +msgid "Select color 4" msgstr "" -msgid "Select polyline" +msgid "Select color 5" msgstr "" -msgid "Select image" +msgid "Select color 6" msgstr "" -msgid "Select text" +msgid "Select color 7" msgstr "" -msgid "Select move" +msgid "Select color 8" msgstr "" -msgid "Select resize" +msgid "Select color 9" msgstr "" -msgid "Select mirror" +msgid "Select ellipse tool" +msgstr "" + +msgid "Select image tool" +msgstr "" + +msgid "Select line tool" +msgstr "" + +msgid "Select mirror tool" +msgstr "" + +msgid "Select move tool" +msgstr "" + +msgid "Select polygon tool" +msgstr "" + +msgid "Select polyline tool" +msgstr "" + +msgid "Select rectangle tool" +msgstr "" + +msgid "Select resize tool" +msgstr "" + +msgid "Select text tool" msgstr "" msgid "Toggle fill/outline" diff --git a/menu.js b/menu.js index 0fe7b6f..ba3f660 100644 --- a/menu.js +++ b/menu.js @@ -66,6 +66,10 @@ const getActor = function(object) { return GS_VERSION < '3.33.0' ? object.actor : object; }; +const getSummary = function(settingKey) { + return Me.internalShortcutSettings.settings_schema.get_key(settingKey).get_summary(); +}; + var DrawingMenu = new Lang.Class({ Name: 'DrawOnYourScreenDrawingMenu', @@ -159,7 +163,7 @@ var DrawingMenu = new Lang.Class({ this.menu.removeAll(); this.actionButtons = []; - let groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: "draw-on-your-screen-menu-group-item" }); + let groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: 'draw-on-your-screen-menu-group-item' }); getActor(groupItem).add_child(this._createActionButton(_("Undo"), this.area.undo.bind(this.area), 'edit-undo-symbolic')); getActor(groupItem).add_child(this._createActionButton(_("Redo"), this.area.redo.bind(this.area), 'edit-redo-symbolic')); getActor(groupItem).add_child(this._createActionButton(_("Erase"), this.area.deleteLastElement.bind(this.area), 'edit-clear-all-symbolic')); @@ -210,19 +214,19 @@ var DrawingMenu = new Lang.Class({ this.imageSection = imageSection; let areaManager = Me.stateObj.areaManager; - this._addSimpleSwitchItem(this.menu, _("Hide panel and dock"), areaManager.hiddenList ? true : false, areaManager.togglePanelAndDockOpacity.bind(areaManager)); - this._addSimpleSwitchItem(this.menu, _("Add a drawing background"), this.area.hasBackground, this.area.toggleBackground.bind(this.area)); - this._addSimpleSwitchItem(this.menu, _("Add a grid overlay"), this.area.hasGrid, this.area.toggleGrid.bind(this.area)); - this._addSimpleSwitchItem(this.menu, _("Square drawing area"), this.area.isSquareArea, this.area.toggleSquareArea.bind(this.area)); + this._addSimpleSwitchItem(this.menu, getSummary('toggle-panel-and-dock-visibility'), !!areaManager.hiddenList, areaManager.togglePanelAndDockOpacity.bind(areaManager)); + this._addSimpleSwitchItem(this.menu, getSummary('toggle-background'), this.area.hasBackground, this.area.toggleBackground.bind(this.area)); + this._addSimpleSwitchItem(this.menu, getSummary('toggle-grid'), this.area.hasGrid, this.area.toggleGrid.bind(this.area)); + this._addSimpleSwitchItem(this.menu, getSummary('toggle-square-area'), this.area.isSquareArea, this.area.toggleSquareArea.bind(this.area)); this._addSeparator(this.menu); this._addDrawingNameItem(this.menu); this._addOpenDrawingSubMenuItem(this.menu); this._addSaveDrawingSubMenuItem(this.menu); - this.menu.addAction(_("Save drawing as a SVG file"), this.area.saveAsSvg.bind(this.area), 'image-x-generic-symbolic'); - this.menu.addAction(_("Open preferences"), areaManager.openPreferences.bind(areaManager), 'document-page-setup-symbolic'); - this.menu.addAction(_("Show help"), () => { this.close(); this.area.toggleHelp(); }, 'preferences-desktop-keyboard-shortcuts-symbolic'); + this.menu.addAction(getSummary('save-as-svg'), this.area.saveAsSvg.bind(this.area), 'image-x-generic-symbolic'); + this.menu.addAction(getSummary('open-preferences'), areaManager.openPreferences.bind(areaManager), 'document-page-setup-symbolic'); + this.menu.addAction(getSummary('toggle-help'), () => { this.close(); this.area.toggleHelp(); }, 'preferences-desktop-keyboard-shortcuts-symbolic'); this._updateActionSensitivity(); this._updateSectionVisibility(); @@ -308,7 +312,7 @@ var DrawingMenu = new Lang.Class({ if (GS_VERSION < '3.33.0') { slider.connect('value-changed', (slider, value, property) => { target[targetProperty] = Math.max(Math.round(value * 50), 0); - label.set_text(target[targetProperty] + " px"); + label.set_text(_("%d px").format(target[targetProperty])); if (target[targetProperty] === 0) label.add_style_class_name(WARNING_COLOR_STYLE_CLASS_NAME); else @@ -317,7 +321,7 @@ var DrawingMenu = new Lang.Class({ } else { slider.connect('notify::value', () => { target[targetProperty] = Math.max(Math.round(slider.value * 50), 0); - label.set_text(target[targetProperty] + " px"); + label.set_text(_("%d px").format(target[targetProperty])); if (target[targetProperty] === 0) label.add_style_class_name(WARNING_COLOR_STYLE_CLASS_NAME); else @@ -539,7 +543,7 @@ var DrawingMenu = new Lang.Class({ }, _addSaveDrawingSubMenuItem: function(menu) { - let item = new PopupMenu.PopupSubMenuMenuItem(_("Save drawing"), true); + let item = new PopupMenu.PopupSubMenuMenuItem(getSummary('save-as-json'), true); this.saveDrawingSubMenuItem = item; this._updateSaveDrawingSubMenuItemSensitivity(); this.saveDrawingSubMenu = item.menu; diff --git a/prefs.js b/prefs.js index a92bb01..7e192cb 100644 --- a/prefs.js +++ b/prefs.js @@ -21,6 +21,7 @@ * along with this program. If not, see . */ +const Atk = imports.gi.Atk; const Gdk = imports.gi.Gdk; const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; @@ -40,91 +41,48 @@ const _GTK = imports.gettext.domain('gtk30').gettext; const GS_VERSION = Config.PACKAGE_VERSION; const MARGIN = 10; +const ROWBOX_MARGIN_PARAMS = { margin_top: MARGIN / 2, margin_bottom: MARGIN / 2, margin_left: MARGIN, margin_right: MARGIN }; -var GLOBAL_KEYBINDINGS = { - 'toggle-drawing': "Enter/leave drawing mode", - 'toggle-modal': "Grab/ungrab keyboard and pointer", - 'erase-drawing': "Erase all drawings" -}; +var GLOBAL_KEYBINDINGS = ['toggle-drawing', 'toggle-modal', 'erase-drawings']; +var INTERNAL_KEYBINDINGS = [ + ['undo', 'undo', 'delete-last-element', 'smooth-last-element'], + ['select-none-shape', 'select-line-shape', 'select-ellipse-shape', 'select-rectangle-shape', 'select-polygon-shape', 'select-polyline-shape', + 'select-text-shape', 'select-image-shape', 'select-move-tool', 'select-resize-tool', 'select-mirror-tool'], + ['switch-fill', 'switch-fill-rule', 'switch-color-palette', 'switch-color-palette-reverse'], + ['increment-line-width', 'decrement-line-width', 'increment-line-width-more', 'decrement-line-width-more', + 'switch-linejoin', 'switch-linecap', 'switch-dash'], + ['switch-font-family', 'switch-font-family-reverse', 'switch-font-weight', 'switch-font-style', 'switch-text-alignment', 'switch-image-file'], + ['toggle-panel-and-dock-visibility', 'toggle-background', 'toggle-grid', 'toggle-square-area'], + ['open-previous-json', 'open-next-json', 'save-as-json', 'save-as-svg', 'open-preferences', 'toggle-help'] +]; -var INTERNAL_KEYBINDINGS = { - 'undo': "Undo last brushstroke", - 'redo': "Redo last brushstroke", - 'delete-last-element' : "Erase last brushstroke", - 'smooth-last-element': "Smooth last brushstroke", - '-separator-1': '', - 'select-none-shape': "Free drawing", - 'select-line-shape': "Select line", - 'select-ellipse-shape': "Select ellipse", - 'select-rectangle-shape': "Select rectangle", - 'select-polygon-shape': "Select polygon", - 'select-polyline-shape': "Select polyline", - 'select-text-shape': "Select text", - 'select-image-shape': "Select image", - 'select-move-tool': "Select move", - 'select-resize-tool': "Select resize", - 'select-mirror-tool': "Select mirror", - '-separator-2': '', - 'switch-fill': "Toggle fill/outline", - 'switch-fill-rule': "Toggle fill rule", - 'switch-color-palette': "Change color palette", - 'switch-color-palette-reverse': "Change color palette (reverse)", - '-separator-3': '', - 'increment-line-width': "Increment line width", - 'decrement-line-width': "Decrement line width", - 'increment-line-width-more': "Increment line width even more", - 'decrement-line-width-more': "Decrement line width even more", - 'switch-linejoin': "Change linejoin", - 'switch-linecap': "Change linecap", - 'switch-dash': "Dashed line", - '-separator-4': '', - 'switch-font-family': "Change font family", - 'switch-font-family-reverse': "Change font family (reverse)", - 'switch-font-weight': "Change font weight", - 'switch-font-style': "Change font style", - 'switch-text-alignment': "Toggle text alignment", - 'switch-image-file': "Change image file", - '-separator-5': '', - 'toggle-panel-and-dock-visibility': "Hide panel and dock", - 'toggle-background': "Add a drawing background", - 'toggle-grid': "Add a grid overlay", - 'toggle-square-area': "Square drawing area", - '-separator-6': '', - 'open-previous-json': "Open previous drawing", - 'open-next-json': "Open next drawing", - 'save-as-json': "Save drawing", - 'save-as-svg': "Save drawing as a SVG file", - 'open-preferences': "Open preferences", - 'toggle-help': "Show help" -}; - -if (GS_VERSION < "3.36") - delete INTERNAL_KEYBINDINGS['open-preferences']; +if (GS_VERSION < '3.36') + delete INTERNAL_KEYBINDINGS[INTERNAL_KEYBINDINGS.length - 1]['open-preferences']; const getKeyLabel = function(accel) { let [keyval, mods] = Gtk.accelerator_parse(accel); return Gtk.accelerator_get_label(keyval, mods); }; -var OTHER_SHORTCUTS = [ - { desc: "Draw", get shortcut() { return _("Left click"); } }, - { desc: "Menu", get shortcut() { return _("Right click"); } }, - { desc: "Toggle fill/outline", get shortcut() { return _("Center click"); } }, - { desc: "Increment/decrement line width", get shortcut() { return _("Scroll"); } }, - { desc: "Select color", get shortcut() { return _("%s … %s").format(getKeyLabel('1'), getKeyLabel('9')); } }, - { desc: "Ignore pointer movement", get shortcut() { return _("%s held").format(getKeyLabel('space')); } }, - { desc: "Leave", shortcut: getKeyLabel('Escape') }, - { desc: "-separator-1", shortcut: "" }, - { desc: "Select eraser (while starting drawing)", shortcut: getKeyLabel('') }, - { desc: "Duplicate (while starting handling)", shortcut: getKeyLabel('') }, - { desc: "Rotate rectangle, polygon, polyline", shortcut: getKeyLabel('') }, - { desc: "Extend circle to ellipse", shortcut: getKeyLabel('') }, - { desc: "Curve line", shortcut: getKeyLabel('') }, - { desc: "Smooth free drawing outline", shortcut: getKeyLabel('') }, - { desc: "Rotate (while moving)", shortcut: getKeyLabel('') }, - { desc: "Stretch (while resizing)", shortcut: getKeyLabel('') }, - { desc: "Inverse (while mirroring)", shortcut: getKeyLabel('') } -]; +var OTHER_SHORTCUTS = [{ + get "Draw"() { return _("Left click"); }, + get "Menu"() { return _("Right click"); }, + get "Toggle fill/outline"() { return _("Center click"); }, + get "Increment/decrement line width"() { return _("Scroll"); }, + get "Select color"() { return _("%s … %s").format(getKeyLabel('1'), getKeyLabel('9')); }, + get "Ignore pointer movement"() { return _("%s held").format(getKeyLabel('space')); }, + "Leave": getKeyLabel('Escape'), + }, { + "Select eraser (while starting drawing)": getKeyLabel(''), + "Duplicate (while starting handling)": getKeyLabel(''), + "Rotate rectangle, polygon, polyline": getKeyLabel(''), + "Extend circle to ellipse": getKeyLabel(''), + "Curve line": getKeyLabel(''), + "Smooth free drawing outline": getKeyLabel(''), + "Rotate (while moving)": getKeyLabel(''), + "Stretch (while resizing)": getKeyLabel(''), + "Inverse (while mirroring)": getKeyLabel(''), +}]; function init() { Convenience.initTranslations(); @@ -168,7 +126,7 @@ const AboutPage = new GObject.Class({ _init: function(params) { this.parent({ hscrollbar_policy: Gtk.PolicyType.NEVER }); - let vbox= new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN*3 }); + let vbox= new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN * 3 }); this.add(vbox); let name = " " + _(Me.metadata.name) + ""; @@ -184,7 +142,7 @@ const AboutPage = new GObject.Class({ vbox.add(aboutLabel); - let creditBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin: 2*MARGIN }); + let creditBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin: 2 * MARGIN }); let leftBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); let rightBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); let leftLabel = new Gtk.Label({ wrap: true, valign: 1, halign: 2, justify: 1, use_markup: true, label: "" + _GTK("Created by") + "" }); @@ -218,42 +176,46 @@ const DrawingPage = new GObject.Class({ this.settings = Convenience.getSettings(Me.metadata['settings-schema'] + '.drawing'); this.schema = this.settings.settings_schema; - let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN*3 }); + let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: 3 * MARGIN, spacing: 3 * MARGIN }); this.add(box); - let palettesFrame = new Gtk.Frame({ label_yalign: 1.0 }); - palettesFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "" + _("Palettes") + "" })); + let palettesFrame = new Frame({ label: _("Palettes") }); box.add(palettesFrame); - let palettesScrolledWindow = new Gtk.ScrolledWindow({ vscrollbar_policy: Gtk.PolicyType.NEVER, margin_top: MARGIN/2, margin_bottom: MARGIN/2 }); + let palettesScrolledWindow = new Gtk.ScrolledWindow({ vscrollbar_policy: Gtk.PolicyType.NEVER, margin_top: MARGIN / 2, margin_bottom: MARGIN / 2 }); palettesFrame.add(palettesScrolledWindow); this.palettesListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true }); this.palettesListBox.get_style_context().add_class('background'); + this.palettesListBox.get_accessible().set_name(this.schema.get_key('palettes').get_summary()); + this.palettesListBox.get_accessible().set_description(this.schema.get_key('palettes').get_description()); palettesScrolledWindow.add(this.palettesListBox); this.settings.connect('changed::palettes', this._updatePalettes.bind(this)); this._updatePalettes(); - this.addBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN, tooltip_text: _("Add a new palette") }); + this.addBox = new Gtk.Box(ROWBOX_MARGIN_PARAMS); let addButton = Gtk.Button.new_from_icon_name('list-add-symbolic', Gtk.IconSize.BUTTON); + addButton.set_tooltip_text(_("Add a new palette")); this.addBox.pack_start(addButton, true, true, 4); addButton.connect('clicked', this._addNewPalette.bind(this)); this.palettesListBox.add(this.addBox); this.addBox.get_parent().set_activatable(false); - let areaFrame = new Gtk.Frame({ margin_top: 3*MARGIN, label_yalign: 1.0 }); - areaFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "" + _("Area") + "" })); + let areaFrame = new Frame({ label: _("Area") }); box.add(areaFrame); - let areaListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN/2, margin_bottom: MARGIN/2 }); + let areaListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN / 2, margin_bottom: MARGIN / 2 }); areaListBox.get_style_context().add_class('background'); areaFrame.add(areaListBox); - let squareAreaRow = new PrefRow({ label: _("Square area size") }); - let squareAreaAutoButton = new Gtk.CheckButton({ label: _("Auto"), tooltip_text: _(this.schema.get_key('square-area-auto').get_description()) }); + let squareAreaRow = new PrefRow({ label: this.schema.get_key('square-area-size').get_summary() }); + let squareAreaAutoButton = new Gtk.CheckButton({ label: _("Auto"), + name: this.schema.get_key('square-area-auto').get_summary(), + tooltip_text: this.schema.get_key('square-area-auto').get_description() }); let squareAreaSizeButton = new PixelSpinButton({ width_chars: 5, digits: 0, adjustment: Gtk.Adjustment.new(0, 64, 32768, 1, 10, 0), - tooltip_text: _(this.schema.get_key('square-area-size').get_description()) }); + name: this.schema.get_key('square-area-size').get_summary(), + tooltip_text: this.schema.get_key('square-area-size').get_description() }); this.settings.bind('square-area-auto', squareAreaAutoButton, 'active', 0); this.settings.bind('square-area-size', squareAreaSizeButton, 'value', 0); squareAreaAutoButton.bind_property('active', squareAreaSizeButton, 'sensitive', GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.INVERT_BOOLEAN); @@ -261,21 +223,26 @@ const DrawingPage = new GObject.Class({ squareAreaRow.addWidget(squareAreaSizeButton); areaListBox.add(squareAreaRow); - let backgroundColorRow = new PrefRow({ label: _("Background color") }); + let backgroundColorRow = new PrefRow({ label: this.schema.get_key('background-color').get_summary() }); let backgroundColorButton = new ColorStringButton({ use_alpha: true, show_editor: true, - tooltip_text: _(this.schema.get_key('area-background-color').get_description()) }); - this.settings.bind('area-background-color', backgroundColorButton, 'color-string', 0); + name: this.schema.get_key('background-color').get_summary(), + tooltip_text: this.schema.get_key('background-color').get_description() }); + this.settings.bind('background-color', backgroundColorButton, 'color-string', 0); backgroundColorRow.addWidget(backgroundColorButton); areaListBox.add(backgroundColorRow); let gridLineRow = new PrefRow({ label: _("Grid overlay line") }); - let gridLineAutoButton = new Gtk.CheckButton({ label: _("Auto"), tooltip_text: _(this.schema.get_key('grid-line-auto').get_description()) }); + let gridLineAutoButton = new Gtk.CheckButton({ label: _("Auto"), + name: this.schema.get_key('grid-line-auto').get_summary(), + tooltip_text: this.schema.get_key('grid-line-auto').get_description() }); let gridLineWidthButton = new PixelSpinButton({ width_chars: 5, digits: 1, - adjustment: Gtk.Adjustment.new(0, 0.1, 10, 0.1, 1, 0), - tooltip_text: _(this.schema.get_key('grid-line-width').get_description()) }); + adjustment: Gtk.Adjustment.new(0, 0.1, 10, 0.1, 1, 0), + name: this.schema.get_key('grid-line-width').get_summary(), + tooltip_text: this.schema.get_key('grid-line-width').get_description() }); let gridLineSpacingButton = new PixelSpinButton({ width_chars: 5, digits: 1, - adjustment: Gtk.Adjustment.new(0, 1, 16384, 1, 10, 0), - tooltip_text: _(this.schema.get_key('grid-line-spacing').get_description()) }); + adjustment: Gtk.Adjustment.new(0, 1, 16384, 1, 10, 0), + name: this.schema.get_key('grid-line-spacing').get_summary(), + tooltip_text: this.schema.get_key('grid-line-spacing').get_description() }); this.settings.bind('grid-line-auto', gridLineAutoButton, 'active', 0); this.settings.bind('grid-line-width', gridLineWidthButton, 'value', 0); this.settings.bind('grid-line-spacing', gridLineSpacingButton, 'value', 0); @@ -286,29 +253,33 @@ const DrawingPage = new GObject.Class({ gridLineRow.addWidget(gridLineSpacingButton); areaListBox.add(gridLineRow); - let gridColorRow = new PrefRow({ label: _("Grid overlay color") }); + let gridColorRow = new PrefRow({ label: this.schema.get_key('grid-color').get_summary() }); let gridColorButton = new ColorStringButton({ use_alpha: true, show_editor: true, - tooltip_text: _(this.schema.get_key('grid-color').get_description()) }); + name: this.schema.get_key('grid-color').get_summary(), + tooltip_text: this.schema.get_key('grid-color').get_description() }); this.settings.bind('grid-color', gridColorButton, 'color-string', 0); gridColorRow.addWidget(gridColorButton); areaListBox.add(gridColorRow); - let toolsFrame = new Gtk.Frame({ margin_top: 3*MARGIN, label_yalign: 1.0 }); - toolsFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "" + _("Tools") + "" })); + let toolsFrame = new Frame({ label: _("Tools") }); box.add(toolsFrame); - let toolsListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN/2, margin_bottom: MARGIN/2 }); + let toolsListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN / 2, margin_bottom: MARGIN / 2 }); toolsListBox.get_style_context().add_class('background'); toolsFrame.add(toolsListBox); let dashArrayRow = new PrefRow({ label: _("Dash array") }); - let dashArrayAutoButton = new Gtk.CheckButton({ label: _("Auto"), tooltip_text: _(this.schema.get_key('dash-array-auto').get_description()) }); + let dashArrayAutoButton = new Gtk.CheckButton({ label: _("Auto"), + name: this.schema.get_key('dash-array-auto').get_summary(), + tooltip_text: this.schema.get_key('dash-array-auto').get_description() }); let dashArrayOnButton = new PixelSpinButton({ width_chars: 5, digits: 1, adjustment: Gtk.Adjustment.new(0, 0, 16384, 0.1, 1, 0), - tooltip_text: _(this.schema.get_key('dash-array-on').get_description()) }); + name: this.schema.get_key('dash-array-on').get_summary(), + tooltip_text: this.schema.get_key('dash-array-on').get_description() }); let dashArrayOffButton = new PixelSpinButton({ width_chars: 5, digits: 1, adjustment: Gtk.Adjustment.new(0, 0, 16384, 0.1, 1, 0), - tooltip_text: _(this.schema.get_key('dash-array-off').get_description()) }); + name: this.schema.get_key('dash-array-off').get_summary(), + tooltip_text: this.schema.get_key('dash-array-off').get_description() }); this.settings.bind('dash-array-auto', dashArrayAutoButton, 'active', 0); this.settings.bind('dash-array-on', dashArrayOnButton, 'value', 0); this.settings.bind('dash-array-off', dashArrayOffButton, 'value', 0); @@ -319,10 +290,11 @@ const DrawingPage = new GObject.Class({ dashArrayRow.addWidget(dashArrayOffButton); toolsListBox.add(dashArrayRow); - let dashOffsetRow = new PrefRow({ label: _("Dash offset") }); + let dashOffsetRow = new PrefRow({ label: this.schema.get_key('dash-offset').get_summary() }); let dashOffsetButton = new PixelSpinButton({ width_chars: 5, digits: 1, adjustment: Gtk.Adjustment.new(0, -16384, 16384, 0.1, 1, 0), - tooltip_text: _(this.schema.get_key('dash-offset').get_description()) }); + name: this.schema.get_key('dash-offset').get_summary(), + tooltip_text: this.schema.get_key('dash-offset').get_description() }); this.settings.bind('dash-offset', dashOffsetButton, 'value', 0); dashOffsetRow.addWidget(dashOffsetButton); toolsListBox.add(dashOffsetRow); @@ -353,7 +325,7 @@ const DrawingPage = new GObject.Class({ let removeButton = Gtk.Button.new_from_icon_name('list-remove-symbolic', Gtk.IconSize.BUTTON); removeButton.set_tooltip_text(_("Remove the palette")); removeButton.connect('clicked', this._removePalette.bind(this, paletteIndex)); - paletteBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN }); + paletteBox = new Gtk.Box(ROWBOX_MARGIN_PARAMS); paletteBox.pack_start(nameEntry, true, true, 4); paletteBox.pack_start(new Gtk.Box({ spacing: 4 }), false, false, 4); paletteBox.pack_start(removeButton, false, false, 4); @@ -416,108 +388,83 @@ const PrefsPage = new GObject.Class({ this.parent({ hscrollbar_policy: Gtk.PolicyType.NEVER }); let settings = Convenience.getSettings(); + let schema = settings.settings_schema; let internalShortcutSettings = Convenience.getSettings(Me.metadata['settings-schema'] + '.internal-shortcuts'); - let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN*3 }); + let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN * 3, spacing: 3 * MARGIN }); this.add(box); - let globalFrame = new Gtk.Frame({ label_yalign: 1.0 }); - globalFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "" + _("Global") + "" })); + let globalFrame = new Frame({ label: _("Global") }); box.add(globalFrame); - let listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN/2, margin_bottom: MARGIN/2 }); + let listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN / 2, margin_bottom: MARGIN / 2 }); + listBox.get_style_context().add_class('background'); globalFrame.add(listBox); - let styleContext = listBox.get_style_context(); - styleContext.add_class('background'); - + let globalKeybindingsRow = new Gtk.ListBoxRow({ activatable: false }); let globalKeybindingsWidget = new KeybindingsWidget(GLOBAL_KEYBINDINGS, settings); - globalKeybindingsWidget.margin = MARGIN; - listBox.add(globalKeybindingsWidget); + globalKeybindingsRow.add(globalKeybindingsWidget); + listBox.add(globalKeybindingsRow); - let persistentBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN }); - let persistentLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); - let persistentLabel1 = new Gtk.Label({label: _("Persistent")}); - let persistentLabel2 = new Gtk.Label({ use_markup: true, halign: 1, wrap: true, xalign: 0, label: "" + _("Persistent drawing through session restart") + "" }); - persistentLabel1.set_halign(1); - persistentLabel2.get_style_context().add_class('dim-label'); - persistentLabelBox.pack_start(persistentLabel1, true, true, 0); - persistentLabelBox.pack_start(persistentLabel2, true, true, 0); - let persistentSwitch = new Gtk.Switch({valign: 3}); + let persistentKey = schema.get_key('persistent-drawing'); + let persistentRow = new PrefRow({ label: persistentKey.get_summary(), desc: persistentKey.get_description() }); + let persistentSwitch = new Gtk.Switch(); settings.bind('persistent-drawing', persistentSwitch, 'active', 0); - persistentBox.pack_start(persistentLabelBox, true, true, 4); - persistentBox.pack_start(persistentSwitch, false, false, 4); - listBox.add(persistentBox); + persistentRow.addWidget(persistentSwitch, true); + listBox.add(persistentRow); - let desktopBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN }); - let desktopLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); - let desktopLabel1 = new Gtk.Label({label: _("Drawing on the desktop")}); - let desktopLabel2 = new Gtk.Label({ use_markup: true, halign: 1, wrap: true, xalign: 0, label: "" + _("Draw On Your Screen becomes Draw On Your Desktop") + "" }); - desktopLabel1.set_halign(1); - desktopLabel2.get_style_context().add_class('dim-label'); - desktopLabelBox.pack_start(desktopLabel1, true, true, 0); - desktopLabelBox.pack_start(desktopLabel2, true, true, 0); - let desktopSwitch = new Gtk.Switch({valign: 3}); + let desktopKey = schema.get_key('drawing-on-desktop'); + let desktopRow = new PrefRow({ label: desktopKey.get_summary(), desc: desktopKey.get_description() }); + let desktopSwitch = new Gtk.Switch(); settings.bind('drawing-on-desktop', desktopSwitch, 'active', 0); - desktopBox.pack_start(desktopLabelBox, true, true, 4); - desktopBox.pack_start(desktopSwitch, false, false, 4); - listBox.add(desktopBox); + desktopRow.addWidget(desktopSwitch, true); + listBox.add(desktopRow); - let osdBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN }); - let osdLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); - let osdLabel1 = new Gtk.Label({label: _("Disable on-screen notifications")}); - osdLabel1.set_halign(1); - osdLabelBox.pack_start(osdLabel1, true, true, 0); - let osdSwitch = new Gtk.Switch({valign: 3}); + let osdKey = schema.get_key('osd-disabled'); + let osdRow = new PrefRow({ label: osdKey.get_summary(), desc: osdKey.get_description() }); + let osdSwitch = new Gtk.Switch(); settings.bind('osd-disabled', osdSwitch, 'active', 0); - osdBox.pack_start(osdLabelBox, true, true, 4); - osdBox.pack_start(osdSwitch, false, false, 4); - listBox.add(osdBox); + osdRow.addWidget(osdSwitch, true); + listBox.add(osdRow); - let indicatorBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN }); - let indicatorLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); - let indicatorLabel1 = new Gtk.Label({label: _("Disable panel indicator")}); - indicatorLabel1.set_halign(1); - indicatorLabelBox.pack_start(indicatorLabel1, true, true, 0); - let indicatorSwitch = new Gtk.Switch({valign: 3}); + let indicatorKey = schema.get_key('indicator-disabled'); + let indicatorRow = new PrefRow({ label: indicatorKey.get_summary(), desc: indicatorKey.get_description() }); + let indicatorSwitch = new Gtk.Switch(); settings.bind('indicator-disabled', indicatorSwitch, 'active', 0); - indicatorBox.pack_start(indicatorLabelBox, true, true, 4); - indicatorBox.pack_start(indicatorSwitch, false, false, 4); - listBox.add(indicatorBox); + indicatorRow.addWidget(indicatorSwitch, true); + listBox.add(indicatorRow); - let children = listBox.get_children(); - for (let i = 0; i < children.length; i++) { - if (children[i].activatable) - children[i].set_activatable(false); - } - - let internalFrame = new Gtk.Frame({ margin_top: 3*MARGIN, label_yalign: 1.0 }); - internalFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "" + _("Internal") + " " + _("(in drawing mode)") })); + let internalFrame = new Frame({ label: _("Internal"), desc: _("In drawing mode") }); box.add(internalFrame); listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN }); + listBox.get_style_context().add_class('background'); internalFrame.add(listBox); - styleContext = listBox.get_style_context(); - styleContext.add_class('background'); - - for (let i = 0; i < OTHER_SHORTCUTS.length; i++) { - if (OTHER_SHORTCUTS[i].desc.indexOf('-separator-') != -1) { - listBox.add(new Gtk.Box({ margin_top: MARGIN, margin_left: MARGIN, margin_right: MARGIN })); - continue; + OTHER_SHORTCUTS.forEach((object, index) => { + if (index) + listBox.add(new Gtk.Box(ROWBOX_MARGIN_PARAMS)); + + for (let key in object) { + let otherBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN }); + let otherLabel = new Gtk.Label({ label: _(key), use_markup: true }); + otherLabel.set_halign(1); + let otherLabel2 = new Gtk.Label({ label: object[key] }); + otherBox.pack_start(otherLabel, true, true, 4); + otherBox.pack_start(otherLabel2, false, false, 4); + listBox.add(otherBox); } - let otherBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN }); - let otherLabel = new Gtk.Label({ label: _(OTHER_SHORTCUTS[i].desc), use_markup: true }); - otherLabel.set_halign(1); - let otherLabel2 = new Gtk.Label({ label: OTHER_SHORTCUTS[i].shortcut }); - otherBox.pack_start(otherLabel, true, true, 4); - otherBox.pack_start(otherLabel2, false, false, 4); - listBox.add(otherBox); - } + }); - let internalKeybindingsWidget = new KeybindingsWidget(INTERNAL_KEYBINDINGS, internalShortcutSettings); - internalKeybindingsWidget.margin = MARGIN; - listBox.add(internalKeybindingsWidget); + listBox.add(new Gtk.Box(ROWBOX_MARGIN_PARAMS)); + + INTERNAL_KEYBINDINGS.forEach((array, index) => { + if (index) + listBox.add(new Gtk.Box(ROWBOX_MARGIN_PARAMS)); + + let internalKeybindingsWidget = new KeybindingsWidget(array, internalShortcutSettings); + listBox.add(internalKeybindingsWidget); + }); let noteBox = new Gtk.Box({ margin: MARGIN }); let noteLabel = new Gtk.Label({ @@ -533,10 +480,22 @@ const PrefsPage = new GObject.Class({ noteBox.pack_start(noteLabel, true, true, 4); listBox.add(noteBox); - children = listBox.get_children(); - for (let i = 0; i < children.length; i++) { - if (children[i].activatable) - children[i].set_activatable(false); + listBox.get_children().forEach(row => row.set_activatable(false)); + } +}); + +const Frame = new GObject.Class({ + Name: 'DrawOnYourScreenFrame', + GTypeName: 'DrawOnYourScreenFrame', + Extends: Gtk.Frame, + + _init: function(params) { + let labelWidget = new Gtk.Label({ margin_bottom: MARGIN / 2, use_markup: true, label: `${params.label}` }); + this.parent({ label_yalign: 1.0, label_widget: labelWidget }); + + if (params.desc) { + labelWidget.set_tooltip_text(params.desc); + this.get_accessible().set_description(params.desc); } } }); @@ -549,7 +508,7 @@ const PrefRow = new GObject.Class({ _init: function(params) { this.parent({ activatable: false }); - let hbox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN }); + let hbox = new Gtk.Box(ROWBOX_MARGIN_PARAMS); this.add(hbox); let labelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); @@ -558,17 +517,31 @@ const PrefRow = new GObject.Class({ this.widgetBox = new Gtk.Box({ spacing: 4 }); hbox.pack_start(this.widgetBox, false, false, 4); - labelBox.pack_start(new Gtk.Label({ use_markup: true, label: params.label, halign: Gtk.Align.START }), true, true, 0); + this.label = new Gtk.Label({ use_markup: true, label: params.label, halign: Gtk.Align.START }); + labelBox.pack_start(this.label, true, true, 0); if (params.desc) { - let desc = new Gtk.Label({ use_markup: true, label: `${params.desc}`, halign: Gtk.Align.START, wrap: true, xalign: 0 }); - desc.get_style_context().add_class('dim-label'); - labelBox.pack_start(desc, true, true, 0); + this.desc = new Gtk.Label({ use_markup: true, label: `${params.desc}`, halign: Gtk.Align.START, wrap: true, xalign: 0 }); + this.desc.get_style_context().add_class('dim-label'); + labelBox.pack_start(this.desc, true, true, 0); this.widgetBox.set_valign(Gtk.Align.START); } }, - addWidget: function(widget) { + addWidget: function(widget, setRelationship) { this.widgetBox.add(widget); + + if (widget.name) + widget.get_accessible().set_name(widget.name); + + if (setRelationship) { + this.label.get_accessible().add_relationship(Atk.RelationType.LABEL_FOR, widget.get_accessible()); + widget.get_accessible().add_relationship(Atk.RelationType.LABELLED_BY, this.label.get_accessible()); + + if (this.desc) { + this.desc.get_accessible().add_relationship(Atk.RelationType.DESCRIPTION_FOR, widget.get_accessible()); + widget.get_accessible().add_relationship(Atk.RelationType.DESCRIBED_BY, this.desc.get_accessible()); + } + } } }); @@ -579,7 +552,7 @@ const PixelSpinButton = new GObject.Class({ // Add 'px' unit. vfunc_output: function() { - this.text = `${Math.round(this.value * 100) / 100} px`; + this.text = _("%d px").format(Math.round(this.value * 100) / 100); return true; }, @@ -631,7 +604,7 @@ const KeybindingsWidget = new GObject.Class({ Extends: Gtk.Box, _init: function(keybindings, settings) { - this.parent(); + this.parent(ROWBOX_MARGIN_PARAMS); this.set_orientation(Gtk.Orientation.VERTICAL); this._keybindings = keybindings; @@ -721,9 +694,7 @@ const KeybindingsWidget = new GObject.Class({ _refresh: function() { this._store.clear(); - for(let settings_key in this._keybindings) { - if (settings_key.indexOf('-separator-') != -1) - continue; + for(let settings_key of this._keybindings) { let [key, mods] = Gtk.accelerator_parse( this._settings.get_strv(settings_key)[0] ); @@ -738,7 +709,7 @@ const KeybindingsWidget = new GObject.Class({ ], [ settings_key, - _(this._keybindings[settings_key]), + this._settings.settings_schema.get_key(settings_key).get_summary(), mods, key ] diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 33fc25c62bfbdc43377393021af8b34bf7878148..85cce3ac7029a5c12ac2a8d6566f5660d0c427ac 100644 GIT binary patch delta 2233 zcmYL~4Qvx-0EWNoD2)BUy0We78Xd4;2VSV6FbuzL%2?2JHZ#+x?AG1ZLg|(3bsN8h zM5BNtgEKlKgiR9CsDzRVA;JU_A=Lzffy5aSQxX>^4ztBXOlF+#+ZDOx-TU18{oMC+ z_x0Q5SC{wgE4CI2v0gNaM!4(9VV`xT5Mt($5iNN7#+}m^-0Zr6QbfqU4?urWYpv75aXkA?) zRoU#Pk0)pHaS2q&$DopM6_u=ILU0mf3{3>!{m}i& zKR;o8@?6wUz`uk}4fZTyPUhs&@Eg$C)t~nuk7sX6P>?}52Gu0$J#0W`E($OJ=;O}C zN#N;^KqdG4t2i zui75<8;vM_yhf?+g0H2x%Qih_H+&^@qJNQl0a}sgVJW=u9Z;+L@(0Yx%=_Sj(DS|b zZ!#xy&yw()P<<{ZGta<9DfTdzlaa?o3BUu*eXy&B9g$1Xpb`EW^g^xynH>e-??Er- zax(LN_yuS~E+;cj!$+a5lgnJ}pUnR8oeP^iF2vrqlgC(KLr{qV5BwFVG1n299ks#t zK^t>9nRy>P3Ec}jZ?PXTACQLs1U2RAlUaWho<9#OdDS<%0MF0f*icZ7unsbI-DqG( zWaeJD0{zo;$-|t?&maQd4}J07VFzJ$Jj3*U;Ei}EFklBcfe)n-ND7f%*oZry>JC`zP>O~?xpTCC%cfl;hUj{M<$s^ zW*huThY)98I=-9r$um&j18;=J6QL>QWUgo{d;ofQKn=uk!xJh2{{xDxZaKpSWX=q4 zq_9C%l_#h3w_WUfRTycc@w^3@P?GAA7G0}MhX z8U0@tkogOE0e%g7V}<+`b27Ie1D}8znvP{(QZgTa4Hf0kK->9F)+ciUZum;*qf5<6 z=4AHog{w~N|LqaqP8Q%MyF|V415l`W^IGO)ewGRNHOTtZsRHKYa^xBK1my6nu4hi> zO5|6e9n{)?{v>lU2jqdThoU_}!yia3wq2LZc6&K~C|7y);5J3yu_i1E%_@71nRMD+ zzF51VD}Dp7fm^{TtAZg${bp=_33_!rQL!K){j zlRe1K!XHDf*!C{wC|*H2Hf0htXR!gKOOuHN4JJ99D@*$c0P zI)BzqGbeLE)$oPT{1NK|=Hz1JVR$p7-&|44oa~l3W&r4ho~}NbtG^rmJyi1Wt;uXa z&O<%~{|zd=bU4bKoR2&W{|EYfWC3SpGbiT6vhv+&k3<#IRE&mEmpaXCP*dk~6WQ?= zU2P6V)tD0ORGZCKG|pVt7D=GF%85I^Z1#@B3n1_XYMQG3fk3g?y8j#shJG>WqBa@Sv zAAt`*OEWo{`4IdbRF}!g%<*MQxhF2Nb64^pA6$;06a_W#b11-yR zL}o{Q@UzgZnC}YflUaWVejTdM)F-q4J-BP4$d-$Z=?XmGzHy@Bb5Dvn znJY9- z0d>Oze*A z3&{M<8-Nc&@5~Q=%bd(DNW&jNOX?5WFDaQ1aQZ|hLr2!0Sy5akw=*l&Vn3MTgCgFon?yO^Z%*m6Gr{RwvZ)o9S=47sf zt4w4H6z)57lsTCLs)jFvj84^TYE4zRFFCB;MFrXOah|U6OtIXa=d78YsdF+vx&J$Q z(TTj$psQ^Weaovc%$h&hh7whp%+XV~I`xsqlU1a(E3sg^u54Dd4kNh1&|=o@;z}z~ s?6to1xvimMXUaLrbU1w0j*=Iw?fC^(vZT&YW<4sI;V4Kw@AYT@2W$7tPyhe` diff --git a/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml b/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml index 7fca073..9b2e3c0 100644 --- a/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml +++ b/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml @@ -1,305 +1,251 @@ - + + + false - move drawing on desktop - move drawing on desktop + Drawing on the desktop + Draw On Your Screen becomes Draw On Your Desktop]]> - - false - persistent drawing - persistent drawing - - - false - disable OSD notifications - disable on-screen notifications + + ["<Alt><Super>e"] + Erase all drawings false - disable panel indicator - disable panel indicator + Disable panel indicator + + + false + Disable on-screen notifications + + + false + Persistent + Persistent drawing through session restart ["<Alt><Super>d"] - toggle drawing - enter or leave drawing mode + Enter/leave drawing mode ["<Primary><Alt><Super>d"] - toggle modeless/modal - toggle modeless/modal + Grab/ungrab keyboard and pointer + - - ["<Alt><Super>e"] - erase drawing - erase drawing - - - - - ["<Primary>z"] - undo - undo - - - ["<Primary><Shift>z"] - redo - redo - - - ["Delete"] - delete last element - delete last element - - - ["<Primary>equal"] - smooth last brushstroke - smooth last brushstroke - - - ["<Primary>b"] - toggle drawing background - toggle drawing background - - - ["<Primary>g"] - toggle grid overlay - toggle grid overlay - - - ["<Primary>h"] - hide or show panel and dock - hide or show panel and dock - - - ["<Primary>n"] - toggle square area - toggle square area - - - ["<Primary>e"] - select cercle - select a cercle - - - ["<Primary>r"] - select rectangle - select rectangle - - - ["<Primary>y"] - select polygon - select polygon - - - ["<Primary>u"] - select polyline - select polyline - - - ["<Primary>l"] - select line - select a line - - - ["<Primary>t"] - select text - select text - - - ["<Primary>i"] - select image - select image - - - ["<Primary>p"] - unselect shape (free drawing) - unselect shape (free drawing) - - - ["<Primary>m"] - select move tool - select move tool - - - ["<Primary>x"] - select resize tool - select resize tool - - - ["<Primary>c"] - select mirror tool - select mirror tool - - - KP_Add','plus']]]> - increment the line width - increment the line width - KP_Subtract','minus','minus']]]> - decrement the line width - decrement the line width - - - ["<Primary><Shift>KP_Add"] - increment the line width even more - increment the line width even more + Decrement line width ["<Primary><Shift>KP_Subtract"] - decrement the line width even more - decrement the line width even more + Decrement line width even more - - ["<Primary>j"] - switch linejoin - switch linejoin + + ["Delete"] + Erase last brushstroke - - ["<Primary>k"] - switch linecap - switch linecap + + KP_Add','plus']]]> + Increment line width - - KP_Multiply','asterisk','asterisk']]]> - switch fill rule - switch fill rule - - - ["<Primary>period"] - switch dash - switch dash - - - ["<Primary>a"] - switch fill - switch fill - - - KP_1','1']]]> - select color1 - select color1 - - - KP_2','2']]]> - select color2 - select color2 - - - KP_3','3']]]> - select color3 - select color3 - - - KP_4','4']]]> - select color4 - select color4 - - - KP_5','5']]]> - select color5 - select color5 - - - KP_6','6']]]> - select color6 - select color6 - - - KP_7','7']]]> - select color7 - select color7 - - - KP_8','8']]]> - select color8 - select color8 - - - KP_9','9']]]> - select color9 - select color9 - - - ["<Primary>f"] - switch font family - switch font family - - - ["<Primary><Shift>f"] - switch font family (reverse) - switch font family (reverse) - - - ["<Primary>w"] - switch font weight - switch font weight - - - ["<Primary><Shift>w"] - switch font style - switch font style - - - ["<Primary>KP_Divide","<Primary>slash"] - switch color palette - switch color palette - - - ["<Primary><Shift>KP_Divide","<Primary><Shift>slash"] - switch color palette (reverse) - switch color palette (reverse) - - - ["<Primary><Shift>a"] - switch text alignment - switch text alignment - - - ["<Primary><Shift>i"] - switch image file - switch image file - - - ["<Primary><Shift>s"] - Save drawing as a svg file - Save drawing as a svg file - - - ["<Primary>s"] - Save drawing as a json file - Save drawing as a json file - - - ["<Primary><Shift>o"] - Open previous json file - Open previous json file + + ["<Primary><Shift>KP_Add"] + Increment line width even more ["<Primary>o"] - Open next json file - Open next json file + Open next drawing ["<Primary>comma"] Open preferences - Open preferences + + + ["<Primary><Shift>o"] + Open previous drawing + + + ["<Primary><Shift>z"] + Redo last brushstroke + + + ["<Primary>s"] + Save drawing + + + ["<Primary><Shift>s"] + Save drawing as a SVG file + + + KP_1','1']]]> + Select color 1 + + + + KP_2','2']]]> + Select color 2 + + + KP_3','3']]]> + Select color 3 + + + KP_4','4']]]> + Select color 4 + + + KP_5','5']]]> + Select color 5 + + + KP_6','6']]]> + Select color 6 + + + KP_7','7']]]> + Select color 7 + + + KP_8','8']]]> + Select color 8 + + + KP_9','9']]]> + Select color 9 + + + ["<Primary>e"] + Select ellipse tool + + + ["<Primary>i"] + Select image tool + + + ["<Primary>l"] + Select line tool + + + ["<Primary>c"] + Select mirror tool + + + ["<Primary>m"] + Select move tool + + + ["<Primary>p"] + Free drawing + + + ["<Primary>y"] + Select polygon tool + + + ["<Primary>u"] + Select polyline tool + + + ["<Primary>r"] + Select rectangle tool + + + ["<Primary>x"] + Select resize tool + + + ["<Primary>t"] + Select text tool + + + ["<Primary>equal"] + Smooth last brushstroke + + + ["<Primary>KP_Divide","<Primary>slash"] + Change color palette + + + ["<Primary><Shift>KP_Divide","<Primary><Shift>slash"] + Change color palette (reverse) + + + ["<Primary>period"] + Dashed line + + + ["<Primary>a"] + Toggle fill/outline + + + KP_Multiply','asterisk','asterisk']]]> + Toggle fill rule + + + ["<Primary>f"] + Change font family + + + ["<Primary><Shift>f"] + Change font family (reverse) + + + ["<Primary><Shift>w"] + Change font style + + + ["<Primary>w"] + Change font weight + + + ["<Primary><Shift>i"] + Change image file + + + ["<Primary>k"] + Change linecap + + + ["<Primary>j"] + Change linejoin + + + ["<Primary><Shift>a"] + Toggle text alignment + + + ["<Primary>b"] + Add a drawing background + + + ["<Primary>g"] + Add a grid overlay ["<Primary>F1"] - toggle help - toggle help + Show help + + + ["<Primary>h"] + Hide panel and dock + + + ["<Primary>n"] + Square drawing area + + + ["<Primary>z"] + Undo last brushstroke - + "#2e2e2e" - Drawing area background color + Background color The color of the drawing area background