1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Provide #defines for GTK3-deprecated gtk_{h,v}foo_new().

In GTK3, GtkBox, GtkScrollbar and GtkSeparator are all single classes
with a GtkOrientation parameter, whereas in GTK2 the horizontal and
vertical versions were trivial subclasses of them. Hence, the old
constructors are now deprecated, but _only_ the constructors are
affected, since after constructing one you always used methods of the
superclass on it anyway.

Rather than faff about with an ifdef at every call site, I've just put
some wrapper macros in gtkcompat.h to make it easy to keep this code
similar between all supported GTK versions.
This commit is contained in:
Simon Tatham 2015-08-22 13:59:20 +01:00
parent 3a27e98fb7
commit ace0dd64b7

View File

@ -165,3 +165,16 @@
#define STANDARD_OPEN_LABEL GTK_STOCK_OPEN
#define STANDARD_CANCEL_LABEL GTK_STOCK_CANCEL
#endif
#if GTK_CHECK_VERSION(3,0,0)
#define gtk_hseparator_new() gtk_separator_new(GTK_ORIENTATION_HORIZONTAL)
/* Fortunately, my hboxes and vboxes never actually set homogeneous to
* TRUE, so I can just wrap these deprecated constructors with a macro
* without also having to arrange a call to gtk_box_set_homogeneous. */
#define gtk_hbox_new(homogeneous, spacing) \
gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing)
#define gtk_vbox_new(homogeneous, spacing) \
gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing)
#define gtk_vscrollbar_new(adjust) \
gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, adjust)
#endif