[goffice] prepare for GSEAL_ENABLE.
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [goffice] prepare for GSEAL_ENABLE.
- Date: Mon, 12 Oct 2009 08:03:46 +0000 (UTC)
commit f7e31d1f45dbaeab7540e3a646cee4fb2200f40d
Author: Jean Brefort <jean brefort normalesup org>
Date: Mon Oct 12 09:58:20 2009 +0200
prepare for GSEAL_ENABLE.
configure.in | 12 ++++-
goffice/canvas/goc-canvas.c | 7 +--
goffice/canvas/goc-item.c | 5 +-
goffice/drawing/god-drawing-view.c | 5 +-
goffice/graph/gog-child-button.c | 5 +-
goffice/graph/gog-error-bar.c | 9 ++--
goffice/graph/gog-guru.c | 15 ++++--
goffice/gtk/Makefile.am | 3 +
goffice/gtk/go-3d-rotation-sel.c | 11 +---
goffice/gtk/go-action-combo-color.c | 6 ++-
goffice/gtk/go-action-combo-pixmaps.c | 6 ++-
goffice/gtk/go-action-combo-stack.c | 3 +-
goffice/gtk/go-color-palette.c | 14 +++--
goffice/gtk/go-color-selector.c | 11 ++--
goffice/gtk/go-combo-box.c | 68 +++++++++++++------------
goffice/gtk/go-combo-text.c | 19 ++++---
goffice/gtk/go-font-sel.c | 11 +++-
goffice/gtk/go-format-sel.c | 11 ++--
goffice/gtk/go-graph-widget.c | 44 +++++++++++------
goffice/gtk/go-optionmenu.c | 24 +++++----
goffice/gtk/go-palette.c | 46 +++---------------
goffice/gtk/go-rotation-sel.c | 4 +-
goffice/gtk/go-selector.c | 12 +++--
goffice/gtk/go-selector.h | 2 +-
goffice/gtk/goffice-gtk.c | 46 ++++++++++-------
goffice/utils/go-style.c | 6 +-
plugins/plot_barcol/gog-barcol-prefs.c | 7 ++-
plugins/plot_barcol/gog-minmax.c | 3 +-
plugins/plot_distrib/gog-boxplot.c | 5 +-
plugins/plot_pie/gog-pie-prefs.c | 9 ++--
plugins/plot_surface/gog-xyz-surface-prefs.c | 5 +-
plugins/plot_xy/gog-bubble-prefs.c | 3 +-
32 files changed, 235 insertions(+), 202 deletions(-)
---
diff --git a/configure.in b/configure.in
index 8e10bd5..cd79ac0 100644
--- a/configure.in
+++ b/configure.in
@@ -270,7 +270,6 @@ if test `expr goffice_version_major % 2` -eq 1; then
CFLAGS="$CFLAGS -DGDK_MULTIHEAD_SAFE"
# gtk+ handled later
gtk_disable_deprecated=maybe
- CFLAGS="$CFLAGS -DLIBGLADE_DISABLE_DEPRECATED"
fi
if test "x$goffice_with_gnome" = "xtrue"; then
CFLAGS="$CFLAGS -DGNOME_DISABLE_DEPRECATED"
@@ -418,7 +417,16 @@ SAVE_LIBS=$LIBS
LIBS="$GOFFICE_LIBS $LIBS"
AC_CHECK_FUNCS(cairo_surface_set_fallback_resolution cairo_ps_surface_set_eps)
AC_CHECK_FUNCS(g_file_new_for_commandline_arg g_file_new_for_uri g_hash_table_iter_init)
-AC_CHECK_FUNCS(g_content_type_from_mime_type gtk_layout_get_bin_window)
+AC_CHECK_FUNCS(g_content_type_from_mime_type)
+AC_CHECK_FUNCS(gtk_adjustment_get_page_size gtk_adjustment_get_upper \
+ gtk_color_selection_dialog_get_color_selection gtk_dialog_get_action_area \
+ gtk_layout_get_bin_window gtk_menu_shell_get_active gtk_selection_data_get_data \
+ gtk_selection_data_get_length gtk_selection_data_get_target gtk_tearoff_menu_item_get_torn_off \
+ gtk_tearoff_menu_item_set_torn_off gtk_widget_get_allocation gtk_widget_get_has_window \
+ gtk_widget_get_state gtk_widget_get_style gtk_widget_get_visible gtk_widget_get_window \
+ gtk_widget_has_focus gtk_widget_is_mapped gtk_widget_is_realized gtk_widget_set_can_default \
+ gtk_widget_is_sensitive gtk_widget_set_can_focus gtk_widget_set_has_focus \
+ gtk_widget_set_receives_default gtk_window_get_default_widget)
LIBS=$SAVE_LIBS
SAVE_CFLAGS=$CFLAGS
diff --git a/goffice/canvas/goc-canvas.c b/goffice/canvas/goc-canvas.c
index 3270434..56dad6e 100644
--- a/goffice/canvas/goc-canvas.c
+++ b/goffice/canvas/goc-canvas.c
@@ -22,6 +22,7 @@
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gsf/gsf-impl-utils.h>
#include <math.h>
@@ -40,10 +41,6 @@
* @GOC_DIRECTION_MAX : First invalid value
**/
-#ifndef HAVE_GTK_LAYOUT_GET_BIN_WINDOW
-# define gtk_layout_get_bin_window(x) (x)->bin_window
-#endif
-
static GObjectClass *parent_klass;
static gboolean
@@ -421,7 +418,7 @@ goc_canvas_get_pixels_per_unit (GocCanvas *canvas)
void
goc_canvas_invalidate (GocCanvas *canvas, double x0, double y0, double x1, double y1)
{
- if (!GTK_WIDGET_REALIZED (canvas))
+ if (!gtk_widget_is_realized (canvas))
return;
x0 = (x0 - canvas->scroll_x1) * canvas->pixels_per_unit;
y0 = (y0 - canvas->scroll_y1) * canvas->pixels_per_unit;
diff --git a/goffice/canvas/goc-item.c b/goffice/canvas/goc-item.c
index ba207b8..5588b0f 100644
--- a/goffice/canvas/goc-item.c
+++ b/goffice/canvas/goc-item.c
@@ -22,6 +22,7 @@
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gtk/gtk.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n-lib.h>
@@ -191,7 +192,7 @@ goc_item_dispose (GObject *object)
if (item->canvas) {
if (item->canvas->last_item == item)
item->canvas->last_item = NULL;
- if (GTK_WIDGET_REALIZED (item->canvas)) {
+ if (gtk_widget_is_realized (item->canvas)) {
item->cached_bounds = TRUE; /* avoids a call to update_bounds */
goc_item_invalidate (item);
}
@@ -429,7 +430,7 @@ goc_item_invalidate (GocItem *item)
if (!parent)
return;
- if (!GTK_WIDGET_REALIZED (item->canvas))
+ if (!gtk_widget_is_realized (item->canvas))
return;
if (!item->cached_bounds)
diff --git a/goffice/drawing/god-drawing-view.c b/goffice/drawing/god-drawing-view.c
index 8aed23d..97d87e5 100644
--- a/goffice/drawing/god-drawing-view.c
+++ b/goffice/drawing/god-drawing-view.c
@@ -25,6 +25,7 @@
#include <goffice/goffice-config.h>
#include <goffice/drawing/god-drawing-view.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gsf/gsf-impl-utils.h>
#include <goffice/drawing/god-drawing-renderer-gdk.h>
@@ -89,9 +90,9 @@ god_drawing_view_realize (GtkWidget *widget)
GTK_WIDGET_CLASS(parent_class)->realize (widget);
god_drawing_renderer_gdk_set_drawable (view->priv->renderer,
- widget->window);
+ gtk_widget_get_window (widget));
god_drawing_renderer_gdk_set_gc (view->priv->renderer,
- widget->style->fg_gc[0]);
+ gtk_widget_get_style (widget)->fg_gc[0]);
}
static gboolean
diff --git a/goffice/graph/gog-child-button.c b/goffice/graph/gog-child-button.c
index 37924f6..0fd8202 100644
--- a/goffice/graph/gog-child-button.c
+++ b/goffice/graph/gog-child-button.c
@@ -22,6 +22,7 @@
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gdk/gdkpixbuf.h>
#include <gdk/gdkkeysyms.h>
@@ -283,10 +284,10 @@ gog_child_button_set_object (GogChildButton *child_button, GogObject *gog_object
static void
gog_child_button_popup (GogChildButton *child_button, guint button, guint32 event_time)
{
- if (!GTK_WIDGET_REALIZED (child_button))
+ if (!gtk_widget_is_realized (child_button))
return;
- if (GTK_WIDGET_MAPPED (child_button->menu))
+ if (gtk_widget_is_mapped (child_button->menu))
return;
child_button->button_handling_in_progress = TRUE;
diff --git a/goffice/graph/gog-error-bar.c b/goffice/graph/gog-error-bar.c
index 40526d3..401dbbe 100644
--- a/goffice/graph/gog-error-bar.c
+++ b/goffice/graph/gog-error-bar.c
@@ -20,6 +20,7 @@
*/
#include <goffice/goffice-config.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include "gog-error-bar.h"
#include "gog-series-impl.h"
#include "gog-plot-impl.h"
@@ -80,9 +81,9 @@ cb_destroy (G_GNUC_UNUSED GtkWidget *w, GogErrorBarEditor *editor)
static void
cb_width_changed (GtkAdjustment *adj, GogErrorBarEditor *editor)
{
- editor->width = adj->value;
+ editor->width = gtk_adjustment_get_value (adj);
if (editor->bar) {
- editor->bar->width = adj->value;
+ editor->bar->width = gtk_adjustment_get_value (adj);
gog_object_request_update (GOG_OBJECT (editor->series));
}
}
@@ -90,9 +91,9 @@ cb_width_changed (GtkAdjustment *adj, GogErrorBarEditor *editor)
static void
cb_line_width_changed (GtkAdjustment *adj, GogErrorBarEditor *editor)
{
- editor->line_width = adj->value;
+ editor->line_width = gtk_adjustment_get_value (adj);
if (editor->bar) {
- editor->bar->style->line.width = adj->value;
+ editor->bar->style->line.width = gtk_adjustment_get_value (adj);
gog_object_request_update (GOG_OBJECT (editor->series));
}
}
diff --git a/goffice/graph/gog-guru.c b/goffice/graph/gog-guru.c
index 2af4d5e..f2d355f 100644
--- a/goffice/graph/gog-guru.c
+++ b/goffice/graph/gog-guru.c
@@ -24,6 +24,7 @@
#include <goffice/goffice-priv.h>
#include <goffice/goffice.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <glib/gi18n-lib.h>
@@ -318,13 +319,14 @@ cb_sample_pressed (GraphGuruTypeSelector *typesel)
return;
if (typesel->sample_graph_item == NULL) {
- GtkAllocation *size = >K_WIDGET (typesel->canvas)->allocation;
+ GtkAllocation size;
+ gtk_widget_get_allocation (GTK_WIDGET (typesel->canvas), &size);
typesel->sample_graph_item = goc_item_new (typesel->graph_group,
GOC_TYPE_GRAPH,
"graph", typesel->state->graph,
NULL);
cb_typesel_sample_plot_resize (GOC_CANVAS (typesel->canvas),
- size, typesel);
+ &size, typesel);
g_return_if_fail (typesel->sample_graph_item != NULL);
}
@@ -440,7 +442,7 @@ cb_plot_families_init (char const *id, GogPlotFamily *family,
static void
cb_canvas_realized (GtkLayout *widget)
{
- gdk_window_set_back_pixmap (widget->bin_window, NULL, FALSE);
+ gdk_window_set_back_pixmap (gtk_layout_get_bin_window (widget), NULL, FALSE);
}
static void
@@ -880,6 +882,7 @@ graph_guru_init_format_page (GraphGuruState *s)
GtkTreeViewColumn *column;
GogRenderer *rend;
GOStyle *style;
+ GtkAllocation size;
if (s->fmt_page_initialized)
return;
@@ -936,7 +939,8 @@ graph_guru_init_format_page (GraphGuruState *s)
"graph", s->graph,
NULL);
gtk_widget_add_events (canvas, GDK_POINTER_MOTION_HINT_MASK);
- cb_sample_plot_resize (GOC_CANVAS (canvas), &canvas->allocation, s);
+ gtk_widget_get_allocation (canvas, &size);
+ cb_sample_plot_resize (GOC_CANVAS (canvas), &size, s);
g_signal_connect (G_OBJECT (canvas),
"size_allocate",
G_CALLBACK (cb_sample_plot_resize), s);
@@ -1091,7 +1095,8 @@ static void
typesel_set_selection_color (GraphGuruTypeSelector *typesel)
{
GtkWidget *w = gtk_entry_new ();
- GdkColor *color = &w->style->base [GTK_WIDGET_HAS_FOCUS (typesel->canvas)
+ GtkStyle *gstyle = gtk_widget_get_style (w);
+ GdkColor *color = &gstyle->base [gtk_widget_has_focus (typesel->canvas)
? GTK_STATE_SELECTED : GTK_STATE_ACTIVE];
GOColor select_color;
GOStyle *style;
diff --git a/goffice/gtk/Makefile.am b/goffice/gtk/Makefile.am
index 3f7169d..cec44b7 100644
--- a/goffice/gtk/Makefile.am
+++ b/goffice/gtk/Makefile.am
@@ -75,6 +75,9 @@ libgoffice_gtk_la_HEADERS = \
go-graph-widget.h \
go-image-sel.h
+noinst_HEADERS = \
+ go-gtk-compat.h
+
uidir = $(goffice_datadir)/ui
dist_ui_DATA = \
go-rotation-sel.ui \
diff --git a/goffice/gtk/go-3d-rotation-sel.c b/goffice/gtk/go-3d-rotation-sel.c
index beb9e6d..be84573 100644
--- a/goffice/gtk/go-3d-rotation-sel.c
+++ b/goffice/gtk/go-3d-rotation-sel.c
@@ -20,12 +20,7 @@
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
-
-#include <goffice/canvas/goc-canvas.h>
-#include <goffice/canvas/goc-item.h>
-#include <goffice/canvas/goc-circle.h>
-#include <goffice/canvas/goc-polygon.h>
-#include <goffice/canvas/goc-structs.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n-lib.h>
@@ -196,7 +191,7 @@ static void
cb_rotate_canvas_realize (GocCanvas *canvas, GO3DRotationSel *g3d)
{
GocGroup *group = GOC_GROUP (goc_canvas_get_root (canvas));
- GtkStyle *style = gtk_style_copy (GTK_WIDGET (canvas)->style);
+ GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (canvas)));
int i;
GOStyle *go_style;
double mgn = g3d->margin - 2 + g3d->radius;
@@ -301,7 +296,7 @@ cb_rotate_canvas_button (GocCanvas *canvas, GdkEventButton *event,
x -= g3d->bank_dial_x;
y -= g3d->bank_dial_y;
r = g3d->bank_dial_r;
- gdk_pointer_grab (canvas->base.bin_window, FALSE,
+ gdk_pointer_grab (gtk_layout_get_bin_window (&canvas->base), FALSE,
GDK_POINTER_MOTION_MASK
| GDK_BUTTON_RELEASE_MASK, NULL, NULL,
event->time);
diff --git a/goffice/gtk/go-action-combo-color.c b/goffice/gtk/go-action-combo-color.c
index 926f30d..2bfa126 100644
--- a/goffice/gtk/go-action-combo-color.c
+++ b/goffice/gtk/go-action-combo-color.c
@@ -19,6 +19,7 @@
* USA
*/
#include <goffice/goffice-config.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include "go-action-combo-color.h"
#include "go-combo-color.h"
#include "go-combo-box.h"
@@ -76,8 +77,9 @@ make_icon (GtkAction *a, GtkWidget *tool)
if (stock_id == NULL)
return NULL;
if (GO_IS_TOOL_COMBO_COLOR (tool)) {
- if (tool->parent)
- size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (tool->parent));
+ GtkWidget *parent = gtk_widget_get_parent (tool);
+ if (parent)
+ size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (parent));
else
g_object_get (settings,
"gtk-toolbar-icon-size", &size,
diff --git a/goffice/gtk/go-action-combo-pixmaps.c b/goffice/gtk/go-action-combo-pixmaps.c
index 390c5cd..4edc139 100644
--- a/goffice/gtk/go-action-combo-pixmaps.c
+++ b/goffice/gtk/go-action-combo-pixmaps.c
@@ -19,6 +19,7 @@
* USA
*/
#include <goffice/goffice-config.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include "go-action-combo-pixmaps.h"
#include "go-combo-pixmaps.h"
#include "go-combo-box.h"
@@ -84,8 +85,9 @@ make_icon (GtkAction *a, const char *stock_id, GtkWidget *tool)
if (stock_id == NULL)
return NULL;
if (GO_IS_TOOL_COMBO_PIXMAPS (tool)) {
- if (tool->parent)
- size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (tool->parent));
+ GtkWidget *parent = gtk_widget_get_parent (tool);
+ if (parent)
+ size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (parent));
else {
GtkSettings *settings = gtk_widget_get_settings (tool);
g_object_get (settings, "gtk-toolbar-icon-size", &size, NULL);
diff --git a/goffice/gtk/go-action-combo-stack.c b/goffice/gtk/go-action-combo-stack.c
index a6a24d1..d3230a5 100644
--- a/goffice/gtk/go-action-combo-stack.c
+++ b/goffice/gtk/go-action-combo-stack.c
@@ -19,6 +19,7 @@
* USA
*/
#include <goffice/goffice-config.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include "go-action-combo-stack.h"
#include "go-combo-box.h"
#include "goffice-gtk.h"
@@ -162,7 +163,7 @@ go_combo_stack_init (GOComboStack *stack)
stack->button = gtk_toggle_button_new ();
gtk_button_set_relief (GTK_BUTTON (stack->button), GTK_RELIEF_NONE);
- GTK_WIDGET_UNSET_FLAGS (stack->button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (stack->button, FALSE);
stack->list = (GtkTreeView *)gtk_tree_view_new ();
selection = gtk_tree_view_get_selection (stack->list);
diff --git a/goffice/gtk/go-color-palette.c b/goffice/gtk/go-color-palette.c
index 8fb17b6..88dd729 100644
--- a/goffice/gtk/go-color-palette.c
+++ b/goffice/gtk/go-color-palette.c
@@ -29,6 +29,7 @@
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <goffice/utils/go-marshalers.h>
#include <gdk/gdkkeysyms.h>
@@ -150,12 +151,13 @@ static GtkWidget *
create_color_sel (GObject *action_proxy, GOColor c, GCallback handler, gboolean allow_alpha)
{
char *title = g_object_get_data (G_OBJECT (action_proxy), "title");
- GtkWidget *w = gtk_color_selection_dialog_new (title);
+ GtkWidget *w = gtk_color_selection_dialog_new (title), *hb;
GtkColorSelectionDialog *dialog = GTK_COLOR_SELECTION_DIALOG (w);
- GtkColorSelection *colorsel = GTK_COLOR_SELECTION (dialog->colorsel);
+ GtkColorSelection *colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (dialog));
GdkColor gdk;
- gtk_widget_hide (dialog->help_button);
+ g_object_get (G_OBJECT (w), "help-button", &hb, NULL);
+ gtk_widget_hide (hb);
gtk_color_selection_set_current_color (colorsel,
go_color_to_gdk (c, &gdk));
gtk_color_selection_set_has_opacity_control (colorsel, allow_alpha);
@@ -175,7 +177,7 @@ handle_color_sel (GtkColorSelectionDialog *dialog,
{
if (response_id == GTK_RESPONSE_OK) {
GdkColor gdk;
- GtkColorSelection *colorsel = GTK_COLOR_SELECTION (dialog->colorsel);
+ GtkColorSelection *colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (dialog));
guint16 alpha = gtk_color_selection_get_current_alpha (colorsel);
gtk_color_selection_get_current_color (colorsel, &gdk);
@@ -290,12 +292,14 @@ swatch_activated (GOColorPalette *pal, GtkBin *button)
{
GList *tmp = gtk_container_get_children (GTK_CONTAINER (gtk_bin_get_child (button)));
GtkWidget *swatch = (tmp != NULL) ? tmp->data : NULL;
+ GtkStyle *style;
g_list_free (tmp);
g_return_if_fail (swatch != NULL);
- set_color (pal, GO_COLOR_FROM_GDK (swatch->style->bg[GTK_STATE_NORMAL]),
+ style = gtk_widget_get_style (swatch);
+ set_color (pal, GO_COLOR_FROM_GDK (style->bg[GTK_STATE_NORMAL]),
FALSE, TRUE, FALSE);
}
diff --git a/goffice/gtk/go-color-selector.c b/goffice/gtk/go-color-selector.c
index 4f66319..daa0b38 100644
--- a/goffice/gtk/go-color-selector.c
+++ b/goffice/gtk/go-color-selector.c
@@ -20,6 +20,7 @@
*/
#include <goffice/goffice-config.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include "go-color-selector.h"
@@ -156,7 +157,7 @@ cb_color_dialog_response (GtkColorSelectionDialog *color_dialog,
{
GtkWidget *color_selection;
- color_selection = GTK_COLOR_SELECTION_DIALOG (color_dialog)->colorsel;
+ color_selection = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (color_dialog));
if (response == GTK_RESPONSE_OK) {
GOColorSelectorState *state;
@@ -191,7 +192,7 @@ cb_combo_custom_activate (GOPalette *palette, GOSelector *selector)
color_dialog = g_object_get_data (G_OBJECT (selector), "color-dialog");
if (color_dialog != NULL) {
- color_selection = GTK_COLOR_SELECTION_DIALOG (color_dialog)->colorsel;
+ color_selection = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (color_dialog));
color = go_color_selector_get_color (selector, NULL);
gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (color_selection),
go_color_to_gdk (color, &gdk_color));
@@ -203,7 +204,7 @@ cb_combo_custom_activate (GOPalette *palette, GOSelector *selector)
}
color_dialog = gtk_color_selection_dialog_new (_("Custom color..."));
- color_selection = GTK_COLOR_SELECTION_DIALOG (color_dialog)->colorsel;
+ color_selection = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (color_dialog));
gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (color_selection), state->allow_alpha);
g_object_set_data_full (G_OBJECT (selector), "color-dialog", color_dialog,
(GDestroyNotify) gtk_widget_destroy);
@@ -218,10 +219,10 @@ cb_combo_custom_activate (GOPalette *palette, GOSelector *selector)
}
static void
-go_color_selector_drag_data_received (GOSelector *selector, gpointer data)
+go_color_selector_drag_data_received (GOSelector *selector, guchar const *data)
{
GOColor color = GO_COLOR_WHITE;
- guint16 *color_data = data;
+ guint16 const *color_data = (guint16 const *) data;
color = GO_COLOR_CHANGE_R (color, color_data[0] >> 8);
color = GO_COLOR_CHANGE_G (color, color_data[1] >> 8);
diff --git a/goffice/gtk/go-combo-box.c b/goffice/gtk/go-combo-box.c
index 93aaa3e..3454824 100644
--- a/goffice/gtk/go-combo-box.c
+++ b/goffice/gtk/go-combo-box.c
@@ -25,6 +25,7 @@
*/
#include <goffice/goffice-config.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include "go-combo-box.h"
#include <goffice/utils/go-marshalers.h>
#include <goffice/gtk/goffice-gtk.h>
@@ -88,7 +89,7 @@ go_combo_popup_reparent (GtkWidget *popup,
if (unrealize) {
g_object_ref (popup);
- gtk_container_remove (GTK_CONTAINER (popup->parent), popup);
+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (popup)), popup);
gtk_container_add (GTK_CONTAINER (new_parent), popup);
g_object_unref (popup);
}
@@ -146,13 +147,10 @@ do_focus_change (GtkWidget *widget, gboolean in)
g_object_ref (widget);
- if (in)
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- else
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
+ gtk_widget_set_has_focus (widget, in);
fevent.type = GDK_FOCUS_CHANGE;
- fevent.window = widget->window;
+ fevent.window = gtk_widget_get_window (widget);
fevent.in = in;
gtk_widget_event (widget, (GdkEvent *)&fevent);
@@ -187,8 +185,7 @@ go_combo_box_popup_hide_unconditional (GOComboBox *combo_box)
gtk_widget_hide (combo_box->priv->toplevel);
gtk_widget_hide (combo_box->priv->popup);
if (combo_box->priv->torn_off) {
- GTK_TEAROFF_MENU_ITEM (combo_box->priv->tearable)->torn_off
- = FALSE;
+ gtk_tearoff_menu_item_set_torn_off (GTK_TEAROFF_MENU_ITEM (combo_box->priv->tearable), FALSE);
go_combo_set_tearoff_state (combo_box, FALSE);
}
@@ -217,7 +214,7 @@ cb_arrow_pressed (GOComboBox *combo_box)
{
if (!combo_box->priv->updating_buttons) {
if (combo_box->priv->toplevel == NULL ||
- !GTK_WIDGET_VISIBLE (combo_box->priv->toplevel))
+ !gtk_widget_get_visible (combo_box->priv->toplevel))
go_combo_box_popup_display (combo_box);
else
go_combo_box_popup_hide_unconditional (combo_box);
@@ -254,7 +251,7 @@ go_combo_box_realize (GtkWidget *widget)
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
GDK_TOP_LEFT_ARROW);
gtk_widget_realize (combo->priv->popup);
- gdk_window_set_cursor (combo->priv->popup->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (combo->priv->popup), cursor);
gdk_cursor_unref (cursor);
((GtkWidgetClass *)go_combo_box_parent_class)->realize (widget);
@@ -346,7 +343,7 @@ go_combo_popup_tear_off (GOComboBox *combo, gboolean set_position)
gtk_widget_realize (tearoff);
title = go_combo_box_get_title (combo);
if (title)
- gdk_window_set_title (tearoff->window, title);
+ gdk_window_set_title (gtk_widget_get_window (tearoff), title);
g_object_set (G_OBJECT (tearoff),
"allow-shrink", FALSE,
"allow-grow", TRUE,
@@ -357,7 +354,7 @@ go_combo_popup_tear_off (GOComboBox *combo, gboolean set_position)
GTK_WIDGET (combo)));
}
- if (GTK_WIDGET_VISIBLE (combo->priv->popup)) {
+ if (gtk_widget_get_visible (combo->priv->popup)) {
gtk_widget_hide (combo->priv->toplevel);
gtk_grab_remove (combo->priv->toplevel);
@@ -393,7 +390,7 @@ go_combo_box_popup_hide (GOComboBox *combo_box)
{
if (!combo_box->priv->torn_off)
go_combo_box_popup_hide_unconditional (combo_box);
- else if (GTK_WIDGET_VISIBLE (combo_box->priv->toplevel)) {
+ else if (gtk_widget_get_visible(combo_box->priv->toplevel)) {
/* Both popup and tearoff window present. Get rid of just
the popup shell. */
go_combo_popup_tear_off (combo_box, FALSE);
@@ -410,13 +407,16 @@ go_combo_box_get_pos (GOComboBox *combo_box, int *x, int *y)
GtkWidget *wcombo = GTK_WIDGET (combo_box);
GdkScreen *screen = gtk_widget_get_screen (wcombo);
int ph, pw;
+ GtkAllocation allocation;
- gdk_window_get_origin (wcombo->window, x, y);
- *y += wcombo->allocation.height + wcombo->allocation.y;
- *x += wcombo->allocation.x;
+ gdk_window_get_origin (gtk_widget_get_window (wcombo), x, y);
+ gtk_widget_get_allocation (wcombo, &allocation);
+ *y += allocation.height + allocation.y;
+ *x += allocation.x;
- ph = combo_box->priv->popup->allocation.height;
- pw = combo_box->priv->popup->allocation.width;
+ gtk_widget_get_allocation (combo_box->priv->popup, &allocation);
+ ph = allocation.height;
+ pw = allocation.width;
if ((*y + ph) > gdk_screen_get_height (screen))
*y = gdk_screen_get_height (screen) - ph;
@@ -437,30 +437,32 @@ go_combo_tearoff_bg_copy (GOComboBox *combo)
GdkPixmap *pixmap;
GdkGC *gc;
GdkGCValues gc_values;
+ GtkAllocation allocation;
GtkWidget *widget = combo->priv->popup;
if (combo->priv->torn_off) {
gc_values.subwindow_mode = GDK_INCLUDE_INFERIORS;
- gc = gdk_gc_new_with_values (widget->window,
+ gc = gdk_gc_new_with_values (gtk_widget_get_window (widget),
&gc_values, GDK_GC_SUBWINDOW);
- pixmap = gdk_pixmap_new (widget->window,
- widget->allocation.width,
- widget->allocation.height,
+ gtk_widget_get_allocation (widget, &allocation);
+ pixmap = gdk_pixmap_new (gtk_widget_get_window (widget),
+ allocation.width,
+ allocation.height,
-1);
gdk_draw_drawable (pixmap, gc,
- widget->window,
+ gtk_widget_get_window (widget),
0, 0, 0, 0, -1, -1);
g_object_unref (gc);
gtk_widget_set_size_request (combo->priv->tearoff_window,
- widget->allocation.width,
- widget->allocation.height);
+ allocation.width,
+ allocation.height);
gdk_window_set_back_pixmap
- (combo->priv->tearoff_window->window, pixmap, FALSE);
+ (gtk_widget_get_window (combo->priv->tearoff_window), pixmap, FALSE);
g_object_unref (pixmap);
}
}
@@ -499,7 +501,7 @@ go_combo_box_popup_display (GOComboBox *combo_box)
do_focus_change (combo_box->priv->toplevel, TRUE);
gtk_grab_add (combo_box->priv->toplevel);
- gdk_pointer_grab (combo_box->priv->toplevel->window, TRUE,
+ gdk_pointer_grab (gtk_widget_get_window (combo_box->priv->toplevel), TRUE,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK,
@@ -515,7 +517,7 @@ go_combo_box_button_press (GtkWidget *widget, GdkEventButton *event, GOComboBox
while (child){
if (child == widget)
return FALSE;
- child = child->parent;
+ child = gtk_widget_get_parent (child);
}
}
@@ -526,7 +528,7 @@ go_combo_box_button_press (GtkWidget *widget, GdkEventButton *event, GOComboBox
static void
cb_state_change (GtkWidget *widget, GtkStateType old_state, GOComboBox *combo_box)
{
- GtkStateType const new_state = GTK_WIDGET_STATE (widget);
+ GtkStateType const new_state = gtk_widget_get_state (widget);
if (combo_box->priv->display_widget)
gtk_widget_set_state (combo_box->priv->display_widget,
new_state);
@@ -542,7 +544,7 @@ go_combo_box_init (GOComboBox *combo_box)
combo_box->priv->arrow_button = gtk_toggle_button_new ();
gtk_button_set_relief (GTK_BUTTON (combo_box->priv->arrow_button), GTK_RELIEF_NONE);
- GTK_WIDGET_UNSET_FLAGS (combo_box->priv->arrow_button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (combo_box->priv->arrow_button, FALSE);
arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (combo_box->priv->arrow_button), arrow);
@@ -675,7 +677,7 @@ cb_tearable_button_release (GtkWidget *w, GdkEventButton *event,
g_return_val_if_fail (GTK_IS_TEAROFF_MENU_ITEM (w), FALSE);
tearable = GTK_TEAROFF_MENU_ITEM (w);
- tearable->torn_off = !tearable->torn_off;
+ gtk_tearoff_menu_item_set_torn_off (tearable, !gtk_tearoff_menu_item_get_torn_off (tearable));
if (!combo->priv->torn_off) {
gboolean need_connect;
@@ -703,8 +705,8 @@ go_combo_box_construct (GOComboBox *combo,
g_return_if_fail (GO_IS_COMBO_BOX (combo));
- GTK_BOX (combo)->spacing = 0;
- GTK_BOX (combo)->homogeneous = FALSE;
+ gtk_box_set_spacing (GTK_BOX (combo), 0);
+ gtk_box_set_homogeneous (GTK_BOX (combo), FALSE);
combo->priv->popdown_container = popdown_container;
combo->priv->display_widget = NULL;
diff --git a/goffice/gtk/go-combo-text.c b/goffice/gtk/go-combo-text.c
index b948774..6cdeebc 100644
--- a/goffice/gtk/go-combo-text.c
+++ b/goffice/gtk/go-combo-text.c
@@ -110,8 +110,9 @@ static void
cb_scroll_size_request (GtkWidget *widget, GtkRequisition *requisition,
GOComboText *ct)
{
- GtkRequisition list_req;
- int mon_width, mon_height;
+ GtkRequisition list_req, w_req;
+ GtkAllocation allocation;
+ int mon_width, mon_height, border_width;
GdkRectangle rect;
GdkScreen *screen;
@@ -125,6 +126,7 @@ cb_scroll_size_request (GtkWidget *widget, GtkRequisition *requisition,
gdk_screen_get_monitor_geometry (screen, 0, &rect);
mon_width = rect.width;
mon_height = rect.height;
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_widget_size_request (ct->list, &list_req);
if (requisition->height < list_req.height) {
@@ -136,10 +138,11 @@ cb_scroll_size_request (GtkWidget *widget, GtkRequisition *requisition,
* overflow the screen, but no more than 20. */
int avail_height, nitems;
+ gtk_widget_get_child_requisition (GTK_WIDGET (w), &w_req);
avail_height = mon_height - 20
- - GTK_CONTAINER (widget)->border_width * 2 + 4;
- nitems = MIN (20, avail_height * ct->rows / w->requisition.height);
- height = nitems * w->requisition.height / ct->rows;
+ - border_width * 2 + 4;
+ nitems = MIN (20, avail_height * ct->rows / w_req.height);
+ height = nitems * w_req.height / ct->rows;
if (height > list_req.height)
height = list_req.height;
}
@@ -148,12 +151,12 @@ cb_scroll_size_request (GtkWidget *widget, GtkRequisition *requisition,
* without it things end up scrolling.
*/
requisition->height = height +
- GTK_CONTAINER (widget)->border_width * 2 + 4;
+ border_width * 2 + 4;
}
+ gtk_widget_get_allocation (ct->entry, &allocation);
requisition->width = MAX (requisition->width,
- ct->entry->allocation.width +
- GTK_CONTAINER (widget)->border_width * 2);
+ allocation.width + border_width * 2);
requisition->width = MIN (requisition->width, mon_width - 20);
requisition->height = MIN (requisition->height, mon_height - 20);
}
diff --git a/goffice/gtk/go-font-sel.c b/goffice/gtk/go-font-sel.c
index 5559ee4..7c719a2 100644
--- a/goffice/gtk/go-font-sel.c
+++ b/goffice/gtk/go-font-sel.c
@@ -10,6 +10,7 @@
*/
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n-lib.h>
@@ -88,10 +89,14 @@ cb_list_adjust (GtkTreeView* view)
int pos, height, child_height;
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (view), &model, &iter)) {
+ GtkAllocation allocation;
+ GtkRequisition requisition;
+ gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
+ gtk_widget_get_child_requisition (GTK_WIDGET (view), &requisition);
path = gtk_tree_model_get_path (model, &iter);
scroll = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (view)));
- height = GTK_WIDGET (view)->allocation.height;
- child_height = GTK_WIDGET (view)->requisition.height;
+ height = allocation.height;
+ child_height = requisition.height;
if (height < child_height) {
gtk_tree_view_get_cell_area (view, path, NULL, &rect);
adj = gtk_scrolled_window_get_vadjustment (scroll);
@@ -225,7 +230,7 @@ select_row (GtkTreeView *list, int row)
path = gtk_tree_path_new_from_indices (row, -1);
gtk_tree_selection_select_path (gtk_tree_view_get_selection (list), path);
- if (GTK_WIDGET_REALIZED (list))
+ if (gtk_widget_is_realized (list))
cb_list_adjust (list);
gtk_tree_path_free (path);
}
diff --git a/goffice/gtk/go-format-sel.c b/goffice/gtk/go-format-sel.c
index a6b2c77..b5c1a9a 100644
--- a/goffice/gtk/go-format-sel.c
+++ b/goffice/gtk/go-format-sel.c
@@ -22,6 +22,7 @@
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
#include <goffice/utils/go-marshalers.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n-lib.h>
@@ -283,7 +284,7 @@ cb_decimals_changed (GtkSpinButton *spin, GOFormatSel *gfs)
gfs->format.details.num_decimals =
gtk_spin_button_get_value_as_int (spin);
- if (GTK_WIDGET_VISIBLE (gfs->format.widget[F_NEGATIVE]))
+ if (gtk_widget_get_visible (gfs->format.widget[F_NEGATIVE]))
fillin_negative_samples (gfs);
draw_format_preview (gfs, TRUE);
@@ -295,7 +296,7 @@ cb_separator_toggle (GtkObject *obj, GOFormatSel *gfs)
gfs->format.details.thousands_sep =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (obj));
- if (GTK_WIDGET_VISIBLE (gfs->format.widget[F_NEGATIVE]))
+ if (gtk_widget_get_visible (gfs->format.widget[F_NEGATIVE]))
fillin_negative_samples (gfs);
draw_format_preview (gfs, TRUE);
@@ -641,9 +642,9 @@ stays:
}
if (show_widget) {
- while (!GTK_WIDGET_VISIBLE (w)) {
+ while (!gtk_widget_get_visible (w)) {
gtk_widget_show (w);
- w = w->parent;
+ w = gtk_widget_get_parent (w);
}
}
}
@@ -758,7 +759,7 @@ cb_format_currency_select (G_GNUC_UNUSED GtkWidget *ct,
}
}
- if (GTK_WIDGET_VISIBLE (gfs->format.widget[F_NEGATIVE]))
+ if (gtk_widget_get_visible (gfs->format.widget[F_NEGATIVE]))
fillin_negative_samples (gfs);
draw_format_preview (gfs, TRUE);
diff --git a/goffice/gtk/go-graph-widget.c b/goffice/gtk/go-graph-widget.c
index 085455a..5c12180 100644
--- a/goffice/gtk/go-graph-widget.c
+++ b/goffice/gtk/go-graph-widget.c
@@ -24,6 +24,7 @@
#include <goffice/graph/gog-object.h>
#include <goffice/graph/gog-renderer.h>
#include <goffice/math/go-math.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gsf/gsf-impl-utils.h>
@@ -118,8 +119,7 @@ go_graph_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
update_image_rect (GO_GRAPH_WIDGET (widget), *allocation);
- GTK_LAYOUT (widget)->width = w->width + w->xoffset;
- GTK_LAYOUT (widget)->height = w->height + w->yoffset;
+ gtk_layout_set_size (GTK_LAYOUT (widget), w->width + w->xoffset, w->height + w->yoffset);
GTK_WIDGET_CLASS (graph_parent_klass)->size_allocate (widget, allocation);
}
@@ -129,11 +129,11 @@ static gboolean
go_graph_widget_expose_event (GtkWidget *widget, GdkEventExpose *event)
{
GOGraphWidget *w = GO_GRAPH_WIDGET (widget);
- GdkDrawable *drawable = GTK_LAYOUT (widget)->bin_window;
+ GdkDrawable *drawable = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
cairo_t *cairo;
cairo_surface_t *surface;
- if (event->window != GTK_LAYOUT (widget)->bin_window)
+ if (event->window != drawable)
return FALSE;
surface = gog_renderer_get_cairo_surface (w->renderer);
@@ -158,7 +158,7 @@ go_graph_widget_button_press_event (GtkWidget *widget,
if (event->type == GDK_BUTTON_PRESS) {
gw->button_pressed = TRUE;
- gdk_window_get_pointer (widget->window,
+ gdk_window_get_pointer (gtk_widget_get_window (widget),
&gw->button_press_x,
&gw->button_press_y,
NULL);
@@ -197,19 +197,26 @@ go_graph_widget_motion_notify_event (GtkWidget *widget,
double newval;
if (gw->button_pressed) {
- gdk_window_get_pointer (widget->window,
+ GtkAdjustment *hadjustment, *vadjustment;
+ hadjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (gw));
+ vadjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (gw));
+ gdk_window_get_pointer (gtk_widget_get_window (widget),
&x, &y, NULL);
- if (GTK_LAYOUT (gw)->hadjustment != NULL) {
- newval = gtk_adjustment_get_value (GTK_LAYOUT (gw)->hadjustment) - (x - gw->button_press_x);
- newval = CLAMP (newval, 0, GTK_LAYOUT (gw)->hadjustment->upper - GTK_LAYOUT (gw)->hadjustment->page_size);
- gtk_adjustment_set_value (GTK_LAYOUT (gw)->hadjustment, newval);
+ if (hadjustment != NULL) {
+ newval = gtk_adjustment_get_value (hadjustment) - (x - gw->button_press_x);
+ newval = CLAMP (newval, 0,
+ gtk_adjustment_get_upper (hadjustment) -
+ gtk_adjustment_get_page_size (hadjustment));
+ gtk_adjustment_set_value (hadjustment, newval);
}
- if (GTK_LAYOUT (gw)->vadjustment != NULL) {
- newval = gtk_adjustment_get_value (GTK_LAYOUT (gw)->vadjustment) - (y - gw->button_press_y);
- newval = CLAMP (newval, 0, GTK_LAYOUT (gw)->vadjustment->upper - GTK_LAYOUT (gw)->vadjustment->page_size);
- gtk_adjustment_set_value (GTK_LAYOUT (gw)->vadjustment, newval);
+ if (vadjustment != NULL) {
+ newval = gtk_adjustment_get_value (vadjustment) - (y - gw->button_press_y);
+ newval = CLAMP (newval, 0,
+ gtk_adjustment_get_upper (vadjustment) -
+ gtk_adjustment_get_page_size (vadjustment));
+ gtk_adjustment_set_value (vadjustment, newval);
}
gw->button_press_x = x;
@@ -237,11 +244,13 @@ go_graph_widget_finalize (GObject *object)
static gint
idle_handler (GOGraphWidget *w)
{
+ GtkAllocation allocation;
GDK_THREADS_ENTER ();
/* Reset idle id */
w->idle_id = 0;
- update_image_rect (w, GTK_WIDGET (w)->allocation);
+ gtk_widget_get_allocation (GTK_WIDGET (w), &allocation);
+ update_image_rect (w, allocation);
gtk_widget_queue_draw (GTK_WIDGET (w));
GDK_THREADS_LEAVE ();
@@ -399,6 +408,8 @@ go_graph_widget_set_size_mode (GOGraphWidget *widget,
int width,
int height)
{
+ GtkAllocation allocation;
+
g_return_if_fail (GO_IS_GRAPH_WIDGET (widget));
g_return_if_fail (size_mode >= GO_GRAPH_WIDGET_SIZE_MODE_FIT &&
size_mode <= GO_GRAPH_WIDGET_SIZE_MODE_FIXED_SIZE);
@@ -411,7 +422,8 @@ go_graph_widget_set_size_mode (GOGraphWidget *widget,
widget->requested_width = width;
widget->requested_height = height;
- update_image_rect (widget, GTK_WIDGET (widget)->allocation);
+ gtk_widget_get_allocation (GTK_WIDGET (widget), &allocation);
+ update_image_rect (widget, allocation);
}
/**
diff --git a/goffice/gtk/go-optionmenu.c b/goffice/gtk/go-optionmenu.c
index 8b75add..c5c3c30 100644
--- a/goffice/gtk/go-optionmenu.c
+++ b/goffice/gtk/go-optionmenu.c
@@ -33,6 +33,7 @@
#include <goffice/goffice-config.h>
#include "go-optionmenu.h"
+#include <goffice/gtk/go-gtk-compat.h>
#include <gdk/gdkkeysyms.h>
#include <glib/gi18n-lib.h>
@@ -74,7 +75,7 @@ go_option_menu_update_contents (GOOptionMenu *option_menu)
GtkWidget *w;
g_return_if_fail (GO_IS_OPTION_MENU (option_menu));
- w = GTK_BIN (option_menu->selected)->child;
+ w = gtk_bin_get_child (GTK_BIN (option_menu->selected));
text = g_object_get_data (G_OBJECT (w), "option-menu-text");
if (!text && GTK_IS_LABEL (w))
@@ -127,18 +128,20 @@ go_option_menu_position (GtkMenu *menu,
gint menu_xpos;
gint menu_ypos;
gint menu_width;
+ GtkAllocation allocation;
widget = GTK_WIDGET (option_menu);
gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition);
menu_width = requisition.width;
- gdk_window_get_origin (widget->window, &menu_xpos, &menu_ypos);
+ gdk_window_get_origin (gtk_widget_get_window (widget), &menu_xpos, &menu_ypos);
- menu_xpos += widget->allocation.x;
- menu_ypos += widget->allocation.y + widget->allocation.height / 2 - 2;
+ gtk_widget_get_allocation (widget, &allocation);
+ menu_xpos += allocation.x;
+ menu_ypos += allocation.y + allocation.height / 2 - 2;
- children = option_menu->menu->children;
+ children = gtk_container_get_children (GTK_CONTAINER (option_menu->menu));
while (children) {
GtkWidget *child = children->data;
@@ -149,7 +152,7 @@ go_option_menu_position (GtkMenu *menu,
break;
}
- if (GTK_WIDGET_VISIBLE (child)) {
+ if (gtk_widget_get_visible (child)) {
gtk_widget_get_child_requisition (child, &requisition);
menu_ypos -= requisition.height;
}
@@ -262,7 +265,7 @@ go_option_menu_set_menu (GOOptionMenu *option_menu,
return;
if (option_menu->menu) {
- if (option_menu->menu->active)
+ if (gtk_menu_shell_get_active (option_menu->menu))
gtk_menu_shell_cancel (option_menu->menu);
handle_menu_signals (option_menu, FALSE);
@@ -300,7 +303,7 @@ go_option_menu_set_history (GOOptionMenu *option_menu, GSList *selection)
while (1) {
int n = GPOINTER_TO_INT (selection->data);
- GtkMenuItem *item = g_list_nth_data (menu->children, n);
+ GtkMenuItem *item = g_list_nth_data (gtk_container_get_children (GTK_CONTAINER (menu)), n);
selection = selection->next;
if (selection)
menu = GTK_MENU_SHELL (gtk_menu_item_get_submenu (item));
@@ -424,8 +427,9 @@ go_option_menu_init (GOOptionMenu *option_menu)
GtkBox *box;
GtkWidget *arrow, *sep;
- GTK_WIDGET_SET_FLAGS (option_menu, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_DEFAULT | GTK_RECEIVES_DEFAULT);
+ gtk_widget_set_can_focus (GTK_WIDGET (option_menu), TRUE);
+ gtk_widget_set_can_default (GTK_WIDGET (option_menu), FALSE);
+ gtk_widget_set_receives_default (GTK_WIDGET (option_menu), FALSE);
box = GTK_BOX (gtk_hbox_new (FALSE, FALSE));
diff --git a/goffice/gtk/go-palette.c b/goffice/gtk/go-palette.c
index e22636e..4de7fdd 100644
--- a/goffice/gtk/go-palette.c
+++ b/goffice/gtk/go-palette.c
@@ -21,6 +21,7 @@
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdkkeysyms.h>
@@ -208,54 +209,21 @@ cb_swatch_expose (GtkWidget *swatch, GdkEventExpose *event, GOPalette *palette)
cairo_t *cr;
GdkRectangle area;
int index;
+ GtkAllocation allocation;
-#if GTK_CHECK_VERSION(2,8,0)
-
- cr = gdk_cairo_create (swatch->window);
+ cr = gdk_cairo_create (gtk_widget_get_window (swatch));
+ gtk_widget_get_allocation (swatch, &allocation);
area.x = 0;
area.y = 0;
- area.width = swatch->allocation.width;
- area.height = swatch->allocation.height;
+ area.width = allocation.width;
+ area.height = allocation.height;
index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (swatch), "index"));
(palette->priv->swatch_render) (cr, &area, index, palette->priv->data);
cairo_destroy (cr);
-
-#else /* if GTK < 2.8.0 */
-
-#warning [GOPalette:cb_swatch_expose] Use of old version of gtk (<2.8.0)
-
- GdkPixbuf *pixbuf;
- GOImage *image;
-
- area.x = 0;
- area.y = 0;
- area.width = swatch->allocation.width;
- area.height = swatch->allocation.height;
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
- area.width, area.height);
- image = go_image_new_from_pixbuf (pixbuf);
- g_object_unref (pixbuf);
-
- cr = go_image_get_cairo (image);
-
- index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (swatch), "index"));
-
- (palette->priv->swatch_render) (cr, &area, index, palette->priv->data);
-
- cairo_destroy (cr);
- pixbuf = go_image_get_pixbuf (image);
-
- gdk_draw_pixbuf (GDK_DRAWABLE (swatch->window), NULL, pixbuf,
- 0, 0, 0, 0, area.width, area.height,
- GDK_RGB_DITHER_NONE, 0, 0);
-
- g_object_unref (image);
-#endif
}
return TRUE;
}
@@ -265,7 +233,7 @@ cb_menu_item_activate (GtkWidget *item, GOPalette *palette)
{
int index;
- index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (GTK_BIN (item)->child), "index"));
+ index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (gtk_bin_get_child (GTK_BIN (item))), "index"));
g_signal_emit (palette, go_palette_signals[GO_PALETTE_ACTIVATE], 0, index);
}
diff --git a/goffice/gtk/go-rotation-sel.c b/goffice/gtk/go-rotation-sel.c
index e6d2292..c4e8116 100644
--- a/goffice/gtk/go-rotation-sel.c
+++ b/goffice/gtk/go-rotation-sel.c
@@ -104,7 +104,7 @@ cb_rotate_canvas_realize (GocCanvas *canvas, GORotationSel *grs)
GocGroup *group = goc_canvas_get_root (canvas);
int i;
GOStyle *go_style;
- GtkStyle *style = gtk_style_copy (GTK_WIDGET (canvas)->style);
+ GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (canvas)));
style->bg[GTK_STATE_NORMAL] = style->white;
gtk_widget_set_style (GTK_WIDGET (canvas), style);
g_object_unref (style);
@@ -186,7 +186,7 @@ cb_rotate_canvas_button (GocCanvas *canvas, GdkEventButton *event, GORotationSel
if (event->type == GDK_BUTTON_PRESS) {
set_rot_from_point (grs, event->x, event->y);
if (grs->motion_handle == 0) {
- gdk_pointer_grab (canvas->base.bin_window, FALSE,
+ gdk_pointer_grab (gtk_layout_get_bin_window (&canvas->base), FALSE,
GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
diff --git a/goffice/gtk/go-selector.c b/goffice/gtk/go-selector.c
index 60842e2..5d43515 100644
--- a/goffice/gtk/go-selector.c
+++ b/goffice/gtk/go-selector.c
@@ -21,6 +21,7 @@
#include <goffice/goffice-config.h>
#include <goffice/gtk/goffice-gtk.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include "go-selector.h"
@@ -228,10 +229,10 @@ go_selector_popup (GOSelector *selector)
priv = selector->priv;
- if (!GTK_WIDGET_REALIZED (selector))
+ if (!gtk_widget_is_realized (selector))
return;
- if (GTK_WIDGET_MAPPED (priv->palette))
+ if (gtk_widget_is_mapped (priv->palette))
return;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), TRUE);
@@ -461,11 +462,11 @@ go_selector_drag_data_received (GtkWidget *button,
{
GOSelectorPrivate *priv = selector->priv;
- if (selection_data->length != priv->dnd_length ||
+ if (gtk_selection_data_get_length (selection_data) != priv->dnd_length ||
priv->dnd_data_received == NULL)
return;
- (priv->dnd_data_received) (selector, selection_data->data);
+ (priv->dnd_data_received) (selector, gtk_selection_data_get_data (selection_data));
}
static void
@@ -505,7 +506,8 @@ go_selector_drag_data_get (GtkWidget *button,
data = (priv->dnd_data_get) (selector);
if (data != NULL) {
- gtk_selection_data_set (selection_data, selection_data->target,
+ gtk_selection_data_set (selection_data,
+ gtk_selection_data_get_target (selection_data),
8, data, priv->dnd_length);
g_free (data);
}
diff --git a/goffice/gtk/go-selector.h b/goffice/gtk/go-selector.h
index 6a5e8c2..5c53381 100644
--- a/goffice/gtk/go-selector.h
+++ b/goffice/gtk/go-selector.h
@@ -64,7 +64,7 @@ void go_selector_activate (GOSelector *selector);
gpointer go_selector_get_user_data (GOSelector *selector);
-typedef void (*GOSelectorDndDataReceived) (GOSelector *selector, gpointer data);
+typedef void (*GOSelectorDndDataReceived) (GOSelector *selector, guchar const *data);
typedef gpointer (*GOSelectorDndDataGet) (GOSelector *selector);
typedef void (*GOSelectorDndFillIcon) (GOSelector *selector, GdkPixbuf *pixbuf);
diff --git a/goffice/gtk/goffice-gtk.c b/goffice/gtk/goffice-gtk.c
index 260531c..10e90e3 100644
--- a/goffice/gtk/goffice-gtk.c
+++ b/goffice/gtk/goffice-gtk.c
@@ -22,6 +22,7 @@
#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
#include <goffice/goffice-priv.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <gdk/gdkkeysyms.h>
#include <atk/atkrelation.h>
@@ -89,7 +90,7 @@ go_gtk_dialog_add_button (GtkDialog *dialog, char const* text, char const* stock
button = go_gtk_button_new_with_stock (text, stock_id);
g_return_val_if_fail (button != NULL, NULL);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -268,8 +269,9 @@ go_gtk_builder_group_value (GtkBuilder *gui, char const * const group[])
static void
cb_activate_default (GtkWindow *window)
{
- if (window->default_widget && GTK_WIDGET_IS_SENSITIVE (window->default_widget))
- gtk_widget_activate (window->default_widget);
+ GtkWidget *w = gtk_window_get_default_widget (window);
+ if (w && gtk_widget_is_sensitive (w))
+ gtk_widget_activate (w);
}
/**
@@ -304,7 +306,7 @@ go_gtk_widget_disable_focus (GtkWidget *w)
if (GTK_IS_CONTAINER (w))
gtk_container_foreach (GTK_CONTAINER (w),
(GtkCallback) go_gtk_widget_disable_focus, NULL);
- GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (w, FALSE);
}
/**
@@ -335,7 +337,7 @@ go_pango_measure_string (PangoContext *context, PangoFontDescription const *font
static void
cb_parent_mapped (GtkWidget *parent, GtkWindow *window)
{
- if (GTK_WIDGET_MAPPED (window)) {
+ if (gtk_widget_is_mapped (window)) {
gtk_window_present (window);
g_signal_handlers_disconnect_by_func (G_OBJECT (parent),
G_CALLBACK (cb_parent_mapped), window);
@@ -370,7 +372,7 @@ go_gtk_window_set_transient (GtkWindow *toplevel, GtkWindow *window)
gtk_window_set_position (window, position);
- if (!GTK_WIDGET_MAPPED (toplevel))
+ if (!gtk_widget_is_mapped (toplevel))
g_signal_connect_after (G_OBJECT (toplevel),
"map",
G_CALLBACK (cb_parent_mapped), window);
@@ -1080,10 +1082,9 @@ go_gtk_notice_dialog (GtkWindow *parent, GtkMessageType type,
GtkWidget *dialog;
VPRINTF_MESSAGE (format, args, msg);
- dialog = gtk_message_dialog_new (parent,
+ dialog = gtk_message_dialog_new_with_markup (parent,
GTK_DIALOG_DESTROY_WITH_PARENT, type, GTK_BUTTONS_OK, "%s", msg);
g_free (msg);
- gtk_label_set_use_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), TRUE);
go_gtk_dialog_run (GTK_DIALOG (dialog), parent);
}
@@ -1216,7 +1217,7 @@ go_dialog_guess_alternative_button_order (GtkDialog *dialog)
gboolean any = FALSE;
int loops = 0;
- children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
+ children = gtk_container_get_children (GTK_CONTAINER (gtk_dialog_get_action_area (dialog)));
if (!children)
return;
@@ -1294,13 +1295,20 @@ go_menu_position_below (GtkMenu *menu,
GdkScreen *screen;
gint monitor_num;
GdkRectangle monitor;
+ GdkWindow *window = gtk_widget_get_window (widget);
+ GtkAllocation size;
+
+ gtk_widget_get_allocation (widget, &size);
- gdk_window_get_origin (widget->window, &sx, &sy);
+ if (window)
+ gdk_window_get_origin (window, &sx, &sy);
+ else
+ sx = sy = 0;
- if (GTK_WIDGET_NO_WINDOW (widget))
+ if (!gtk_widget_get_has_window (widget))
{
- sx += widget->allocation.x;
- sy += widget->allocation.y;
+ sx += size.x;
+ sy += size.y;
}
gtk_widget_size_request (GTK_WIDGET (menu), &req);
@@ -1308,11 +1316,11 @@ go_menu_position_below (GtkMenu *menu,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
*x = sx;
else
- *x = sx + widget->allocation.width - req.width;
+ *x = sx + size.width - req.width;
*y = sy;
screen = gtk_widget_get_screen (widget);
- monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
+ monitor_num = gdk_screen_get_monitor_at_window (screen, window);
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
if (*x < monitor.x)
@@ -1320,12 +1328,12 @@ go_menu_position_below (GtkMenu *menu,
else if (*x + req.width > monitor.x + monitor.width)
*x = monitor.x + monitor.width - req.width;
- if (monitor.y + monitor.height - *y - widget->allocation.height >= req.height)
- *y += widget->allocation.height;
+ if (monitor.y + monitor.height - *y - size.height >= req.height)
+ *y +=size.height;
else if (*y - monitor.y >= req.height)
*y -= req.height;
- else if (monitor.y + monitor.height - *y - widget->allocation.height > *y - monitor.y)
- *y += widget->allocation.height;
+ else if (monitor.y + monitor.height - *y - size.height > *y - monitor.y)
+ *y += size.height;
else
*y -= req.height;
diff --git a/goffice/utils/go-style.c b/goffice/utils/go-style.c
index cfb0cf0..1aa2c60 100644
--- a/goffice/utils/go-style.c
+++ b/goffice/utils/go-style.c
@@ -172,7 +172,7 @@ cb_outline_size_changed (GtkAdjustment *adj, StylePrefState *state)
g_return_if_fail (style != NULL);
- style->line.width = go_rint (adj->value * 100.) / 100.;
+ style->line.width = go_rint (gtk_adjustment_get_value (adj) * 100.) / 100.;
set_style (state);
}
@@ -247,7 +247,7 @@ cb_line_size_changed (GtkAdjustment *adj, StylePrefState const *state)
g_return_if_fail (style != NULL);
- style->line.width = go_rint (adj->value * 100.) / 100.;
+ style->line.width = go_rint (gtk_adjustment_get_value (adj) * 100.) / 100.;
set_style (state);
}
@@ -721,7 +721,7 @@ cb_marker_fill_color_changed (GOSelector *selector,
static void
cb_marker_size_changed (GtkAdjustment *adj, StylePrefState *state)
{
- go_marker_set_size (state->style->marker.mark, adj->value);
+ go_marker_set_size (state->style->marker.mark, gtk_adjustment_get_value (adj));
set_style (state);
}
diff --git a/plugins/plot_barcol/gog-barcol-prefs.c b/plugins/plot_barcol/gog-barcol-prefs.c
index 807d721..d999caf 100644
--- a/plugins/plot_barcol/gog-barcol-prefs.c
+++ b/plugins/plot_barcol/gog-barcol-prefs.c
@@ -23,19 +23,20 @@
#include "gog-barcol.h"
#include <goffice/gtk/goffice-gtk.h>
#include <goffice/app/go-plugin.h>
+#include <goffice/gtk/go-gtk-compat.h>
GtkWidget *gog_barcol_plot_pref (GogBarColPlot *plot, GOCmdContext *cc);
static void
-cb_gap_changed (GtkAdjustment *adj, GObject *barcal)
+cb_gap_changed (GtkAdjustment *adj, GObject *barcol)
{
- g_object_set (barcal, "gap-percentage", (int)adj->value, NULL);
+ g_object_set (barcol, "gap-percentage", (int) gtk_adjustment_get_value (adj), NULL);
}
static void
cb_overlap_changed (GtkAdjustment *adj, GObject *barcol)
{
- g_object_set (barcol, "overlap-percentage", (int)adj->value, NULL);
+ g_object_set (barcol, "overlap-percentage", (int) gtk_adjustment_get_value (adj), NULL);
}
GtkWidget *
diff --git a/plugins/plot_barcol/gog-minmax.c b/plugins/plot_barcol/gog-minmax.c
index 7c33454..4e9c856 100644
--- a/plugins/plot_barcol/gog-minmax.c
+++ b/plugins/plot_barcol/gog-minmax.c
@@ -30,6 +30,7 @@
#include <goffice/utils/go-persist.h>
#include <goffice/utils/go-styled-object.h>
#include <goffice/app/go-plugin.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <glib/gi18n-lib.h>
#include <gsf/gsf-impl-utils.h>
@@ -167,7 +168,7 @@ gog_minmax_axis_get_bounds (GogPlot *plot, GogAxisType axis,
static void
cb_gap_changed (GtkAdjustment *adj, GObject *minmax)
{
- g_object_set (minmax, "gap-percentage", (int)adj->value, NULL);
+ g_object_set (minmax, "gap-percentage", (int) gtk_adjustment_get_value (adj), NULL);
}
static void
diff --git a/plugins/plot_distrib/gog-boxplot.c b/plugins/plot_distrib/gog-boxplot.c
index 6dd5bbd..3212fa0 100644
--- a/plugins/plot_distrib/gog-boxplot.c
+++ b/plugins/plot_distrib/gog-boxplot.c
@@ -35,6 +35,7 @@
#include <goffice/utils/go-marker.h>
#include <goffice/utils/go-path.h>
#include <goffice/utils/go-persist.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <glib/gi18n-lib.h>
#include <gsf/gsf-impl-utils.h>
@@ -61,7 +62,7 @@ static GType gog_box_plot_view_get_type (void);
static void
cb_gap_changed (GtkAdjustment *adj, GObject *boxplot)
{
- g_object_set (boxplot, "gap-percentage", (int)adj->value, NULL);
+ g_object_set (boxplot, "gap-percentage", (int) gtk_adjustment_get_value (adj), NULL);
}
static void
@@ -97,7 +98,7 @@ cb_outliers_changed (GtkToggleButton *btn, GObject *boxplot)
static void
cb_ratio_changed (GtkAdjustment *adj, GObject *boxplot)
{
- g_object_set (boxplot, "radius-ratio", adj->value / 200., NULL);
+ g_object_set (boxplot, "radius-ratio", gtk_adjustment_get_value (adj) / 200., NULL);
}
static gpointer
diff --git a/plugins/plot_pie/gog-pie-prefs.c b/plugins/plot_pie/gog-pie-prefs.c
index 1827fdf..f1f30ba 100644
--- a/plugins/plot_pie/gog-pie-prefs.c
+++ b/plugins/plot_pie/gog-pie-prefs.c
@@ -24,13 +24,14 @@
#include <goffice/gtk/goffice-gtk.h>
#include <goffice/app/go-plugin.h>
+#include <goffice/gtk/go-gtk-compat.h>
GtkWidget *gog_pie_series_element_pref (GogPieSeriesElement *element, GOCmdContext *cc);
static void
cb_element_separation_changed (GtkAdjustment *adj, GObject *element)
{
- g_object_set (element, "separation", adj->value / 100., NULL);
+ g_object_set (element, "separation", gtk_adjustment_get_value (adj) / 100., NULL);
}
GtkWidget *
@@ -78,13 +79,13 @@ pie_pref_state_free (PiePrefState *state)
static void
cb_default_separation_changed (GtkAdjustment *adj, GObject *pie)
{
- g_object_set (pie, "default-separation", adj->value / 100., NULL);
+ g_object_set (pie, "default-separation", gtk_adjustment_get_value (adj) / 100., NULL);
}
static void
cb_rotation_changed (GtkAdjustment *adj, GObject *pie)
{
- g_object_set (pie, "initial-angle", adj->value, NULL);
+ g_object_set (pie, "initial-angle", gtk_adjustment_get_value (adj), NULL);
}
@@ -170,7 +171,7 @@ GtkWidget *gog_ring_plot_pref (GogRingPlot *ring, GOCmdContext *cc);
static void
cb_center_size_changed (GtkAdjustment *adj, GObject *ring)
{
- g_object_set (ring, "center-size", adj->value/100., NULL);
+ g_object_set (ring, "center-size", gtk_adjustment_get_value (adj) / 100., NULL);
}
diff --git a/plugins/plot_surface/gog-xyz-surface-prefs.c b/plugins/plot_surface/gog-xyz-surface-prefs.c
index bde1fba..c6eb5eb 100644
--- a/plugins/plot_surface/gog-xyz-surface-prefs.c
+++ b/plugins/plot_surface/gog-xyz-surface-prefs.c
@@ -23,6 +23,7 @@
#include "gog-xyz-surface.h"
#include <goffice/gtk/goffice-gtk.h>
#include <goffice/app/go-plugin.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <string.h>
@@ -31,13 +32,13 @@ GtkWidget *gog_xyz_surface_plot_pref (GogXYZSurfacePlot *plot, GOCmdContext *c
static void
cb_rows_changed (GtkAdjustment *adj, GObject *plot)
{
- g_object_set (plot, "rows", (int) adj->value, NULL);
+ g_object_set (plot, "rows", (int) gtk_adjustment_get_value (adj), NULL);
}
static void
cb_columns_changed (GtkAdjustment *adj, GObject *plot)
{
- g_object_set (plot, "columns", (int) adj->value, NULL);
+ g_object_set (plot, "columns", (int) gtk_adjustment_get_value (adj), NULL);
}
GtkWidget *
diff --git a/plugins/plot_xy/gog-bubble-prefs.c b/plugins/plot_xy/gog-bubble-prefs.c
index b72c8dd..e83f62a 100644
--- a/plugins/plot_xy/gog-bubble-prefs.c
+++ b/plugins/plot_xy/gog-bubble-prefs.c
@@ -23,6 +23,7 @@
#include "gog-xy.h"
#include <goffice/gtk/goffice-gtk.h>
#include <goffice/app/go-plugin.h>
+#include <goffice/gtk/go-gtk-compat.h>
#include <string.h>
@@ -60,7 +61,7 @@ cb_negatives_changed (GtkToggleButton* button, GObject *bubble)
static void
cb_scale_changed (GtkAdjustment *adj, GObject *bubble)
{
- g_object_set (bubble, "bubble-scale", adj->value / 100., NULL);
+ g_object_set (bubble, "bubble-scale", gtk_adjustment_get_value (adj) / 100., NULL);
}
GtkWidget *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]