Do not manually manage fixed column sizes

This commit is contained in:
Jesse van den Kieboom 2014-01-04 23:41:32 +01:00
parent db31d577f9
commit 377a336120
2 changed files with 6 additions and 29 deletions

View file

@ -50,15 +50,6 @@ class Paned : Gtk.Paned
[GtkChild]
private Gtk.ScrolledWindow d_scrolled_window_commit_list;
[GtkChild]
private Gtk.TreeViewColumn d_column_commit_list_subject;
[GtkChild]
private Gtk.TreeViewColumn d_column_commit_list_author;
[GtkChild]
private Gtk.TreeViewColumn d_column_commit_list_author_date;
[Notify]
public Gtk.Orientation inner_orientation
{
@ -119,20 +110,6 @@ class Paned : Gtk.Paned
d_renderer_commit_list_author_date.add_class("dim-label");
d_stack_switcher_panels.set_stack(d_stack_panel);
d_commit_list_view.size_allocate.connect(on_list_view_size_allocate);
}
private void on_list_view_size_allocate(Gtk.Widget view, Gtk.Allocation alloc)
{
// Resize columns
int subject = (int)(0.6 * alloc.width);
int author = (int)(0.6 * (alloc.width - subject));
int date = alloc.width - subject - author;
d_column_commit_list_subject.fixed_width = subject;
d_column_commit_list_author.fixed_width = author;
d_column_commit_list_author_date.fixed_width = date;
}
public Paned()

View file

@ -88,12 +88,12 @@
<property name="fixed-height-mode">True</property>
<property name="headers-visible">False</property>
<child>
<object class="GtkTreeViewColumn" id="d_column_commit_list_subject">
<object class="GtkTreeViewColumn" id="column_commit_list_subject">
<property name="title" translatable="yes">Subject</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="expand">True</property>
<property name="fixed-width">600</property>
<property name="fixed-width">50</property>
<child>
<object class="GitgCellRendererLanes" id="renderer_commit_list_subject">
<property name="ellipsize">end</property>
@ -105,11 +105,11 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="d_column_commit_list_author">
<object class="GtkTreeViewColumn" id="column_commit_list_author">
<property name="title" translatable="yes">Author</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="fixed-width">200</property>
<property name="fixed-width">150</property>
<child>
<object class="GdStyledTextRenderer" id="d_renderer_commit_list_author">
<property name="ellipsize">end</property>
@ -121,11 +121,11 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="d_column_commit_list_author_date">
<object class="GtkTreeViewColumn" id="column_commit_list_author_date">
<property name="title" translatable="yes">Date</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="fixed-width">250</property>
<property name="fixed-width">100</property>
<child>
<object class="GdStyledTextRenderer" id="d_renderer_commit_list_author_date">
<property name="ellipsize">end</property>