[nautilus/wip/antoniof/experimental-gtk4-build: 32/52] GtkDrawingArea API update




commit 5c7f2c0f5db681cf5d512df3292e1d4eeb4c064d
Author: António Fernandes <antoniof gnome org>
Date:   Thu Dec 23 23:54:46 2021 +0000

    GtkDrawingArea API update
    
    Now we set a function instead of listening to a signal.

 src/nautilus-toolbar.c               | 13 +++++++++----
 src/resources/ui/nautilus-toolbar.ui |  1 -
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index a3e5e9b93..badf31e37 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -570,18 +570,19 @@ on_new_progress_info (NautilusProgressInfoManager *manager,
 }
 
 static void
-on_operations_icon_draw (GtkWidget       *widget,
+on_operations_icon_draw (GtkDrawingArea  *drawing_area,
                          cairo_t         *cr,
+                         int              width,
+                         int              height,
                          NautilusToolbar *self)
 {
+    GtkWidget *widget = GTK_WIDGET (drawing_area);
     gfloat elapsed_progress = 0;
     gint remaining_progress = 0;
     gint total_progress;
     gdouble ratio;
     GList *progress_infos;
     GList *l;
-    guint width;
-    guint height;
     gboolean all_cancelled;
     GdkRGBA background;
     GdkRGBA foreground;
@@ -885,6 +886,11 @@ nautilus_toolbar_init (NautilusToolbar *self)
 {
     gtk_widget_init_template (GTK_WIDGET (self));
 
+    gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self->operations_icon),
+                                    (GtkDrawingAreaDrawFunc) on_operations_icon_draw,
+                                    self,
+                                    NULL);
+
     gtk_widget_set_parent (self->back_menu, self->back_button);
     g_signal_connect (self->back_menu, "destroy", G_CALLBACK (gtk_widget_unparent), NULL);
     gtk_widget_set_parent (self->forward_menu, self->forward_button);
@@ -1157,7 +1163,6 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
 
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, search_button);
 
-    gtk_widget_class_bind_template_callback (widget_class, on_operations_icon_draw);
     gtk_widget_class_bind_template_callback (widget_class, on_operations_popover_notify_visible);
 }
 
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index 8fcb590f8..5c704e2c3 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -239,7 +239,6 @@
                         <property name="height_request">16</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
-                        <signal name="draw" handler="on_operations_icon_draw" object="NautilusToolbar" 
swapped="no"/>
                       </object>
                     </child>
                     <style>


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