mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-08-27 11:59:17 +00:00
Correctly implement get_preferred_width
This commit is contained in:
parent
9a8a4687fb
commit
db31d577f9
|
@ -42,16 +42,18 @@ namespace Gitg
|
|||
LabelRenderer.width(widget, font_desc, labels);
|
||||
}
|
||||
|
||||
public override void get_size(Gtk.Widget widget,
|
||||
Gdk.Rectangle? area,
|
||||
out int xoffset,
|
||||
out int yoffset,
|
||||
out int width,
|
||||
out int height)
|
||||
public override void get_preferred_width(Gtk.Widget widget,
|
||||
out int minimum_width,
|
||||
out int natural_width)
|
||||
{
|
||||
base.get_size(widget, area, out xoffset, out yoffset, out width, out height);
|
||||
base.get_preferred_width(widget, out minimum_width, out natural_width);
|
||||
|
||||
width += (int)total_width(widget);
|
||||
var w = (int)total_width(widget);
|
||||
|
||||
if (w > minimum_width)
|
||||
{
|
||||
minimum_width = w;
|
||||
}
|
||||
}
|
||||
|
||||
private void draw_arrow(Cairo.Context context,
|
||||
|
|
|
@ -282,17 +282,21 @@ public class SidebarRendererText : Gtk.CellRendererText
|
|||
|
||||
protected override void get_preferred_width(Gtk.Widget widget,
|
||||
out int minimum_width,
|
||||
out int minimum_height)
|
||||
out int natural_width)
|
||||
{
|
||||
ensure_pixbuf(widget.get_style_context());
|
||||
|
||||
// Size of text
|
||||
base.get_preferred_width(widget, out minimum_width, out minimum_height);
|
||||
base.get_preferred_width(widget, out minimum_width, out natural_width);
|
||||
|
||||
if (d_pixbuf != null)
|
||||
{
|
||||
minimum_width += d_pixbuf.get_width() + 3;
|
||||
minimum_height += d_pixbuf.get_height();
|
||||
var w = d_pixbuf.get_width() + 3;
|
||||
|
||||
if (w > minimum_width)
|
||||
{
|
||||
minimum_width = w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue