clang-tidy: readability-non-const-parameter
[geeqie.git] / src / compat.cc
1 /*
2  * Copyright (C) 2008 - 2016 The Geeqie Team
3  *
4  * Authors: Vladimir Nadvornik, Laurent Monin
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #include "main.h"
22 #include "compat.h"
23
24 #ifdef HAVE_GTK4
25 void gq_gtk_container_add(GtkWidget *container, GtkWidget *widget)
26 {
27         if (GTK_IS_BUTTON(container))
28                 {
29                 gtk_button_set_child(GTK_BUTTON(container), widget);
30                 }
31         else if (GTK_IS_BUTTON_BOX(container))
32                 {
33                 gtk_box_set_child(GTK_BUTTON_BOX(container), widget);
34                 }
35         else if (GTK_IS_EXPANDER(container))
36                 {
37                 gtk_expander_set_child(GTK_EXPANDER(container), widget);
38                 }
39         else if (GTK_IS_FRAME(container))
40                 {
41                 gtk_frame_set_child(GTK_FRAME(container), widget);
42                 }
43         else if (GTK_IS_MENU_ITEM(container))
44                 {
45                 gtk_frame_set_child(container, widget); /* @FIXME GTK4 menu */
46                 }
47         else if (GTK_IS_POPOVER(container))
48                 {
49                 gtk_popover_set_child(GTK_POPOVER(container), widget);
50                 }
51         else if (GTK_IS_TOGGLE_BUTTON(container))
52                 {
53                 gtk_toggle_button_set_child(GTK_TOGGLE_BUTTON(container), widget);
54                 }
55         else if (GTK_IS_TOOLBAR(container))
56                 {
57                 gtk_toolbar_set_child(GTK_TOOLBAR(container), widget);
58                 }
59         else if (GTK_IS_VIEWPORT(container))
60                 {
61                 gtk_viewport_set_child(GTK_VIEWPORT(container), widget);
62                 }
63         else if (GTK_IS_WINDOW(container))
64                 {
65                 gtk_window_set_child(GTK_WINDOW(container), widget);
66                 }
67         else
68                 {
69                 g_abort();
70                 }
71 }
72 #else
73 void gq_gtk_container_add(GtkWidget *container, GtkWidget *widget)
74 {
75         gtk_container_add(reinterpret_cast<GtkContainer *>(container), widget);
76 }
77 #endif
78 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */