diff options
author | Christian Neumair <chris@gnome-de.org> | 2006-10-19 13:27:28 +0000 |
---|---|---|
committer | Christian Neumair <cneumair@src.gnome.org> | 2006-10-19 13:27:28 +0000 |
commit | 69ddc1935315013f9f2a723c5fac959d2148b3f5 (patch) | |
tree | e77587dfc3a1444ce9006ac5473b57da4632531a /libnautilus-private | |
parent | b5023c72f73e2ab8354892c4d1799597a50b6e25 (diff) | |
download | nautilus-69ddc1935315013f9f2a723c5fac959d2148b3f5.tar.gz |
Handle NULL pattern chit, don't unref pattern tile in make_pattern_chit.
2006-10-19 Christian Neumair <chris@gnome-de.org>
* libnautilus-private/nautilus-customization-data.c:
(nautilus_customization_data_new),
(nautilus_customization_data_get_next_element),
(nautilus_customization_make_pattern_chit):
Handle NULL pattern chit, don't unref pattern tile in
make_pattern_chit.
* libnautilus-private/nautilus-file-utilities.c:
(nautilus_pixmap_file):
Bail using g_debug if pixmap couldn't be found.
* src/nautilus-emblem-sidebar.c: (nautilus_emblem_sidebar_populate):
Only create pixmap if path lookup succeeded.
* src/nautilus-property-browser.c: (nautilus_property_browser_init),
(make_drag_image), (make_color_drag_image),
(make_properties_from_directories), (add_reset_property),
(property_browser_category_button_new):
Handle NULL pattern chits, don't operate on NULL pixbufs.
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/nautilus-customization-data.c | 25 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-utilities.c | 5 |
2 files changed, 19 insertions, 11 deletions
diff --git a/libnautilus-private/nautilus-customization-data.c b/libnautilus-private/nautilus-customization-data.c index 11996ab09..610f4a965 100644 --- a/libnautilus-private/nautilus-customization-data.c +++ b/libnautilus-private/nautilus-customization-data.c @@ -130,16 +130,17 @@ nautilus_customization_data_new (const char *customization_name, data->current_file_list = data->public_file_list; } + data->pattern_frame = NULL; + /* load the frame if necessary */ if (strcmp (customization_name, "patterns") == 0) { temp_str = nautilus_pixmap_file ("chit_frame.png"); - data->pattern_frame = gdk_pixbuf_new_from_file (temp_str, NULL); + if (temp_str != NULL) { + data->pattern_frame = gdk_pixbuf_new_from_file (temp_str, NULL); + } g_free (temp_str); - } else { - data->pattern_frame = NULL; } - data->private_data_was_displayed = FALSE; data->data_is_for_a_menu = data_is_for_a_menu; data->customization_name = g_strdup (customization_name); @@ -223,15 +224,17 @@ nautilus_customization_data_get_next_element_for_display (NautilusCustomizationD is_reset_image = eel_strcmp(current_file_info->name, RESET_IMAGE_NAME) == 0; *emblem_name = g_strdup (current_file_info->name); - - if (strcmp (data->customization_name, "patterns") == 0) { + + if (strcmp (data->customization_name, "patterns") == 0 && + data->pattern_frame != NULL) { pixbuf = nautilus_customization_make_pattern_chit (orig_pixbuf, data->pattern_frame, FALSE, is_reset_image); } else { pixbuf = eel_gdk_pixbuf_scale_down_to_fit (orig_pixbuf, data->maximum_icon_width, data->maximum_icon_height); - g_object_unref (orig_pixbuf); } + + g_object_unref (orig_pixbuf); *pixbuf_out = pixbuf; @@ -360,8 +363,10 @@ nautilus_customization_make_pattern_chit (GdkPixbuf *pattern_tile, GdkPixbuf *fr GdkPixbuf *pixbuf, *temp_pixbuf; int frame_width, frame_height; int pattern_width, pattern_height; - - + + g_assert (pattern_tile != NULL); + g_assert (frame != NULL); + frame_width = gdk_pixbuf_get_width (frame); frame_height = gdk_pixbuf_get_height (frame); pattern_width = gdk_pixbuf_get_width (pattern_tile); @@ -385,8 +390,6 @@ nautilus_customization_make_pattern_chit (GdkPixbuf *pattern_tile, GdkPixbuf *fr g_object_unref (pixbuf); pixbuf = temp_pixbuf; } - - g_object_unref (pattern_tile); return pixbuf; } diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c index c6a362322..80a1f72c5 100644 --- a/libnautilus-private/nautilus-file-utilities.c +++ b/libnautilus-private/nautilus-file-utilities.c @@ -414,6 +414,11 @@ nautilus_pixmap_file (const char *partial_path) path = g_build_filename (DATADIR "/pixmaps/nautilus", partial_path, NULL); if (g_file_test (path, G_FILE_TEST_EXISTS)) { return path; + } else { + char *tmp; + tmp = nautilus_get_pixmap_directory (); + g_debug ("Failed to locate \"%s\" in Nautilus pixmap path \"%s\". Incomplete installation?", partial_path, tmp); + g_free (tmp); } g_free (path); return NULL; |