[gitg] Percentage sizing of columns
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Percentage sizing of columns
- Date: Sat, 4 Jan 2014 22:15:42 +0000 (UTC)
commit 60d126ed2104818de1fe1fbdc5bfb0444a3d753f
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Jan 4 23:15:11 2014 +0100
Percentage sizing of columns
gitg/history/gitg-history-paned.vala | 23 +++++++++++++++++++++++
gitg/resources/ui/gitg-history-paned.ui | 6 +++---
2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/gitg/history/gitg-history-paned.vala b/gitg/history/gitg-history-paned.vala
index 79a1d52..3c44015 100644
--- a/gitg/history/gitg-history-paned.vala
+++ b/gitg/history/gitg-history-paned.vala
@@ -50,6 +50,15 @@ 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
{
@@ -110,6 +119,20 @@ 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()
diff --git a/gitg/resources/ui/gitg-history-paned.ui b/gitg/resources/ui/gitg-history-paned.ui
index a7df591..6b0bbab 100644
--- a/gitg/resources/ui/gitg-history-paned.ui
+++ b/gitg/resources/ui/gitg-history-paned.ui
@@ -88,7 +88,7 @@
<property name="fixed-height-mode">True</property>
<property name="headers-visible">False</property>
<child>
- <object class="GtkTreeViewColumn" id="column_commit_list_subject">
+ <object class="GtkTreeViewColumn" id="d_column_commit_list_subject">
<property name="title" translatable="yes">Subject</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
@@ -105,7 +105,7 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn" id="column_commit_list_author">
+ <object class="GtkTreeViewColumn" id="d_column_commit_list_author">
<property name="title" translatable="yes">Author</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
@@ -121,7 +121,7 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn" id="column_commit_list_author_date">
+ <object class="GtkTreeViewColumn" id="d_column_commit_list_author_date">
<property name="title" translatable="yes">Date</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]