1 /* 2 * Copyright 2017 LarsGit223 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 /* Compatibility macros to support different GTK versions */ 20 21 #ifndef GP_GTKCOMPAT_H 22 #define GP_GTKCOMPAT_H 23 24 G_BEGIN_DECLS 25 26 /* Remove gtk_window_set_has_resize_grip() starting from version 3.14 */ 27 #if GTK_CHECK_VERSION(3, 14, 0) 28 #define gtk_window_set_has_resize_grip(window, value) 29 #endif 30 31 /* Replace calls to gtk_widget_set_state() with call to 32 gtk_widget_set_state_flags() and translate States to State-Flags. 33 Starting from version 3.0.*/ 34 #if GTK_CHECK_VERSION(3, 0, 0) 35 #define GTK_STATE_NORMAL GTK_STATE_FLAG_NORMAL 36 #define GTK_STATE_ACTIVE GTK_STATE_FLAG_ACTIVE 37 #define GTK_STATE_PRELIGHT GTK_STATE_FLAG_PRELIGHT 38 #define GTK_STATE_SELECTED GTK_STATE_FLAG_SELECTED 39 #define GTK_STATE_INSENSITIVE GTK_STATE_FLAG_INSENSITIVE 40 #define GTK_STATE_INCONSISTENT GTK_STATE_FLAG_INCONSISTENT 41 #define GTK_STATE_FOCUSED GTK_STATE_FLAG_FOCUSED 42 #define gtk_widget_set_state(widget, state) \ 43 gtk_widget_set_state_flags(widget, state, FALSE) 44 #endif 45 46 /* Replace some GTK_STOCK constants with labels. 47 Add new ones on-demand. Starting from version 3.10 */ 48 #if GTK_CHECK_VERSION(3, 10, 0) 49 #undef GTK_STOCK_OPEN 50 #undef GTK_STOCK_CANCEL 51 #undef GTK_STOCK_OK 52 #define GTK_STOCK_OPEN _("_Open") 53 #define GTK_STOCK_CANCEL _("_Cancel") 54 #define GTK_STOCK_OK _("_OK") 55 #endif 56 57 /* Replace calls to gtk_icon_info_free() with call to 58 g_object_unref(). Starting from version 3.8.*/ 59 #if GTK_CHECK_VERSION(3, 8, 0) 60 #define gtk_icon_info_free(icon_info) \ 61 g_object_unref(icon_info) 62 #endif 63 64 G_END_DECLS 65 66 #endif /* GP_GTKCOMPAT_H */ 67