2 * Definitions to provide some functions that are not present in older
3 * GTK versions (down to 2.12.0)
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #ifndef OLD_GTK_COMPAT_H
27 #define OLD_GTK_COMPAT_H
29 #if !GTK_CHECK_VERSION (2, 14, 0)
30 # define gtk_widget_get_window(widget) (widget)->window
31 # define gtk_color_selection_dialog_get_color_selection(dialog) (dialog)->colorsel
32 # define gtk_selection_data_get_length(seldata) (seldata)->length
33 # define gtk_selection_data_get_data(seldata) (seldata)->data
34 # define gtk_adjustment_set_upper(adj, val) (adj)->upper = val
35 # define gtk_adjustment_get_upper(adj) (adj)->upper
36 # define gtk_adjustment_get_lower(adj) (adj)->lower
37 # define gtk_adjustment_set_step_increment(adj, val) (adj)->step_increment = val
38 # define gtk_adjustment_set_page_increment(adj, val) (adj)->page_increment = val
39 # define gtk_adjustment_get_page_increment(adj) (adj)->page_increment
40 # define gtk_adjustment_set_page_size(adj, val) (adj)->page_size = val
41 # define gtk_adjustment_get_page_size(adj) (adj)->page_size
42 # define gtk_dialog_get_content_area(dialog) (dialog)->vbox
45 #if !GTK_CHECK_VERSION (2, 16, 0)
46 # define GTK_ORIENTABLE(x) GTK_TOOLBAR(x)
47 # define gtk_orientable_set_orientation(x,y) gtk_toolbar_set_orientation(x,y)
50 #if !GTK_CHECK_VERSION (2, 18, 0)
51 # define gtk_widget_get_has_window(x) (!GTK_WIDGET_NO_WINDOW(x))
52 # define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x)
53 # define gtk_widget_get_state(x) GTK_WIDGET_STATE(x)
54 # define gtk_widget_get_allocation(x,y) (*(y) = x->allocation)
55 # define gtk_widget_get_sensitive(x) GTK_WIDGET_SENSITIVE(x)
56 # define gtk_widget_is_drawable(x) GDK_IS_DRAWABLE(x)
59 #if !GTK_CHECK_VERSION (2, 20, 0)
60 # define gtk_widget_get_realized(x) GTK_WIDGET_REALIZED(x)
63 #if !GTK_CHECK_VERSION (2, 22, 0)
66 #if !GTK_CHECK_VERSION (2, 24, 0)
67 # define GTK_COMBO_BOX_TEXT(x) GTK_COMBO_BOX(x)
68 # define gtk_combo_box_text_get_active_text(x) gtk_combo_box_get_active_text(x)
69 # define gtk_combo_box_text_new() gtk_combo_box_new_text()
70 # define gtk_combo_box_text_insert_text(x,y,z) gtk_combo_box_insert_text(x,y,z)
71 # define gtk_combo_box_text_append_text(x,y) gtk_combo_box_append_text(x,y)
72 # define gtk_combo_box_text_remove(x,y) gtk_combo_box_remove_text(x,y)
73 # define gtk_combo_box_text_new_with_entry() gtk_combo_box_entry_new_text()
74 # define gtk_combo_box_text_prepend_text(x,y) gtk_combo_box_prepend_text(x,y)
77 #if !GTK_CHECK_VERSION (3, 0, 0)
78 # define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
79 # define GtkStyleContext GtkStyle
80 # define gtk_widget_get_style_context(x) gtk_widget_get_style(x)
81 # define gtk_style_context_get_color(x,y,z) gdkcolor_to_color_t(&z, &x->text[y])
82 # define gtk_style_context_get_color_background(x,y,z) gdkcolor_to_color_t(&z, &x->base[y])
83 # if GTK_CHECK_VERSION (2, 14, 0) && defined(GSEAL_ENABLE)
84 /* This is too late, see https://bugzilla.gnome.org/show_bug.cgi?id=641089
86 * http://ftp.acc.umu.se/pub/GNOME/sources/gtk+/2.13/gtk+-2.13.4.changes
87 * access to the button element was sealed during 2.13. They also admit that
88 * they missed a use case and thus failed to provide an accessor function:
89 * http://mail.gnome.org/archives/commits-list/2010-December/msg00578.html
90 * An accessor function was finally added in 3.0.
92 # define gtk_tree_view_column_get_button(x) x->_g_sealed__button
94 # define gtk_tree_view_column_get_button(x) x->button