From 9c41b25138d7bff3554d4be038f92c16d56dc734 Mon Sep 17 00:00:00 2001 From: Wolfgang Ulbrich Date: Fri, 20 Nov 2015 00:40:13 +0100 Subject: [PATCH] GTK3: replace depracated gtk_widget_size_request with gtk_widget_get_preferred_size --- pluma/pluma-documents-panel.c | 6 +++++- pluma/pluma-status-combo-box.c | 12 ++++++++++-- pluma/pluma-utils.c | 8 ++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/pluma/pluma-documents-panel.c b/pluma/pluma-documents-panel.c index 1ba7a5c..97308ef 100644 --- a/pluma/pluma-documents-panel.c +++ b/pluma/pluma-documents-panel.c @@ -539,8 +539,12 @@ menu_position (GtkMenu *menu, wy = rect.y; gdk_window_get_origin (gtk_widget_get_window (w), x, y); - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition); +#else gtk_widget_size_request (GTK_WIDGET (menu), &requisition); +#endif if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL) { diff --git a/pluma/pluma-status-combo-box.c b/pluma/pluma-status-combo-box.c index f138ab2..aaae982 100644 --- a/pluma/pluma-status-combo-box.c +++ b/pluma/pluma-status-combo-box.c @@ -180,8 +180,12 @@ menu_position_func (GtkMenu *menu, GtkAllocation allocation; *push_in = FALSE; - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (gtk_widget_get_toplevel (GTK_WIDGET (menu)), NULL, &request); +#else gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request); +#endif /* get the origin... */ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y); @@ -205,8 +209,12 @@ button_press_event (GtkWidget *widget, GtkRequisition request; GtkAllocation allocation; gint max_height; - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (combo->priv->menu, NULL, &request); +#else gtk_widget_size_request (combo->priv->menu, &request); +#endif gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation); /* do something relative to our own height here, maybe we can do better */ diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c index 657003d..19405eb 100644 --- a/pluma/pluma-utils.c +++ b/pluma/pluma-utils.c @@ -134,7 +134,11 @@ pluma_utils_menu_position_under_widget (GtkMenu *menu, widget = GTK_WIDGET (user_data); widget_get_origin (widget, x, y); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition); +#else gtk_widget_size_request (GTK_WIDGET (menu), &requisition); +#endif gtk_widget_get_allocation (widget, &allocation); @@ -189,7 +193,11 @@ pluma_utils_menu_position_under_tree_view (GtkMenu *menu, if (gtk_widget_get_direction (GTK_WIDGET (tree)) == GTK_TEXT_DIR_RTL) { GtkRequisition requisition; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &requisition); +#else gtk_widget_size_request (GTK_WIDGET (menu), &requisition); +#endif *x += rect.width - requisition.width; } }