Skip to content

Commit

Permalink
polkit-dialog: Clean up the styling a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephMcc authored and mtwebster committed Feb 9, 2024
1 parent c4e1614 commit cbb5f9c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 54 deletions.
51 changes: 29 additions & 22 deletions data/theme/cinnamon.css
Original file line number Diff line number Diff line change
Expand Up @@ -1173,68 +1173,75 @@ StScrollBar StButton#vhandle:hover {
width: 500px;
}
.polkit-dialog-main-layout {
spacing: 24px;
padding: 10px;
}
.polkit-dialog-message-layout {
spacing: 16px;
spacing: 10px;
}

.polkit-dialog-headline {
font-size: 12pt;
text-align: center;
font-size: 1.3em;
font-weight: bold;
color: #666666;
color: white;
}
.polkit-dialog-description {
font-size: 10pt;
text-align: center;
font-size: 1em;
color: white;
}
.polkit-dialog-user-layout {
padding-left: 10px;
spacing: 10px;
}
.polkit-dialog-user-layout:rtl {
padding-left: 0px;
padding-right: 10px;
}
.polkit-dialog-user-root-label {
color: #ff0000;
}
.polkit-dialog-password-label:ltr {
padding-top: 0.5em;
padding-right: 0.5em;
}
.polkit-dialog-password-label:rtl {
padding-left: 0.5em;
}
.polkit-dialog-password-entry {
background-gradient-start: rgb(236,236,236);
background-gradient-end: white;
padding: 5px;
border-radius: 4px;
color: rgb(64, 64, 64);
border: 2px solid rgba(245,245,245,0.2);
background-gradient-start: rgba(5,5,6,0.1);
background-gradient-end: rgba(254,254,254,0.1);
background-gradient-direction: vertical;
color: black;
border-radius: 5px;
border: 2px solid #555753;
selected-color: black;
caret-color: rgb(64, 64, 64);
caret-size: 1px;
width: 21em;
height: 1.2em;
transition-duration: 300;
box-shadow: inset 0px 2px 4px rgba(0,0,0,0.6);
}
.polkit-dialog-password-entry:focus {
border: 2px solid #3465a4;
border: 2px solid rgb(136,138,133);
background-gradient-start: rgb(80, 80, 80);
background-gradient-end: white;
background-gradient-direction: vertical;
}
.polkit-dialog-password-entry .capslock-warning {
icon-size: 16px;
warning-color: #999;
warning-color: rgb(64, 64, 64);
padding: 0 4px;
}
.polkit-dialog-error-label {
font-size: 10pt;
text-align: center;
font-size: 1em;
color: #ffff00;
padding-bottom: 8px;
}
.polkit-dialog-info-label {
font-size: 10pt;
padding-bottom: 8px;
font-size: 1em;
}
/* intentionally left transparent to avoid dialog changing size */
.polkit-dialog-null-label {
font-size: 10pt;
color: rgba(0,0,0,0);
padding-bottom: 8px;
}

/* ###################################################################
Expand Down
54 changes: 22 additions & 32 deletions js/ui/polkitAuthenticationAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,24 @@ AuthenticationDialog.prototype = {
this._completed = false;

let mainContentBox = new St.BoxLayout({ style_class: 'polkit-dialog-main-layout',
vertical: false });
vertical: true });
this.contentLayout.add(mainContentBox,
{ x_fill: true,
y_fill: true });

let icon = new St.Icon({ icon_name: 'dialog-password-symbolic' });
mainContentBox.add(icon,
{ x_fill: true,
y_fill: false,
x_align: St.Align.END,
y_align: St.Align.START });

let messageBox = new St.BoxLayout({ style_class: 'polkit-dialog-message-layout',
vertical: true });
mainContentBox.add(messageBox,
{ y_align: St.Align.START });

this._subjectLabel = new St.Label({ style_class: 'polkit-dialog-headline',
text: _("Authentication Required") });

messageBox.add(this._subjectLabel,
mainContentBox.add(this._subjectLabel,
{ y_fill: false,
y_align: St.Align.START });
y_align: St.Align.MIDDLE });

this._descriptionLabel = new St.Label({ style_class: 'polkit-dialog-description',
text: message });
this._descriptionLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
this._descriptionLabel.clutter_text.line_wrap = true;

messageBox.add(this._descriptionLabel,
mainContentBox.add(this._descriptionLabel,
{ y_fill: true,
y_align: St.Align.START });

Expand Down Expand Up @@ -110,53 +98,55 @@ AuthenticationDialog.prototype = {
if (userIsRoot) {
let userLabel = new St.Label(({ style_class: 'polkit-dialog-user-root-label',
text: userRealName }));
messageBox.add(userLabel);
mainContentBox.add(userLabel);
} else {
let userBox = new St.BoxLayout({ style_class: 'polkit-dialog-user-layout',
vertical: false });
messageBox.add(userBox);
vertical: true });
mainContentBox.add(userBox);
this._userIcon = new St.Icon();
this._userIcon.hide();
userBox.add(this._userIcon,
{ x_fill: true,
y_fill: false,
x_align: St.Align.END,
{ x_fill: false,
y_fill: true,
x_align: St.Align.MIDDLE,
y_align: St.Align.START });
let userLabel = new St.Label(({ style_class: 'polkit-dialog-user-label',
text: userRealName }));
userBox.add(userLabel,
{ x_fill: true,
y_fill: false,
x_align: St.Align.END,
y_align: St.Align.MIDDLE });
{ x_fill: false,
y_fill: true,
x_align: St.Align.MIDDLE,
y_align: St.Align.START });
}

this._onUserChanged();

this._passwordBox = new St.BoxLayout({ vertical: false });
messageBox.add(this._passwordBox);
mainContentBox.add(this._passwordBox);
this._passwordLabel = new St.Label(({ style_class: 'polkit-dialog-password-label' }));
this._passwordBox.add(this._passwordLabel);
this._passwordBox.add(this._passwordLabel,
{ y_align: St.Align.MIDDLE });
this._passwordEntry = new St.Entry({ style_class: 'polkit-dialog-password-entry',
text: "",
can_focus: true});
CinnamonEntry.addContextMenu(this._passwordEntry, { isPassword: true });
this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivate));
this._passwordBox.add(this._passwordEntry,
{expand: true });
{ expand: true,
y_align: St.Align.START });
this.setInitialKeyFocus(this._passwordEntry);
this._passwordBox.hide();

this._errorMessageLabel = new St.Label({ style_class: 'polkit-dialog-error-label' });
this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
this._errorMessageLabel.clutter_text.line_wrap = true;
messageBox.add(this._errorMessageLabel);
mainContentBox.add(this._errorMessageLabel);
this._errorMessageLabel.hide();

this._infoMessageLabel = new St.Label({ style_class: 'polkit-dialog-info-label' });
this._infoMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
this._infoMessageLabel.clutter_text.line_wrap = true;
messageBox.add(this._infoMessageLabel);
mainContentBox.add(this._infoMessageLabel);
this._infoMessageLabel.hide();

/* text is intentionally non-blank otherwise the height is not the same as for
Expand All @@ -167,7 +157,7 @@ AuthenticationDialog.prototype = {
text: 'abc'});
this._nullMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
this._nullMessageLabel.clutter_text.line_wrap = true;
messageBox.add(this._nullMessageLabel);
mainContentBox.add(this._nullMessageLabel);
this._nullMessageLabel.show();

this.setButtons([{ label: _("Cancel"),
Expand Down

0 comments on commit cbb5f9c

Please sign in to comment.