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



commit 81682ded28a766c8cc3e0d5f693480de0786bd83
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 0e39aaf..fa91152 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1186,7 +1186,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 51a7c91..44b3492 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -781,7 +781,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;
 
@@ -790,7 +790,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 6203850..e7a4f52 100644
--- a/app/widgets/gimpcontainergridview.c
+++ b/app/widgets/gimpcontainergridview.c
@@ -633,7 +633,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;
 
@@ -691,8 +691,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 3d11b31..122f85d 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -286,7 +286,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 1cf11f4..0552076 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -661,7 +661,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);
@@ -1386,7 +1386,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 249b151..1ee4f7a 100644
--- a/app/widgets/gimpmessagebox.c
+++ b/app/widgets/gimpmessagebox.c
@@ -251,7 +251,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));
 
@@ -280,7 +280,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 d255747..974c5ac 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 991acda..5ba9f3a 100644
--- a/app/widgets/gimpthumbbox.c
+++ b/app/widgets/gimpthumbbox.c
@@ -420,8 +420,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 2108438..7daae55 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -395,9 +395,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,
@@ -739,7 +742,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 7c26e29..b12bbfd 100644
--- a/app/widgets/gimpuimanager.c
+++ b/app/widgets/gimpuimanager.c
@@ -836,7 +836,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 90bfd58..6c773c8 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -97,7 +97,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)
     {
@@ -174,7 +174,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]