From e31e31be03f22fffb82774b7a182dbefbf46b4bd Mon Sep 17 00:00:00 2001 From: Bradford Hovinen Date: Sun, 17 Feb 2002 20:06:53 +0000 Subject: [PATCH] Set the object value to NULL if the icon is NULL 2002-02-17 Bradford Hovinen * mime-types-model.c (mime_types_model_get_value): Set the object value to NULL if the icon is NULL * mime-type-info.c (get_icon_pixbuf): Give up if it can't find nautilus/i-regular-24.png (mime_type_info_get_icon): Only ref the pixbuf if non-NULL --- capplets/file-types/ChangeLog | 7 +++++++ capplets/file-types/mime-type-info.c | 6 +++++- capplets/file-types/mime-types-model.c | 9 ++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/capplets/file-types/ChangeLog b/capplets/file-types/ChangeLog index a64c54163..d5a6f64f4 100644 --- a/capplets/file-types/ChangeLog +++ b/capplets/file-types/ChangeLog @@ -1,5 +1,12 @@ 2002-02-17 Bradford Hovinen + * mime-types-model.c (mime_types_model_get_value): Set the object + value to NULL if the icon is NULL + + * mime-type-info.c (get_icon_pixbuf): Give up if it can't find + nautilus/i-regular-24.png + (mime_type_info_get_icon): Only ref the pixbuf if non-NULL + * mime-category-edit-dialog.c (fill_dialog): Fill the name entry with the description, not the name field diff --git a/capplets/file-types/mime-type-info.c b/capplets/file-types/mime-type-info.c index 61396750f..15865c1b8 100644 --- a/capplets/file-types/mime-type-info.c +++ b/capplets/file-types/mime-type-info.c @@ -131,7 +131,8 @@ mime_type_info_get_icon (MimeTypeInfo *info) if (info->small_icon_pixbuf == NULL) get_icon_pixbuf (info, mime_type_info_get_icon_path (info), FALSE); - g_object_ref (G_OBJECT (info->small_icon_pixbuf)); + if (info->small_icon_pixbuf != NULL) + g_object_ref (G_OBJECT (info->small_icon_pixbuf)); return info->small_icon_pixbuf; } @@ -827,6 +828,9 @@ get_icon_pixbuf (MimeTypeInfo *info, const gchar *icon_path, gboolean want_large if (icon_path == NULL) icon_path = gnome_vfs_icon_path_from_filename ("nautilus/i-regular-24.png"); + if (icon_path == NULL) + return; + if ((want_large && info->icon_pixbuf != NULL) || info->small_icon_pixbuf != NULL) return; diff --git a/capplets/file-types/mime-types-model.c b/capplets/file-types/mime-types-model.c index 6a9a7aaac..df7cf6216 100644 --- a/capplets/file-types/mime-types-model.c +++ b/capplets/file-types/mime-types-model.c @@ -373,6 +373,7 @@ mime_types_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, gint co { MimeTypesModel *model; ModelEntry *entry; + GdkPixbuf *icon; g_return_if_fail (tree_model != NULL); g_return_if_fail (IS_MIME_TYPES_MODEL (tree_model)); @@ -432,7 +433,13 @@ mime_types_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, gint co switch (entry->type) { case MODEL_ENTRY_MIME_TYPE: - g_value_set_object (value, G_OBJECT (mime_type_info_get_icon (MIME_TYPE_INFO (entry)))); + icon = mime_type_info_get_icon (MIME_TYPE_INFO (entry)); + + if (icon != NULL) + g_value_set_object (value, G_OBJECT (icon)); + else + g_value_set_object (value, NULL); + break; default: