mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-08-28 04:19:40 +00:00
Update diff and files for having history in the core
This commit is contained in:
parent
3c97a13a6c
commit
f4689c95d7
|
@ -19,30 +19,32 @@
|
||||||
|
|
||||||
namespace GitgDiff
|
namespace GitgDiff
|
||||||
{
|
{
|
||||||
public class Panel : Object, GitgExt.UIElement, GitgExt.Panel
|
public class Panel : Object, GitgExt.UIElement, GitgExt.HistoryPanel
|
||||||
{
|
{
|
||||||
// Do this to pull in config.h before glib.h (for gettext...)
|
// Do this to pull in config.h before glib.h (for gettext...)
|
||||||
private const string version = Gitg.Config.VERSION;
|
private const string version = Gitg.Config.VERSION;
|
||||||
|
|
||||||
public GitgExt.Application? application { owned get; construct set; }
|
public GitgExt.Application? application { owned get; construct set; }
|
||||||
|
public GitgExt.History? history { owned get; construct set; }
|
||||||
|
|
||||||
private Gtk.ScrolledWindow d_sw;
|
private Gtk.ScrolledWindow d_sw;
|
||||||
private Gitg.DiffView d_diff;
|
private Gitg.DiffView d_diff;
|
||||||
private GitgExt.ObjectSelection? d_view;
|
|
||||||
private Gitg.WhenMapped d_whenMapped;
|
private Gitg.WhenMapped d_whenMapped;
|
||||||
|
|
||||||
construct
|
construct
|
||||||
{
|
{
|
||||||
d_sw = new Gtk.ScrolledWindow(null, null);
|
d_sw = new Gtk.ScrolledWindow(null, null);
|
||||||
d_sw.show();
|
d_sw.show();
|
||||||
|
|
||||||
d_diff = new Gitg.DiffView(null);
|
d_diff = new Gitg.DiffView(null);
|
||||||
d_diff.show();
|
d_diff.show();
|
||||||
|
|
||||||
d_sw.add(d_diff);
|
d_sw.add(d_diff);
|
||||||
|
|
||||||
d_whenMapped = new Gitg.WhenMapped(d_sw);
|
d_whenMapped = new Gitg.WhenMapped(d_sw);
|
||||||
|
|
||||||
application.notify["current_view"].connect((a, v) => {
|
history.selection_changed.connect(on_selection_changed);
|
||||||
notify_property("available");
|
on_selection_changed(history);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string id
|
public string id
|
||||||
|
@ -52,17 +54,7 @@ namespace GitgDiff
|
||||||
|
|
||||||
public bool available
|
public bool available
|
||||||
{
|
{
|
||||||
get
|
get { return true; }
|
||||||
{
|
|
||||||
var view = application.current_view;
|
|
||||||
|
|
||||||
if (view == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (view is GitgExt.ObjectSelection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string display_name
|
public string display_name
|
||||||
|
@ -75,13 +67,9 @@ namespace GitgDiff
|
||||||
owned get { return "diff-symbolic"; }
|
owned get { return "diff-symbolic"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_panel_activated()
|
private void on_selection_changed(GitgExt.History history)
|
||||||
{
|
{
|
||||||
}
|
history.foreach_selected((commit) => {
|
||||||
|
|
||||||
private void on_selection_changed(GitgExt.ObjectSelection selection)
|
|
||||||
{
|
|
||||||
selection.foreach_selected((commit) => {
|
|
||||||
var c = commit as Gitg.Commit;
|
var c = commit as Gitg.Commit;
|
||||||
|
|
||||||
if (c != null)
|
if (c != null)
|
||||||
|
@ -99,33 +87,12 @@ namespace GitgDiff
|
||||||
|
|
||||||
public Gtk.Widget? widget
|
public Gtk.Widget? widget
|
||||||
{
|
{
|
||||||
owned get
|
owned get { return d_sw; }
|
||||||
{
|
|
||||||
var objsel = (GitgExt.ObjectSelection)application.current_view;
|
|
||||||
|
|
||||||
if (objsel != d_view)
|
|
||||||
{
|
|
||||||
if (d_view != null)
|
|
||||||
{
|
|
||||||
d_view.selection_changed.disconnect(on_selection_changed);
|
|
||||||
}
|
|
||||||
|
|
||||||
d_view = objsel;
|
|
||||||
d_view.selection_changed.connect(on_selection_changed);
|
|
||||||
|
|
||||||
on_selection_changed(objsel);
|
|
||||||
}
|
|
||||||
|
|
||||||
return d_sw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool enabled
|
public bool enabled
|
||||||
{
|
{
|
||||||
get
|
get { return true; }
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int negotiate_order(GitgExt.UIElement other)
|
public int negotiate_order(GitgExt.UIElement other)
|
||||||
|
@ -148,7 +115,7 @@ public void peas_register_types(TypeModule module)
|
||||||
{
|
{
|
||||||
Peas.ObjectModule mod = module as Peas.ObjectModule;
|
Peas.ObjectModule mod = module as Peas.ObjectModule;
|
||||||
|
|
||||||
mod.register_extension_type(typeof(GitgExt.Panel),
|
mod.register_extension_type(typeof(GitgExt.HistoryPanel),
|
||||||
typeof(GitgDiff.Panel));
|
typeof(GitgDiff.Panel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
|
|
||||||
namespace GitgFiles
|
namespace GitgFiles
|
||||||
{
|
{
|
||||||
public class Panel : Object, GitgExt.UIElement, GitgExt.Panel
|
public class Panel : Object, GitgExt.UIElement, GitgExt.HistoryPanel
|
||||||
{
|
{
|
||||||
// Do this to pull in config.h before glib.h (for gettext...)
|
// Do this to pull in config.h before glib.h (for gettext...)
|
||||||
private const string version = Gitg.Config.VERSION;
|
private const string version = Gitg.Config.VERSION;
|
||||||
|
|
||||||
public GitgExt.Application? application { owned get; construct set; }
|
public GitgExt.Application? application { owned get; construct set; }
|
||||||
private GitgExt.ObjectSelection? d_view;
|
public GitgExt.History? history { owned get; construct set; }
|
||||||
|
|
||||||
private TreeStore d_model;
|
private TreeStore d_model;
|
||||||
private Gtk.Paned d_paned;
|
private Gtk.Paned d_paned;
|
||||||
|
@ -50,6 +50,8 @@ namespace GitgFiles
|
||||||
application.notify["current_view"].connect((a, v) => {
|
application.notify["current_view"].connect((a, v) => {
|
||||||
notify_property("available");
|
notify_property("available");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
history.selection_changed.connect(on_selection_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string id
|
public string id
|
||||||
|
@ -59,17 +61,7 @@ namespace GitgFiles
|
||||||
|
|
||||||
public bool available
|
public bool available
|
||||||
{
|
{
|
||||||
get
|
get { return true; }
|
||||||
{
|
|
||||||
var view = application.current_view;
|
|
||||||
|
|
||||||
if (view == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (view is GitgExt.ObjectSelection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string display_name
|
public string display_name
|
||||||
|
@ -82,13 +74,9 @@ namespace GitgFiles
|
||||||
owned get { return "system-file-manager-symbolic"; }
|
owned get { return "system-file-manager-symbolic"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_panel_activated()
|
private void on_selection_changed(GitgExt.History history)
|
||||||
{
|
{
|
||||||
}
|
history.foreach_selected((commit) => {
|
||||||
|
|
||||||
private void on_selection_changed(GitgExt.ObjectSelection selection)
|
|
||||||
{
|
|
||||||
selection.foreach_selected((commit) => {
|
|
||||||
var c = commit as Ggit.Commit;
|
var c = commit as Ggit.Commit;
|
||||||
|
|
||||||
if (c != null)
|
if (c != null)
|
||||||
|
@ -203,21 +191,6 @@ namespace GitgFiles
|
||||||
{
|
{
|
||||||
owned get
|
owned get
|
||||||
{
|
{
|
||||||
var objsel = (GitgExt.ObjectSelection)application.current_view;
|
|
||||||
|
|
||||||
if (objsel != d_view)
|
|
||||||
{
|
|
||||||
if (d_view != null)
|
|
||||||
{
|
|
||||||
d_view.selection_changed.disconnect(on_selection_changed);
|
|
||||||
}
|
|
||||||
|
|
||||||
d_view = objsel;
|
|
||||||
d_view.selection_changed.connect(on_selection_changed);
|
|
||||||
|
|
||||||
on_selection_changed(objsel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d_paned == null)
|
if (d_paned == null)
|
||||||
{
|
{
|
||||||
build_ui();
|
build_ui();
|
||||||
|
@ -337,7 +310,7 @@ public void peas_register_types(TypeModule module)
|
||||||
{
|
{
|
||||||
Peas.ObjectModule mod = module as Peas.ObjectModule;
|
Peas.ObjectModule mod = module as Peas.ObjectModule;
|
||||||
|
|
||||||
mod.register_extension_type(typeof(GitgExt.Panel),
|
mod.register_extension_type(typeof(GitgExt.HistoryPanel),
|
||||||
typeof(GitgFiles.Panel));
|
typeof(GitgFiles.Panel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue