[gitg] Set repository through property
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Set repository through property
- Date: Tue, 26 Feb 2013 09:06:25 +0000 (UTC)
commit 3185b6ea7c8abafc7041e6e327238f63310eba46
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Tue Oct 30 11:03:55 2012 +0100
Set repository through property
gitg/gitg-window.vala | 27 +++++++++++++++++++--------
libgitg-ext/gitg-ext-application.vala | 2 +-
2 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index ed1901e..270f5e8 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -55,9 +55,23 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
owned get { return d_message_bus; }
}
+ [Notify]
public Repository? repository
{
owned get { return d_repository; }
+ set
+ {
+ close();
+ d_repository = value;
+
+ repository_changed();
+ }
+ }
+
+ private void repository_changed()
+ {
+ d_views.update();
+ activate_default_view();
}
protected override bool window_state_event(Gdk.EventWindowState event)
@@ -136,6 +150,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
// Update panels
d_panels.update();
+ notify_property("current_view");
}
private void on_panel_activated(UIElements elements,
@@ -243,6 +258,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
((Initable)ret).init(null);
} catch {}
+ ret.repository_changed();
return ret;
}
@@ -269,6 +285,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
public void open(File path)
{
File repo;
+ Gitg.Repository? repository = null;
if (d_repository != null &&
d_repository.get_location().equal(path))
@@ -286,19 +303,13 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
return;
}
- if (d_repository != null)
- {
- close();
- }
-
try
{
- d_repository = new Gitg.Repository(repo, null);
- notify_property("repository");
+ repository = new Gitg.Repository(repo, null);
}
catch {}
- d_views.update();
+ this.repository = repository;
}
public void create(File path)
diff --git a/libgitg-ext/gitg-ext-application.vala b/libgitg-ext/gitg-ext-application.vala
index dd6c91a..0d86ed3 100644
--- a/libgitg-ext/gitg-ext-application.vala
+++ b/libgitg-ext/gitg-ext-application.vala
@@ -33,7 +33,7 @@ public interface Application : Object
/**
* The currently open repository.
*/
- public abstract Gitg.Repository? repository { owned get; }
+ public abstract Gitg.Repository? repository { owned get; set; }
/**
* An application wide message bus over which plugins can communicate.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]