[gnome-shell] userMenu: fix line wrapping
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] userMenu: fix line wrapping
- Date: Mon, 19 Sep 2011 21:36:41 +0000 (UTC)
commit ab67c0f8b0d69c071a4e4a1de536c7b69fbc3484
Author: Dan Winship <danw gnome org>
Date: Tue Aug 23 13:15:31 2011 -0400
userMenu: fix line wrapping
The previous wrapping code hardcoded a width in pixels, making it
non-text-zoom-friendly. Specify a CSS width in pts, and fix the
userMenu code to completely opt out of the popupMenu column behavior.
Hack PopupComboBoxMenuItem slightly to deal with the fact that the
pop-up no longer gets setColumnWidth'ed.
https://bugzilla.gnome.org/show_bug.cgi?id=652837
data/theme/gnome-shell.css | 1 +
js/ui/popupMenu.js | 3 ++-
js/ui/userMenu.js | 19 ++++---------------
3 files changed, 7 insertions(+), 16 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index f36f9c8..f9b1cce 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -402,6 +402,7 @@ StTooltip StLabel {
.status-chooser-user-name {
font-weight: bold;
font-size: 1.3em;
+ min-width: 120pt;
}
.status-chooser-combo {
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 0ce16f9..53ddc97 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1580,7 +1580,8 @@ PopupComboBoxMenuItem.prototype = {
this.addActor(this._itemBox);
let expander = new St.Label({ text: '\u2304' });
- this.addActor(expander, { align: St.Align.END });
+ this.addActor(expander, { align: St.Align.END,
+ span: -1 });
this._menu = new PopupComboMenu(this.actor);
Main.uiGroup.add_actor(this._menu.actor);
diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js
index 15a627a..e81d499 100644
--- a/js/ui/userMenu.js
+++ b/js/ui/userMenu.js
@@ -5,6 +5,7 @@ const DBus = imports.dbus;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
+const Pango = imports.gi.Pango;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const Tp = imports.gi.TelepathyGLib;
@@ -22,7 +23,6 @@ const DISABLE_USER_SWITCH_KEY = 'disable-user-switching';
const DISABLE_LOCK_SCREEN_KEY = 'disable-lock-screen';
const DISABLE_LOG_OUT_KEY = 'disable-log-out';
-const WRAP_WIDTH = 150;
const DIALOG_ICON_SIZE = 64;
const IMStatus = {
@@ -87,28 +87,20 @@ IMUserNameItem.prototype = {
this.label = new St.Label();
this.label.clutter_text.set_line_wrap(true);
+ this.label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
this._wrapper.add_actor(this.label);
},
_wrapperGetPreferredWidth: function(actor, forHeight, alloc) {
- [alloc.min_size, alloc.natural_size] = this.label.get_preferred_width(-1);
- if (alloc.natural_size > WRAP_WIDTH)
- alloc.natural_size = WRAP_WIDTH;
+ alloc.min_size = 1;
+ alloc.natural_size = 1;
},
_wrapperGetPreferredHeight: function(actor, forWidth, alloc) {
- let minWidth, natWidth;
[alloc.min_size, alloc.natural_size] = this.label.get_preferred_height(forWidth);
- [minWidth, natWidth] = this.label.get_preferred_width(-1);
- if (natWidth > WRAP_WIDTH) {
- alloc.min_size *= 2;
- alloc.natural_size *= 2;
- }
},
_wrapperAllocate: function(actor, box, flags) {
- let availWidth = box.x2 - box.x1;
- let availHeight = box.y2 - box.y1;
this.label.allocate(box, flags);
}
};
@@ -207,9 +199,6 @@ IMStatusChooserItem.prototype = {
},
setColumnWidths: function(widths) {
- this._columnWidths = PopupMenu.PopupBaseMenuItem.prototype.getColumnWidths.call(this);
- let sectionWidths = this._section.getColumnWidths();
- this._section.setColumnWidths(sectionWidths);
},
_updateUser: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]