Skip to content

Commit

Permalink
appletManager: Clean up a couple more modal dialogs
Browse files Browse the repository at this point in the history
Totally missed these in the first go around. Also fixes and error in the
NotifyDialog.
  • Loading branch information
JosephMcc committed Dec 2, 2024
1 parent e9ab164 commit 3708b15
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
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

0 comments on commit 3708b15

Please sign in to comment.