Set the object value to NULL if the icon is NULL

2002-02-17  Bradford Hovinen  <hovinen@ximian.com>

	* 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
This commit is contained in:
Bradford Hovinen 2002-02-17 20:06:53 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 6016be681e
commit e31e31be03
3 changed files with 20 additions and 2 deletions

View file

@ -1,5 +1,12 @@
2002-02-17 Bradford Hovinen <hovinen@ximian.com>
* 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

View file

@ -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;

View file

@ -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: