0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-22 05:33:03 -05:00

Prevent multiple restart prompts in fullpage-translations-customization.patch

This commit is contained in:
Malte Jürgens 2023-11-25 15:44:00 +01:00
parent 1afd23bb2e
commit ab94858bad
No known key found for this signature in database
GPG key ID: D29FBD5F93C0CFC3

View file

@ -1,4 +1,5 @@
diff --git a/browser/base/content/main-popupset.inc.xhtml b/browser/base/content/main-popupset.inc.xhtml diff --git a/browser/base/content/main-popupset.inc.xhtml b/browser/base/content/main-popupset.inc.xhtml
index 2633ccd..d2156e6 100644
--- a/browser/base/content/main-popupset.inc.xhtml --- a/browser/base/content/main-popupset.inc.xhtml
+++ b/browser/base/content/main-popupset.inc.xhtml +++ b/browser/base/content/main-popupset.inc.xhtml
@@ -654,6 +654,8 @@ @@ -654,6 +654,8 @@
@ -11,9 +12,10 @@ diff --git a/browser/base/content/main-popupset.inc.xhtml b/browser/base/content
<menuitem class="manage-languages-menuitem" <menuitem class="manage-languages-menuitem"
data-l10n-id="translations-panel-settings-manage-languages" data-l10n-id="translations-panel-settings-manage-languages"
diff --git a/browser/components/preferences/main.inc.xhtml b/browser/components/preferences/main.inc.xhtml diff --git a/browser/components/preferences/main.inc.xhtml b/browser/components/preferences/main.inc.xhtml
index 30b9076..c338c45 100644
--- a/browser/components/preferences/main.inc.xhtml --- a/browser/components/preferences/main.inc.xhtml
+++ b/browser/components/preferences/main.inc.xhtml +++ b/browser/components/preferences/main.inc.xhtml
@@ -382,27 +382,36 @@ @@ -384,27 +384,36 @@
preference="layout.spellcheckDefault"/> preference="layout.spellcheckDefault"/>
<!-- Translations --> <!-- Translations -->
@ -71,6 +73,7 @@ diff --git a/browser/components/preferences/main.inc.xhtml b/browser/components/
</vbox> </vbox>
</groupbox> </groupbox>
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
index 08c91c4..ef459f9 100644
--- a/browser/components/preferences/main.js --- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js +++ b/browser/components/preferences/main.js
@@ -141,6 +141,10 @@ Preferences.addAll([ @@ -141,6 +141,10 @@ Preferences.addAll([
@ -84,36 +87,41 @@ diff --git a/browser/components/preferences/main.js b/browser/components/prefere
// Files and Applications // Files and Applications
{ id: "pref.downloads.disable_button.edit_actions", type: "bool" }, { id: "pref.downloads.disable_button.edit_actions", type: "bool" },
@@ -323,6 +327,17 @@ var gMainPane = { @@ -323,6 +327,22 @@ var gMainPane = {
gMainPane.initTranslations(); gMainPane.initTranslations();
+ let inPrompt = false;
+ Preferences.get("browser.translations.enable").on("change", () => { + Preferences.get("browser.translations.enable").on("change", () => {
+ if(!Preferences.get("browser.translations.enable").value) + if(!Preferences.get("browser.translations.enable").value)
+ if(!inPrompt) {
+ inPrompt = true;
+ confirmRestartPrompt(false, 1, true, false).then(buttonIndex => { + confirmRestartPrompt(false, 1, true, false).then(buttonIndex => {
+ inPrompt = false;
+ if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) { + if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
+ Services.startup.quit( + Services.startup.quit(
+ Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart + Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart
+ ); + );
+ } + }
+ }); + });
+ }
+ }); + });
+ +
if ( if (
Services.prefs.getBoolPref( Services.prefs.getBoolPref(
"media.videocontrols.picture-in-picture.enabled" "media.videocontrols.picture-in-picture.enabled"
@@ -784,6 +799,10 @@ var gMainPane = { @@ -783,6 +803,10 @@ var gMainPane = {
document.getElementById("checkSpelling"),
() => this.writeCheckSpelling() () => this.writeCheckSpelling()
); );
Preferences.addSyncFromPrefListener( + Preferences.addSyncFromPrefListener(
+ document.getElementById("translations-manage-enable"), + document.getElementById("translations-manage-enable"),
+ () => this.readEnableTranslations() + () => this.readEnableTranslations()
+ ); + );
+ Preferences.addSyncFromPrefListener( Preferences.addSyncFromPrefListener(
document.getElementById("alwaysAsk"), document.getElementById("alwaysAsk"),
() => this.readUseDownloadDir() () => this.readUseDownloadDir()
); @@ -1010,24 +1034,33 @@ var gMainPane = {
@@ -1010,24 +1029,33 @@ var gMainPane = {
document.getElementById("zoomBox").hidden = false; document.getElementById("zoomBox").hidden = false;
}, },
@ -152,9 +160,10 @@ diff --git a/browser/components/preferences/main.js b/browser/components/prefere
/** /**
* The fully initialized state. * The fully initialized state.
diff --git a/browser/components/translations/content/translationsPanel.js b/browser/components/translations/content/translationsPanel.js diff --git a/browser/components/translations/content/translationsPanel.js b/browser/components/translations/content/translationsPanel.js
index b9916dc..1ff8d64 100644
--- a/browser/components/translations/content/translationsPanel.js --- a/browser/components/translations/content/translationsPanel.js
+++ b/browser/components/translations/content/translationsPanel.js +++ b/browser/components/translations/content/translationsPanel.js
@@ -1322,6 +1322,12 @@ var TranslationsPanel = new (class { @@ -1318,6 +1318,12 @@ var TranslationsPanel = new (class {
); );
} }
@ -168,9 +177,10 @@ diff --git a/browser/components/translations/content/translationsPanel.js b/brow
* Redirect the user to about:preferences * Redirect the user to about:preferences
*/ */
diff --git a/browser/locales/en-US/browser/translations.ftl b/browser/locales/en-US/browser/translations.ftl diff --git a/browser/locales/en-US/browser/translations.ftl b/browser/locales/en-US/browser/translations.ftl
index 8483a45..14478f4 100644
--- a/browser/locales/en-US/browser/translations.ftl --- a/browser/locales/en-US/browser/translations.ftl
+++ b/browser/locales/en-US/browser/translations.ftl +++ b/browser/locales/en-US/browser/translations.ftl
@@ -58,6 +58,9 @@ translations-panel-settings-never-transl @@ -58,6 +58,9 @@ translations-panel-settings-never-translate-unknown-language =
translations-panel-settings-never-translate-site = translations-panel-settings-never-translate-site =
.label = Never translate this site .label = Never translate this site
@ -180,7 +190,7 @@ diff --git a/browser/locales/en-US/browser/translations.ftl b/browser/locales/en
## The translation panel appears from the url bar, and this view is the default ## The translation panel appears from the url bar, and this view is the default
## translation view. ## translation view.
@@ -123,6 +126,10 @@ translations-manage-header = Translation @@ -123,6 +126,10 @@ translations-manage-header = Translations
translations-manage-settings-button = translations-manage-settings-button =
.label = Settings… .label = Settings…
.accesskey = t .accesskey = t