[gitg] Show submodules in dash
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Show submodules in dash
- Date: Wed, 10 Dec 2014 07:37:00 +0000 (UTC)
commit d023afc835c2a042224e9d17ddb69b25a1b7d119
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Wed Dec 10 08:36:25 2014 +0100
Show submodules in dash
libgitg/gitg-repository-list-box.vala | 48 +++++++++++++++++++++
libgitg/resources/gitg-repository-list-box-row.ui | 26 +++++++++--
2 files changed, 70 insertions(+), 4 deletions(-)
---
diff --git a/libgitg/gitg-repository-list-box.vala b/libgitg/gitg-repository-list-box.vala
index c8d9a4d..8dd5b33 100644
--- a/libgitg/gitg-repository-list-box.vala
+++ b/libgitg/gitg-repository-list-box.vala
@@ -55,6 +55,8 @@ namespace Gitg
private Gtk.CheckButton d_remove_check_button;
[GtkChild]
private Gtk.Revealer d_remove_revealer;
+ [GtkChild]
+ private Gtk.Box d_submodule_box;
public signal void request_remove();
@@ -189,6 +191,43 @@ namespace Gitg
{
Object(repository_name: name, branch_name: branch_name, has_remote:
has_remote);
}
+
+ public void add_submodule(Ggit.Submodule module)
+ {
+ var box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 3);
+ var tip = @"$(module.get_path())/ ($(module.get_url()))";
+ box.set_tooltip_text(tip);
+ box.show();
+
+ var icon = new Gtk.Image.from_icon_name("folder-remote-symbolic",
+ Gtk.IconSize.MENU);
+ icon.show();
+
+ var name = Path.get_basename(module.get_url());
+
+ if (name.has_suffix(".git"))
+ {
+ name = name[0:-4];
+ }
+
+ var labelName = new Gtk.Label(name);
+ labelName.show();
+
+ var arrow = new Gtk.Arrow(Gtk.ArrowType.RIGHT, Gtk.ShadowType.NONE);
+ arrow.show();
+
+ var path = module.get_path();
+ var labelPath = new Gtk.Label(@"$path/");
+ labelPath.set_ellipsize(Pango.EllipsizeMode.MIDDLE);
+ labelPath.show();
+
+ box.add(icon);
+ box.add(labelName);
+ box.add(arrow);
+ box.add(labelPath);
+
+ d_submodule_box.add(box);
+ }
}
[Notify]
@@ -354,6 +393,15 @@ namespace Gitg
row.repository = repository;
row.show();
+ try
+ {
+ repository.submodule_foreach((module) => {
+ row.add_submodule(module);
+ return 0;
+ });
+ }
+ catch {}
+
if (f != null)
{
bind_property("mode",
diff --git a/libgitg/resources/gitg-repository-list-box-row.ui
b/libgitg/resources/gitg-repository-list-box-row.ui
index c74c5e8..b9e15c7 100644
--- a/libgitg/resources/gitg-repository-list-box-row.ui
+++ b/libgitg/resources/gitg-repository-list-box-row.ui
@@ -39,7 +39,7 @@
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
- <property name="height">2</property>
+ <property name="height">3</property>
</packing>
</child>
<child>
@@ -54,7 +54,7 @@
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
- <property name="height">2</property>
+ <property name="height">3</property>
</packing>
</child>
<child>
@@ -96,6 +96,24 @@
</packing>
</child>
<child>
+ <object class="GtkBox" id="d_submodule_box">
+ <property name="orientation">horizontal</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="spacing">24</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkArrow" id="d_arrow">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -107,7 +125,7 @@
<property name="left_attach">3</property>
<property name="top_attach">0</property>
<property name="width">1</property>
- <property name="height">2</property>
+ <property name="height">3</property>
</packing>
</child>
<child>
@@ -120,7 +138,7 @@
<property name="left_attach">4</property>
<property name="top_attach">0</property>
<property name="width">1</property>
- <property name="height">2</property>
+ <property name="height">3</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]