Add extension update notification

This commit is contained in:
Charles Gagnon
2025-02-19 16:09:29 -05:00
parent 8378946aad
commit 55ccb19a8d
8 changed files with 165 additions and 129 deletions

View File

@@ -5,7 +5,7 @@ MODULES = src/*.js src/stylesheet.css metadata.json COPYING README.md
UI_MODULES = ui/*.ui UI_MODULES = ui/*.ui
IMAGES = ./* ../media/design/svg/dash-to-panel-logo-light.svg IMAGES = ./* ../media/design/svg/dash-to-panel-logo-light.svg
TOLOCALIZE = src/prefs.js src/appIcons.js src/taskbar.js TOLOCALIZE = src/extension.js src/prefs.js src/appIcons.js src/taskbar.js
MSGSRC = $(wildcard po/*.po) MSGSRC = $(wildcard po/*.po)
ifeq ($(strip $(DESTDIR)),) ifeq ($(strip $(DESTDIR)),)
INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions

View File

@@ -9,8 +9,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Dash To Panel\n" "Project-Id-Version: Dash To Panel\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-19 08:28-0500\n" "POT-Creation-Date: 2025-02-19 16:00-0500\n"
"PO-Revision-Date: 2025-02-19 09:46-0500\n" "PO-Revision-Date: 2025-02-19 16:04-0500\n"
"Last-Translator: Charles Gagnon <charlesg99@outlook.com>\n" "Last-Translator: Charles Gagnon <charlesg99@outlook.com>\n"
"Language-Team: French\n" "Language-Team: French\n"
"Language: fr\n" "Language: fr\n"
@@ -39,6 +39,14 @@ msgstr ""
"X-Poedit-SearchPath-16: desktopIconsIntegration.js\n" "X-Poedit-SearchPath-16: desktopIconsIntegration.js\n"
"X-Poedit-SearchPath-17: appIcons.js\n" "X-Poedit-SearchPath-17: appIcons.js\n"
#: src/extension.js:87
msgid "Dash to panel has been updated!"
msgstr "Dash to panel a été mis à jour!"
#: src/extension.js:91
msgid "See what's new"
msgstr "Voir les nouveautés"
#: src/prefs.js:275 #: src/prefs.js:275
msgid "Show Desktop button height (px)" msgid "Show Desktop button height (px)"
msgstr "Hauteur du bouton Afficher le Bureau (px)" msgstr "Hauteur du bouton Afficher le Bureau (px)"
@@ -268,11 +276,11 @@ msgstr "Options d'animation des icônes d'application"
msgid "App icon highlight options" msgid "App icon highlight options"
msgstr "Options d'animation du surlignement des icônes d'application" msgstr "Options d'animation du surlignement des icônes d'application"
#: src/prefs.js:3505 #: src/prefs.js:3508
msgid "Export settings" msgid "Export settings"
msgstr "Exporter les paramètres" msgstr "Exporter les paramètres"
#: src/prefs.js:3526 #: src/prefs.js:3529
msgid "Import settings" msgid "Import settings"
msgstr "Importer des paramètres" msgstr "Importer des paramètres"
@@ -1081,10 +1089,6 @@ msgid "Export and Import"
msgstr "Import et export" msgstr "Import et export"
#: ui/SettingsAbout.ui.h:7 #: ui/SettingsAbout.ui.h:7
msgid "Export and import settings"
msgstr "Import et export de paramètres"
#: ui/SettingsAbout.ui.h:8
msgid "" msgid ""
"Use the buttons below to create a settings file from your current " "Use the buttons below to create a settings file from your current "
"preferences that can be imported on a different machine." "preferences that can be imported on a different machine."
@@ -1092,6 +1096,10 @@ msgstr ""
"Utiliser les boutons ci-dessous pour créer un fichier de paramètres à partir " "Utiliser les boutons ci-dessous pour créer un fichier de paramètres à partir "
"de vos préférences actuelles qui pourra être importé sur une autre machine." "de vos préférences actuelles qui pourra être importé sur une autre machine."
#: ui/SettingsAbout.ui.h:8
msgid "Export and import settings"
msgstr "Import et export de paramètres"
#: ui/SettingsAbout.ui.h:9 #: ui/SettingsAbout.ui.h:9
msgid "Export to file" msgid "Export to file"
msgstr "Exporter vers un fichier" msgstr "Exporter vers un fichier"

View File

@@ -1331,5 +1331,9 @@
<default>''</default> <default>''</default>
<summary>Unix time when the donate icon was hidden</summary> <summary>Unix time when the donate icon was hidden</summary>
</key> </key>
<key type="i" name="extension-version">
<default>65</default>
<summary>Installed extension version</summary>
</key>
</schema> </schema>
</schemalist> </schemalist>

View File

@@ -1826,7 +1826,7 @@ export function resetRecentlyClickedApp() {
recentlyClickedAppIndex = 0 recentlyClickedAppIndex = 0
recentlyClickedAppMonitorIndex = null recentlyClickedAppMonitorIndex = null
return false return GLib.SOURCE_REMOVE
} }
export function closeAllWindows(app, monitor) { export function closeAllWindows(app, monitor) {

View File

@@ -18,10 +18,14 @@
*/ */
import Gio from 'gi://Gio' import Gio from 'gi://Gio'
import GLib from 'gi://GLib'
import * as Main from 'resource:///org/gnome/shell/ui/main.js' import * as Main from 'resource:///org/gnome/shell/ui/main.js'
import { EventEmitter } from 'resource:///org/gnome/shell/misc/signals.js' import { EventEmitter } from 'resource:///org/gnome/shell/misc/signals.js'
import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js' import {
Extension,
gettext as _,
} from 'resource:///org/gnome/shell/extensions/extension.js'
import * as PanelSettings from './panelSettings.js' import * as PanelSettings from './panelSettings.js'
import * as PanelManager from './panelManager.js' import * as PanelManager from './panelManager.js'
@@ -78,6 +82,24 @@ export default class DashToPanelExtension extends Extension {
if (donateIconUnixtime && donateIconUnixtime < Date.now() - 10368000000) if (donateIconUnixtime && donateIconUnixtime < Date.now() - 10368000000)
SETTINGS.set_string('hide-donate-icon-unixtime', '') SETTINGS.set_string('hide-donate-icon-unixtime', '')
if (this.metadata.version != SETTINGS.get_int('extension-version')) {
Utils.notify(
_('Dash to panel has been updated!'),
_(`You are now running version ${this.metadata.version}.`),
'software-update-available-symbolic',
{
text: _(`See what's new`),
func: () =>
Gio.app_info_launch_default_for_uri(
`${this.metadata.url}/releases/tag/v${this.metadata.version}`,
global.create_app_launch_context(0, -1),
),
},
)
SETTINGS.set_int('extension-version', this.metadata.version)
}
Main.layoutManager.startInOverview = !SETTINGS.get_boolean( Main.layoutManager.startInOverview = !SETTINGS.get_boolean(
'hide-overview-on-startup', 'hide-overview-on-startup',
) )
@@ -99,6 +121,8 @@ export default class DashToPanelExtension extends Extension {
panelManager = new PanelManager.PanelManager() panelManager = new PanelManager.PanelManager()
panelManager.enable() panelManager.enable()
ubuntuDockDelayId = 0 ubuntuDockDelayId = 0
return GLib.SOURCE_REMOVE
} }
// disable ubuntu dock if present // disable ubuntu dock if present
@@ -110,13 +134,17 @@ export default class DashToPanelExtension extends Extension {
global.settings.set_strv('disabled-extensions', disabled) global.settings.set_strv('disabled-extensions', disabled)
// wait a bit so ubuntu dock can disable itself and restore the showappsbutton // wait a bit so ubuntu dock can disable itself and restore the showappsbutton
ubuntuDockDelayId = setTimeout(completeEnable, 200) ubuntuDockDelayId = GLib.timeout_add(
GLib.PRIORITY_DEFAULT,
200,
completeEnable,
)
} }
} else completeEnable() } else completeEnable()
} }
disable() { disable() {
if (ubuntuDockDelayId) clearTimeout(ubuntuDockDelayId) if (ubuntuDockDelayId) GLib.Source.remove(ubuntuDockDelayId)
PanelSettings.disable(SETTINGS) PanelSettings.disable(SETTINGS)
panelManager.disable() panelManager.disable()

View File

@@ -3491,12 +3491,15 @@ const Preferences = class {
// About Panel // About Panel
this._builder let versionLinkButton = this._builder.get_object('extension_version')
.get_object('extension_version')
.set_label( versionLinkButton.set_label(
this._metadata.version.toString() + this._metadata.version.toString() +
(this._metadata.commit ? ' (' + this._metadata.commit + ')' : ''), (this._metadata.commit ? ' (' + this._metadata.commit + ')' : ''),
) )
versionLinkButton.set_uri(
`${this._metadata.url}/${this._metadata.commit ? `commit/${this._metadata.commit}` : `releases/tag/v${this._metadata.version}`}`,
)
this._builder this._builder
.get_object('importexport_export_button') .get_object('importexport_export_button')
@@ -3587,16 +3590,22 @@ const Preferences = class {
) )
this.notebook.connect('notify::visible-page', () => { this.notebook.connect('notify::visible-page', () => {
clearTimeout(revealDonateTimeout) if (revealDonateTimeout) GLib.Source.remove(revealDonateTimeout)
if ( if (
this.notebook.visible_page_name == 'donation' && this.notebook.visible_page_name == 'donation' &&
!donationRevealer.get_reveal_child() !donationRevealer.get_reveal_child()
) )
revealDonateTimeout = setTimeout(() => { revealDonateTimeout = GLib.timeout_add(
donationRevealer.set_reveal_child(true) GLib.PRIORITY_DEFAULT,
donationSpinner.set_spinning(false) 15000,
}, 15000) () => {
donationRevealer.set_reveal_child(true)
donationSpinner.set_spinning(false)
return GLib.SOURCE_REMOVE
},
)
}) })
} }

