Break prefs into settings and contribute pages. Remove about window. More icons
This commit is contained in:
+115
-58
@@ -5,97 +5,154 @@ import Adw from 'gi://Adw';
|
||||
import GLib from 'gi://GLib';
|
||||
import Gdk from 'gi://Gdk';
|
||||
|
||||
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'
|
||||
import {OnDemandShortcutButton} from './shortcutButton.js'
|
||||
import {gr_log} from './utils/logger.js'
|
||||
import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'
|
||||
import { OnDemandShortcutButton } from './shortcutButton.js'
|
||||
|
||||
export default class GravatarPreferences extends ExtensionPreferences {
|
||||
constructor(metadata) {
|
||||
super(metadata);
|
||||
|
||||
let IconsPath = GLib.build_filenamev([this.path, 'ui', 'icons']);
|
||||
let iconTheme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
|
||||
iconTheme.add_search_path(IconsPath);
|
||||
}
|
||||
|
||||
getVersionString(_page) {
|
||||
return _('Version %d').format(this.metadata.version);
|
||||
}
|
||||
|
||||
fillPreferencesWindow(window) {
|
||||
this.settings = this.getSettings();
|
||||
this.aboutWindow = null;
|
||||
//window.set_default_size(960, 420);
|
||||
this.page = new Adw.PreferencesPage({
|
||||
title: "Gravatar",
|
||||
let IconsPath = GLib.build_filenamev([this.path, 'ui', 'icons']);
|
||||
let iconTheme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
|
||||
iconTheme.add_search_path(IconsPath);
|
||||
|
||||
window.settings = this.getSettings();
|
||||
|
||||
let page = new Adw.PreferencesPage({
|
||||
title: "Settings",
|
||||
icon_name: "general-symbolic",
|
||||
})
|
||||
window.add(this.page);
|
||||
window.add(page);
|
||||
|
||||
this.prefGroup = new Adw.PreferencesGroup({
|
||||
title: _("Settings"),
|
||||
});
|
||||
this.page.add(this.prefGroup);
|
||||
let prefGroup = new Adw.PreferencesGroup({
|
||||
title: _("General"),
|
||||
});
|
||||
page.add(prefGroup);
|
||||
|
||||
this.emailEntryRow = new Adw.EntryRow({
|
||||
let emailEntryRow = new Adw.EntryRow({
|
||||
title: "Gravatar Email Address",
|
||||
show_apply_button: true,
|
||||
text: this.settings.get_string('email'),
|
||||
text: window.settings.get_string('email'),
|
||||
});
|
||||
this.prefGroup.add(this.emailEntryRow);
|
||||
prefGroup.add(emailEntryRow);
|
||||
|
||||
this.emailEntryRow.connect("apply", () => {
|
||||
this.settings.set_string('email', this.emailEntryRow.get_text());
|
||||
emailEntryRow.connect("apply", () => {
|
||||
window.settings.set_string('email', emailEntryRow.get_text());
|
||||
});
|
||||
|
||||
this.shortcutButton = new OnDemandShortcutButton(this.settings, {
|
||||
let shortcutButton = new OnDemandShortcutButton(window.settings, {
|
||||
hhomogeneous: false,
|
||||
});
|
||||
this.settings.connect("changed::gravatar-ondemand-keybinding", () => {
|
||||
this.shortcutButton.keybinding = this.settings.get_strv("gravatar-ondemand-keybinding")[0];
|
||||
window.settings.connect("changed::gravatar-ondemand-keybinding", () => {
|
||||
shortcutButton.keybinding = window.settings.get_strv("gravatar-ondemand-keybinding")[0];
|
||||
});
|
||||
this.shortcutButton.keybinding = this.settings.get_strv("gravatar-ondemand-keybinding")[0];
|
||||
shortcutButton.keybinding = window.settings.get_strv("gravatar-ondemand-keybinding")[0];
|
||||
|
||||
this.shortcutButton.connect("notify::keybinding", () => {
|
||||
this.settings.set_strv("gravatar-ondemand-keybinding", [this.shortcutButton.keybinding]);
|
||||
shortcutButton.connect("notify::keybinding", () => {
|
||||
window.settings.set_strv("gravatar-ondemand-keybinding", [shortcutButton.keybinding]);
|
||||
});
|
||||
|
||||
this.shortcutActionRow = new Adw.ActionRow({
|
||||
let shortcutActionRow = new Adw.ActionRow({
|
||||
title: "Keyboard Shortcut",
|
||||
subtitle: "Shortcut triggers downloading and setting user icon from Gravatar"
|
||||
});
|
||||
this.prefGroup.add(this.shortcutActionRow);
|
||||
prefGroup.add(shortcutActionRow);
|
||||
|
||||
this.shortcutActionRow.add_suffix(this.shortcutButton);
|
||||
this.shortcutActionRow.set_activatable_widget(this.shortcutButton);
|
||||
shortcutActionRow.add_suffix(shortcutButton);
|
||||
shortcutActionRow.set_activatable_widget(shortcutButton);
|
||||
|
||||
this.aboutPrefGroup = new Adw.PreferencesGroup({
|
||||
title: "About",
|
||||
let contribution_page = new Adw.PreferencesPage({
|
||||
title: _("Contribute"),
|
||||
icon_name: 'contribute-symbolic',
|
||||
});
|
||||
this.page.add(this.aboutPrefGroup);
|
||||
|
||||
this.aboutActionRow = new Adw.ActionRow({
|
||||
title: 'Extension Information',
|
||||
});
|
||||
this.aboutPrefGroup.add(this.aboutActionRow);
|
||||
|
||||
this.aboutButton = new Gtk.Button({
|
||||
icon_name: "org.gnome.Settings-about-symbolic",
|
||||
valign: Gtk.Align.CENTER,
|
||||
tooltip_text: 'About the Gravatar Extension'
|
||||
window.add(contribution_page);
|
||||
|
||||
let contribute_icon_pref_group = new Adw.PreferencesGroup();
|
||||
let icon_box = new Gtk.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
margin_top: 24,
|
||||
margin_bottom: 24,
|
||||
spacing: 18,
|
||||
});
|
||||
this.aboutActionRow.add_suffix(this.aboutButton);
|
||||
this.aboutActionRow.set_activatable_widget(this.aboutButton);
|
||||
this.aboutButton.connect("clicked", (button) => {
|
||||
this.aboutWindow = new Adw.AboutWindow({
|
||||
website: 'https://github.com/dsheeler/gnome-shell-extensions-gravatar',
|
||||
application_name: "Gravatar",
|
||||
developer_name: "Daniel Sheeler (dsheeler)",
|
||||
version: this.getVersionString(),
|
||||
license: 'The MIT License (MIT)',
|
||||
copyright: 'Copyright (C) 2024 Daniel Sheeler',
|
||||
issue_url: 'https://github.com/dsheeler/gnome-shell-extensions-gravatar/issues',
|
||||
application_icon: 'gravatar-symbolic',
|
||||
});
|
||||
this.aboutWindow.show();
|
||||
|
||||
let icon_image = new Gtk.Image({
|
||||
icon_name: "gravatar",
|
||||
pixel_size: 128,
|
||||
});
|
||||
|
||||
let label_box = new Gtk.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
spacing: 6,
|
||||
});
|
||||
|
||||
let label = new Gtk.Label({
|
||||
label: "Gravatar",
|
||||
wrap: true,
|
||||
});
|
||||
let context = label.get_style_context();
|
||||
context.add_class("title-1");
|
||||
|
||||
let another_label = new Gtk.Label({
|
||||
label: this.getVersionString(),
|
||||
});
|
||||
|
||||
let links_pref_group = new Adw.PreferencesGroup();
|
||||
let code_row = new Adw.ActionRow({
|
||||
icon_name: "code-symbolic",
|
||||
title: _("Code (create pull requests, report issues, etc.)")
|
||||
});
|
||||
let github_link = new Gtk.LinkButton({
|
||||
label: "Github",
|
||||
uri: "https://github.com/dsheeler/gnome-shell-extensions-gravatar/",
|
||||
});
|
||||
|
||||
let donate_row = new Adw.ActionRow({
|
||||
title: _("Donate"),
|
||||
icon_name: "support-symbolic",
|
||||
})
|
||||
let donate_link = new Gtk.LinkButton({
|
||||
label: "Liberapay",
|
||||
uri: "https://liberapay.com/dsheeler/donate",
|
||||
});
|
||||
|
||||
let donate_link_paypal = new Gtk.LinkButton({
|
||||
label: "PayPal",
|
||||
|
||||
uri: "https://paypal.me/DanielSheeler?country.x=US&locale.x=en_US",
|
||||
});
|
||||
|
||||
let donate_link_github = new Gtk.LinkButton({
|
||||
label: "Github",
|
||||
|
||||
uri: "https://github.com/sponsors/dsheeler",
|
||||
});
|
||||
|
||||
code_row.add_suffix(github_link);
|
||||
code_row.set_activatable_widget(github_link);
|
||||
|
||||
donate_row.add_suffix(donate_link);
|
||||
donate_row.add_suffix(donate_link_paypal);
|
||||
donate_row.add_suffix(donate_link_github);
|
||||
|
||||
links_pref_group.add(code_row);
|
||||
links_pref_group.add(donate_row);
|
||||
|
||||
label_box.append(label);
|
||||
label_box.append(another_label);
|
||||
icon_box.append(icon_image);
|
||||
icon_box.append(label_box);
|
||||
contribute_icon_pref_group.add(icon_box);
|
||||
|
||||
contribution_page.add(contribute_icon_pref_group);
|
||||
contribution_page.add(links_pref_group)
|
||||
|
||||
window.set_search_enabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
-->
|
||||
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m3.7578 2.0293a1 1 0 0 0-0.61523 0.45703l-3 5a1.0001 1.0001 0 0 0 0 1.0273l3 5a1 1 0 0 0 1.3711 0.34375 1 1 0 0 0 0.34375-1.3711l-2.6914-4.4863 2.6914-4.4863a1 1 0 0 0-0.34375-1.3711 1 1 0 0 0-0.75586-0.11328z"/>
|
||||
<path d="m12.242 2.0293a1 1 0 0 0-0.75586 0.11328 1 1 0 0 0-0.34375 1.3711l2.6914 4.4863-2.6914 4.4863a1 1 0 0 0 0.34375 1.3711 1 1 0 0 0 1.3711-0.34375l3-5a1.0001 1.0001 0 0 0 0-1.0273l-3-5a1 1 0 0 0-0.61523-0.45703z"/>
|
||||
<path d="m9.1953 2.0195a1 1 0 0 0-1.1758 0.78516l-2 10a1 1 0 0 0 0.78516 1.1758 1 1 0 0 0 1.1758-0.78516l2-10a1 1 0 0 0-0.78516-1.1758z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 848 B |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
-->
|
||||
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m4.5 1c-2.4853 0-4.5 2.0147-4.5 4.5 0.0032498 1.2489 0.75291 2.3099 1.4414 3.2891 1.7318 2.463 6.5586 6.2109 6.5586 6.2109s4.8267-3.7479 6.5586-6.2109c0.68851-0.97919 1.4382-2.0402 1.4414-3.2891 0-2.4853-2.0147-4.5-4.5-4.5-2.5 0-3.101 2.001-3.5 2s-1-2-3.5-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 535 B |
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
enable-background="new"
|
||||
version="1.1"
|
||||
id="svg16"
|
||||
sodipodi:docname="general-symbolic.svg"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs20" />
|
||||
<sodipodi:namedview
|
||||
id="namedview18"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showgrid="false"
|
||||
inkscape:zoom="24.174578"
|
||||
inkscape:cx="13.98163"
|
||||
inkscape:cy="8.3765683"
|
||||
inkscape:window-width="1500"
|
||||
inkscape:window-height="963"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g14" />
|
||||
<g
|
||||
fill="#363636"
|
||||
id="g14"
|
||||
transform="rotate(90,7.75,8.25)">
|
||||
<path
|
||||
d="m 2.9500144,1 c -0.277,0 -0.5,0.223 -0.5,0.5 v 6.5547 a 2.5,2.5 0 0 1 0.5,-0.054688 2.5,2.5 0 0 1 0.5,0.050781 v -6.5508 c 0,-0.277 -0.223,-0.5 -0.5,-0.5 z m 0.5,11.945 a 2.5,2.5 0 0 1 -0.5,0.05469 2.5,2.5 0 0 1 -0.5,-0.05078 v 1.5508 c 0,0.277 0.223,0.5 0.5,0.5 0.277,0 0.5,-0.223 0.5,-0.5 v -1.5547 z"
|
||||
id="path2" />
|
||||
<path
|
||||
d="M 7.5,1 C 7.223,1 7,1.223 7,1.5 V 3.0547 A 2.5,2.5 0 0 1 7.5,3.000012 2.5,2.5 0 0 1 8,3.050793 v -1.5508 c 0,-0.277 -0.223,-0.5 -0.5,-0.5 z M 8,7.9453 A 2.5,2.5 0 0 1 7.5,7.999988 2.5,2.5 0 0 1 7,7.949207 v 6.5508 c 0,0.277 0.223,0.5 0.5,0.5 0.277,0 0.5,-0.223 0.5,-0.5 v -6.5547 z"
|
||||
id="path4" />
|
||||
<path
|
||||
d="m 12.049986,1.0001482 c -0.277,0 -0.5,0.223 -0.5,0.5 v 6.5547 a 2.5,2.5 0 0 1 0.5,-0.054688 2.5,2.5 0 0 1 0.5,0.050781 v -6.5508 c 0,-0.277 -0.223,-0.5 -0.5,-0.5 z m 0.5,11.9450008 a 2.5,2.5 0 0 1 -0.5,0.05469 2.5,2.5 0 0 1 -0.5,-0.05078 v 1.5508 c 0,0.276999 0.223,0.5 0.5,0.5 0.277,0 0.5,-0.223001 0.5,-0.5 v -1.5547 z"
|
||||
id="path6" />
|
||||
<circle
|
||||
cx="2.9500144"
|
||||
cy="10.5"
|
||||
id="circle8"
|
||||
r="1.5" />
|
||||
<circle
|
||||
cx="7.5"
|
||||
cy="5.5"
|
||||
r="1.5"
|
||||
id="circle10" />
|
||||
<circle
|
||||
cx="12.049986"
|
||||
cy="10.500149"
|
||||
id="circle12"
|
||||
r="1.5" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" ?><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title/><path d="M12 0c-1.326 0-2.4 1.074-2.4 2.4v8.4c0 1.324 1.074 2.398 2.4 2.398s2.4-1.074 2.4-2.398V5.21c2.795.99 4.799 3.654 4.799 6.789 0 3.975-3.225 7.199-7.199 7.199S4.801 15.975 4.801 12c0-1.989.805-3.789 2.108-5.091.938-.938.938-2.458 0-3.396s-2.458-.938-3.396 0C1.344 5.686 0 8.686 0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0"/></svg>
|
||||
|
Before Width: | Height: | Size: 451 B |
@@ -0,0 +1 @@
|
||||
<svg width="2500" height="2500" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M128 0c-14.144 0-25.6 11.456-25.6 25.6v89.6c0 14.128 11.456 25.6 25.6 25.6 14.144 0 25.6-11.472 25.6-25.6V55.584c29.824 10.56 51.2 38.976 51.2 72.416 0 42.4-34.4 76.8-76.8 76.8S51.2 170.4 51.2 128c0-21.216 8.592-40.416 22.496-54.304 10-10 10-26.208 0-36.208s-26.208-10-36.208 0C14.336 60.64 0 92.64 0 128c0 70.688 57.312 128 128 128s128-57.312 128-128S198.688 0 128 0" fill="#1E8CBE"/></svg>
|
||||
|
After Width: | Height: | Size: 520 B |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
-->
|
||||
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m4.5 1c-2.4853 0-4.5 2.0147-4.5 4.5 0.0032498 1.2489 0.75291 2.3099 1.4414 3.2891 1.7318 2.463 6.5586 6.2109 6.5586 6.2109s4.8267-3.7479 6.5586-6.2109c0.68851-0.97919 1.4382-2.0402 1.4414-3.2891 0-2.4853-2.0147-4.5-4.5-4.5-2.5 0-3.101 2.001-3.5 2s-1-2-3.5-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 535 B |
Reference in New Issue
Block a user