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



commit 403e3bd24a85298eeb758d49d569509949e32fdb
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 8a64fcb..723c39c 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1102,7 +1102,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 e5a9460..5bb7cd2 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -659,7 +659,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;
 
@@ -668,7 +668,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 36a9e38..875cb77 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -293,7 +293,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 bf47c16..ff11f4c 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -667,7 +667,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);
@@ -1379,7 +1379,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 f384c20..0c6694b 100644
--- a/app/widgets/gimpmessagebox.c
+++ b/app/widgets/gimpmessagebox.c
@@ -236,7 +236,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));
 
@@ -265,7 +265,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 e34bdff..d3feeae 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 80072a3..85c07e9 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 e828cb8..47491c9 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -453,9 +453,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,
@@ -799,7 +802,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 ab21498..8418af0 100644
--- a/app/widgets/gimpuimanager.c
+++ b/app/widgets/gimpuimanager.c
@@ -818,7 +818,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 e1bcd2d..27dbf98 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -94,7 +94,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)
     {
@@ -171,7 +171,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]