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

Use gtk_window_set_icon() where available.

GTK is deprecating the use of gdk_window_set_icon(), in favour of a
method that doesn't have to drop down to the GDK level at all (and
also doesn't use a pixmap). No reason not to use that instead.
This commit is contained in:
Simon Tatham 2015-08-16 09:41:10 +01:00
parent f853b695de
commit 0413cc856c

View File

@ -3817,20 +3817,26 @@ static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data)
void set_window_icon(GtkWidget *window, const char *const *const *icon, void set_window_icon(GtkWidget *window, const char *const *const *icon,
int n_icon) int n_icon)
{ {
GdkPixmap *iconpm;
GdkBitmap *iconmask;
#if GTK_CHECK_VERSION(2,0,0) #if GTK_CHECK_VERSION(2,0,0)
GList *iconlist; GList *iconlist;
int n; int n;
#else
GdkPixmap *iconpm;
GdkBitmap *iconmask;
#endif #endif
if (!n_icon) if (!n_icon)
return; return;
gtk_widget_realize(window); gtk_widget_realize(window);
#if GTK_CHECK_VERSION(2,0,0)
gtk_window_set_icon(GTK_WINDOW(window),
gdk_pixbuf_new_from_xpm_data((const gchar **)icon[0]));
#else
iconpm = gdk_pixmap_create_from_xpm_d(gtk_widget_get_window(window), iconpm = gdk_pixmap_create_from_xpm_d(gtk_widget_get_window(window),
&iconmask, NULL, (gchar **)icon[0]); &iconmask, NULL, (gchar **)icon[0]);
gdk_window_set_icon(gtk_widget_get_window(window), NULL, iconpm, iconmask); gdk_window_set_icon(gtk_widget_get_window(window), NULL, iconpm, iconmask);
#endif
#if GTK_CHECK_VERSION(2,0,0) #if GTK_CHECK_VERSION(2,0,0)
iconlist = NULL; iconlist = NULL;
@ -3840,7 +3846,7 @@ void set_window_icon(GtkWidget *window, const char *const *const *icon,
gdk_pixbuf_new_from_xpm_data((const gchar **) gdk_pixbuf_new_from_xpm_data((const gchar **)
icon[n])); icon[n]));
} }
gdk_window_set_icon_list(gtk_widget_get_window(window), iconlist); gtk_window_set_icon_list(GTK_WINDOW(window), iconlist);
#endif #endif
} }