[planner: 49/61] Use accessor functions (GSEAL) for straightforward cases
- From: Mart Raudsepp <mraudsepp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [planner: 49/61] Use accessor functions (GSEAL) for straightforward cases
- Date: Sat, 12 Jun 2021 17:30:27 +0000 (UTC)
commit 13ffeeda506fdab507aba05b2a23df1c13cd8cbb
Author: Mart Raudsepp <leio gentoo org>
Date: Sun Jan 3 01:20:42 2021 +0200
Use accessor functions (GSEAL) for straightforward cases
Various straightforward fixes for compilation with
CFLAGS+="-DGSEAL_ENABLED".
More involved cases will be handled in subsequent separate commits.
src/planner-cell-renderer-date.c | 2 +-
src/planner-cell-renderer-popup.c | 21 +++++++++++----------
src/planner-gantt-chart.c | 14 ++++++++++----
src/planner-gantt-header.c | 35 ++++++++++++++++++++---------------
src/planner-gantt-row.c | 38 ++++++++++++++++++++------------------
src/planner-gantt-view.c | 8 +++++---
src/planner-popup-button.c | 27 +++++++++++++++------------
src/planner-popup-entry.c | 2 +-
src/planner-task-date-widget.c | 4 ++--
src/planner-usage-chart.c | 18 ++++++++++++------
src/planner-usage-view.c | 9 +++++----
src/planner-util.c | 2 +-
src/planner-window.c | 9 +++++----
13 files changed, 108 insertions(+), 81 deletions(-)
---
diff --git a/src/planner-cell-renderer-date.c b/src/planner-cell-renderer-date.c
index a2657776..5ba76e81 100644
--- a/src/planner-cell-renderer-date.c
+++ b/src/planner-cell-renderer-date.c
@@ -505,6 +505,6 @@ mcrd_constraint_activated_cb (GtkComboBox *combo,
* optionmenu is activated, since focus is transferred to the optionmenu
* when it's popped up.
*/
- mcrd_grab_on_window (PLANNER_CELL_RENDERER_POPUP (cell)->popup_window->window,
+ mcrd_grab_on_window (gtk_widget_get_window (PLANNER_CELL_RENDERER_POPUP (cell)->popup_window),
gtk_get_current_event_time ());
}
diff --git a/src/planner-cell-renderer-popup.c b/src/planner-cell-renderer-popup.c
index 258344c7..43f295a2 100644
--- a/src/planner-cell-renderer-popup.c
+++ b/src/planner-cell-renderer-popup.c
@@ -237,7 +237,7 @@ mcrp_show_popup (PlannerCellRendererPopup *cell,
gtk_window_move (GTK_WINDOW (cell->popup_window), -500, -500);
gtk_widget_show (cell->popup_window);
- alloc = cell->popup_window->allocation;
+ gtk_widget_get_allocation (cell->popup_window, &alloc);
x = x2;
y = y2;
@@ -280,7 +280,7 @@ mcrp_show_popup (PlannerCellRendererPopup *cell,
gtk_widget_grab_focus (cell->focus_window);
- mcrp_grab_on_window (cell->popup_window->window,
+ mcrp_grab_on_window (gtk_widget_get_window (cell->popup_window),
gtk_get_current_event_time ());
}
@@ -327,16 +327,16 @@ mcrp_arrow_clicked (GtkCellEditable *entry,
* events generated when the window is mapped, such as enter
* notify events on subwidgets. If the grab fails, bail out.
*/
- if (!mcrp_grab_on_window (GTK_WIDGET (entry)->window,
+ if (!mcrp_grab_on_window (gtk_widget_get_window (GTK_WIDGET (entry)),
gtk_get_current_event_time ())) {
return;
}
gtk_editable_select_region (GTK_EDITABLE (PLANNER_POPUP_ENTRY (entry)->entry), 0, 0);
- gdk_window_get_origin (GTK_WIDGET (entry)->window, &x, &y);
+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (entry)), &x, &y);
- alloc = GTK_WIDGET (entry)->allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (entry), &alloc);
g_signal_emit (cell, signals[SHOW_POPUP], 0,
path,
@@ -471,7 +471,7 @@ mcrp_button_press_event (GtkWidget *widget,
GdkEventButton *event,
PlannerCellRendererPopup *popup)
{
- GtkAllocation alloc;
+ GtkAllocation alloc, widget_alloc;
gdouble x, y;
gint xoffset, yoffset;
gint x1, y1;
@@ -488,14 +488,15 @@ mcrp_button_press_event (GtkWidget *widget,
x = event->x_root;
y = event->y_root;
- gdk_window_get_root_origin (widget->window,
+ gdk_window_get_root_origin (gtk_widget_get_window (widget),
&xoffset,
&yoffset);
- xoffset += widget->allocation.x;
- yoffset += widget->allocation.y;
+ gtk_widget_get_allocation (widget, &widget_alloc);
+ xoffset += widget_alloc.x;
+ yoffset += widget_alloc.y;
- alloc = popup->popup_window->allocation;
+ gtk_widget_get_allocation (popup->popup_window, &alloc);
x1 = alloc.x + xoffset;
y1 = alloc.y + yoffset;
x2 = x1 + alloc.width;
diff --git a/src/planner-gantt-chart.c b/src/planner-gantt-chart.c
index bd45ef70..ef25bb84 100644
--- a/src/planner-gantt-chart.c
+++ b/src/planner-gantt-chart.c
@@ -972,7 +972,7 @@ gantt_chart_reflow_idle (PlannerGanttChart *chart)
height = priv->height;
}
- allocation = GTK_WIDGET (priv->canvas)->allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (priv->canvas), &allocation);
t1 = priv->project_start;
t2 = priv->last_time;
@@ -1748,12 +1748,14 @@ static mrptime
gantt_chart_get_center (PlannerGanttChart *chart)
{
PlannerGanttChartPriv *priv;
+ GtkAllocation allocation;
gint x1, width, x;
priv = chart->priv;
gnome_canvas_get_scroll_offsets (priv->canvas, &x1, NULL);
- width = GTK_WIDGET (priv->canvas)->allocation.width;
+ gtk_widget_get_allocation (GTK_WIDGET (priv->canvas), &allocation);
+ width = allocation.width;
x = x1 + width / 2 - PADDING;
@@ -1767,12 +1769,14 @@ gantt_chart_set_center (PlannerGanttChart *chart, mrptime t)
{
PlannerGanttChartPriv *priv;
gint x, x1, width;
+ GtkAllocation allocation;
priv = chart->priv;
x = floor (t * SCALE (priv->zoom) + 0.5);
- width = GTK_WIDGET (priv->canvas)->allocation.width;
+ gtk_widget_get_allocation (GTK_WIDGET (priv->canvas), &allocation);
+ width = allocation.width;
x1 = x - width / 2 + PADDING;
@@ -1837,6 +1841,7 @@ planner_gantt_chart_zoom_to_fit (PlannerGanttChart *chart)
gdouble t;
gdouble zoom;
gdouble alloc;
+ GtkAllocation allocation;
g_return_if_fail (PLANNER_IS_GANTT_CHART (chart));
@@ -1845,7 +1850,8 @@ planner_gantt_chart_zoom_to_fit (PlannerGanttChart *chart)
return;
}
- alloc = GTK_WIDGET (chart)->allocation.width - PADDING * 2;
+ gtk_widget_get_allocation (GTK_WIDGET (chart), &allocation);
+ alloc = allocation.width - PADDING * 2;
zoom = planner_scale_clamp_zoom (ZOOM (alloc / t));
gantt_chart_set_zoom (chart, zoom);
diff --git a/src/planner-gantt-header.c b/src/planner-gantt-header.c
index 15bd58fe..52669872 100644
--- a/src/planner-gantt-header.c
+++ b/src/planner-gantt-header.c
@@ -388,26 +388,29 @@ gantt_header_map (GtkWidget *widget)
gtk_widget_set_mapped (widget, TRUE);
gdk_window_show (header->priv->bin_window);
- gdk_window_show (widget->window);
+ gdk_window_show (gtk_widget_get_window (widget));
}
static void
gantt_header_realize (GtkWidget *widget)
{
PlannerGanttHeader *header;
+ GtkAllocation allocation;
GdkWindowAttr attributes;
gint attributes_mask;
+ GdkWindow *window;
header = PLANNER_GANTT_HEADER (widget);
gtk_widget_set_realized (widget, TRUE);
+ gtk_widget_get_allocation (widget, &allocation);
/* Create the main, clipping window. */
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
@@ -415,15 +418,17 @@ gantt_header_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
+ window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, widget);
/* Bin window. */
attributes.x = 0;
attributes.y = header->priv->height;
attributes.width = header->priv->width;
- attributes.height = widget->allocation.height;
+ gtk_widget_get_allocation (widget, &allocation);
+ attributes.height = allocation.height;
attributes.event_mask = GDK_EXPOSURE_MASK |
GDK_SCROLL_MASK |
GDK_POINTER_MOTION_MASK |
@@ -433,13 +438,13 @@ gantt_header_realize (GtkWidget *widget)
GDK_BUTTON_RELEASE_MASK |
gtk_widget_get_events (widget);
- header->priv->bin_window = gdk_window_new (widget->window,
+ header->priv->bin_window = gdk_window_new (gtk_widget_get_window (widget),
&attributes,
attributes_mask);
gdk_window_set_user_data (header->priv->bin_window, widget);
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_background (widget->window,
+ widget->style = gtk_style_attach (gtk_widget_get_style (widget), gtk_widget_get_window (widget));
+ gdk_window_set_background (gtk_widget_get_window (widget),
&widget->style->base[widget->state]);
gdk_window_set_background (header->priv->bin_window,
&widget->style->base[widget->state]);
@@ -470,11 +475,11 @@ gantt_header_size_allocate (GtkWidget *widget,
header = PLANNER_GANTT_HEADER (widget);
if (gtk_widget_get_realized (widget)) {
- gdk_window_move_resize (widget->window,
+ gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
gdk_window_move_resize (header->priv->bin_window,
- - (gint) header->priv->hadjustment->value,
+ - (gint) gtk_adjustment_get_value (header->priv->hadjustment),
0,
MAX (header->priv->width, allocation->width),
allocation->height);
@@ -703,7 +708,7 @@ gantt_header_adjustment_changed (GtkAdjustment *adjustment,
{
if (gtk_widget_get_realized (GTK_WIDGET (header))) {
gdk_window_move (header->priv->bin_window,
- -header->priv->hadjustment->value,
+ - gtk_adjustment_get_value (header->priv->hadjustment),
0);
}
}
diff --git a/src/planner-gantt-row.c b/src/planner-gantt-row.c
index cc3a2acb..fd54cb20 100644
--- a/src/planner-gantt-row.c
+++ b/src/planner-gantt-row.c
@@ -2071,6 +2071,7 @@ gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
{
PlannerGanttChart *chart;
GnomeCanvas *canvas;
+ GtkAllocation allocation;
gint width, height;
gint x, y, item_cx, item_cy;
gint cx, cy;
@@ -2091,12 +2092,13 @@ gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
/* Get the current mouse position so that we can decide if the pointer
* is inside the viewport.
*/
- gdk_window_get_pointer (GTK_WIDGET(canvas)->window, &x, &y, NULL);
+ gdk_window_get_pointer (gtk_widget_get_window (GTK_WIDGET (canvas)), &x, &y, NULL);
gnome_canvas_get_scroll_offsets (canvas, &cx, &cy);
- width = GTK_WIDGET(canvas)->allocation.width;
- height = GTK_WIDGET(canvas)->allocation.height;
+ gtk_widget_get_allocation (GTK_WIDGET (canvas), &allocation);
+ width = allocation.width;
+ height = allocation.height;
if(!scroll)
{
@@ -2558,7 +2560,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
*/
if (!(priv->state & STATE_DRAG_ANY) &&
!(event->crossing.state & GDK_BUTTON1_MASK)) {
- gdk_window_set_cursor (canvas_widget->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (canvas_widget), NULL);
}
g_object_set (row,
@@ -2583,14 +2585,14 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
( (drag_spot == DRAG_DURATION_SPOT) || (drag_spot == DRAG_COMPLETE_SPOT) ) ) {
if(drag_spot == DRAG_DURATION_SPOT) {
cursor = gdk_cursor_new (GDK_RIGHT_SIDE);
- gdk_window_set_cursor (canvas_widget->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (canvas_widget), cursor);
if (cursor) {
gdk_cursor_unref (cursor);
}
}
else { /* DRAG_COMPLETE_SPOT */
cursor = gdk_cursor_new (GDK_HAND2);
- gdk_window_set_cursor (canvas_widget->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (canvas_widget), cursor);
if (cursor) {
gdk_cursor_unref (cursor);
}
@@ -2610,7 +2612,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
} else {
cursor = NULL;
}
- gdk_window_set_cursor (canvas_widget->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (canvas_widget), cursor);
if (cursor) {
gdk_cursor_unref (cursor);
}
@@ -2778,7 +2780,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
}
/* We're done, reset the cursor and state, ungrab pointer. */
- gdk_window_set_cursor (canvas_widget->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (canvas_widget), NULL);
gnome_canvas_item_ungrab (item, event->button.time);
@@ -2872,11 +2874,11 @@ eel_gtk_adjustment_set_value (GtkAdjustment *adjustment,
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
- upper_page_start = MAX (adjustment->upper - adjustment->page_size,
- adjustment->lower);
- clamped_value = CLAMP (value, adjustment->lower, upper_page_start);
- if (clamped_value != adjustment->value) {
- adjustment->value = clamped_value;
+ upper_page_start = MAX (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_page_size
(adjustment),
+ gtk_adjustment_get_lower (adjustment));
+ clamped_value = CLAMP (value, gtk_adjustment_get_lower (adjustment), upper_page_start);
+ if (clamped_value != gtk_adjustment_get_value (adjustment)) {
+ gtk_adjustment_set_value (adjustment, clamped_value);
gtk_adjustment_value_changed (adjustment);
}
}
@@ -2896,14 +2898,14 @@ gantt_row_canvas_scroll (GtkWidget *widget,
* actually scrolling. We may not have in a case where the resulting
* value got pinned to the adjustment min or max.
*/
- old_h_value = hadj->value;
- old_v_value = vadj->value;
+ old_h_value = gtk_adjustment_get_value (hadj);
+ old_v_value = gtk_adjustment_get_value (vadj);
- eel_gtk_adjustment_set_value (hadj, hadj->value + delta_x);
- eel_gtk_adjustment_set_value (vadj, vadj->value + delta_y);
+ eel_gtk_adjustment_set_value (hadj, old_h_value + delta_x);
+ eel_gtk_adjustment_set_value (vadj, old_v_value + delta_y);
/* return TRUE if we did scroll */
- return hadj->value != old_h_value || vadj->value != old_v_value;
+ return gtk_adjustment_get_value (hadj) != old_h_value || gtk_adjustment_get_value (vadj) !=
old_v_value;
}
static gint
diff --git a/src/planner-gantt-view.c b/src/planner-gantt-view.c
index b9e3b560..ff72c070 100644
--- a/src/planner-gantt-view.c
+++ b/src/planner-gantt-view.c
@@ -553,12 +553,14 @@ gantt_view_tree_view_scroll_event_cb (GtkWidget *widget,
adj = gtk_tree_view_get_vadjustment (tv);
if (event->direction == GDK_SCROLL_UP) {
- new_value = adj->value - adj->page_increment / 2;
+ new_value = gtk_adjustment_get_value (adj) - gtk_adjustment_get_page_increment (adj) / 2;
} else {
- new_value = adj->value + adj->page_increment / 2;
+ new_value = gtk_adjustment_get_value (adj) + gtk_adjustment_get_page_increment (adj) / 2;
}
- new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+ new_value = CLAMP (new_value,
+ gtk_adjustment_get_lower (adj),
+ gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
gtk_adjustment_set_value (adj, new_value);
return TRUE;
diff --git a/src/planner-popup-button.c b/src/planner-popup-button.c
index ec4a3899..f589fea4 100644
--- a/src/planner-popup-button.c
+++ b/src/planner-popup-button.c
@@ -141,14 +141,14 @@ popup_button_press_event_cb (GtkWidget *popup_window,
x = event->x_root;
y = event->y_root;
- gdk_window_get_root_origin (popup_window->window,
+ gdk_window_get_root_origin (gtk_widget_get_window (popup_window),
&xoffset,
&yoffset);
- xoffset += popup_window->allocation.x;
- yoffset += popup_window->allocation.y;
+ gtk_widget_get_allocation (popup_window, &alloc);
+ xoffset += alloc.x;
+ yoffset += alloc.y;
- alloc = popup_window->allocation;
x1 = alloc.x + xoffset;
y1 = alloc.y + yoffset;
x2 = x1 + alloc.width;
@@ -189,6 +189,7 @@ popup_button_position (PlannerPopupButton *button,
{
PlannerPopupButtonPrivate *priv;
GtkWidget *button_widget;
+ GtkAllocation allocation;
GtkRequisition popup_req;
GdkScreen *screen;
gint monitor_num;
@@ -198,16 +199,17 @@ popup_button_position (PlannerPopupButton *button,
button_widget = GTK_WIDGET (button);
- gdk_window_get_origin (button_widget->window, x, y);
+ gdk_window_get_origin (gtk_widget_get_window (button_widget), x, y);
+ gtk_widget_get_allocation (button_widget, &allocation);
if (! gtk_widget_get_has_window (button_widget)) {
- *x += button_widget->allocation.x;
- *y += button_widget->allocation.y;
+ *x += allocation.x;
+ *y += allocation.y;
}
/* The popup should be placed below the button, right-aligned to it. */
- *y += button_widget->allocation.height;
- *x += button_widget->allocation.width;
+ *y += allocation.height;
+ *x += allocation.width;
gtk_widget_size_request (priv->popup_widget, &popup_req);
@@ -216,7 +218,7 @@ popup_button_position (PlannerPopupButton *button,
/* Don't popup outside the monitor edges. */
screen = gtk_widget_get_screen (GTK_WIDGET (button));
monitor_num = gdk_screen_get_monitor_at_window (
- screen, GTK_WIDGET (button)->window);
+ screen, gtk_widget_get_window (GTK_WIDGET (button)));
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
if (*x < monitor.x) {
@@ -226,8 +228,9 @@ popup_button_position (PlannerPopupButton *button,
*x = monitor.x + monitor.width - popup_req.width;
}
+ gtk_widget_get_allocation (button_widget, &allocation);
if (*y + popup_req.height > monitor.y + monitor.height) {
- *y -= popup_req.height + button_widget->allocation.height;
+ *y -= popup_req.height + allocation.height;
}
}
@@ -255,7 +258,7 @@ popup_button_popup (PlannerPopupButton *button)
gtk_widget_grab_focus (priv->popup_widget);
- if (!popup_button_grab_on_window (GTK_WIDGET (priv->popup_widget)->window,
+ if (!popup_button_grab_on_window (gtk_widget_get_window (GTK_WIDGET (priv->popup_widget)),
gtk_get_current_event_time ())) {
popup_button_popdown (button, FALSE);
diff --git a/src/planner-popup-entry.c b/src/planner-popup-entry.c
index 9471c722..611bf56b 100644
--- a/src/planner-popup-entry.c
+++ b/src/planner-popup-entry.c
@@ -179,7 +179,7 @@ mpw_key_press_event (GtkWidget *box,
/* Hackish :/ Synthesize a key press event for the entry. */
memcpy (&tmp_event, key_event, sizeof (GdkEventKey));
- tmp_event.key.window = widget->entry->window;
+ tmp_event.key.window = gtk_widget_get_window (widget->entry);
tmp_event.key.send_event = TRUE;
gtk_widget_event (widget->entry, &tmp_event);
diff --git a/src/planner-task-date-widget.c b/src/planner-task-date-widget.c
index 8b6231de..89f8a744 100644
--- a/src/planner-task-date-widget.c
+++ b/src/planner-task-date-widget.c
@@ -155,8 +155,8 @@ task_date_widget_combo_changed_cb (GtkComboBox *combo,
* has been used, since focus is transferred to the combo when it's
* popped up.
*/
- if (GTK_WIDGET (widget)->window) {
- grab_on_window (GTK_WIDGET (widget)->window, gtk_get_current_event_time ());
+ if (gtk_widget_get_window (GTK_WIDGET (widget))) {
+ grab_on_window (gtk_widget_get_window (GTK_WIDGET (widget)), gtk_get_current_event_time ());
}
}
diff --git a/src/planner-usage-chart.c b/src/planner-usage-chart.c
index f46b3dbb..7e9d9fc8 100644
--- a/src/planner-usage-chart.c
+++ b/src/planner-usage-chart.c
@@ -439,13 +439,15 @@ static mrptime
usage_chart_get_center (PlannerUsageChart * chart)
{
PlannerUsageChartPriv *priv;
- gint x1, width, x;
+ gint x1, width, x;
+ GtkAllocation allocation;
priv = chart->priv;
gnome_canvas_get_scroll_offsets (priv->canvas, &x1, NULL);
- width = GTK_WIDGET (priv->canvas)->allocation.width;
+ gtk_widget_get_allocation (GTK_WIDGET (priv->canvas), &allocation);
+ width = allocation.width;
x = x1 + width / 2 - PADDING;
x += floor (priv->project_start * SCALE (priv->zoom) + 0.5);
@@ -457,13 +459,15 @@ static void
usage_chart_set_center (PlannerUsageChart *chart, mrptime t)
{
PlannerUsageChartPriv *priv;
- gint x1, width, x;
+ gint x1, width, x;
+ GtkAllocation allocation;
priv = chart->priv;
x = floor (t * SCALE (priv->zoom) + 0.5);
- width = GTK_WIDGET (priv->canvas)->allocation.width;
+ gtk_widget_get_allocation (GTK_WIDGET (priv->canvas), &allocation);
+ width = allocation.width;
x1 = x - width / 2 + PADDING;
x1 -= floor (priv->project_start * SCALE (priv->zoom) + 0.5);
@@ -535,6 +539,7 @@ planner_usage_chart_zoom_to_fit (PlannerUsageChart *chart)
gdouble t;
gdouble zoom;
gdouble alloc;
+ GtkAllocation allocation;
g_return_if_fail (PLANNER_IS_USAGE_CHART (chart));
@@ -543,7 +548,8 @@ planner_usage_chart_zoom_to_fit (PlannerUsageChart *chart)
return;
}
- alloc = GTK_WIDGET (chart)->allocation.width - PADDING * 2;
+ gtk_widget_get_allocation (GTK_WIDGET (chart), &allocation);
+ alloc = allocation.width - PADDING * 2;
zoom = planner_scale_clamp_zoom (ZOOM (alloc / t));
usage_chart_set_zoom (chart, zoom);
@@ -817,7 +823,7 @@ usage_chart_reflow_idle (PlannerUsageChart *chart)
height = priv->height;
}
- allocation = GTK_WIDGET (priv->canvas)->allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (priv->canvas), &allocation);
t1 = priv->project_start;
t2 = priv->last_time;
diff --git a/src/planner-usage-view.c b/src/planner-usage-view.c
index e85e2fa4..5a100869 100644
--- a/src/planner-usage-view.c
+++ b/src/planner-usage-view.c
@@ -403,12 +403,13 @@ usage_view_tree_view_scroll_event_cb (GtkWidget *widget,
}
adj = gtk_tree_view_get_vadjustment (tv);
if (event->direction == GDK_SCROLL_UP) {
- new_value = adj->value - adj->page_increment / 2;
+ new_value = gtk_adjustment_get_value (adj) - gtk_adjustment_get_page_increment (adj) / 2;
} else {
- new_value = adj->value + adj->page_increment / 2;
+ new_value = gtk_adjustment_get_value (adj) + gtk_adjustment_get_page_increment (adj) / 2;
}
- new_value =
- CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+ new_value = CLAMP (new_value,
+ gtk_adjustment_get_lower (adj),
+ gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
gtk_adjustment_set_value (adj, new_value);
return TRUE;
}
diff --git a/src/planner-util.c b/src/planner-util.c
index 8c99f959..e4652d2b 100644
--- a/src/planner-util.c
+++ b/src/planner-util.c
@@ -90,7 +90,7 @@ planner_util_menu_position_on_current_cell (GtkMenu *menu,
pos_y = rect.y;
/* Note: this is not perfect, but good enough for now. */
- gdk_window_get_root_origin (GTK_WIDGET (tree)->window, &pos_x, &pos_y);
+ gdk_window_get_root_origin (gtk_widget_get_window (GTK_WIDGET (tree)), &pos_x, &pos_y);
rect.x += pos_x;
rect.y += pos_y;
diff --git a/src/planner-window.c b/src/planner-window.c
index 745f573b..c14441f7 100644
--- a/src/planner-window.c
+++ b/src/planner-window.c
@@ -1209,13 +1209,14 @@ window_drag_data_received_cb (GtkWidget *widget,
gchar **uris;
gint i;
- if (data->length < 0 || data->format != 8) {
- g_message ("Don't know how to handle format %d", data->format);
+ if (gtk_selection_data_get_length (data) < 0 || gtk_selection_data_get_format (data) != 8) {
+ g_message ("Don't know how to handle format %d",
+ gtk_selection_data_get_format (data));
gtk_drag_finish (context, FALSE, FALSE, time);
return;
}
- uris = g_uri_list_extract_uris (data->data);
+ uris = g_uri_list_extract_uris (gtk_selection_data_get_data (data));
i = 0;
while (uris[i]) {
@@ -1943,7 +1944,7 @@ window_save_state (PlannerWindow *window)
GdkWindowState state;
gboolean maximized;
- state = gdk_window_get_state (GTK_WIDGET (window)->window);
+ state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
if (state & GDK_WINDOW_STATE_MAXIMIZED) {
maximized = TRUE;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]