Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appletManager: Clean up a couple more modal dialogs #12544

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions js/ui/appletManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const Main = imports.ui.main;
const Applet = imports.ui.applet;
const Extension = imports.ui.extension;
const ModalDialog = imports.ui.modalDialog;
const Dialog = imports.ui.dialog;
const {getModuleByIndex} = imports.misc.fileUtils;
const {queryCollection} = imports.misc.util;
const Gettext = imports.gettext;
Expand Down Expand Up @@ -443,14 +444,15 @@ function removeAppletFromInappropriatePanel (extension, appletDefinition) {

global.logWarning((allowedLayout == Applet.AllowedLayout.HORIZONTAL)+", "+[St.Side.LEFT, St.Side.RIGHT].indexOf(appletDefinition.orientation));

let label_text = "<b>" + extension.meta.name + "</b>\n" +
_("This applet does not support panels of that type. This can cause visual glitches in the panel.") + "\n" +
_("Would you like to continue using it anyway, remove it from the panel, or try to move it to a different panel?");
let label = new St.Label({text: label_text});
label.clutter_text.set_use_markup(true);

let dialog = new ModalDialog.ModalDialog();
dialog.contentLayout.add(label);

let title = extension.meta.name;
let description = _("This applet does not support panels of that type. This can cause visual glitches " +
"in the panel. Would you like to continue using it anyway, remove it from the panel, " +
"or try to move it to a different panel?");

let content = new Dialog.MessageDialogContent({ title, description });
dialog.contentLayout.add_child(content);

dialog.setButtons([
{
Expand Down Expand Up @@ -527,7 +529,7 @@ function moveApplet(appletDefinition, allowedLayout) {

if (panelId == null) {
removeApplet(appletDefinition);
let dialog = new ModalDialog.NotifyDialog(_("A suitable panel could not be found. The applet has been removed instead.") + "\n\n");
let dialog = new ModalDialog.NotifyDialog(_("A suitable panel could not be found. The applet has been removed instead."));
dialog.open();
return;
}
Expand Down Expand Up @@ -804,7 +806,7 @@ function pasteAppletConfiguration(panelId) {
global.settings.set_strv("enabled-applets", rawDefinitions);

if (skipped) {
let dialog = new ModalDialog.NotifyDialog(_("Certain applets do not allow multiple instances or were at their max number of instances so were not copied") + "\n\n");
let dialog = new ModalDialog.NotifyDialog(_("Certain applets do not allow multiple instances or were at their max number of instances so were not copied"));
dialog.open();
}
}
Expand Down
9 changes: 7 additions & 2 deletions js/ui/modalDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,17 @@ class NotifyDialog extends ModalDialog {
*/
_init(description) {
super._init();
this.contentLayout.add(new St.Label({text: label}));

let title = _("Attention");

let content = new Dialog.MessageDialogContent({ title, description });
this.contentLayout.add_child(content);

this.setButtons([
{
label: _("OK"),
action: this.destroy.bind(this)
action: this.destroy.bind(this),
default: true,
}
]);
}
Expand Down
Loading