[gimp/gtk3-port: 35/229] app: use gtk_widget_get_preferred_size() instead of size_request()



commit c64fa2c75569b9d9c957f67568e4fdf1f9930191
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 19 12:11:59 2010 +0200

    app: use gtk_widget_get_preferred_size() instead of size_request()

 app/display/gimpdisplayshell.c      |    2 +-
 app/display/gimpimagewindow.c       |    4 ++--
 app/widgets/gimpcontainerbox.c      |    2 +-
 app/widgets/gimpcontainergridview.c |    6 +++---
 app/widgets/gimpdockable.c          |    2 +-
 app/widgets/gimpdockbook.c          |    4 ++--
 app/widgets/gimpmessagebox.c        |    4 ++--
 app/widgets/gimpoverlaydialog.c     |   10 +++++-----
 app/widgets/gimpthumbbox.c          |    4 ++--
 app/widgets/gimptoolbox.c           |   11 +++++++----
 app/widgets/gimpuimanager.c         |    2 +-
 app/widgets/gimpwidgets-utils.c     |    4 ++--
 12 files changed, 29 insertions(+), 26 deletions(-)
---
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index ac39f7f..acccda1 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1217,7 +1217,7 @@ gimp_display_shell_transform_overlay (GimpDisplayShell *shell,
                                      overlay->image_y,
                                      x, y);
 
