summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-04-09 02:51:02 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-04-09 02:51:02 +0000
commit1b842bb9e13f3978db5491e83f7c5853288964a9 (patch)
tree7e48a3b59687f8b2c81057bb78a457467a9b42f1
parent0d9888e7c5220f4724df80c44978f39fcfe0e9f4 (diff)
downloadgtk+-1b842bb9e13f3978db5491e83f7c5853288964a9.tar.gz
If a stock_id is unknown, display the missing image. (#169870, Steven
2005-04-08 Matthias Clasen <mclasen@redhat.com> * gtk/gtkimage.c (gtk_image_expose, gtk_image_calc_size): If a stock_id is unknown, display the missing image. (#169870, Steven Walter)
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLog.pre-2-104
-rw-r--r--ChangeLog.pre-2-84
-rw-r--r--gtk/gtkimage.c20
4 files changed, 28 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a7e693d7ef..8de208ffd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2005-04-08 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkimage.c (gtk_image_expose, gtk_image_calc_size):
+ If a stock_id is unknown, display the missing image. (#169870,
+ Steven Walter)
+
* gtk/gtkiconcache.c (icon_name_hash): Use the same function
as in updateiconcache.c. (spotted by Morten Welinder)
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index a7e693d7ef..8de208ffd4 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,5 +1,9 @@
2005-04-08 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkimage.c (gtk_image_expose, gtk_image_calc_size):
+ If a stock_id is unknown, display the missing image. (#169870,
+ Steven Walter)
+
* gtk/gtkiconcache.c (icon_name_hash): Use the same function
as in updateiconcache.c. (spotted by Morten Welinder)
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index a7e693d7ef..8de208ffd4 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,5 +1,9 @@
2005-04-08 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkimage.c (gtk_image_expose, gtk_image_calc_size):
+ If a stock_id is unknown, display the missing image. (#169870,
+ Steven Walter)
+
* gtk/gtkiconcache.c (icon_name_hash): Use the same function
as in updateiconcache.c. (spotted by Morten Welinder)
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 91827549de..9de4a86606 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1545,6 +1545,9 @@ gtk_image_expose (GtkWidget *widget,
GdkBitmap *mask;
GdkPixbuf *pixbuf;
gboolean needs_state_transform;
+ GtkStockItem item;
+ gchar *stock_id;
+
image = GTK_IMAGE (widget);
misc = GTK_MISC (widget);
@@ -1632,8 +1635,7 @@ gtk_image_expose (GtkWidget *widget,
case GTK_IMAGE_PIXBUF:
image_bound.width = gdk_pixbuf_get_width (image->data.pixbuf.pixbuf);
- image_bound.height = gdk_pixbuf_get_height (image->data.pixbuf.pixbuf);
-
+ image_bound.height = gdk_pixbuf_get_height (image->data.pixbuf.pixbuf);
if (rectangle_intersect_even (&area, &image_bound) &&
needs_state_transform)
@@ -1653,8 +1655,12 @@ gtk_image_expose (GtkWidget *widget,
break;
case GTK_IMAGE_STOCK:
+ if (gtk_stock_lookup (image->data.stock.stock_id, &item))
+ stock_id = image->data.stock.stock_id;
+ else
+ stock_id = GTK_STOCK_MISSING_IMAGE;
pixbuf = gtk_widget_render_icon (widget,
- image->data.stock.stock_id,
+ stock_id,
image->icon_size,
NULL);
if (pixbuf)
@@ -1949,6 +1955,8 @@ gtk_image_calc_size (GtkImage *image)
{
GtkWidget *widget = GTK_WIDGET (image);
GdkPixbuf *pixbuf = NULL;
+ GtkStockItem item;
+ gchar *stock_id;
/* We update stock/icon set on every size request, because
* the theme could have affected the size; for other kinds of
@@ -1958,8 +1966,12 @@ gtk_image_calc_size (GtkImage *image)
switch (image->storage_type)
{
case GTK_IMAGE_STOCK:
+ if (gtk_stock_lookup (image->data.stock.stock_id, &item))
+ stock_id = image->data.stock.stock_id;
+ else
+ stock_id = GTK_STOCK_MISSING_IMAGE;
pixbuf = gtk_widget_render_icon (widget,
- image->data.stock.stock_id,
+ stock_id,
image->icon_size,
NULL);
break;