dateMenu: Enforce calendar column width
We want the width of the calendar column to be determined by the calendar, other elements should adjust their allocation accordingly. However neither ellipsization nor wrapping will kick in unless the parent's width is restricted, so use a small custom layout manager that enforces the desired behavior. https://bugzilla.gnome.org/show_bug.cgi?id=754031
This commit is contained in:
parent
c6f22826cf
commit
796fdca5c5
@ -36,7 +36,7 @@ const TodayButton = new Lang.Class({
|
|||||||
// on the current date can be confusing. So don't make the button reactive
|
// on the current date can be confusing. So don't make the button reactive
|
||||||
// until the selected date changes.
|
// until the selected date changes.
|
||||||
this.actor = new St.Button({ style_class: 'datemenu-today-button',
|
this.actor = new St.Button({ style_class: 'datemenu-today-button',
|
||||||
x_align: St.Align.START,
|
x_expand: true, x_align: St.Align.START,
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
reactive: false
|
reactive: false
|
||||||
});
|
});
|
||||||
@ -290,6 +290,22 @@ const FreezableBinLayout = new Lang.Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const CalendarColumnLayout = new Lang.Class({
|
||||||
|
Name: 'CalendarColumnLayout',
|
||||||
|
Extends: Clutter.BoxLayout,
|
||||||
|
|
||||||
|
_init(actor) {
|
||||||
|
this.parent({ orientation: Clutter.Orientation.VERTICAL });
|
||||||
|
this._calActor = actor;
|
||||||
|
},
|
||||||
|
|
||||||
|
vfunc_get_preferred_width: function(container, forHeight) {
|
||||||
|
if (!this._calActor || this._calActor.get_parent() != container)
|
||||||
|
return this.parent(container, forHeight);
|
||||||
|
return this._calActor.get_preferred_width(forHeight);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const DateMenuButton = new Lang.Class({
|
const DateMenuButton = new Lang.Class({
|
||||||
Name: 'DateMenuButton',
|
Name: 'DateMenuButton',
|
||||||
Extends: PanelMenu.Button,
|
Extends: PanelMenu.Button,
|
||||||
@ -346,14 +362,16 @@ const DateMenuButton = new Lang.Class({
|
|||||||
hbox.add(this._messageList.actor, { expand: true, y_fill: false, y_align: St.Align.START });
|
hbox.add(this._messageList.actor, { expand: true, y_fill: false, y_align: St.Align.START });
|
||||||
|
|
||||||
// Fill up the second column
|
// Fill up the second column
|
||||||
vbox = new St.BoxLayout({ style_class: 'datemenu-calendar-column',
|
let boxLayout = new CalendarColumnLayout(this._calendar.actor);
|
||||||
vertical: true });
|
vbox = new St.Widget({ style_class: 'datemenu-calendar-column',
|
||||||
|
layout_manager: boxLayout });
|
||||||
|
boxLayout.hookup_style(vbox);
|
||||||
hbox.add(vbox);
|
hbox.add(vbox);
|
||||||
|
|
||||||
this._date = new TodayButton(this._calendar);
|
this._date = new TodayButton(this._calendar);
|
||||||
vbox.add_actor(this._date.actor);
|
vbox.add_actor(this._date.actor);
|
||||||
|
|
||||||
vbox.add(this._calendar.actor);
|
vbox.add_actor(this._calendar.actor);
|
||||||
|
|
||||||
this._displaysSection = new St.ScrollView({ style_class: 'datemenu-displays-section vfade',
|
this._displaysSection = new St.ScrollView({ style_class: 'datemenu-displays-section vfade',
|
||||||
x_expand: true, x_fill: true,
|
x_expand: true, x_fill: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user