From fe0b6370b7415d81b575bac22caea623aa69c9c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 4 Nov 2011 19:18:05 +0100 Subject: [PATCH] * gtkutil.c (xg_make_tool_item): Add callbacks of one of wimage or label is not null. (xg_tool_item_stale_p): Handle the fact that wimage and/or wlbl may be NULL. Fixes: debbugs:9951 --- src/ChangeLog | 7 +++++++ src/gtkutil.c | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ccfcb48daf0..b03c609f907 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-11-04 Jan Djärv + + * gtkutil.c (xg_make_tool_item): Add callbacks of one of wimage or + label is not null (Bug#9951). + (xg_tool_item_stale_p): Handle the fact that wimage and/or wlbl + may be NULL. + 2011-11-04 Eli Zaretskii * window.c (Fwindow_body_size): Mention in the doc string that the diff --git a/src/gtkutil.c b/src/gtkutil.c index 26959d57d4b..af697c72673 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4237,7 +4237,7 @@ xg_make_tool_item (FRAME_PTR f, gtk_container_add (GTK_CONTAINER (weventbox), wb); gtk_container_add (GTK_CONTAINER (ti), weventbox); - if (wimage) + if (wimage || label) { intptr_t ii = i; gpointer gi = (gpointer) ii; @@ -4302,21 +4302,21 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage); /* Check if the tool icon matches. */ - if (stock_name) + if (stock_name && wimage) { old = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME); if (!old || strcmp (old, stock_name)) return 1; } - else if (icon_name) + else if (icon_name && wimage) { old = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME); if (!old || strcmp (old, icon_name)) return 1; } - else + else if (wimage) { gpointer gold_img = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA); @@ -4331,7 +4331,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, return 1; /* Ensure label is correct. */ - if (label) + if (label && wlbl) gtk_label_set_text (GTK_LABEL (wlbl), label); return 0; } -- 2.39.2