[gitg] Tidy up the commit details
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Tidy up the commit details
- Date: Wed, 23 Dec 2015 14:45:36 +0000 (UTC)
commit 4ea660ac1bbf4c9048945170e9389fdffd7e0752
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Wed Dec 23 15:45:15 2015 +0100
Tidy up the commit details
libgitg/gitg-diff-view-commit-details.vala | 33 ++++++++++++----
.../resources/ui/gitg-diff-view-commit-details.ui | 42 ++++++++++++-------
2 files changed, 51 insertions(+), 24 deletions(-)
---
diff --git a/libgitg/gitg-diff-view-commit-details.vala b/libgitg/gitg-diff-view-commit-details.vala
index 5f772ce..d0d5f9c 100644
--- a/libgitg/gitg-diff-view-commit-details.vala
+++ b/libgitg/gitg-diff-view-commit-details.vala
@@ -50,6 +50,9 @@ class Gitg.DiffViewCommitDetails : Gtk.Grid
[GtkChild( name = "expander_files" )]
private Gtk.Expander d_expander_files;
+ [GtkChild( name = "label_expand_collapse_files" )]
+ private Gtk.Label d_label_expand_collapse_files;
+
public bool expanded
{
get { return d_expander_files.expanded; }
@@ -65,7 +68,12 @@ class Gitg.DiffViewCommitDetails : Gtk.Grid
public bool expander_visible
{
get { return d_expander_files.visible; }
- set { d_expander_files.visible = value; }
+
+ set
+ {
+ d_expander_files.visible = value;
+ d_label_expand_collapse_files.visible = value;
+ }
}
private Cancellable? d_avatar_cancel;
@@ -131,11 +139,11 @@ class Gitg.DiffViewCommitDetails : Gtk.Grid
d_expander_files.notify["expanded"].connect(() => {
if (d_expander_files.expanded)
{
- d_expander_files.label = _("Collapse all");
+ d_label_expand_collapse_files.label = _("Collapse all");
}
else
{
- d_expander_files.label = _("Expand all");
+ d_label_expand_collapse_files.label = _("Expand all");
}
notify_property("expanded");
@@ -190,14 +198,11 @@ class Gitg.DiffViewCommitDetails : Gtk.Grid
{
d_label_committer.label = _("Committed by %s").printf(author_to_markup(committer));
d_label_committer_date.label =
committer.get_time().to_timezone(committer.get_time_zone()).format("%x %X %z");
-
- d_label_committer.show();
- d_label_committer_date.show();
}
else
{
- d_label_committer.hide();
- d_label_committer_date.hide();
+ d_label_committer.label = "";
+ d_label_committer_date.label = "";
}
var parents = commit.get_parents();
@@ -296,6 +301,18 @@ class Gitg.DiffViewCommitDetails : Gtk.Grid
d_image_avatar.get_style_context().add_class("dim-label");
}
}
+
+ [GtkCallback]
+ private bool button_press_on_event_box_expand_collapse(Gdk.EventButton event)
+ {
+ if (event.button == Gdk.BUTTON_PRIMARY)
+ {
+ d_expander_files.expanded = !d_expander_files.expanded;
+ return true;
+ }
+
+ return false;
+ }
}
// ex:ts=4 noet
diff --git a/libgitg/resources/ui/gitg-diff-view-commit-details.ui
b/libgitg/resources/ui/gitg-diff-view-commit-details.ui
index 19c0549..4808fe3 100644
--- a/libgitg/resources/ui/gitg-diff-view-commit-details.ui
+++ b/libgitg/resources/ui/gitg-diff-view-commit-details.ui
@@ -6,20 +6,23 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
+ <property name="row_spacing">12</property>
<child>
<object class="GtkGrid" id="grid_inner">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="border_width">12</property>
- <property name="row_spacing">6</property>
+ <property name="margin_top">12</property>
+ <property name="margin_start">12</property>
+ <property name="margin_end">12</property>
+ <property name="row_spacing">12</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkImage" id="image_avatar">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="valign">start</property>
- <property name="pixel_size">70</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="pixel_size">50</property>
<property name="icon_name">avatar-default-symbolic</property>
</object>
<packing>
@@ -123,8 +126,6 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
- <property name="margin_top">6</property>
- <property name="margin_bottom">6</property>
<property name="label">Subject</property>
<property name="wrap">True</property>
<property name="selectable">True</property>
@@ -140,7 +141,7 @@
<object class="GtkGrid" id="grid_parents_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_bottom">12</property>
+ <property name="margin_top">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
@@ -185,26 +186,35 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
- <property name="margin_start">3</property>
+ <property name="margin_start">6</property>
<property name="margin_end">12</property>
- <property name="margin_top">12</property>
<property name="margin_bottom">6</property>
<child>
<object class="GtkExpander" id="expander_files">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">baseline</property>
- <property name="hexpand">True</property>
- <child type="label">
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkEventBox" id="event_box_expand_collapse_files">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <signal name="button-press-event" handler="button_press_on_event_box_expand_collapse" />
+ <child>
<object class="GtkLabel" id="label_expand_collapse_files">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Expand all</property>
+ <property name="valign">baseline</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
</child>
- <style>
- <class name="dim-label"/>
- </style>
</object>
</child>
<child>
@@ -212,7 +222,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <property name="valign">start</property>
+ <property name="valign">baseline</property>
<property name="hexpand">True</property>
<property name="label">0000000000000000000000000000000000000000</property>
<property name="selectable">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]