GTK3: replace depracated gtk_widget_size_request with gtk_widget_get_preferred_size

This commit is contained in:
Wolfgang Ulbrich 2015-11-20 00:40:13 +01:00
parent 1b8d58e81e
commit 9c41b25138
3 changed files with 23 additions and 3 deletions

View File

@ -540,7 +540,11 @@ menu_position (GtkMenu *menu,
gdk_window_get_origin (gtk_widget_get_window (w), x, 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); gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
#endif
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL) if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
{ {

View File

@ -181,7 +181,11 @@ menu_position_func (GtkMenu *menu,
*push_in = FALSE; *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); gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request);
#endif
/* get the origin... */ /* get the origin... */
gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y); gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y);
@ -206,7 +210,11 @@ button_press_event (GtkWidget *widget,
GtkAllocation allocation; GtkAllocation allocation;
gint max_height; 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); gtk_widget_size_request (combo->priv->menu, &request);
#endif
gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation); gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
/* do something relative to our own height here, maybe we can do better */ /* do something relative to our own height here, maybe we can do better */

View File

@ -134,7 +134,11 @@ pluma_utils_menu_position_under_widget (GtkMenu *menu,
widget = GTK_WIDGET (user_data); widget = GTK_WIDGET (user_data);
widget_get_origin (widget, x, y); 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); gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
#endif
gtk_widget_get_allocation (widget, &allocation); 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) if (gtk_widget_get_direction (GTK_WIDGET (tree)) == GTK_TEXT_DIR_RTL)
{ {
GtkRequisition requisition; 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); gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
#endif
*x += rect.width - requisition.width; *x += rect.width - requisition.width;
} }
} }