From 5f7604888bcd5a2a96392874b947f4a74056d303 Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Wed, 20 Dec 2017 11:55:51 +0000 Subject: [PATCH] Let puttyapp/ptermapp build against old Gtk 3. gtk_application_set_accels_for_action() is new in Gtk 3.12, but (e.g.) Ubuntu 14.04 LTS still ships with Gtk 3.10. On the other hand, the function I've used instead, gtk_application_add_accelerator(), is deprecated from Gtk 3.14 onwards, indicating that it will disappear in some future version, so I've left the newer code in against that day. --- unix/gtkapp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unix/gtkapp.c b/unix/gtkapp.c index 6d53c38e..351238db 100644 --- a/unix/gtkapp.c +++ b/unix/gtkapp.c @@ -153,12 +153,20 @@ static void startup(GApplication *app, gpointer user_data) g_menu_append(section, "Clear Scrollback", "win.clearscrollback"); g_menu_append(section, "Reset Terminal", "win.resetterm"); +#if GTK_CHECK_VERSION(3,12,0) #define SET_ACCEL(app, command, accel) do \ { \ static const char *const accels[] = { accel, NULL }; \ gtk_application_set_accels_for_action( \ GTK_APPLICATION(app), command, accels); \ } while (0) +#else + /* The Gtk function used above was new in 3.12; the one below + * was deprecated from 3.14. */ +#define SET_ACCEL(app, command, accel) \ + gtk_application_add_accelerator(GTK_APPLICATION(app), accel, \ + command, NULL) +#endif SET_ACCEL(app, "app.newwin", "n"); SET_ACCEL(app, "win.copy", "c");