Can't use GLib.SList as property type

This commit is contained in:
Jesse van den Kieboom 2012-04-25 00:01:27 +02:00
parent e6b79289a4
commit 03f8446283
4 changed files with 41 additions and 29 deletions

View File

@ -12,7 +12,7 @@ namespace GitgGtk
private uint num_lanes
{
get { return commit.lanes.length(); }
get { return commit.get_lanes().length(); }
}
private uint total_width(Gtk.Widget widget)
@ -61,7 +61,7 @@ namespace GitgGtk
{
uint to = 0;
foreach (Gitg.Lane lane in commit.lanes)
foreach (var lane in commit.get_lanes())
{
var color = lane.color;
context.set_source_rgb(color.r, color.g, color.b);
@ -93,7 +93,7 @@ namespace GitgGtk
double cw = lane_width;
double ch = area.height / 2.0;
foreach (var lane in commit.lanes)
foreach (var lane in commit.get_lanes())
{
var color = lane.color;
context.set_source_rgb(color.r, color.g, color.b);
@ -185,26 +185,29 @@ namespace GitgGtk
Gdk.Rectangle cell_area,
Gtk.CellRendererState flags)
{
var ncell_area = cell_area;
var narea = area;
d_last_height = area.height;
context.save();
if (commit != null)
{
context.save();
Gdk.cairo_rectangle(context, area);
context.clip();
Gdk.cairo_rectangle(context, area);
context.clip();
draw_paths(context, area);
draw_indicator(context, area);
draw_labels(context, area, widget);
draw_paths(context, area);
draw_indicator(context, area);
draw_labels(context, area, widget);
var narea = area;
var ncell_area = cell_area;
var tw = total_width(widget);
var tw = total_width(widget);
narea.x += (int)tw;
ncell_area.x += (int)tw;
narea.x += (int)tw;
ncell_area.x += (int)tw;
context.restore();
context.restore();
}
base.render(context, widget, narea, ncell_area, flags);
}

View File

@ -213,6 +213,7 @@ namespace GitgGtk
return_val_if_fail(iter.stamp == d_stamp, null);
uint idx = (uint)(ulong)iter.user_data;
return base[idx];
}

View File

@ -6,8 +6,12 @@ public class Commit : Ggit.Commit
public LaneTag tag { get; set; }
private uint d_mylane;
private SList<Lane> d_lanes;
public unowned SList<Lane> lanes { get; set; }
public unowned SList<Lane> get_lanes()
{
return d_lanes;
}
public uint mylane
{
@ -21,18 +25,24 @@ public class Commit : Ggit.Commit
public Lane lane
{
get { return lanes.nth_data(d_mylane); }
get { return d_lanes.nth_data(d_mylane); }
}
public unowned SList<Lane> insert_lane(Lane lane, int idx)
{
d_lanes.insert(lane, idx);
return d_lanes;
}
public unowned SList<Lane> remove_lane(Lane lane)
{
lanes.remove(lane);
return lanes;
d_lanes.remove(lane);
return d_lanes;
}
private void update_lane_tag()
{
unowned Lane? lane = lanes.nth_data(d_mylane);
unowned Lane? lane = d_lanes.nth_data(d_mylane);
if (lane == null)
{
@ -46,7 +56,7 @@ public class Commit : Ggit.Commit
public void update_lanes(owned SList<Lane> lanes, int mylane)
{
lanes = (owned)lanes;
d_lanes = (owned)lanes;
if (mylane >= 0)
{

View File

@ -208,9 +208,8 @@ public class Lanes : Object
while (item != null)
{
var commit = item.data;
unowned SList<Lane> lns = commit.lanes;
unowned SList<Lane> lstlane = lns.nth(index);
unowned Lane lane = lstlane.data;
unowned SList<Lane> lns = commit.get_lanes();
unowned Lane lane = lns.nth_data(index);
if (item.next != null)
{
@ -270,7 +269,7 @@ public class Lanes : Object
private int ensure_correct_index(Commit commit,
int index)
{
var len = commit.lanes.length();
var len = commit.get_lanes().length();
if (index > len)
{
@ -357,7 +356,7 @@ public class Lanes : Object
// Insert new lane at the index
Lane copy = ln.copy();
unowned SList<Lane> lns = commit.lanes;
unowned SList<Lane> lns = commit.get_lanes();
if (ptr.next == null || cnt + 1 == inactive_collapse)
{
@ -372,8 +371,7 @@ public class Lanes : Object
update_merge_indices(lns, (int)index, 1);
}
commit.lanes.insert((owned)copy, (int)index);
lns = commit.lanes;
commit.insert_lane(copy, (int)index);
var mylane = commit.mylane;