summaryrefslogtreecommitdiff
path: root/media-gfx/gnome-font-viewer/files/45.0-window-Fix-function-callback-definition.patch
blob: a7a27dbb361c1f166f57d19f62967c17a5070331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
https://gitlab.gnome.org/GNOME/gnome-font-viewer/-/merge_requests/54

From 359a3c2ea1614195c647c2c57e940805986e7ab3 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Sat, 8 Jul 2023 00:01:07 -0400
Subject: [PATCH] window: Fix function callback definition

Without this, the build fails with clang with
CFLAGS=-Werror=incompatible-function-pointer-types

```
../src/font-view-window.c:864:77: error: incompatible function pointer types passing 'void (FontViewWindow *)' (aka 'void (struct _FontViewWindow *)') to parameter of type 'GtkWidgetActionActivateFunc' (aka 'void (*)(struct _GtkWidget *, const char *, struct _GVariant *)') [-Wincompatible-function-pointer-types]
  gtk_widget_class_install_action (widget_class, "win.toggle-search", NULL, action_toggle_search_cb);
                                                                            ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/gtk-4.0/gtk/gtkwidget.h:956:87: note: passing argument to parameter 'activate' here
                                                         GtkWidgetActionActivateFunc  activate);
                                                                                      ^
```
---
 src/font-view-window.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/font-view-window.c b/src/font-view-window.c
index 639ac33..24461f7 100644
--- a/src/font-view-window.c
+++ b/src/font-view-window.c
@@ -758,8 +758,11 @@ font_view_window_show_overview (FontViewWindow *self)
 }
 
 static void
-action_toggle_search_cb (FontViewWindow *self)
+action_toggle_search_cb (GtkWidget  *widget,
+                         const char *action_name,
+                         GVariant   *parameter)
 {
+  FontViewWindow *self = FONT_VIEW_WINDOW (widget);
 
  gtk_toggle_button_set_active (self->search_button,
                                !gtk_toggle_button_get_active (self->search_button));
-- 
2.41.0