[gitg/wip/clone: 4/4] dash: add clone_repository method



commit afabea9d11dabae0d7f4d13d92a13cc7a851dedb
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Mar 21 17:32:15 2013 +0100

    dash: add clone_repository method

 gitg/gitg-window.vala               |    2 +-
 libgitg-gtk/gitg-gtk-dash-view.vala |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 3661d88..1e8f111 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -195,7 +195,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
                dlg.response.connect((d, id) => {
                        if (id == Gtk.ResponseType.OK)
                        {
-                               //FIXME
+                               d_dash_view.clone_repository(entry_url.get_text(), chooser.get_file());
                        }
 
                        d.destroy();
diff --git a/libgitg-gtk/gitg-gtk-dash-view.vala b/libgitg-gtk/gitg-gtk-dash-view.vala
index 6b29077..a63f356 100644
--- a/libgitg-gtk/gitg-gtk-dash-view.vala
+++ b/libgitg-gtk/gitg-gtk-dash-view.vala
@@ -36,6 +36,7 @@ namespace GitgGtk
                        public Label repository_label;
                        public Label branch_label;
                        public Arrow arrow;
+                       public Spinner spinner;
                }
 
                public signal void repository_activated(Repository repository);
@@ -252,6 +253,26 @@ namespace GitgGtk
                        recent_manager.add_full(workdir.get_uri(), item);
                }
 
+               public void clone_repository(string url, File location)
+               {
+                       Gitg.Repository? repository = null;
+
+                       try
+                       {
+                               repository = Ggit.Repository.clone(url, location, null) as Gitg.Repository;
+                               add_repository(repository);
+
+                               RepositoryData? data = get_data_for_repository(repository);
+                               data.arrow.hide();
+
+                               data.spinner = new Spinner();
+                               data.grid.attach(data.spinner, 2, 0, 1, 2);
+                               data.spinner.show();
+                               data.spinner.start();
+                       }
+                       catch {}
+               }
+
                public void filter_text(string? text)
                {
                        d_filter_text = text;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]