View File

@@ -528,16 +528,18 @@ export const getPoint = function (coords) {
return new Graphene.Point(coords) return new Graphene.Point(coords)
} }
export const notify = function (text, iconName, action, isTransient) { export const notify = function (title, body, iconName, action, isTransient) {
let source = new MessageTray.SystemNotificationSource() let source = new MessageTray.Source({
let notification = new MessageTray.Notification(source, 'Dash to Panel', text) title: 'Dash to Panel',
let notifyFunc = source.showNotification || source.notify })
let notification = new MessageTray.Notification({
source,
title,
body,
isTransient: isTransient || false,
})
if (iconName) { if (iconName) source.iconName = iconName
source.createIcon = function () {
return new St.Icon({ icon_name: iconName })
}
}
if (action) { if (action) {
if (!(action instanceof Array)) { if (!(action instanceof Array)) {
@@ -548,9 +550,7 @@ export const notify = function (text, iconName, action, isTransient) {
} }
Main.messageTray.add(source) Main.messageTray.add(source)
source.addNotification(notification)
notification.setTransient(isTransient)
notifyFunc.call(source, notification)
} }
/* /*

View File

@@ -1,99 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version='1.0' encoding='UTF-8'?>
<interface> <interface>
<!-- interface-name SettingsAbout.ui -->
<requires lib="gtk" version="4.0"/> <requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.6"/>
<object class="AdwPreferencesPage" id="about"> <object class="AdwPreferencesPage" id="about">
<property name="icon-name">help-about-symbolic</property>
<property name="title" translatable="yes">About</property> <property name="title" translatable="yes">About</property>
<property name="icon_name">help-about-symbolic</property> <child>
<object class="AdwPreferencesGroup" id="about_group_info">
<!-- group info --> <property name="title" translatable="yes">Info</property>
<child> <child>
<object class="AdwPreferencesGroup" id="about_group_info"> <object class="AdwActionRow">
<property name="title" translatable="yes">Info</property> <property name="title" translatable="yes">Version</property>
<child>
<child> <object class="GtkLinkButton" id="extension_version"/>
<object class="AdwActionRow"> </child>
<property name="title" translatable="yes">Version</property> </object>
<child> </child>
<object class="GtkLabel" id="extension_version"> <child>
<property name="label">...</property> <object class="AdwActionRow">
</object> <property name="title" translatable="yes">Source</property>
</child> <child>
</object> <object class="GtkLinkButton" id="homepage_link">
</child> <property name="halign">center</property>
<property name="label" translatable="yes">GitHub</property>
<child> <property name="receives-default">True</property>
<object class="AdwActionRow"> <property name="uri">https://github.com/home-sweet-gnome/dash-to-panel</property>
<property name="title" translatable="yes">Source</property> </object>
<child> </child>
<object class="GtkLinkButton" id="homepage_link"> </object>
<property name="label" translatable="yes">GitHub</property> </child>
<property name="receives_default">True</property> </object>
<property name="halign">center</property> </child>
<property name="uri">https://github.com/home-sweet-gnome/dash-to-panel</property> <child>
</object> <object class="AdwPreferencesGroup" id="about_group_export_and_import">
</child> <property name="title" translatable="yes">Export and Import</property>
</object> <child>
</child> <object class="AdwActionRow">
<property name="subtitle" translatable="yes">Use the buttons below to create a settings file from your current preferences that can be imported on a different machine.</property>
</object> <property name="title" translatable="yes">Export and import settings</property>
</child> </object>
</child>
<!-- group export import --> <child>
<child> <object class="AdwPreferencesRow">
<object class="AdwPreferencesGroup" id="about_group_export_and_import"> <child>
<property name="title" translatable="yes">Export and Import</property> <object class="GtkBox">
<property name="halign">end</property>
<child> <property name="margin-bottom">4</property>
<object class="AdwActionRow"> <property name="margin-end">8</property>
<property name="title" translatable="yes">Export and import settings</property> <property name="margin-start">8</property>
<property name="subtitle" translatable="yes">Use the buttons below to create a settings file from your current preferences that can be imported on a different machine.</property> <property name="margin-top">4</property>
</object> <property name="spacing">8</property>
</child> <child>
<object class="GtkButton" id="importexport_export_button">
<child> <property name="label" translatable="yes">Export to file</property>
<object class="AdwPreferencesRow"> <property name="receives-default">True</property>
<child> </object>
<object class="GtkBox"> </child>
<property name="margin_start">8</property> <child>
<property name="margin_end">8</property> <object class="GtkButton" id="importexport_import_button">
<property name="margin_top">4</property> <property name="label" translatable="yes">Import from file</property>
<property name="margin_bottom">4</property> <property name="receives-default">True</property>
<property name="spacing">8</property> </object>
<property name="halign">end</property> </child>
<child> </object>
<object class="GtkButton" id="importexport_export_button"> </child>
<property name="label" translatable="yes">Export to file</property> </object>
<property name="receives_default">True</property> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkButton" id="importexport_import_button"> <object class="AdwPreferencesGroup" id="about_group_disclaimer">
<property name="label" translatable="yes">Import from file</property> <child>
<property name="receives_default">True</property> <object class="GtkLabel" id="label1">
</object> <property name="justify">center</property>
</child> <property name="label" translatable="yes">&lt;span size="small"&gt;This program comes with ABSOLUTELY NO WARRANTY.
</object> See the &lt;a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html"&gt;GNU General Public License, version 2 or later&lt;/a&gt; for details.&lt;/span&gt;</property>
</child> <property name="use-markup">True</property>
</object> <property name="wrap">True</property>
</child> </object>
</child>
</object> </object>
</child> </child>
<!-- group disclaimer -->
<child>
<object class="AdwPreferencesGroup" id="about_group_disclaimer">
<child>
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">&lt;span size="small"&gt;This program comes with ABSOLUTELY NO WARRANTY.&#10;See the &lt;a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html"&gt;GNU General Public License, version 2 or later&lt;/a&gt; for details.&lt;/span&gt;</property>
<property name="use_markup">True</property>
<property name="justify">center</property>
<property name="wrap">True</property>
</object>
</child>
</object>
</child>
</object> </object>
</interface> </interface>