GtkWindow: Tidy up after icon became a cairo surface

Use g_value_set/get_boxed() in gtk_window_get/set_property(), case PROP_ICON.
icon_from_list() shall always add a reference to the returned icon.
gtk_window_set_icon() must accept icon != NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=789870
This commit is contained in:
Kjell Ahlstedt 2017-11-03 20:05:28 +01:00
parent 11b8f27b76
commit 23014438d6

View File

@ -2008,7 +2008,7 @@ gtk_window_set_property (GObject *object,
break; break;
case PROP_ICON: case PROP_ICON:
gtk_window_set_icon (window, gtk_window_set_icon (window,
g_value_get_object (value)); g_value_get_boxed (value));
break; break;
case PROP_ICON_NAME: case PROP_ICON_NAME:
gtk_window_set_icon_name (window, g_value_get_string (value)); gtk_window_set_icon_name (window, g_value_get_string (value));
@ -2118,7 +2118,7 @@ gtk_window_get_property (GObject *object,
g_value_set_boolean (value, priv->destroy_with_parent); g_value_set_boolean (value, priv->destroy_with_parent);
break; break;
case PROP_ICON: case PROP_ICON:
g_value_set_object (value, gtk_window_get_icon (window)); g_value_set_boxed (value, gtk_window_get_icon (window));
break; break;
case PROP_ICON_NAME: case PROP_ICON_NAME:
g_value_set_string (value, gtk_window_get_icon_name (window)); g_value_set_string (value, gtk_window_get_icon_name (window));
@ -4574,7 +4574,7 @@ icon_from_list (GtkWindow *window,
} }
if (best == NULL && list != NULL) if (best == NULL && list != NULL)
best = (cairo_surface_t *)list->data; best = cairo_surface_reference ((cairo_surface_t *)list->data);
if (best) if (best)
@ -4781,7 +4781,7 @@ gtk_window_set_icon (GtkWindow *window,
GList *list; GList *list;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (icon == NULL); g_return_if_fail (icon == NULL || cairo_surface_get_type (icon) == CAIRO_SURFACE_TYPE_IMAGE);
list = NULL; list = NULL;