event-widget: turn into a GtkBin subclass
The current GcalEventWidget implementation is a direct GtkWidget subclass, which means we have to take care of all the implementation details such as raising GdkWindows and managing the drawing all by ourselves. The event widget, however, can be easily described through a GtkBuilder file. This would simplify the implementation and makes us maintain less code. Fix that by making GcalEventWidget a GtkBin subclass.
This commit is contained in:
@@ -1791,6 +1791,9 @@ gcal_month_view_size_allocate (GtkWidget *widget,
|
||||
pos_x = cell_width * column + margin.left;
|
||||
pos_y = cell_height * (row + first_row_gap) + start_grid_y + margin.top;
|
||||
|
||||
/* TODO: find a better way to take the lines into account */
|
||||
pos_y += 2;
|
||||
|
||||
child_allocation.x = pos_x;
|
||||
child_allocation.y = pos_y + vertical_cell_space - size_left[cell_idx];
|
||||
child_allocation.width = cell_width * length - (margin.left + margin.right);
|
||||
@@ -1865,6 +1868,9 @@ gcal_month_view_size_allocate (GtkWidget *widget,
|
||||
pos_x = cell_width * (i % 7) + margin.left;
|
||||
pos_y = cell_height * ((i / 7) + first_row_gap) + start_grid_y + margin.top;
|
||||
|
||||
/* TODO: find a better way to take the lines into account */
|
||||
pos_y += 2;
|
||||
|
||||
child_allocation.x = pos_x;
|
||||
child_allocation.y = pos_y + vertical_cell_space - size_left[i];
|
||||
child_allocation.width = cell_width - (margin.left + margin.right);
|
||||
|
||||
@@ -615,8 +615,8 @@ gcal_week_grid_size_allocate (GtkWidget *widget,
|
||||
gboolean ltr;
|
||||
gdouble minutes_height;
|
||||
gdouble column_width;
|
||||
guint x, y;
|
||||
guint i;
|
||||
guint x;
|
||||
|
||||
/* No need to relayout stuff if nothing changed */
|
||||
if (allocation->height == gtk_widget_get_allocated_height (widget) &&
|
||||
@@ -698,15 +698,21 @@ gcal_week_grid_size_allocate (GtkWidget *widget,
|
||||
width = column_width / events_at_range - margin.left - margin.right;
|
||||
height = (data->end - data->start) * minutes_height - margin.top - margin.bottom;
|
||||
offset = (width + margin.left + margin.right) * widget_index;
|
||||
y = (data->start % MINUTES_PER_DAY) * minutes_height + margin.top;
|
||||
|
||||
if (ltr)
|
||||
x = column_width * i + offset + allocation->x + margin.left + 1;
|
||||
else
|
||||
x = allocation->width - width - (column_width * i + offset + allocation->x + margin.left + 1);
|
||||
|
||||
/* TODO: find a better way to handle line widths */
|
||||
height -= 2;
|
||||
width -= 1;
|
||||
y += 1;
|
||||
|
||||
/* Setup the child position and size */
|
||||
child_allocation.x = x;
|
||||
child_allocation.y = (data->start % MINUTES_PER_DAY) * minutes_height + margin.top;
|
||||
child_allocation.y = y;
|
||||
child_allocation.width = width;
|
||||
child_allocation.height = height;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user