mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-08-27 20:09:23 +00:00
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.
This commit is contained in:
parent
dd1cfbe730
commit
ed3e11efc3
|
@ -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()
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue