[nautilus/wip/antoniof/gtk4-preparation-batch-rename-dialog: 58/63] batch-rename-dialog: Don't use gtk_widget_get_preferred_height()




commit be1f1c90ce37703ab452685a22ee5d51bc408e13
Author: Ernestas Kulik <ernestask gnome org>
Date:   Fri Jul 6 10:13:07 2018 +0300

    batch-rename-dialog: Don't use gtk_widget_get_preferred_height()
    
    The functions for getting the width and height separately are gone
    in GTK4. When not using them for height-for-width/width-for-height
    measurements, they can be trivially replaced with get_preferred_size().
    
    Rebased and ammended by António Fernandes <antoniof gnome org>

 src/nautilus-batch-rename-dialog.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index 84897eae3..b223f4e64 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -512,7 +512,7 @@ static void
 update_rows_height (NautilusBatchRenameDialog *dialog)
 {
     GList *l;
-    gint current_row_natural_height;
+    GtkRequisition current_row_natural_size;
     gint maximum_height;
 
     maximum_height = -1;
@@ -520,37 +520,37 @@ update_rows_height (NautilusBatchRenameDialog *dialog)
     /* check if maximum height has changed */
     for (l = dialog->listbox_labels_new; l != NULL; l = l->next)
     {
-        gtk_widget_get_preferred_height (GTK_WIDGET (l->data),
-                                         NULL,
-                                         &current_row_natural_height);
+        gtk_widget_get_preferred_size (GTK_WIDGET (l->data),
+                                       NULL,
+                                       &current_row_natural_size);
 
-        if (current_row_natural_height > maximum_height)
+        if (current_row_natural_size.height > maximum_height)
         {
-            maximum_height = current_row_natural_height;
+            maximum_height = current_row_natural_size.height;
         }
     }
 
     for (l = dialog->listbox_labels_old; l != NULL; l = l->next)
     {
-        gtk_widget_get_preferred_height (GTK_WIDGET (l->data),
-                                         NULL,
-                                         &current_row_natural_height);
+        gtk_widget_get_preferred_size (GTK_WIDGET (l->data),
+                                       NULL,
+                                       &current_row_natural_size);
 
-        if (current_row_natural_height > maximum_height)
+        if (current_row_natural_size.height > maximum_height)
         {
-            maximum_height = current_row_natural_height;
+            maximum_height = current_row_natural_size.height;
         }
     }
 
     for (l = dialog->listbox_icons; l != NULL; l = l->next)
     {
-        gtk_widget_get_preferred_height (GTK_WIDGET (l->data),
-                                         NULL,
-                                         &current_row_natural_height);
+        gtk_widget_get_preferred_size (GTK_WIDGET (l->data),
+                                       NULL,
+                                       &current_row_natural_size);
 
-        if (current_row_natural_height > maximum_height)
+        if (current_row_natural_size.height > maximum_height)
         {
-            maximum_height = current_row_natural_height;
+            maximum_height = current_row_natural_size.height;
         }
     }
 


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