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



commit 81fd9590b2d7ee7038c3fa5b08c17adc525616c8
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/gimpcontainerpopup.c    |    2 +-
 app/widgets/gimpdockable.c          |    2 +-
 app/widgets/gimpdockbook.c          |    4 ++--
 app/widgets/gimpmessagebox.c        |    4 ++--
 app/widgets/gimpoverlaydialog.c     |    6 +++---
 app/widgets/gimpthumbbox.c          |    4 ++--
 app/widgets/gimptoolbox.c           |   11 +++++++----
 app/widgets/gimpuimanager.c         |    2 +-
 app/widgets/gimpwidgets-utils.c     |    4 ++--
 13 files changed, 28 insertions(+), 25 deletions(-)
---
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 2e0973c..141fe43 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1106,7 +1106,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 428d9d0..2d0cdbf 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -615,7 +615,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;
 
@@ -624,7 +624,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 685b195..8b4a6eb 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 8100ccc..89d340f 100644
--- a/app/widgets/gimpcontainergridview.c
+++ b/app/widgets/gimpcontainergridview.c
@@ -627,7 +627,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;
 
@@ -685,8 +685,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/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c
index 4539390..d27f6c5 100644
--- a/app/widgets/gimpcontainerpopup.c
+++ b/app/widgets/gimpcontainerpopup.c
@@ -438,7 +438,7 @@ gimp_container_popup_show (GimpContainerPopup *popup,
   g_return_if_fail (GIMP_IS_CONTAINER_POPUP (popup));
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  gtk_widget_size_request (GTK_WIDGET (popup), &requisition);
+  gtk_widget_get_preferred_size (GTK_WIDGET (popup), &requisition, NULL);
 
   gtk_widget_get_allocation (widget, &allocation);
   gdk_window_get_origin (gtk_widget_get_window (widget), &orig_x, &orig_y);
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index f31c1be..c86c65e 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -274,7 +274,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 580c112..8f1c397 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -665,7 +665,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);
@@ -1333,7 +1333,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 927e31b..2dd7866 100644
--- a/app/widgets/gimpmessagebox.c
+++ b/app/widgets/gimpmessagebox.c
@@ -244,7 +244,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));
 
@@ -273,7 +273,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 1ef9e07..a582203 100644
--- a/app/widgets/gimpoverlaydialog.c
+++ b/app/widgets/gimpoverlaydialog.c
@@ -156,7 +156,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
     {
@@ -164,7 +164,7 @@ gimp_overlay_dialog_size_request (GtkWidget      *widget,
       child_requisition.height = 0;
     }
 
-  gtk_widget_size_request (dialog->action_area, &action_requisition);
+  gtk_widget_get_preferred_size (dialog->action_area, &action_requisition, NULL);
 
   requisition->width  += MAX (child_requisition.width,
                               action_requisition.width);
@@ -189,7 +189,7 @@ gimp_overlay_dialog_size_allocate (GtkWidget     *widget,
 
   border_width = gtk_container_get_border_width (container);
 
-  gtk_widget_size_request (dialog->action_area, &action_requisition);
+  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 34ab6f2..82e0822 100644
--- a/app/widgets/gimpthumbbox.c
+++ b/app/widgets/gimpthumbbox.c
@@ -426,8 +426,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 8ffdad5..e5fe86c 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -461,9 +461,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,
@@ -807,7 +810,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 89331e8..66741c3 100644
--- a/app/widgets/gimpuimanager.c
+++ b/app/widgets/gimpuimanager.c
@@ -826,7 +826,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 21df3d7..9b8003f 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -91,7 +91,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)
     {
@@ -168,7 +168,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]