[gitg] Show author information in commit dialog
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Show author information in commit dialog
- Date: Sat, 6 Jul 2013 13:55:36 +0000 (UTC)
commit 769fe836ccb467d960bedacdf7d63b0b15f5da6e
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Jul 6 15:55:01 2013 +0200
Show author information in commit dialog
gitg/commit/gitg-commit-dialog.vala | 42 +++++++++
gitg/commit/gitg-commit.vala | 2 +-
gitg/resources/ui/gitg-commit-dialog.ui | 140 +++++++++++++++++++-----------
3 files changed, 132 insertions(+), 52 deletions(-)
---
diff --git a/gitg/commit/gitg-commit-dialog.vala b/gitg/commit/gitg-commit-dialog.vala
index 0184bc3..f53aae2 100644
--- a/gitg/commit/gitg-commit-dialog.vala
+++ b/gitg/commit/gitg-commit-dialog.vala
@@ -35,6 +35,15 @@ class Dialog : Gtk.Dialog
[GtkChild (name = "check_button_sign_off")]
private Gtk.CheckButton d_check_button_sign_off;
+ [GtkChild (name = "image_avatar")]
+ private Gtk.Image d_image_avatar;
+
+ [GtkChild (name = "label_user")]
+ private Gtk.Label d_label_user;
+
+ [GtkChild (name = "label_date")]
+ private Gtk.Label d_label_date;
+
private Settings d_fontsettings;
public GtkSource.View source_view_message
@@ -83,6 +92,16 @@ class Dialog : Gtk.Dialog
[Notify]
public bool sign_off { get; set; }
+ [Notify]
+ public Ggit.Signature author { owned get; construct set; }
+
+ private Cancellable d_cancel_avatar;
+
+ ~Dialog()
+ {
+ d_cancel_avatar.cancel();
+ }
+
construct
{
d_fontsettings = new Settings("org.gnome.desktop.interface");
@@ -116,6 +135,29 @@ class Dialog : Gtk.Dialog
"sign-off",
SettingsBindFlags.GET |
SettingsBindFlags.SET);
+
+ var name = author.get_name();
+ var email = author.get_email();
+
+ d_label_user.set_label(@"$name <$email>");
+ d_label_date.set_label((new Gitg.Date.for_date_time(author.get_time())).for_display());
+
+ var ac = Gitg.AvatarCache.default();
+ d_cancel_avatar = new Cancellable();
+
+ ac.load.begin(author.get_email(), d_cancel_avatar, (obj, res) => {
+ var pixbuf = ac.load.end(res);
+
+ if (pixbuf != null && !d_cancel_avatar.is_cancelled())
+ {
+ d_image_avatar.set_from_pixbuf(pixbuf);
+ }
+ });
+ }
+
+ public Dialog(Ggit.Signature author)
+ {
+ Object(author: author);
}
private void update_font_settings()
diff --git a/gitg/commit/gitg-commit.vala b/gitg/commit/gitg-commit.vala
index a4e97bd..e65b0ec 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -495,7 +495,7 @@ namespace GitgCommit
Ggit.Signature author,
Ggit.Signature committer)
{
- var dlg = new Dialog();
+ var dlg = new Dialog(author);
dlg.set_transient_for((Gtk.Window)d_main.get_toplevel());
dlg.set_default_response(Gtk.ResponseType.OK);
diff --git a/gitg/resources/ui/gitg-commit-dialog.ui b/gitg/resources/ui/gitg-commit-dialog.ui
index 1959347..56844d1 100644
--- a/gitg/resources/ui/gitg-commit-dialog.ui
+++ b/gitg/resources/ui/gitg-commit-dialog.ui
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <template class="GitgCommitDialog">
+ <!-- interface-requires gtksourceview 3.0 -->
+ <template class="GitgCommitDialog" parent="GtkDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Commit</property>
- <property name="resizable">True</property>
<property name="modal">True</property>
- <property name="type_hint">dialog</property>
<property name="default_width">600</property>
<property name="default_height">400</property>
+ <property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -58,76 +58,114 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="box1">
+ <object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_message">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkSourceView" id="source_view_message">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="auto-indent">True</property>
- <property name="show-right-margin">True</property>
- <property name="smart-home-end">after</property>
- <property name="right-margin-position">72</property>
+ <property name="left_margin">2</property>
+ <property name="right_margin">2</property>
+ <property name="auto_indent">True</property>
+ <property name="show_right_margin">True</property>
+ <property name="right_margin_position">72</property>
+ <property name="smart_home_end">after</property>
</object>
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="check_button_amend">
+ <property name="label" translatable="yes">_Amend previous commit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="box2">
+ <object class="GtkCheckButton" id="check_button_sign_off">
+ <property name="label" translatable="yes">Add _signed-off-by signature</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="image_avatar">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkCheckButton" id="check_button_amend">
- <property name="label" translatable="yes">_Amend previous commit</property>
- <property name="use_underline">True</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="check_button_sign_off">
- <property name="label" translatable="yes">Add _signed-off-by signature</property>
- <property name="use_underline">True</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="pixel_size">50</property>
+ <property name="icon_size">6</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_user">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="hexpand">True</property>
+ <property name="valign">end</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_date">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="hexpand">True</property>
+ <property name="valign">start</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]