From 6d65a92dfc99f686caa70e95d2700e299ddb79a0 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 22 Aug 2015 13:50:56 +0100 Subject: [PATCH] Stop using deprecated GTK_STOCK_* in GTK3. According to the GTK3 docs, we're now supposed to use fixed label strings instead. --- unix/gtkcompat.h | 11 ++++++++++- unix/gtkdlg.c | 4 ++-- unix/gtkfont.c | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/unix/gtkcompat.h b/unix/gtkcompat.h index 17351aef..76b29962 100644 --- a/unix/gtkcompat.h +++ b/unix/gtkcompat.h @@ -1,7 +1,7 @@ /* * Header file to make compatibility with older GTK versions less * painful, by #defining various things that are pure spelling changes - * between GTK1 and GTK2. + * between GTK1 and GTK2, or between 2 and 3. */ #if !GTK_CHECK_VERSION(2,0,0) @@ -156,3 +156,12 @@ #endif +#if GTK_CHECK_VERSION(3,0,0) +#define STANDARD_OK_LABEL "_OK" +#define STANDARD_OPEN_LABEL "_Open" +#define STANDARD_CANCEL_LABEL "_Cancel" +#else +#define STANDARD_OK_LABEL GTK_STOCK_OK +#define STANDARD_OPEN_LABEL GTK_STOCK_OPEN +#define STANDARD_CANCEL_LABEL GTK_STOCK_CANCEL +#endif diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index d4d0e828..9c870551 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -1674,8 +1674,8 @@ static void filefont_clicked(GtkButton *button, gpointer data) (uc->ctrl->fileselect.for_writing ? GTK_FILE_CHOOSER_ACTION_SAVE : GTK_FILE_CHOOSER_ACTION_OPEN), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL, + STANDARD_OPEN_LABEL, GTK_RESPONSE_ACCEPT, (const gchar *)NULL); gtk_window_set_modal(GTK_WINDOW(filechoose), TRUE); g_object_set_data(G_OBJECT(filechoose), "user-data", (gpointer)uc); diff --git a/unix/gtkfont.c b/unix/gtkfont.c index 53a261f1..1676a387 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -2996,9 +2996,9 @@ unifontsel *unifontsel_new(const char *wintitle) fs->u.window = GTK_WINDOW(gtk_dialog_new()); gtk_window_set_title(fs->u.window, wintitle); fs->u.cancel_button = gtk_dialog_add_button - (GTK_DIALOG(fs->u.window), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + (GTK_DIALOG(fs->u.window), STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL); fs->u.ok_button = gtk_dialog_add_button - (GTK_DIALOG(fs->u.window), GTK_STOCK_OK, GTK_RESPONSE_OK); + (GTK_DIALOG(fs->u.window), STANDARD_OK_LABEL, GTK_RESPONSE_OK); gtk_widget_grab_default(fs->u.ok_button); /*