From e619d8ac0231616d445d789ab608e5a1c18b95e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 12 Jul 2015 15:08:58 +0200 Subject: [PATCH] Replace deprecated GTK2 API to fix compilation against GTK3 --- addons/src/ao_doclist.c | 17 ++++++++++++----- build/addons.m4 | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/addons/src/ao_doclist.c b/addons/src/ao_doclist.c index 16a5ffaeb..181229ae3 100644 --- a/addons/src/ao_doclist.c +++ b/addons/src/ao_doclist.c @@ -123,18 +123,25 @@ static void ao_popup_position_menu(GtkMenu *menu, gint *x, gint *y, gboolean *pu gint wx, wy; GtkRequisition widget_req; GtkWidget *widget = data; + GdkWindow *window = gtk_widget_get_window(widget); gint widget_height; /* Retrieve size and position of both widget and menu */ - if (GTK_WIDGET_NO_WINDOW(widget)) + if (! gtk_widget_get_has_window(widget)) { - gdk_window_get_position(widget->window, &wx, &wy); - wx += widget->allocation.x; - wy += widget->allocation.y; + GtkAllocation allocation; + gdk_window_get_position(window, &wx, &wy); + gtk_widget_get_allocation(widget, &allocation); + wx += allocation.x; + wy += allocation.y; } else - gdk_window_get_origin(widget->window, &wx, &wy); + gdk_window_get_origin(window, &wx, &wy); +#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_get_preferred_size(widget, &widget_req, NULL); +#else gtk_widget_size_request(widget, &widget_req); +#endif widget_height = widget_req.height; /* Better than allocation.height */ /* Calculate menu position */ diff --git a/build/addons.m4 b/build/addons.m4 index e668612d0..22fc25a35 100644 --- a/build/addons.m4 +++ b/build/addons.m4 @@ -1,7 +1,6 @@ AC_DEFUN([GP_CHECK_ADDONS], [ GP_ARG_DISABLE([Addons], [auto]) - GP_CHECK_PLUGIN_GTK2_ONLY([Addons]) GP_COMMIT_PLUGIN_STATUS([Addons]) AC_CONFIG_FILES([ addons/Makefile