diff options
author | António Fernandes <antoniof@gnome.org> | 2021-12-23 23:54:46 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-01-01 22:24:03 +0000 |
commit | 3942cef75bce88538be1ed7c1c34432d1274c740 (patch) | |
tree | 3b80d171bebf8b3748d51781bb25a380d40a64a2 | |
parent | e9803de414f4e833210b9716d0f89b636103035d (diff) | |
download | nautilus-3942cef75bce88538be1ed7c1c34432d1274c740.tar.gz |
general: Adapt to GtkDrawingArea API changes
Now we set a function instead of listening to a signal.
-rw-r--r-- | src/nautilus-properties-window.c | 30 | ||||
-rw-r--r-- | src/nautilus-toolbar.c | 13 | ||||
-rw-r--r-- | src/resources/ui/nautilus-toolbar.ui | 1 |
3 files changed, 27 insertions, 17 deletions
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c index 81e0f8d31..827df0840 100644 --- a/src/nautilus-properties-window.c +++ b/src/nautilus-properties-window.c @@ -2400,10 +2400,13 @@ should_show_volume_usage (NautilusPropertiesWindow *self) } static void -paint_legend (GtkWidget *widget, - cairo_t *cr, - gpointer data) +paint_legend (GtkDrawingArea *drawing_area, + cairo_t *cr, + int width, + int height, + gpointer data) { + GtkWidget *widget = GTK_WIDGET (drawing_area); GtkStyleContext *context; GtkAllocation allocation; @@ -2488,11 +2491,14 @@ paint_slice (GtkWidget *widget, } static void -paint_pie_chart (GtkWidget *widget, - cairo_t *cr, - gpointer data) +paint_pie_chart (GtkDrawingArea *drawing_area, + cairo_t *cr, + int width, + int height, + gpointer data) { NautilusPropertiesWindow *self; + GtkWidget *widget = GTK_WIDGET (drawing_area); double free, used, reserved; self = NAUTILUS_PROPERTIES_WINDOW (data); @@ -2552,12 +2558,12 @@ setup_pie_widget (NautilusPropertiesWindow *self) } } - g_signal_connect (self->pie_chart, "draw", - G_CALLBACK (paint_pie_chart), self); - g_signal_connect (self->used_color, "draw", - G_CALLBACK (paint_legend), self); - g_signal_connect (self->free_color, "draw", - G_CALLBACK (paint_legend), self); + gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self->pie_chart), + paint_pie_chart, self, NULL); + gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self->used_color), + paint_legend, self, NULL); + gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self->free_color), + paint_legend, self, NULL); } static void diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c index 5df687cc0..758d387ee 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; @@ -869,6 +870,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); @@ -1141,7 +1147,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> |