[gitg/wip/clone: 3/4] dash: factor out get_data_for_repository



commit 49f9c9444d11c85c18d3e5b1936724e8a6c9b60b
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Mar 21 16:51:25 2013 +0100

    dash: factor out get_data_for_repository

 libgitg-gtk/gitg-gtk-dash-view.vala |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/libgitg-gtk/gitg-gtk-dash-view.vala b/libgitg-gtk/gitg-gtk-dash-view.vala
index b91a60a..6b29077 100644
--- a/libgitg-gtk/gitg-gtk-dash-view.vala
+++ b/libgitg-gtk/gitg-gtk-dash-view.vala
@@ -35,6 +35,7 @@ namespace GitgGtk
                        public Image image;
                        public Label repository_label;
                        public Label branch_label;
+                       public Arrow arrow;
                }
 
                public signal void repository_activated(Repository repository);
@@ -141,11 +142,9 @@ namespace GitgGtk
                        }
                }
 
-               public void add_repository(Gitg.Repository repository)
+               private RepositoryData get_data_for_repository(Gitg.Repository repository)
                {
                        RepositoryData? data = null;
-                       File? workdir = repository.get_workdir();
-                       File? repo_file = repository.get_location();
 
                        foreach (var child in d_listbox.get_children())
                        {
@@ -157,6 +156,15 @@ namespace GitgGtk
                                }
                        }
 
+                       return data;
+               }
+
+               public void add_repository(Gitg.Repository repository)
+               {
+                       RepositoryData? data = get_data_for_repository(repository);
+                       File? workdir = repository.get_workdir();
+                       File? repo_file = repository.get_location();
+
                        if (data == null)
                        {
                                data = new RepositoryData();
@@ -220,7 +228,8 @@ namespace GitgGtk
                                        catch {}
                                }
 
-                               data.grid.attach(new Arrow(ArrowType.RIGHT, ShadowType.NONE), 2, 0, 1, 2);
+                               data.arrow = new Arrow(ArrowType.RIGHT, ShadowType.NONE);
+                               data.grid.attach(data.arrow, 2, 0, 1, 2);
 
                                data.grid.set_data<RepositoryData>("data", data);
                                data.grid.show_all();


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