[gitg] Let current view handle reloading when repository changes
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Let current view handle reloading when repository changes
- Date: Mon, 27 May 2013 07:24:44 +0000 (UTC)
commit ed3e11efc32b23cbf882ca3998ddfda857bcd667
Author: Techlive Zheng <techlivezheng gmail com>
Date: Thu May 23 22:23:15 2013 +0800
Let current view handle reloading when repository changes
This way is really cheap and quick without going throhgh all the user
interface rebuilding process, just let the view handle the reloading
itself, the view should know what is best.
gitg/gitg-window.vala | 6 ++++--
libgitg-ext/gitg-ext-view.vala | 2 ++
plugins/history/gitg-history.vala | 7 +++++++
3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 136bb11..e798c8d 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -205,8 +205,10 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
private void on_reload_activated()
{
- this.repository = new Gitg.Repository(this.repository.get_location(),
- null);
+ d_repository = new Gitg.Repository(this.repository.get_location(),
+ null);
+ notify_property("repository");
+ d_views.current.reload();
}
private void on_clone_repository()
diff --git a/libgitg-ext/gitg-ext-view.vala b/libgitg-ext/gitg-ext-view.vala
index c8303bb..dbef416 100644
--- a/libgitg-ext/gitg-ext-view.vala
+++ b/libgitg-ext/gitg-ext-view.vala
@@ -56,6 +56,8 @@ public enum ViewAction
*/
public interface View : Object, UIElement
{
+ public abstract void reload();
+
/**
* Give the view itself a chance to perform some actions after being
* activated.
diff --git a/plugins/history/gitg-history.vala b/plugins/history/gitg-history.vala
index c8b77b8..a1e69df 100644
--- a/plugins/history/gitg-history.vala
+++ b/plugins/history/gitg-history.vala
@@ -170,6 +170,13 @@ namespace GitgHistory
d_navigation.select_first();
}
+ public void reload()
+ {
+ d_navigation.model.reload();
+ d_navigation.expand_all();
+ d_navigation.select_first();
+ }
+
private void build_ui()
{
var ret = GitgExt.UI.from_builder("history/view-history.ui",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]