[nautilus/wip/antoniof/gtk4-preparation-step-container-api: 20/20] extensions/image-properties: Reduce container API




commit 54617c32b33b052acebc1308e1b020e437493087
Author: António Fernandes <antoniof gnome org>
Date:   Thu Nov 25 19:46:20 2021 +0000

    extensions/image-properties: Reduce container API
    
    Preparing for GTK4.

 extensions/image-properties/nautilus-image-properties-page.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/extensions/image-properties/nautilus-image-properties-page.c 
b/extensions/image-properties/nautilus-image-properties-page.c
index 345e85791..86d4ce9cd 100644
--- a/extensions/image-properties/nautilus-image-properties-page.c
+++ b/extensions/image-properties/nautilus-image-properties-page.c
@@ -68,7 +68,7 @@ append_item (NautilusImagesPropertiesPage *page,
     pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
     gtk_label_set_attributes (GTK_LABEL (name_label), attrs);
     pango_attr_list_unref (attrs);
-    gtk_container_add (GTK_CONTAINER (page->grid), name_label);
+    gtk_grid_attach_next_to (GTK_GRID (page->grid), name_label, NULL, GTK_POS_BOTTOM, 1, 1);
     gtk_widget_set_halign (name_label, GTK_ALIGN_START);
     gtk_widget_show (name_label);
 
@@ -110,7 +110,12 @@ nautilus_image_properties_page_init (NautilusImagesPropertiesPage *self)
     gtk_grid_set_row_spacing (GTK_GRID (self->grid), 6);
     gtk_grid_set_column_spacing (GTK_GRID (self->grid), 18);
     append_item (self, _("Loading…"), NULL);
+#if GTK_MAJOR_VERSION < 4
     gtk_container_add (GTK_CONTAINER (self->page_widget), self->grid);
+#else
+    gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (self->page_widget),
+                                   self->grid);
+#endif
 
     gtk_widget_show_all (GTK_WIDGET (self->page_widget));
 }
@@ -262,7 +267,7 @@ load_finished (NautilusImagesPropertiesPage *page)
     GtkWidget *label;
 
     label = gtk_grid_get_child_at (GTK_GRID (page->grid), 0, 0);
-    gtk_container_remove (GTK_CONTAINER (page->grid), label);
+    gtk_widget_hide (label);
 
     if (page->loader != NULL)
     {


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