-  gtk_widget_size_request (child, &requisition);
+  gtk_widget_get_preferred_size (child, &requisition, NULL);
 
   switch (overlay->anchor)
     {
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 6566913..990b8cf 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -729,7 +729,7 @@ gimp_image_window_style_set (GtkWidget *widget,
 
   statusbar = gimp_display_shell_get_statusbar (shell);
 
-  gtk_widget_size_request (GTK_WIDGET (statusbar), &requisition);
+  gtk_widget_get_preferred_size (GTK_WIDGET (statusbar), &requisition, NULL);
 
   geometry.min_height = 23;
 
@@ -738,7 +738,7 @@ gimp_image_window_style_set (GtkWidget *widget,
 
   if (private->menubar)
     {
-      gtk_widget_size_request (private->menubar, &requisition);
+      gtk_widget_get_preferred_size (private->menubar, &requisition, NULL);
 
       geometry.min_height += requisition.height;
     }
diff --git a/app/widgets/gimpcontainerbox.c b/app/widgets/gimpcontainerbox.c
index 15a7289..2cefc2c 100644
--- a/app/widgets/gimpcontainerbox.c
+++ b/app/widgets/gimpcontainerbox.c
@@ -159,7 +159,7 @@ gimp_container_box_set_size_request (GimpContainerBox *box,
 
   sb = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (box->scrolled_win));
 
-  gtk_widget_size_request (sb, &req);
+  gtk_widget_get_preferred_size (sb, &req, NULL);
   scrollbar_width += req.width;
 
   border_x = border_y = gtk_container_get_border_width (GTK_CONTAINER (box));
diff --git a/app/widgets/gimpcontainergridview.c b/app/widgets/gimpcontainergridview.c
index 0f6ace9..6f2be03 100644
--- a/app/widgets/gimpcontainergridview.c
+++ b/app/widgets/gimpcontainergridview.c
@@ -632,7 +632,7 @@ gimp_container_grid_view_highlight_item (GimpContainerView *container_view,
       adj = gtk_scrolled_window_get_vadjustment
         (GTK_SCROLLED_WINDOW (box->scrolled_win));
 
-      gtk_widget_size_request (GTK_WIDGET (view), &view_requisition);
+      gtk_widget_get_preferred_size (GTK_WIDGET (view), &view_requisition, NULL);
 
       item_height = view_requisition.height;
 
@@ -690,8 +690,8 @@ gimp_container_grid_view_viewport_resized (GtkWidget             *widget,
           gint           columns;
           gint           rows;
 
-          gtk_widget_size_request (GTK_WIDGET (children->data),
-                                   &view_requisition);
+          gtk_widget_get_preferred_size (GTK_WIDGET (children->data),
+                                         &view_requisition, NULL);
 
           g_list_free (children);
 
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index 54da05e..d8705aa 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -294,7 +294,7 @@ gimp_dockable_size_request (GtkWidget      *widget,
 
   if (child && gtk_widget_get_visible (child))
     {
-      gtk_widget_size_request (child, &child_requisition);
+      gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
       requisition->width  += child_requisition.width;
       requisition->height += child_requisition.height;
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index 02d2aea..069debc 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -656,7 +656,7 @@ gimp_dockbook_get_dockable_tab_width (GimpDockbook *dockbook,
    */
   gimp_dock_temp_add (dockbook->p->dock, tab_widget);
 
-  gtk_widget_size_request (tab_widget, &dockable_request);
+  gtk_widget_get_preferred_size (tab_widget, &dockable_request, NULL);
 
   /* Also destroys the widget */
   gimp_dock_temp_remove (dockbook->p->dock, tab_widget);
@@ -1368,7 +1368,7 @@ gimp_dockbook_tab_drag_begin (GtkWidget      *widget,
   gtk_container_add (GTK_CONTAINER (window), view);
   gtk_widget_show (view);
 
-  gtk_widget_size_request (view, &requisition);
+  gtk_widget_get_preferred_size (view, &requisition, NULL);
 
   if (requisition.width < allocation.width)
     gtk_widget_set_size_request (view, allocation.width, -1);
diff --git a/app/widgets/gimpmessagebox.c b/app/widgets/gimpmessagebox.c
index 6ff2183..a143e0c 100644
--- a/app/widgets/gimpmessagebox.c
+++ b/app/widgets/gimpmessagebox.c
@@ -245,7 +245,7 @@ gimp_message_box_size_request (GtkWidget      *widget,
       GtkRequisition  child_requisition;
       gint            border_width;
 
-      gtk_widget_size_request (box->image, &child_requisition);
+      gtk_widget_get_preferred_size (box->image, &child_requisition, NULL);
 
       border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
@@ -274,7 +274,7 @@ gimp_message_box_size_allocate (GtkWidget     *widget,
       gint            border_width;
       gint            height;
 
-      gtk_widget_size_request (box->image, &child_requisition);
+      gtk_widget_get_preferred_size (box->image, &child_requisition, NULL);
 
       border_width = gtk_container_get_border_width (container);
 
diff --git a/app/widgets/gimpoverlaydialog.c b/app/widgets/gimpoverlaydialog.c
index 8663ead..6bebdce 100644
--- a/app/widgets/gimpoverlaydialog.c
+++ b/app/widgets/gimpoverlaydialog.c
@@ -354,7 +354,7 @@ gimp_overlay_dialog_size_request (GtkWidget      *widget,
 
   if (child && gtk_widget_get_visible (child))
     {
-      gtk_widget_size_request (child, &child_requisition);
+      gtk_widget_get_preferred_size (child, &child_requisition, NULL);
     }
   else
     {
@@ -362,8 +362,8 @@ gimp_overlay_dialog_size_request (GtkWidget      *widget,
       child_requisition.height = 0;
     }
 
-  gtk_widget_size_request (dialog->header,      &header_requisition);
-  gtk_widget_size_request (dialog->action_area, &action_requisition);
+  gtk_widget_get_preferred_size (dialog->header,      &header_requisition, NULL);
+  gtk_widget_get_preferred_size (dialog->action_area, &action_requisition, NULL);
 
   requisition->width  += MAX (MAX (child_requisition.width,
                                    action_requisition.width),
@@ -392,8 +392,8 @@ gimp_overlay_dialog_size_allocate (GtkWidget     *widget,
 
   border_width = gtk_container_get_border_width (container);
 
-  gtk_widget_size_request (dialog->header,      &header_requisition);
-  gtk_widget_size_request (dialog->action_area, &action_requisition);
+  gtk_widget_get_preferred_size (dialog->header,      &header_requisition, NULL);
+  gtk_widget_get_preferred_size (dialog->action_area, &action_requisition, NULL);
 
   if (child && gtk_widget_get_visible (child))
     {
diff --git a/app/widgets/gimpthumbbox.c b/app/widgets/gimpthumbbox.c
index 345fb4b..f16d755 100644
--- a/app/widgets/gimpthumbbox.c
+++ b/app/widgets/gimpthumbbox.c
@@ -427,8 +427,8 @@ gimp_thumb_box_new (GimpContext *context)
   /* don't gtk_widget_show (box->progress); */
 
   /* eek */
-  gtk_widget_size_request (box->info,     &info_requisition);
-  gtk_widget_size_request (box->progress, &progress_requisition);
+  gtk_widget_get_preferred_size (box->info,     &info_requisition,     NULL);
+  gtk_widget_get_preferred_size (box->progress, &progress_requisition, NULL);
 
   gtk_widget_set_size_request (box->info,
                                -1, info_requisition.height);
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index 4aef16e..2ceefb4 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -399,9 +399,12 @@ gimp_toolbox_size_allocate (GtkWidget     *widget,
 
   config = GIMP_GUI_CONFIG (toolbox->p->context->gimp->config);
 
-  gtk_widget_size_request (toolbox->p->color_area, &color_requisition);
-  gtk_widget_size_request (toolbox->p->foo_area,   &foo_requisition);
-  gtk_widget_size_request (toolbox->p->image_area, &image_requisition);
+  gtk_widget_get_preferred_size (toolbox->p->color_area,
+                                 &color_requisition, NULL);
+  gtk_widget_get_preferred_size (toolbox->p->foo_area,
+                                 &foo_requisition, NULL);
+  gtk_widget_get_preferred_size (toolbox->p->image_area,
+                                 &image_requisition, NULL);
 
   width  = MAX (color_requisition.width,
                 MAX (foo_requisition.width,
@@ -743,7 +746,7 @@ toolbox_area_notify (GimpGuiConfig *config,
 
       gtk_widget_show (parent);
 
-      gtk_widget_size_request (area, &req);
+      gtk_widget_get_preferred_size (area, &req, NULL);
       gtk_widget_set_size_request (parent, req.width, req.height);
     }
   else
diff --git a/app/widgets/gimpuimanager.c b/app/widgets/gimpuimanager.c
index a66f3dc..047ff27 100644
--- a/app/widgets/gimpuimanager.c
+++ b/app/widgets/gimpuimanager.c
@@ -817,7 +817,7 @@ gimp_ui_manager_menu_position (GtkMenu  *menu,
 
   gtk_menu_set_screen (menu, screen);
 
-  gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL);
 
   if (gtk_widget_get_direction (GTK_WIDGET (menu)) == GTK_TEXT_DIR_RTL)
     {
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 93837e6..69ef567 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -95,7 +95,7 @@ gimp_menu_position (GtkMenu *menu,
 
   gtk_menu_set_screen (menu, screen);
 
-  gtk_widget_size_request (widget, &requisition);
+  gtk_widget_get_preferred_size (widget, &requisition, NULL);
 
   if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
     {
@@ -172,7 +172,7 @@ gimp_button_menu_position (GtkWidget       *button,
 
   gdk_window_get_root_coords (gtk_widget_get_window (button), *x, *y, x, y);
 
-  gtk_widget_size_request (GTK_WIDGET (menu), &menu_requisition);
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_requisition, NULL);
 
   screen = gtk_widget_get_screen (button);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]