From 5ffe52a03ee8ad4262aa154c6f00d228c225e7bd Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sat, 22 Aug 2015 11:52:23 +0200 Subject: [PATCH] Gtk code cleanups: Use accessor functions on GtkWidget instead of deprecated direct access --- .../business-gnome/dialog-billterms.c | 4 +- .../business-gnome/dialog-date-close.c | 2 +- src/gnome-search/dialog-search.c | 2 +- src/gnome-search/search-account.c | 6 +- src/gnome-utils/cursors.c | 2 +- src/gnome-utils/dialog-account.c | 10 +-- src/gnome-utils/dialog-transfer.c | 4 +- src/gnome-utils/dialog-utils.c | 8 +- .../gnc-cell-renderer-popup-entry.c | 2 +- src/gnome-utils/gnc-cell-renderer-popup.c | 25 +++--- src/gnome-utils/gnc-combott.c | 17 +++-- src/gnome-utils/gnc-date-edit.c | 14 ++-- src/gnome-utils/gnc-dense-cal.c | 76 +++++++++++-------- src/gnome-utils/gnc-gui-query.c | 2 +- src/gnome-utils/gnc-main-window.c | 4 +- src/gnome/gnc-plugin-budget.c | 2 +- src/gnome/gnc-split-reg.c | 14 ++-- src/gnome/gnc-split-reg2.c | 8 +- src/import-export/aqb/gnc-gwen-gui.c | 2 +- .../csv-imp/assistant-csv-trans-import.c | 8 +- .../qif-imp/dialog-account-picker.c | 2 +- src/plugins/bi_import/dialog-bi-import-gui.c | 8 -- .../dialog-customer-import-gui.c | 8 -- src/register/register-gnome/combocell-gnome.c | 4 +- src/register/register-gnome/gnucash-cursor.c | 2 +- src/register/register-gnome/gnucash-grid.c | 2 +- src/register/register-gnome/gnucash-header.c | 8 +- .../register-gnome/gnucash-item-edit.c | 12 +-- src/register/register-gnome/gnucash-sheet.c | 45 ++++++----- 29 files changed, 165 insertions(+), 138 deletions(-) diff --git a/src/business/business-gnome/dialog-billterms.c b/src/business/business-gnome/dialog-billterms.c index 839edd1203f..c7e3b3f45b5 100644 --- a/src/business/business-gnome/dialog-billterms.c +++ b/src/business/business-gnome/dialog-billterms.c @@ -107,8 +107,8 @@ read_widget (GtkBuilder *builder, char *name, gboolean read_only) GtkAdjustment *adj; gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE); adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - adj->step_increment = 0.0; - adj->page_increment = 0.0; + gtk_adjustment_set_step_increment (adj, 0.0); + gtk_adjustment_set_page_increment (adj, 0.0); gtk_adjustment_changed (adj); } diff --git a/src/business/business-gnome/dialog-date-close.c b/src/business/business-gnome/dialog-date-close.c index 8b4a6a7d9ae..e8a0ffe703a 100644 --- a/src/business/business-gnome/dialog-date-close.c +++ b/src/business/business-gnome/dialog-date-close.c @@ -261,7 +261,7 @@ gnc_dialog_dates_acct_question_parented (GtkWidget *parent, const char *message, if (question_check_message) { - gtk_label_set_text(GTK_LABEL(GTK_BIN(ddc->question_check)->child), question_check_message); + gtk_label_set_text(GTK_LABEL(gtk_bin_get_child (GTK_BIN(ddc->question_check))), question_check_message); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ddc->question_check), *answer); } else diff --git a/src/gnome-search/dialog-search.c b/src/gnome-search/dialog-search.c index 87e911b565f..b8c425ac264 100644 --- a/src/gnome-search/dialog-search.c +++ b/src/gnome-search/dialog-search.c @@ -973,7 +973,7 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw) data = g_object_get_data (G_OBJECT (w), "data"); sw->crit_list = g_list_append (sw->crit_list, data); - rows = GTK_TABLE (sw->criteria_table)->nrows; + gtk_table_get_size (GTK_TABLE (sw->criteria_table), &rows, NULL); gtk_table_resize (GTK_TABLE (sw->criteria_table), rows + 1, 2); attach_element (w, sw, rows); diff --git a/src/gnome-search/search-account.c b/src/gnome-search/search-account.c index d54a10ec1fc..b149507a0ae 100644 --- a/src/gnome-search/search-account.c +++ b/src/gnome-search/search-account.c @@ -263,9 +263,9 @@ button_clicked (GtkButton *button, GNCSearchAccount *fi) NULL)); /* Put the dialog together */ - gtk_box_pack_start ((GtkBox *)dialog->vbox, label, + gtk_box_pack_start ((GtkBox *) gtk_dialog_get_content_area (dialog), label, FALSE, FALSE, 3); - gtk_box_pack_start ((GtkBox *)dialog->vbox, accounts_scroller, + gtk_box_pack_start ((GtkBox *) gtk_dialog_get_content_area (dialog), accounts_scroller, TRUE, TRUE, 3); gtk_widget_show_all (GTK_WIDGET (dialog)); @@ -280,7 +280,7 @@ button_clicked (GtkButton *button, GNCSearchAccount *fi) gnc_tree_view_account_get_selected_accounts (GNC_TREE_VIEW_ACCOUNT (account_tree)); desc = describe_button (fi); - gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), desc); + gtk_label_set_text (GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))), desc); } gtk_widget_destroy (GTK_WIDGET (dialog)); diff --git a/src/gnome-utils/cursors.c b/src/gnome-utils/cursors.c index bfb033ea4af..d05bd1c471e 100644 --- a/src/gnome-utils/cursors.c +++ b/src/gnome-utils/cursors.c @@ -88,7 +88,7 @@ gnc_set_busy_cursor (GtkWidget *w, gboolean update_now) { w = node->data; - if (!w || !GTK_IS_WIDGET (w) || !w->window) + if (!w || !GTK_IS_WIDGET (w) || !gtk_widget_get_has_window(w)) continue; gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_BUSY, update_now); diff --git a/src/gnome-utils/dialog-account.c b/src/gnome-utils/dialog-account.c index 6e6a9aa4861..2e551360c38 100644 --- a/src/gnome-utils/dialog-account.c +++ b/src/gnome-utils/dialog-account.c @@ -666,7 +666,7 @@ verify_children_compatible (AccountWindow *aw) gint size; PangoFontDescription *font_desc; - size = pango_font_description_get_size (label->style->font_desc); + size = pango_font_description_get_size (gtk_widget_get_style (label)->font_desc); font_desc = pango_font_description_new (); pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE); @@ -695,16 +695,16 @@ verify_children_compatible (AccountWindow *aw) gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, TRUE, TRUE, 0); /* spacings */ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14); + gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14); gtk_container_set_border_width ( - GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6); + GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 5); + gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 6); gtk_widget_show_all (hbox); diff --git a/src/gnome-utils/dialog-transfer.c b/src/gnome-utils/dialog-transfer.c index 83db9ef9142..d7ce77e61aa 100644 --- a/src/gnome-utils/dialog-transfer.c +++ b/src/gnome-utils/dialog-transfer.c @@ -2035,12 +2035,12 @@ gnc_xfer_dialog_create(GtkWidget *parent, XferDialog *xferData) if (use_accounting_labels) { - gtk_label_set_text(GTK_LABEL(GTK_BIN(xferData->amount_radio)->child), + gtk_label_set_text(GTK_LABEL(gtk_bin_get_child (GTK_BIN(xferData->amount_radio))), _("Debit Amount:")); } else { - gtk_label_set_text(GTK_LABEL(GTK_BIN(xferData->amount_radio)->child), + gtk_label_set_text(GTK_LABEL(gtk_bin_get_child (GTK_BIN(xferData->amount_radio))), _("To Amount:")); } } diff --git a/src/gnome-utils/dialog-utils.c b/src/gnome-utils/dialog-utils.c index 88c18a56608..40959c98ca7 100644 --- a/src/gnome-utils/dialog-utils.c +++ b/src/gnome-utils/dialog-utils.c @@ -217,7 +217,7 @@ gnc_window_adjust_for_screen(GtkWindow * window) return; g_return_if_fail(GTK_IS_WINDOW(window)); - if (GTK_WIDGET(window)->window == NULL) + if (gtk_widget_get_window (GTK_WIDGET(window)) == NULL) return; screen_width = gdk_screen_width(); @@ -234,7 +234,7 @@ gnc_window_adjust_for_screen(GtkWindow * window) height = MIN(height, screen_height - 10); height = MAX(height, 0); - gdk_window_resize(GTK_WIDGET(window)->window, width, height); + gdk_window_resize(gtk_widget_get_window (GTK_WIDGET(window)), width, height); gtk_widget_queue_resize(GTK_WIDGET(window)); } @@ -552,8 +552,8 @@ gnc_dialog_run (GtkDialog *dialog, const gchar *pref_name) : _("Don't tell me again this _session.")); gtk_widget_show(perm); gtk_widget_show(temp); - gtk_box_pack_start(GTK_BOX(dialog->vbox), perm, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(dialog->vbox), temp, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), perm, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), temp, TRUE, TRUE, 0); g_signal_connect(perm, "clicked", G_CALLBACK(gnc_perm_button_cb), temp); /* OK. Present the dialog. */ diff --git a/src/gnome-utils/gnc-cell-renderer-popup-entry.c b/src/gnome-utils/gnc-cell-renderer-popup-entry.c index 4a62bd1bc01..f2421b0c3f0 100644 --- a/src/gnome-utils/gnc-cell-renderer-popup-entry.c +++ b/src/gnome-utils/gnc-cell-renderer-popup-entry.c @@ -230,7 +230,7 @@ gpw_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/gnome-utils/gnc-cell-renderer-popup.c b/src/gnome-utils/gnc-cell-renderer-popup.c index 74494404d46..19386d5e90e 100644 --- a/src/gnome-utils/gnc-cell-renderer-popup.c +++ b/src/gnome-utils/gnc-cell-renderer-popup.c @@ -255,7 +255,7 @@ gcrp_show_popup (GncCellRendererPopup *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; @@ -298,7 +298,7 @@ gcrp_show_popup (GncCellRendererPopup *cell, gtk_widget_grab_focus (cell->focus_window); - gcrp_grab_on_window (cell->popup_window->window, + gcrp_grab_on_window (gtk_widget_get_window (cell->popup_window), gtk_get_current_event_time ()); } @@ -345,16 +345,16 @@ gcrp_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 (!gcrp_grab_on_window (GTK_WIDGET (entry)->window, + if (!gcrp_grab_on_window (gtk_widget_get_window (GTK_WIDGET (entry)), gtk_get_current_event_time ())) { return; } gtk_editable_select_region (GTK_EDITABLE (GNC_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, @@ -376,17 +376,19 @@ gcrp_start_editing (GtkCellRenderer *cell, GncCellRendererPopup *popup; GtkWidget *editable; gchar *text; + gboolean iseditable; popup = GNC_CELL_RENDERER_POPUP (cell); + g_object_get (G_OBJECT (popup), "editable", &iseditable, NULL); /* If the cell isn't editable we return NULL. */ - if (GTK_CELL_RENDERER_TEXT (popup)->editable == FALSE) { + if (iseditable == FALSE) { return NULL; } editable = g_object_new (GNC_TYPE_POPUP_ENTRY, NULL); - text = GTK_CELL_RENDERER_TEXT (cell)->text; + g_object_get (G_OBJECT (cell), "text", &text, NULL); popup->cell_text = text; gnc_popup_entry_set_text (GNC_POPUP_ENTRY (editable), text ? text : ""); @@ -506,14 +508,15 @@ gcrp_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, &alloc); + xoffset += alloc.x; + yoffset += 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/gnome-utils/gnc-combott.c b/src/gnome-utils/gnc-combott.c index 87ec6e08188..651911258e8 100644 --- a/src/gnome-utils/gnc-combott.c +++ b/src/gnome-utils/gnc-combott.c @@ -469,27 +469,32 @@ gctt_combott_menu_position (GtkMenu *menu, gint sx, sy; GtkWidget *child; GtkRequisition req; + GtkAllocation alloc; - child = GTK_BIN (priv->button)->child; + child = gtk_bin_get_child (GTK_BIN (priv->button)); sx = sy = 0; if (!gtk_widget_get_has_window (child)) { - sx += child->allocation.x; - sy += child->allocation.y; + gtk_widget_get_allocation (child, &alloc); + sx += alloc.x; + sy += alloc.y; } - gdk_window_get_root_coords (child->window, sx, sy, &sx, &sy); + gdk_window_get_root_coords (gtk_widget_get_window (child), sx, sy, &sx, &sy); - sx -= GTK_WIDGET (priv->button)->style->xthickness; + sx -= gtk_widget_get_style (GTK_WIDGET (priv->button))->xthickness; gtk_widget_size_request (GTK_WIDGET (menu), &req); if (gtk_widget_get_direction (GTK_WIDGET (priv->button)) == GTK_TEXT_DIR_LTR) *x = sx; else - *x = sx + child->allocation.width - req.width; + { + gtk_widget_get_allocation (child, &alloc); + *x = sx + alloc.width - req.width; + } if(priv->active == -1 || priv->active == 0) *y = sy; diff --git a/src/gnome-utils/gnc-date-edit.c b/src/gnome-utils/gnc-date-edit.c index 5d91f96ace9..ba117331d4e 100644 --- a/src/gnome-utils/gnc-date-edit.c +++ b/src/gnome-utils/gnc-date-edit.c @@ -215,15 +215,17 @@ position_popup (GNCDateEdit *gde) gint x, y; gint bwidth, bheight; GtkRequisition req; + GtkAllocation alloc; gtk_widget_size_request (gde->cal_popup, &req); - gdk_window_get_origin (gde->date_button->window, &x, &y); + gdk_window_get_origin (gtk_widget_get_window (gde->date_button), &x, &y); - x += gde->date_button->allocation.x; - y += gde->date_button->allocation.y; - bwidth = gde->date_button->allocation.width; - bheight = gde->date_button->allocation.height; + gtk_widget_get_allocation (gde->date_button, &alloc); + x += alloc.x; + y += alloc.y; + bwidth = alloc.width; + bheight = alloc.height; x += bwidth - req.width; y += bheight; @@ -322,7 +324,7 @@ gnc_date_edit_popup (GNCDateEdit *gde) if (!gtk_widget_has_focus (gde->calendar)) gtk_widget_grab_focus (gde->calendar); - if (!popup_grab_on_window ((GTK_WIDGET(gde->cal_popup))->window, + if (!popup_grab_on_window (gtk_widget_get_window ((GTK_WIDGET(gde->cal_popup))), GDK_CURRENT_TIME, TRUE)) { gtk_widget_hide (gde->cal_popup); diff --git a/src/gnome-utils/gnc-dense-cal.c b/src/gnome-utils/gnc-dense-cal.c index 70a8ec27a7c..88d894ce99b 100644 --- a/src/gnome-utils/gnc-dense-cal.c +++ b/src/gnome-utils/gnc-dense-cal.c @@ -708,18 +708,25 @@ gnc_dense_cal_realize (GtkWidget *widget, gpointer user_data) recompute_x_y_scales(dcal); gdc_reconfig(dcal); - gtk_style_set_background(widget->style, widget->window, GTK_STATE_ACTIVE); + gtk_style_set_background(gtk_widget_get_style (widget), + gtk_widget_get_window (widget), + GTK_STATE_ACTIVE); } static void gdc_reconfig(GncDenseCal *dcal) { + GtkWidget *widget; + GdkWindow *window; + GtkAllocation alloc; + if (dcal->drawbuf) g_object_unref(dcal->drawbuf); - dcal->drawbuf = gdk_pixmap_new(GTK_WIDGET(dcal->cal_drawing_area)->window, - GTK_WIDGET(dcal->cal_drawing_area)->allocation.width, - GTK_WIDGET(dcal->cal_drawing_area)->allocation.height, - -1); + + widget = GTK_WIDGET(dcal->cal_drawing_area); + window = gtk_widget_get_window (widget); + gtk_widget_get_allocation (widget, &alloc); + dcal->drawbuf = gdk_pixmap_new(window, alloc.width, alloc.height, -1); gnc_dense_cal_draw_to_buffer(dcal); } @@ -756,8 +763,10 @@ recompute_x_y_scales(GncDenseCal *dcal) height = DENSE_CAL_DEFAULT_HEIGHT; if (dcal->initialized) { - width = GTK_WIDGET(dcal->cal_drawing_area)->allocation.width; - height = GTK_WIDGET(dcal->cal_drawing_area)->allocation.height; + GtkAllocation alloc; + gtk_widget_get_allocation (GTK_WIDGET(dcal->cal_drawing_area), &alloc); + width = alloc.width; + height = alloc.height; } /* FIXME: there's something slightly wrong in the x_scale computation that @@ -869,8 +878,8 @@ gnc_dense_cal_expose(GtkWidget *widget, return FALSE; dcal = GNC_DENSE_CAL(user_data); - gc = widget->style->fg_gc[gtk_widget_get_state(widget)]; - gdk_draw_drawable(GDK_DRAWABLE(GTK_WIDGET(dcal->cal_drawing_area)->window), + gc = gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state(widget)]; + gdk_draw_drawable(GDK_DRAWABLE(gtk_widget_get_window (GTK_WIDGET(dcal->cal_drawing_area))), gc, GDK_DRAWABLE(dcal->drawbuf), 0, 0, 0, 0, -1, -1); @@ -883,6 +892,7 @@ static void gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) { GtkWidget *widget; + GtkAllocation alloc; gint i; int maxWidth; PangoLayout *layout; @@ -899,12 +909,13 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) layout = gtk_widget_create_pango_layout(GTK_WIDGET(dcal), NULL); LOG_AND_RESET(timer, "create_pango_layout"); + gtk_widget_get_allocation (GTK_WIDGET(dcal->cal_drawing_area), &alloc); gdk_draw_rectangle(dcal->drawbuf, - widget->style->white_gc, + gtk_widget_get_style (widget)->white_gc, TRUE, 0, 0, - GTK_WIDGET(dcal->cal_drawing_area)->allocation.width, - GTK_WIDGET(dcal->cal_drawing_area)->allocation.height); + alloc.width, + alloc.height); /* Fill in alternating month colors. */ { @@ -913,8 +924,8 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) GdkRectangle *rect; GList *mcList, *mcListIter; - gc = gdk_gc_new(GTK_WIDGET(dcal)->window); - gdk_gc_copy(gc, widget->style->fg_gc[gtk_widget_get_state(widget)]); + gc = gdk_gc_new(gtk_widget_get_window (GTK_WIDGET(dcal))); + gdk_gc_copy(gc, gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state(widget)]); /* reset all of the month position offsets. */ for (i = 0; i < 12; i++) @@ -955,12 +966,12 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) GdkColor markColor; GdkGCValues current_values; - gdk_gc_get_values(widget->style->fg_gc[widget->state], ¤t_values); + gdk_gc_get_values(gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], ¤t_values); gdk_color_parse(MARK_COLOR, &markColor); gdk_colormap_alloc_color(gdk_colormap_get_system(), &markColor, TRUE, TRUE); - gdk_gc_set_foreground(widget->style->fg_gc[widget->state], &markColor); + gdk_gc_set_foreground(gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], &markColor); for (i = 0; i < dcal->numMarks; i++) { if (dcal->marks[i] != NULL) @@ -985,7 +996,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) } gdk_draw_arc(dcal->drawbuf, - widget->style->fg_gc[widget->state], + gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], TRUE, x_offset, y_offset, MIN(w, h), MIN(w, h), 0 * 64, @@ -994,7 +1005,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) } // reset to the previous foreground color. - gdk_gc_set_foreground(widget->style->fg_gc[widget->state], ¤t_values.foreground); + gdk_gc_set_foreground(gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], ¤t_values.foreground); } LOG_AND_RESET(timer, "marked days"); @@ -1015,14 +1026,14 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) /* draw the outside border [inside the month labels] */ gdk_draw_rectangle(dcal->drawbuf, - widget->style->fg_gc[widget->state], + gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], FALSE, x, y, w, h); /* draw the week seperations */ for (j = 0; j < num_weeks_per_col(dcal); j++) { gint wy = y + (j * week_height(dcal)); gdk_draw_line(dcal->drawbuf, - widget->style->fg_gc[widget->state], + gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], x, wy, x + w, wy); } @@ -1032,7 +1043,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) { gint dx = x + (j * day_width(dcal)); gdk_draw_line(dcal->drawbuf, - widget->style->fg_gc[widget->state], + gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], dx, y, dx, y + col_height(dcal)); } @@ -1059,7 +1070,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) - (day_label_width / 2); label_y_offset = y - dcal->dayLabelHeight; pango_layout_set_text(layout, day_label_str, -1); - gdk_draw_layout(GDK_DRAWABLE(dcal->drawbuf), widget->style->fg_gc[widget->state], + gdk_draw_layout(GDK_DRAWABLE(dcal->drawbuf), gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], label_x_offset, label_y_offset, layout); @@ -1085,7 +1096,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) idx = (dcal->month - 1 + i) % 12; pango_layout_set_text(layout, month_name(idx), -1); gdk_draw_layout(GDK_DRAWABLE(dcal->drawbuf), - widget->style->fg_gc[widget->state], + gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], dcal->leftPadding + dcal->monthPositions[i].x, dcal->monthPositions[i].y, layout); @@ -1118,7 +1129,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) w = (x2 - x1) + 1; h = (y2 - y1) + 1; gdk_draw_layout(GDK_DRAWABLE(dcal->drawbuf), - widget->style->fg_gc[widget->state], + gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], x1 + (w / 2) - (numW / 2), y1 + (h / 2) - (numH / 2), layout); @@ -1126,11 +1137,12 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal) } LOG_AND_RESET(timer, "dates"); + gtk_widget_get_allocation (widget, &alloc); gtk_widget_queue_draw_area(GTK_WIDGET(dcal), - widget->allocation.x, - widget->allocation.y, - widget->allocation.width, - widget->allocation.height); + alloc.x, + alloc.y, + alloc.width, + alloc.height); LOG_AND_RESET(timer, "queue draw"); @@ -1231,7 +1243,7 @@ gnc_dense_cal_motion_notify(GtkWidget *widget, /* As per http://www.gtk.org/tutorial/sec-eventhandling.html */ if (event->is_hint) gdk_window_get_pointer(event->window, &unused, &unused, &unused2); - gdk_window_move(GTK_WIDGET(dcal->transPopup)->window, + gdk_window_move(gtk_widget_get_window (GTK_WIDGET(dcal->transPopup)), x_root_offset + 5, y_root_offset + 5); doc = wheres_this(dcal, event->x, event->y); if (doc >= 0) @@ -1609,6 +1621,7 @@ wheres_this(GncDenseCal *dcal, int x, int y) { gint colNum, weekRow, dayCol, dayOfCal; GDate d, startD; + GtkAllocation alloc; x -= dcal->leftPadding; y -= dcal->topPadding; @@ -1617,8 +1630,9 @@ wheres_this(GncDenseCal *dcal, int x, int y) { return -1; } - if ((x >= GTK_WIDGET(dcal)->allocation.width) - || (y >= GTK_WIDGET(dcal)->allocation.height)) + gtk_widget_get_allocation (GTK_WIDGET(dcal), &alloc); + if ((x >= alloc.width) + || (y >= alloc.height)) { return -1; } diff --git a/src/gnome-utils/gnc-gui-query.c b/src/gnome-utils/gnc-gui-query.c index 52d2cedd86d..8a9e6b73dd5 100644 --- a/src/gnome-utils/gnc-gui-query.c +++ b/src/gnome-utils/gnc-gui-query.c @@ -350,7 +350,7 @@ gnc_choose_radio_option_dialog(GtkWidget *parent, /* default to ok */ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); - dvbox = GTK_DIALOG(dialog)->vbox; + dvbox = gtk_dialog_get_content_area (GTK_DIALOG(dialog)); gtk_box_pack_start(GTK_BOX(dvbox), main_vbox, TRUE, TRUE, 0); diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index 474fad05af3..4c7913c5967 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -1037,7 +1037,7 @@ gnc_main_window_save_window (GncMainWindow *window, GncMainWindowSaveData *data) /* Save the window coordinates, etc. */ gtk_window_get_position(GTK_WINDOW(window), &coords[0], &coords[1]); gtk_window_get_size(GTK_WINDOW(window), &coords[2], &coords[3]); - maximized = (gdk_window_get_state((GTK_WIDGET(window))->window) + maximized = (gdk_window_get_state(gtk_widget_get_window ((GTK_WIDGET(window)))) & GDK_WINDOW_STATE_MAXIMIZED) != 0; g_key_file_set_integer_list(data->key_file, window_group, WINDOW_POSITION, &coords[0], 2); @@ -2670,7 +2670,7 @@ gnc_main_window_new (void) gint width, height; gtk_window_get_size (GTK_WINDOW (old_window), &width, &height); gtk_window_resize (GTK_WINDOW (window), width, height); - if ((gdk_window_get_state((GTK_WIDGET(old_window))->window) + if ((gdk_window_get_state((gtk_widget_get_window (GTK_WIDGET(old_window)))) & GDK_WINDOW_STATE_MAXIMIZED) != 0) { gtk_window_maximize (GTK_WINDOW (window)); diff --git a/src/gnome/gnc-plugin-budget.c b/src/gnome/gnc-plugin-budget.c index 35f50cca38b..049ee4aacaf 100644 --- a/src/gnome/gnc-plugin-budget.c +++ b/src/gnome/gnc-plugin-budget.c @@ -295,7 +295,7 @@ gnc_budget_gui_select_budget(QofBook *book) tm = gnc_tree_model_budget_new(book); gnc_tree_view_budget_set_model(tv, tm); g_object_unref(tm); - gtk_container_add(GTK_CONTAINER(dlg->vbox), GTK_WIDGET(tv)); + gtk_container_add(GTK_CONTAINER (gtk_dialog_get_content_area (dlg)), GTK_WIDGET(tv)); gtk_widget_show_all(GTK_WIDGET(dlg)); bgt = NULL; diff --git a/src/gnome/gnc-split-reg.c b/src/gnome/gnc-split-reg.c index 8af0e96b9a1..0ffb765d76b 100644 --- a/src/gnome/gnc-split-reg.c +++ b/src/gnome/gnc-split-reg.c @@ -1103,7 +1103,7 @@ gsr_default_associate_handler_location( GNCSplitReg *gsr, gpointer data ) GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); - content_area = GTK_DIALOG (dialog)->vbox; + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); // add a label label = gtk_label_new ("Please enter URL:"); @@ -1472,8 +1472,8 @@ gsr_default_expand_handler( GNCSplitReg *gsr, gpointer data ) /* These should all be in agreement. */ activeCount = - ( ( GTK_CHECK_MENU_ITEM(gsr->split_menu_check)->active ? 1 : -1 ) - + ( GTK_CHECK_MENU_ITEM(gsr->split_popup_check)->active ? 1 : -1 ) + ( ( gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(gsr->split_menu_check)) ? 1 : -1 ) + + ( gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(gsr->split_popup_check)) ? 1 : -1 ) + ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(gsr->split_button) ) ? 1 : -1 ) ); @@ -1699,7 +1699,7 @@ gnc_split_reg_style_ledger_cb (GtkWidget *w, gpointer data) { GNCSplitReg *gsr = data; - if (!GTK_CHECK_MENU_ITEM(w)->active) + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w))) return; gnc_split_reg_change_style (gsr, REG_STYLE_LEDGER); @@ -1710,7 +1710,7 @@ gnc_split_reg_style_auto_ledger_cb (GtkWidget *w, gpointer data) { GNCSplitReg *gsr = data; - if (!GTK_CHECK_MENU_ITEM(w)->active) + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w))) return; gnc_split_reg_change_style (gsr, REG_STYLE_AUTO_LEDGER); @@ -1721,7 +1721,7 @@ gnc_split_reg_style_journal_cb (GtkWidget *w, gpointer data) { GNCSplitReg *gsr = data; - if (!GTK_CHECK_MENU_ITEM(w)->active) + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w))) return; gnc_split_reg_change_style (gsr, REG_STYLE_JOURNAL); @@ -1734,7 +1734,7 @@ gnc_split_reg_double_line_cb (GtkWidget *w, gpointer data) SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger); gboolean use_double_line; - use_double_line = GTK_CHECK_MENU_ITEM(w)->active; + use_double_line = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)); if ( use_double_line == reg->use_double_line ) return; diff --git a/src/gnome/gnc-split-reg2.c b/src/gnome/gnc-split-reg2.c index 8cf4c2a389a..a27bf2b8610 100644 --- a/src/gnome/gnc-split-reg2.c +++ b/src/gnome/gnc-split-reg2.c @@ -843,7 +843,7 @@ gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data) { GNCSplitReg2 *gsr = data; - if (!GTK_CHECK_MENU_ITEM (w)->active) + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w))) return; gnc_split_reg2_change_style (gsr, REG2_STYLE_LEDGER); @@ -854,7 +854,7 @@ gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data) { GNCSplitReg2 *gsr = data; - if (!GTK_CHECK_MENU_ITEM (w)->active) + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w))) return; gnc_split_reg2_change_style (gsr, REG2_STYLE_AUTO_LEDGER); @@ -865,7 +865,7 @@ gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data) { GNCSplitReg2 *gsr = data; - if (!GTK_CHECK_MENU_ITEM (w)->active) + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w))) return; gnc_split_reg2_change_style (gsr, REG2_STYLE_JOURNAL); @@ -878,7 +878,7 @@ gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data) GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger); gboolean use_double_line; - use_double_line = GTK_CHECK_MENU_ITEM (w)->active; + use_double_line = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w)); if (use_double_line == model->use_double_line) return; diff --git a/src/import-export/aqb/gnc-gwen-gui.c b/src/import-export/aqb/gnc-gwen-gui.c index 9cf64815417..1bfc956a580 100644 --- a/src/import-export/aqb/gnc-gwen-gui.c +++ b/src/import-export/aqb/gnc-gwen-gui.c @@ -1126,7 +1126,7 @@ messagebox_cb(GWEN_GUI *gwen_gui, guint32 flags, const gchar *title, gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(vbox), label); gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), vbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG(dialog))), vbox); gtk_widget_show_all(dialog); result = gtk_dialog_run(GTK_DIALOG(dialog)); diff --git a/src/import-export/csv-imp/assistant-csv-trans-import.c b/src/import-export/csv-imp/assistant-csv-trans-import.c index 9b7eb5f8d9d..96fac062276 100644 --- a/src/import-export/csv-imp/assistant-csv-trans-import.c +++ b/src/import-export/csv-imp/assistant-csv-trans-import.c @@ -962,8 +962,12 @@ static void header_button_press_handler (GtkWidget* button, GdkEventButton* even { /* col is the number of the column that was clicked, and offset is to correct for the indentation of button. */ - int i, col = 0, offset = GTK_BIN(button)->child->allocation.x - button->allocation.x, - ncols = info->parse_data->column_types->len; + int i, offset; + GtkAllocation alloc; + int col = 0, ncols = info->parse_data->column_types->len; + + gtk_widget_get_allocation (gtk_bin_get_child (GTK_BIN(button)), &alloc); + offset = alloc.x - alloc.x; /* Find the column that was clicked. */ for (i = 0; i < ncols; i++) { diff --git a/src/import-export/qif-imp/dialog-account-picker.c b/src/import-export/qif-imp/dialog-account-picker.c index d213dde03f5..162c983810b 100644 --- a/src/import-export/qif-imp/dialog-account-picker.c +++ b/src/import-export/qif-imp/dialog-account-picker.c @@ -222,7 +222,7 @@ gnc_ui_qif_account_picker_new_cb(GtkButton * w, gpointer user_data) gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); gtk_entry_set_max_length(GTK_ENTRY(entry), 250); gtk_widget_show(entry); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dlg)->vbox), entry); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG(dlg))), entry); /* Run the dialog to get the new account name. */ response = gtk_dialog_run(GTK_DIALOG(dlg)); diff --git a/src/plugins/bi_import/dialog-bi-import-gui.c b/src/plugins/bi_import/dialog-bi-import-gui.c index 6c3c772713c..c9a3b8f99e1 100644 --- a/src/plugins/bi_import/dialog-bi-import-gui.c +++ b/src/plugins/bi_import/dialog-bi-import-gui.c @@ -400,11 +400,7 @@ gnc_input_dialog (GtkWidget *parent, const gchar *title, const gchar *msg, const GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); -#ifdef HAVE_GTK_2_14 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); -#else - content_area = GTK_DIALOG (dialog)->vbox; -#endif // add a label label = gtk_label_new (msg); @@ -461,11 +457,7 @@ gnc_info2_dialog (GtkWidget *parent, const gchar *title, const gchar *msg) GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); -#ifdef HAVE_GTK_2_14 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); -#else - content_area = GTK_DIALOG (dialog)->vbox; -#endif // add a scroll area scrolledwindow = gtk_scrolled_window_new (NULL, NULL); diff --git a/src/plugins/customer_import/dialog-customer-import-gui.c b/src/plugins/customer_import/dialog-customer-import-gui.c index 0f5ab5046c7..15d9ef34eaa 100644 --- a/src/plugins/customer_import/dialog-customer-import-gui.c +++ b/src/plugins/customer_import/dialog-customer-import-gui.c @@ -379,11 +379,7 @@ gnc_input_dialog (GtkWidget *parent, const gchar *title, const gchar *msg, const GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); -#ifdef HAVE_GTK_2_14 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); -#else - content_area = GTK_DIALOG (dialog)->vbox; -#endif // add a label label = gtk_label_new (msg); @@ -439,11 +435,7 @@ gnc_info2_dialog (GtkWidget *parent, const gchar *title, const gchar *msg) GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); -#ifdef HAVE_GTK_2_14 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); -#else - content_area = GTK_DIALOG (dialog)->vbox; -#endif // add a scroll area scrolledwindow = gtk_scrolled_window_new (NULL, NULL); diff --git a/src/register/register-gnome/combocell-gnome.c b/src/register/register-gnome/combocell-gnome.c index ecdbd5e06bb..6899ebf21b2 100644 --- a/src/register/register-gnome/combocell-gnome.c +++ b/src/register/register-gnome/combocell-gnome.c @@ -833,7 +833,9 @@ static int popup_get_width (GnomeCanvasItem *item, gpointer user_data) { - return GTK_WIDGET (GNC_ITEM_LIST (item)->tree_view)->allocation.width; + GtkAllocation alloc; + gtk_widget_get_allocation (GTK_WIDGET (GNC_ITEM_LIST (item)->tree_view), &alloc); + return alloc.width; } static gboolean diff --git a/src/register/register-gnome/gnucash-cursor.c b/src/register/register-gnome/gnucash-cursor.c index a53e92f56a8..96b41cde5bb 100644 --- a/src/register/register-gnome/gnucash-cursor.c +++ b/src/register/register-gnome/gnucash-cursor.c @@ -372,7 +372,7 @@ gnucash_cursor_realize (GnomeCanvasItem *item) (*GNOME_CANVAS_ITEM_CLASS (gnucash_cursor_parent_class)->realize)(item); - window = GTK_WIDGET (item->canvas)->window; + window = gtk_widget_get_window (GTK_WIDGET (item->canvas)); cursor->gc = gdk_gc_new (window); } diff --git a/src/register/register-gnome/gnucash-grid.c b/src/register/register-gnome/gnucash-grid.c index f032a9c17ff..efeb984ce24 100644 --- a/src/register/register-gnome/gnucash-grid.c +++ b/src/register/register-gnome/gnucash-grid.c @@ -90,7 +90,7 @@ gnucash_grid_realize (GnomeCanvasItem *item) (gnucash_grid_parent_class)->realize)(item); gnucash_grid = GNUCASH_GRID (item); - window = GTK_WIDGET (item->canvas)->window; + window = gtk_widget_get_window (GTK_WIDGET (item->canvas)); /* Configure the default grid gc */ gnucash_grid->grid_gc = gc = gdk_gc_new (window); diff --git a/src/register/register-gnome/gnucash-header.c b/src/register/register-gnome/gnucash-header.c index dab6873c8d7..dacb8db0a0b 100644 --- a/src/register/register-gnome/gnucash-header.c +++ b/src/register/register-gnome/gnucash-header.c @@ -249,7 +249,7 @@ gnc_header_realize (GnomeCanvasItem *item) if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) GNOME_CANVAS_ITEM_CLASS (parent_class)->realize (item); - window = GTK_WIDGET (item->canvas)->window; + window = gtk_widget_get_window (GTK_WIDGET (item->canvas)); header->gc = gdk_gc_new (window); } @@ -488,10 +488,10 @@ gnc_header_event (GnomeCanvasItem *item, GdkEvent *event) if (pointer_on_resize_line(header, x, y, &col) && gnucash_style_col_is_resizable (header->style, col)) - gdk_window_set_cursor (GTK_WIDGET(canvas)->window, + gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(canvas)), header->resize_cursor); else - gdk_window_set_cursor (GTK_WIDGET(canvas)->window, + gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(canvas)), header->normal_cursor); break; @@ -747,7 +747,7 @@ gnc_header_get_type (void) static void gnc_header_realized (GtkWidget *widget, gpointer data) { - gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, + gdk_window_set_back_pixmap (gtk_layout_get_bin_window (GTK_LAYOUT (widget)), NULL, FALSE); } diff --git a/src/register/register-gnome/gnucash-item-edit.c b/src/register/register-gnome/gnucash-item-edit.c index fb25ee2ea7a..ed7ad2b2a95 100644 --- a/src/register/register-gnome/gnucash-item-edit.c +++ b/src/register/register-gnome/gnucash-item-edit.c @@ -468,7 +468,7 @@ gnc_item_edit_realize (GnomeCanvasItem *item) (gnc_item_edit_parent_class)->realize) (item); item_edit = GNC_ITEM_EDIT (item); - window = GTK_WIDGET (canvas)->window; + window = gtk_widget_get_window (GTK_WIDGET (canvas)); item_edit->gc = gdk_gc_new (window); } @@ -491,7 +491,7 @@ gnc_item_edit_focus_in (GncItemEdit *item_edit) g_return_if_fail (GNC_IS_ITEM_EDIT(item_edit)); ev.type = GDK_FOCUS_CHANGE; - ev.window = GTK_WIDGET (item_edit->sheet)->window; + ev.window = gtk_widget_get_window (GTK_WIDGET (item_edit->sheet)); ev.in = TRUE; gtk_widget_event (item_edit->editor, (GdkEvent*) &ev); queue_sync(item_edit); @@ -506,7 +506,7 @@ gnc_item_edit_focus_out (GncItemEdit *item_edit) g_return_if_fail (GNC_IS_ITEM_EDIT(item_edit)); ev.type = GDK_FOCUS_CHANGE; - ev.window = GTK_WIDGET (item_edit->sheet)->window; + ev.window = gtk_widget_get_window (GTK_WIDGET (item_edit->sheet)); ev.in = FALSE; gtk_widget_event (item_edit->editor, (GdkEvent*) &ev); queue_sync(item_edit); @@ -1280,6 +1280,7 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit) { GtkToggleButton *toggle; GtkAnchorType popup_anchor; + GtkAllocation alloc; GnucashSheet *sheet; gint x, y, w, h; gint y_offset; @@ -1300,8 +1301,9 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit) sheet = item_edit->sheet; - view_height = GTK_WIDGET (sheet)->allocation.height; - view_width = GTK_WIDGET (sheet)->allocation.width; + gtk_widget_get_allocation (GTK_WIDGET (sheet), &alloc); + view_height = alloc.height; + view_width = alloc.width; gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), NULL, &y_offset); gnc_item_edit_get_pixel_coords (item_edit, &x, &y, &w, &h); diff --git a/src/register/register-gnome/gnucash-sheet.c b/src/register/register-gnome/gnucash-sheet.c index 1a65d17ff98..c884fdc5ec8 100644 --- a/src/register/register-gnome/gnucash-sheet.c +++ b/src/register/register-gnome/gnucash-sheet.c @@ -389,6 +389,7 @@ void gnucash_sheet_compute_visible_range (GnucashSheet *sheet) { VirtualCellLocation vcell_loc; + GtkAllocation alloc; gint height; gint cy; gint old_visible_blocks, old_visible_rows; @@ -396,7 +397,8 @@ gnucash_sheet_compute_visible_range (GnucashSheet *sheet) g_return_if_fail (sheet != NULL); g_return_if_fail (GNUCASH_IS_SHEET (sheet)); - height = GTK_WIDGET(sheet)->allocation.height; + gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc); + height = alloc.height; gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), NULL, &cy); @@ -449,6 +451,7 @@ gnucash_sheet_show_row (GnucashSheet *sheet, gint virt_row) { VirtualCellLocation vcell_loc = { virt_row, 0 }; SheetBlock *block; + GtkAllocation alloc; gint block_height; gint height; gint cx, cy; @@ -465,7 +468,8 @@ gnucash_sheet_show_row (GnucashSheet *sheet, gint virt_row) gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), &cx, &cy); x = cx; - height = GTK_WIDGET(sheet)->allocation.height; + gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc); + height = alloc.height; block = gnucash_sheet_get_block (sheet, vcell_loc); @@ -519,6 +523,7 @@ gnucash_sheet_show_range (GnucashSheet *sheet, { SheetBlock *start_block; SheetBlock *end_block; + GtkAllocation alloc; gint block_height; gint height; gint cx, cy; @@ -538,7 +543,8 @@ gnucash_sheet_show_range (GnucashSheet *sheet, gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), &cx, &cy); x = cx; - height = GTK_WIDGET(sheet)->allocation.height; + gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc); + height = alloc.height; start_block = gnucash_sheet_get_block (sheet, start_loc); end_block = gnucash_sheet_get_block (sheet, end_loc); @@ -584,10 +590,10 @@ gnucash_sheet_update_adjustments (GnucashSheet *sheet) vadj = sheet->vadj; if (sheet->num_visible_blocks > 0) - vadj->step_increment = - vadj->page_size / sheet->num_visible_blocks; + gtk_adjustment_set_step_increment (vadj, + gtk_adjustment_get_page_size (vadj) / sheet->num_visible_blocks); else - vadj->step_increment = 0; + gtk_adjustment_set_step_increment (vadj, 0); gtk_adjustment_changed(vadj); } @@ -612,7 +618,8 @@ gnucash_sheet_hadjustment_changed (GtkAdjustment *adj, reg = GNUCASH_REGISTER(sheet->reg); g_return_if_fail (reg != NULL); - if (adj->upper - adj->lower > adj->page_size) + if (gtk_adjustment_get_upper (adj) - gtk_adjustment_get_lower (adj) + > gtk_adjustment_get_page_size (adj)) { if (!reg->hscrollbar_visible) { @@ -658,6 +665,7 @@ gnucash_sheet_redraw_block (GnucashSheet *sheet, VirtualCellLocation vcell_loc) gint x, y, w, h; GnomeCanvas *canvas; SheetBlock *block; + GtkAllocation alloc; g_return_if_fail (sheet != NULL); g_return_if_fail (GNUCASH_IS_SHEET(sheet)); @@ -671,9 +679,10 @@ gnucash_sheet_redraw_block (GnucashSheet *sheet, VirtualCellLocation vcell_loc) x = block->origin_x; y = block->origin_y; + gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc); h = block->style->dimensions->height; w = MIN(block->style->dimensions->width, - GTK_WIDGET(sheet)->allocation.width); + alloc.width); gnome_canvas_request_redraw (canvas, x, y, x + w + 1, y + h + 1); } @@ -714,8 +723,8 @@ gnucash_sheet_realize (GtkWidget *widget) if (GTK_WIDGET_CLASS (sheet_parent_class)->realize) (*GTK_WIDGET_CLASS (sheet_parent_class)->realize)(widget); - window = widget->window; - gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, + window = gtk_widget_get_window (widget); + gdk_window_set_back_pixmap (gtk_layout_get_bin_window (GTK_LAYOUT (widget)), NULL, FALSE); gtk_im_context_set_client_window( GNUCASH_SHEET (widget)->im_context, window); @@ -1326,21 +1335,21 @@ gnucash_scroll_event (GtkWidget *widget, GdkEventScroll *event) sheet = GNUCASH_SHEET (widget); vadj = sheet->vadj; - v_value = vadj->value; + v_value = gtk_adjustment_get_value (vadj); switch (event->direction) { case GDK_SCROLL_UP: - v_value -= vadj->step_increment; + v_value -= gtk_adjustment_get_step_increment (vadj); break; case GDK_SCROLL_DOWN: - v_value += vadj->step_increment; + v_value += gtk_adjustment_get_step_increment (vadj); break; default: return FALSE; } - v_value = CLAMP(v_value, vadj->lower, vadj->upper - vadj->page_size); + v_value = CLAMP(v_value, gtk_adjustment_get_lower (vadj), gtk_adjustment_get_upper (vadj) - gtk_adjustment_get_page_size (vadj)); gtk_adjustment_set_value(vadj, v_value); @@ -1358,7 +1367,7 @@ gnucash_sheet_check_grab (GnucashSheet *sheet) device = gdk_device_get_core_pointer (); - gdk_device_get_state (device, GTK_WIDGET(sheet)->window, + gdk_device_get_state (device, gtk_widget_get_window (GTK_WIDGET(sheet)), 0, &mods); if (!(mods & GDK_BUTTON1_MASK)) @@ -2419,6 +2428,7 @@ gnucash_sheet_set_scroll_region (GnucashSheet *sheet) { int height, width; GtkWidget *widget; + GtkAllocation alloc; double x, y; if (!sheet) @@ -2432,8 +2442,9 @@ gnucash_sheet_set_scroll_region (GnucashSheet *sheet) gnome_canvas_get_scroll_region (GNOME_CANVAS(sheet), NULL, NULL, &x, &y); - height = MAX (sheet->height, widget->allocation.height); - width = MAX (sheet->width, widget->allocation.width); + gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc); + height = MAX (sheet->height, alloc.height); + width = MAX (sheet->width, alloc.width); if (width != (int)x || height != (int)y) gnome_canvas_set_scroll_region (GNOME_CANVAS(sheet),