diff options
author | Andy Hertzfeld <andy@src.gnome.org> | 2000-08-01 05:23:52 +0000 |
---|---|---|
committer | Andy Hertzfeld <andy@src.gnome.org> | 2000-08-01 05:23:52 +0000 |
commit | 2a2160c1a5383a66fa4709c785a499bfd14f632b (patch) | |
tree | 049f7fe3462fea3ec6f6e4c7dea9c55477be572c | |
parent | e02747156c97a03e8e812adda7236bbc44fb034d (diff) | |
download | nautilus-2a2160c1a5383a66fa4709c785a499bfd14f632b.tar.gz |
only save and restore the foreground color if we're actually drawing;
only save and restore the foreground color if we're actually
drawing; otherwise, the gc isn't allocated and we crash.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-icon-canvas-item.c | 7 | ||||
-rw-r--r-- | libnautilus-private/nautilus-icon-canvas-item.c | 7 |
3 files changed, 15 insertions, 6 deletions
@@ -1,3 +1,10 @@ +2000-07-31 Andy Hertzfeld <andy@eazel.com> + + * libnautilus-extensions/nautilus-icon-canvas-item.c: + (draw_or_measure_label_text): + only save and restore the foreground color if we're drawing, otherwise + the gc isn't allocated and we crash. + 2000-07-31 Darin Adler <darin@eazel.com> * libnautilus-extensions/nautilus-icon-canvas-item.c: diff --git a/libnautilus-extensions/nautilus-icon-canvas-item.c b/libnautilus-extensions/nautilus-icon-canvas-item.c index 2974e78c0..a4f7bc393 100644 --- a/libnautilus-extensions/nautilus-icon-canvas-item.c +++ b/libnautilus-extensions/nautilus-icon-canvas-item.c @@ -636,11 +636,11 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, if (drawable != NULL) { icon_width = details->pixbuf == NULL ? 0 : gdk_pixbuf_get_width (details->pixbuf); gc = gdk_gc_new (canvas_item->canvas->layout.bin_window); + gdk_gc_get_values (gc, &save_gc); } max_text_width = floor (MAX_TEXT_WIDTH * canvas_item->canvas->pixels_per_unit); - gdk_gc_get_values (gc, &save_gc); /* if the icon is highlighted, do some set-up */ if (needs_highlight && drawable != NULL && !details->is_renaming) { @@ -712,8 +712,9 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, } g_strfreev (pieces); - gdk_gc_set_foreground (gc, &save_gc.foreground); - + if (drawable != NULL) + gdk_gc_set_foreground (gc, &save_gc.foreground); + if (needs_highlight) { height_so_far += 2; /* extra slop for nicer highlighting */ width_so_far += 4; /* account for emboldening, plus extra to make it look nicer */ diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c index 2974e78c0..a4f7bc393 100644 --- a/libnautilus-private/nautilus-icon-canvas-item.c +++ b/libnautilus-private/nautilus-icon-canvas-item.c @@ -636,11 +636,11 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, if (drawable != NULL) { icon_width = details->pixbuf == NULL ? 0 : gdk_pixbuf_get_width (details->pixbuf); gc = gdk_gc_new (canvas_item->canvas->layout.bin_window); + gdk_gc_get_values (gc, &save_gc); } max_text_width = floor (MAX_TEXT_WIDTH * canvas_item->canvas->pixels_per_unit); - gdk_gc_get_values (gc, &save_gc); /* if the icon is highlighted, do some set-up */ if (needs_highlight && drawable != NULL && !details->is_renaming) { @@ -712,8 +712,9 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, } g_strfreev (pieces); - gdk_gc_set_foreground (gc, &save_gc.foreground); - + if (drawable != NULL) + gdk_gc_set_foreground (gc, &save_gc.foreground); + if (needs_highlight) { height_so_far += 2; /* extra slop for nicer highlighting */ width_so_far += 4; /* account for emboldening, plus extra to make it look nicer */ |