[dia] Handle deprecations of gtk-2-18 and gtk-2-20
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Handle deprecations of gtk-2-18 and gtk-2-20
- Date: Fri, 16 Jul 2010 11:26:40 +0000 (UTC)
commit 75c452ad2daab31ae0ccaf4e88f521ce3704c6dd
Author: Hans Breuer <hans breuer org>
Date: Tue Jun 22 21:00:31 2010 +0200
Handle deprecations of gtk-2-18 and gtk-2-20
Here is still a bunch of older deprecations, but at least there are no new #undef GTK_DISABLE_DEPRECATED necessary
app/color_area.c | 4 ++++
app/diacanvas.c | 29 +++++++++++++++++++++++++++++
app/diagram_tree_view.c | 4 ++++
app/diagram_tree_window.c | 4 ++++
app/display.c | 8 ++++++++
app/filedlg.c | 8 ++++++++
app/gtkhwrapbox.c | 21 +++++++++++++++++++++
app/gtkvwrapbox.c | 21 +++++++++++++++++++++
app/gtkwrapbox.c | 41 +++++++++++++++++++++++++++++++++++++++++
app/interface.c | 12 ++++++++++++
app/navigation.c | 8 ++++++++
app/properties-dialog.c | 4 ++++
lib/diaarrowchooser.c | 16 ++++++++++++++++
lib/dialinechooser.c | 8 ++++++++
lib/persistence.c | 12 ++++++++++++
15 files changed, 200 insertions(+), 0 deletions(-)
---
diff --git a/app/color_area.c b/app/color_area.c
index 025ef2c..1e051b1 100644
--- a/app/color_area.c
+++ b/app/color_area.c
@@ -394,7 +394,11 @@ color_area_events (GtkWidget *widget,
color_area->allocation.height, 1);
break;
case GDK_EXPOSE:
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_is_drawable(color_area))
+#else
if (GTK_WIDGET_DRAWABLE (color_area))
+#endif
{
if (!color_area_gc)
{
diff --git a/app/diacanvas.c b/app/diacanvas.c
index 88904c7..0c0cb67 100644
--- a/app/diacanvas.c
+++ b/app/diacanvas.c
@@ -26,6 +26,7 @@
#include "diacanvas.h"
#include "intl.h"
+#include <gtk/gtkversion.h>
enum {
CHILD_PROP_0,
@@ -262,7 +263,11 @@ dia_canvas_move_internal (DiaCanvas *canvas,
gtk_widget_thaw_child_notify (widget);
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (widget) && gtk_widget_get_visible (canvas))
+#else
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (canvas))
+#endif
gtk_widget_queue_resize (GTK_WIDGET (canvas));
}
@@ -379,7 +384,11 @@ dia_canvas_size_request (GtkWidget *widget,
child = children->data;
children = children->next;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child->widget))
+#else
if (GTK_WIDGET_VISIBLE (child->widget))
+#endif
{
gtk_widget_size_request (child->widget, &child_requisition);
@@ -412,7 +421,11 @@ dia_canvas_size_allocate (GtkWidget *widget,
widget->allocation = *allocation;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_realized (widget)) {
+#else
if (GTK_WIDGET_REALIZED (widget)) {
+#endif
gdk_window_move_resize (widget->window,
allocation->x,
allocation->y,
@@ -428,13 +441,21 @@ dia_canvas_size_allocate (GtkWidget *widget,
child = children->data;
children = children->next;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child->widget))
+#else
if (GTK_WIDGET_VISIBLE (child->widget))
+#endif
{
gtk_widget_get_child_requisition (child->widget, &child_requisition);
child_allocation.x = child->x + border_width;
child_allocation.y = child->y + border_width;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_has_window (widget))
+#else
if (GTK_WIDGET_NO_WINDOW (widget))
+#endif
{
child_allocation.x += widget->allocation.x;
child_allocation.y += widget->allocation.y;
@@ -471,7 +492,11 @@ dia_canvas_remove (GtkContainer *container,
if (child->widget == widget)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ gboolean was_visible = gtk_widget_get_visible (widget);
+#else
gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
+#endif
gtk_widget_unparent (widget);
@@ -479,7 +504,11 @@ dia_canvas_remove (GtkContainer *container,
g_list_free (children);
g_free (child);
+#if GTK_CHECK_VERSION(2,20,0)
+ if (was_visible && gtk_widget_get_visible (container))
+#else
if (was_visible && GTK_WIDGET_VISIBLE (container))
+#endif
gtk_widget_queue_resize (GTK_WIDGET (container));
break;
diff --git a/app/diagram_tree_view.c b/app/diagram_tree_view.c
index 76aca77..6d30f68 100644
--- a/app/diagram_tree_view.c
+++ b/app/diagram_tree_view.c
@@ -525,7 +525,11 @@ diagram_tree_show (void)
G_CALLBACK (gtk_widget_destroyed),
&window);
+#if GTK_CHECK_VERSION(2,20,0)
+ if (!gtk_widget_get_visible (window))
+#else
if (!GTK_WIDGET_VISIBLE (window))
+#endif
gtk_widget_show_all (window);
}
gtk_window_present (GTK_WINDOW(window));
diff --git a/app/diagram_tree_window.c b/app/diagram_tree_window.c
index f69a325..db5ab91 100644
--- a/app/diagram_tree_window.c
+++ b/app/diagram_tree_window.c
@@ -130,7 +130,11 @@ create_diagram_tree_window(DiagramTreeConfig *config, GtkToggleAction *action)
if (!diagwindow_) {
diagwindow_ = diagram_tree_window_new(config_);
}
+#if GTK_CHECK_VERSION(2,20,0)
+ gtk_toggle_action_set_active(action, gtk_widget_get_realized(diagwindow_));
+#else
gtk_toggle_action_set_active(action, GTK_WIDGET_REALIZED(diagwindow_));
+#endif
}
/* menu callbacks */
diff --git a/app/display.c b/app/display.c
index 661d364..1886e89 100644
--- a/app/display.c
+++ b/app/display.c
@@ -1434,7 +1434,11 @@ void display_rulers_show (DDisplay *ddisp)
gtk_widget_show (ddisp->hrule);
gtk_widget_show (ddisp->vrule);
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (parent))
+#else
if (GTK_WIDGET_VISIBLE (parent))
+#endif
gtk_widget_queue_resize (parent);
ddisp->rulers_are_showing = TRUE;
@@ -1458,7 +1462,11 @@ void display_rulers_hide (DDisplay *ddisp)
gtk_widget_hide (ddisp->hrule);
gtk_widget_hide (ddisp->vrule);
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (parent))
+#else
if (GTK_WIDGET_VISIBLE (parent))
+#endif
gtk_widget_queue_resize (parent);
ddisp->rulers_are_showing = FALSE;
diff --git a/app/filedlg.c b/app/filedlg.c
index 1c68ba1..07e2299 100644
--- a/app/filedlg.c
+++ b/app/filedlg.c
@@ -299,7 +299,11 @@ file_open_callback(gpointer data, guint action, GtkWidget *widget)
G_CALLBACK(gtk_widget_destroyed), &opendlg);
} else {
gtk_widget_set_sensitive(opendlg, TRUE);
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible(opendlg))
+#else
if (GTK_WIDGET_VISIBLE(opendlg))
+#endif
return;
}
if (!gtk_file_chooser_get_extra_widget(GTK_FILE_CHOOSER(opendlg))) {
@@ -469,7 +473,11 @@ file_save_as_callback(gpointer data, guint action, GtkWidget *widget)
g_signal_handlers_unblock_by_func(G_OBJECT(compressbutton), toggle_compress_callback, NULL);
if (g_object_get_data (G_OBJECT (savedlg), "user_data") != NULL)
g_object_unref (g_object_get_data (G_OBJECT (savedlg), "user_data"));
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible(savedlg)) {
+#else
if (GTK_WIDGET_VISIBLE(savedlg)) {
+#endif
/* keep a refernce to the diagram */
g_object_ref(dia);
g_object_set_data (G_OBJECT (savedlg), "user_data", dia);
diff --git a/app/gtkhwrapbox.c b/app/gtkhwrapbox.c
index 00f1d23..30f5a46 100644
--- a/app/gtkhwrapbox.c
+++ b/app/gtkhwrapbox.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "gtkhwrapbox.h"
+#include <gtk/gtkversion.h>
/* --- prototypes --- */
@@ -140,7 +141,11 @@ get_layout_size (GtkHWrapBox *this,
GtkRequisition child_requisition;
guint row_width, row_height, n = 1;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (!gtk_widget_get_visible (child->widget))
+#else
if (!GTK_WIDGET_VISIBLE (child->widget))
+#endif
continue;
get_child_requisition (wbox, child->widget, &child_requisition);
@@ -150,7 +155,11 @@ get_layout_size (GtkHWrapBox *this,
row_height = child_requisition.height;
for (row_child = child->next; row_child && n < wbox->child_limit; row_child = row_child->next)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (row_child->widget))
+#else
if (GTK_WIDGET_VISIBLE (row_child->widget))
+#endif
{
get_child_requisition (wbox, row_child->widget, &child_requisition);
if (row_width + wbox->hspacing + child_requisition.width > max_width)
@@ -192,7 +201,11 @@ gtk_hwrap_box_size_request (GtkWidget *widget,
/* size_request all children */
for (child = wbox->children; child; child = child->next)
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child->widget))
+#else
if (GTK_WIDGET_VISIBLE (child->widget))
+#endif
{
GtkRequisition child_requisition;
@@ -251,7 +264,11 @@ reverse_list_row_children (GtkWrapBox *wbox,
*max_child_size = 0;
*expand_line = FALSE;
+#if GTK_CHECK_VERSION(2,20,0)
+ while (child && !gtk_widget_get_visible (child->widget))
+#else
while (child && !GTK_WIDGET_VISIBLE (child->widget))
+#endif
{
*child_p = child->next;
child = *child_p;
@@ -272,7 +289,11 @@ reverse_list_row_children (GtkWrapBox *wbox,
while (child && n < wbox->child_limit)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child->widget))
+#else
if (GTK_WIDGET_VISIBLE (child->widget))
+#endif
{
get_child_requisition (wbox, child->widget, &child_requisition);
if (width + wbox->hspacing + child_requisition.width > row_width ||
diff --git a/app/gtkvwrapbox.c b/app/gtkvwrapbox.c
index b940135..f648e0d 100644
--- a/app/gtkvwrapbox.c
+++ b/app/gtkvwrapbox.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "gtkvwrapbox.h"
+#include <gtk/gtkversion.h>
/* --- prototypes --- */
@@ -140,7 +141,11 @@ get_layout_size (GtkVWrapBox *this,
GtkRequisition child_requisition;
guint col_height, col_width, n = 1;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (!gtk_widget_get_visible (child->widget))
+#else
if (!GTK_WIDGET_VISIBLE (child->widget))
+#endif
continue;
get_child_requisition (wbox, child->widget, &child_requisition);
@@ -150,7 +155,11 @@ get_layout_size (GtkVWrapBox *this,
col_width = child_requisition.width;
for (col_child = child->next; col_child && n < wbox->child_limit; col_child = col_child->next)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (col_child->widget))
+#else
if (GTK_WIDGET_VISIBLE (col_child->widget))
+#endif
{
get_child_requisition (wbox, col_child->widget, &child_requisition);
if (col_height + wbox->vspacing + child_requisition.height > max_height)
@@ -192,7 +201,11 @@ gtk_vwrap_box_size_request (GtkWidget *widget,
/* size_request all children */
for (child = wbox->children; child; child = child->next)
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child->widget))
+#else
if (GTK_WIDGET_VISIBLE (child->widget))
+#endif
{
GtkRequisition child_requisition;
@@ -251,7 +264,11 @@ reverse_list_col_children (GtkWrapBox *wbox,
*max_child_size = 0;
*expand_line = FALSE;
+#if GTK_CHECK_VERSION(2,20,0)
+ while (child && !gtk_widget_get_visible (child->widget))
+#else
while (child && !GTK_WIDGET_VISIBLE (child->widget))
+#endif
{
*child_p = child->next;
child = *child_p;
@@ -272,7 +289,11 @@ reverse_list_col_children (GtkWrapBox *wbox,
while (child && n < wbox->child_limit)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child->widget))
+#else
if (GTK_WIDGET_VISIBLE (child->widget))
+#endif
{
get_child_requisition (wbox, child->widget, &child_requisition);
if (height + wbox->vspacing + child_requisition.height > col_height ||
diff --git a/app/gtkwrapbox.c b/app/gtkwrapbox.c
index dea2e50..a53f0a9 100644
--- a/app/gtkwrapbox.c
+++ b/app/gtkwrapbox.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "gtkwrapbox.h"
+#include <gtk/gtkversion.h>
/* --- properties --- */
@@ -618,12 +619,24 @@ gtk_wrap_box_pack_wrapped (GtkWrapBox *wbox,
gtk_widget_set_parent (child, GTK_WIDGET (wbox));
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_realized (wbox))
+#else
if (GTK_WIDGET_REALIZED (wbox))
+#endif
gtk_widget_realize (child);
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (wbox) && gtk_widget_get_visible (child))
+#else
if (GTK_WIDGET_VISIBLE (wbox) && GTK_WIDGET_VISIBLE (child))
+#endif
{
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_mapped (wbox))
+#else
if (GTK_WIDGET_MAPPED (wbox))
+#endif
gtk_widget_map (child);
gtk_widget_queue_resize (child);
@@ -676,7 +689,11 @@ gtk_wrap_box_reorder_child (GtkWrapBox *wbox,
wbox->children = child_info;
}
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child) && gtk_widget_get_visible (wbox))
+#else
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (wbox))
+#endif
gtk_widget_queue_resize (child);
}
}
@@ -749,7 +766,11 @@ gtk_wrap_box_set_child_packing (GtkWrapBox *wbox,
child_info->vfill = vfill;
child_info->wrapped = wrapped;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child) && gtk_widget_get_visible (wbox))
+#else
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (wbox))
+#endif
gtk_widget_queue_resize (child);
}
}
@@ -811,8 +832,16 @@ gtk_wrap_box_map (GtkWidget *widget)
GTK_WIDGET_SET_FLAGS (wbox, GTK_MAPPED);
for (child = wbox->children; child; child = child->next)
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child->widget) &&
+#else
if (GTK_WIDGET_VISIBLE (child->widget) &&
+#endif
+#if GTK_CHECK_VERSION(2,20,0)
+ !gtk_widget_get_mapped (child->widget))
+#else
!GTK_WIDGET_MAPPED (child->widget))
+#endif
gtk_widget_map (child->widget);
}
@@ -825,8 +854,16 @@ gtk_wrap_box_unmap (GtkWidget *widget)
GTK_WIDGET_UNSET_FLAGS (wbox, GTK_MAPPED);
for (child = wbox->children; child; child = child->next)
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_visible (child->widget) &&
+#else
if (GTK_WIDGET_VISIBLE (child->widget) &&
+#endif
+#if GTK_CHECK_VERSION(2,20,0)
+ gtk_widget_get_mapped (child->widget))
+#else
GTK_WIDGET_MAPPED (child->widget))
+#endif
gtk_widget_unmap (child->widget);
}
@@ -858,7 +895,11 @@ gtk_wrap_box_remove (GtkContainer *container,
{
gboolean was_visible;
+#if GTK_CHECK_VERSION(2,20,0)
+ was_visible = gtk_widget_get_visible (widget);
+#else
was_visible = GTK_WIDGET_VISIBLE (widget);
+#endif
gtk_widget_unparent (widget);
if (last)
diff --git a/app/interface.c b/app/interface.c
index 4c21789..4fffdd1 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -1863,7 +1863,11 @@ gboolean integrated_ui_main_toolbar_is_showing (void)
{
if (ui.toolbar)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ return gtk_widget_get_visible (ui.toolbar)? TRUE : FALSE;
+#else
return GTK_WIDGET_VISIBLE (ui.toolbar)? TRUE : FALSE;
+#endif
}
return FALSE;
}
@@ -1901,7 +1905,11 @@ gboolean integrated_ui_layer_view_is_showing (void)
{
if (ui.layer_view)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ return gtk_widget_get_visible (ui.layer_view)? TRUE : FALSE;
+#else
return GTK_WIDGET_VISIBLE (ui.layer_view)? TRUE : FALSE;
+#endif
}
return FALSE;
}
@@ -1941,7 +1949,11 @@ gboolean integrated_ui_main_statusbar_is_showing (void)
{
if (ui.statusbar)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ return gtk_widget_get_visible (ui.statusbar)? TRUE : FALSE;
+#else
return GTK_WIDGET_VISIBLE (ui.statusbar)? TRUE : FALSE;
+#endif
}
return FALSE;
}
diff --git a/app/navigation.c b/app/navigation.c
index 8d0abf0..19e3d3b 100644
--- a/app/navigation.c
+++ b/app/navigation.c
@@ -312,7 +312,11 @@ on_da_expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer unused)
{
/*refresh the part outdated by the event*/
gdk_draw_drawable (widget->window,
+#if GTK_CHECK_VERSION(2,18,0)
+ widget->style->fg_gc[gtk_widget_get_state (widget)],
+#else
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+#endif
GDK_PIXMAP(nav->buffer),
event->area.x, event->area.y,
event->area.x, event->area.y,
@@ -394,7 +398,11 @@ on_da_motion_notify_event (GtkWidget * drawing_area, GdkEventMotion * event, gpo
/*--Draw the miniframe*/
/*refresh from the buffer*/
gdk_draw_drawable (drawing_area->window,
+#if GTK_CHECK_VERSION(2,18,0)
+ drawing_area->style->fg_gc[gtk_widget_get_state (drawing_area)],
+#else
drawing_area->style->fg_gc[GTK_WIDGET_STATE (drawing_area)],
+#endif
GDK_PIXMAP(nav->buffer),
0, 0, 0, 0, nav->width, nav->height);
/*draw directly on the window, do not buffer the miniframe*/
diff --git a/app/properties-dialog.c b/app/properties-dialog.c
index 8a97edb..0a7dca3 100644
--- a/app/properties-dialog.c
+++ b/app/properties-dialog.c
@@ -183,7 +183,11 @@ properties_respond(GtkWidget *widget,
static void
properties_give_focus(GtkWidget *widget, gpointer data)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_can_focus(widget)) {
+#else
if (GTK_WIDGET_CAN_FOCUS(widget)) {
+#endif
gtk_widget_grab_focus(widget);
} else {
if (GTK_IS_CONTAINER(widget)) {
diff --git a/lib/diaarrowchooser.c b/lib/diaarrowchooser.c
index a73f5b1..411b525 100644
--- a/lib/diaarrowchooser.c
+++ b/lib/diaarrowchooser.c
@@ -151,7 +151,11 @@ dia_arrow_preview_set(DiaArrowPreview *arrow, ArrowType atype, gboolean left)
if (arrow->atype != atype || arrow->left != left) {
arrow->atype = atype;
arrow->left = left;
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_is_drawable(GTK_WIDGET(arrow)))
+#else
if (GTK_WIDGET_DRAWABLE(arrow))
+#endif
gtk_widget_queue_draw(GTK_WIDGET(arrow));
}
}
@@ -165,7 +169,11 @@ dia_arrow_preview_set(DiaArrowPreview *arrow, ArrowType atype, gboolean left)
static gint
dia_arrow_preview_expose(GtkWidget *widget, GdkEventExpose *event)
{
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_is_drawable(widget)) {
+#else
if (GTK_WIDGET_DRAWABLE(widget)) {
+#endif
Point from, to;
Point move_arrow, move_line, arrow_head;
DiaRenderer *renderer;
@@ -217,8 +225,16 @@ dia_arrow_preview_expose(GtkWidget *widget, GdkEventExpose *event)
{
Color color_bg, color_fg;
/* the text colors are the best approximation to what we had */
+#if GTK_CHECK_VERSION(2,18,0)
+ GdkColor bg = widget->style->base[gtk_widget_get_state(widget)];
+#else
GdkColor bg = widget->style->base[GTK_WIDGET_STATE(widget)];
+#endif
+#if GTK_CHECK_VERSION(2,18,0)
+ GdkColor fg = widget->style->text[gtk_widget_get_state(widget)];
+#else
GdkColor fg = widget->style->text[GTK_WIDGET_STATE(widget)];
+#endif
GDK_COLOR_TO_DIA(bg, color_bg);
GDK_COLOR_TO_DIA(fg, color_fg);
diff --git a/lib/dialinechooser.c b/lib/dialinechooser.c
index 84c624e..6f65bd7 100644
--- a/lib/dialinechooser.c
+++ b/lib/dialinechooser.c
@@ -98,7 +98,11 @@ dia_line_preview_set(DiaLinePreview *line, LineStyle lstyle)
{
if (line->lstyle != lstyle) {
line->lstyle = lstyle;
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_is_drawable(GTK_WIDGET(line)))
+#else
if (GTK_WIDGET_DRAWABLE(line))
+#endif
gtk_widget_queue_draw(GTK_WIDGET(line));
}
}
@@ -116,7 +120,11 @@ dia_line_preview_expose(GtkWidget *widget, GdkEventExpose *event)
gint8 dash_list[6];
int line_width = 2;
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_is_drawable(widget)) {
+#else
if (GTK_WIDGET_DRAWABLE(widget)) {
+#endif
width = widget->allocation.width - misc->xpad * 2;
height = widget->allocation.height - misc->ypad * 2;
x = (widget->allocation.x + misc->xpad);
diff --git a/lib/persistence.c b/lib/persistence.c
index a1427a5..addc56a 100644
--- a/lib/persistence.c
+++ b/lib/persistence.c
@@ -541,7 +541,11 @@ persistence_window_event_handler(GtkWindow *window, GdkEvent *event, gpointer da
dia_log_message ("configure (%s)", persistence_get_window_name(window));
break;
}
+#if GTK_CHECK_VERSION(2,20,0)
+ persistence_update_window(window, !gtk_widget_get_mapped(GTK_WIDGET(window)));
+#else
persistence_update_window(window, !(GTK_WIDGET_MAPPED(window)));
+#endif
/* continue processing */
return FALSE;
}
@@ -554,7 +558,11 @@ persistence_window_event_handler(GtkWindow *window, GdkEvent *event, gpointer da
static gboolean
persistence_hide_show_window(GtkWindow *window, gpointer data)
{
+#if GTK_CHECK_VERSION(2,20,0)
+ persistence_update_window(window, !(gtk_widget_get_mapped(GTK_WIDGET(window))));
+#else
persistence_update_window(window, !GTK_WIDGET_MAPPED(window));
+#endif
return FALSE;
}
@@ -610,7 +618,11 @@ persistence_register_window(GtkWindow *window)
gtk_window_get_position(window, &wininfo->x, &wininfo->y);
gtk_window_get_size(window, &wininfo->width, &wininfo->height);
/* Drawable means visible & mapped, what we usually think of as open. */
+#if GTK_CHECK_VERSION(2,18,0)
+ wininfo->isopen = gtk_widget_is_drawable(GTK_WIDGET(window));
+#else
wininfo->isopen = GTK_WIDGET_DRAWABLE(GTK_WIDGET(window));
+#endif
g_hash_table_insert(persistent_windows, (gchar *)name, wininfo);
}
if (wininfo->window != NULL && wininfo->window != window) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]