Bind topological-order setting to model sort mode

This commit is contained in:
Jesse van den Kieboom 2012-07-19 10:28:02 +02:00
parent c4b196d558
commit fb0a809aeb

View file

@ -33,6 +33,7 @@ namespace GitgHistory
private GitgGtk.CommitModel? d_model; private GitgGtk.CommitModel? d_model;
private Gee.HashSet<Ggit.OId> d_selected; private Gee.HashSet<Ggit.OId> d_selected;
private ulong d_insertsig; private ulong d_insertsig;
private Settings d_settings;
private Gtk.Widget d_main; private Gtk.Widget d_main;
@ -61,9 +62,28 @@ namespace GitgHistory
d_model.started.connect(on_commit_model_started); d_model.started.connect(on_commit_model_started);
d_model.finished.connect(on_commit_model_finished); d_model.finished.connect(on_commit_model_finished);
d_settings = new Settings("org.gnome.gitg.history.preferences");
d_settings.changed["topological-order"].connect((s, k) => {
update_sort_mode();
});
update_sort_mode();
application.bind_property("repository", d_model, "repository", BindingFlags.DEFAULT); application.bind_property("repository", d_model, "repository", BindingFlags.DEFAULT);
} }
private void update_sort_mode()
{
if (d_settings.get_boolean("topological-order"))
{
d_model.sort_mode |= Ggit.SortMode.TOPOLOGICAL;
}
else
{
d_model.sort_mode &= ~Ggit.SortMode.TOPOLOGICAL;
}
}
private void on_commit_model_started(Gitg.CommitModel model) private void on_commit_model_started(Gitg.CommitModel model)
{ {
if (d_insertsig == 0) if (d_insertsig == 0)