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.
This commit is contained in:
Jacob Nevins 2017-12-20 11:55:51 +00:00
Родитель 599bab84a1
Коммит 5f7604888b
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -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", "<Primary>n");
SET_ACCEL(app, "win.copy", "<Primary>c");