Use fallback stock icon if there is no throbber animation
This commit is contained in:
parent
bd111d485c
commit
53c5bd3c9c
1 changed files with 13 additions and 5 deletions
|
@ -840,19 +840,27 @@ katze_throbber_expose_event (GtkWidget* widget,
|
||||||
|
|
||||||
if (!throbber->pixbuf)
|
if (!throbber->pixbuf)
|
||||||
{
|
{
|
||||||
g_warning (_("Icon '%s' couldn't be loaded"), throbber->icon_name);
|
/* Fallback to a stock icon */
|
||||||
katze_assign (throbber->icon_name, NULL);
|
katze_assign (throbber->icon_name, g_strdup (GTK_STOCK_EXECUTE));
|
||||||
g_object_notify (G_OBJECT (throbber), "icon-name");
|
g_object_notify (G_OBJECT (throbber), "icon-name");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_UNLIKELY (!throbber->pixbuf))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
gint cols = gdk_pixbuf_get_width (throbber->pixbuf) / throbber->width;
|
gint cols = gdk_pixbuf_get_width (throbber->pixbuf) / throbber->width;
|
||||||
gint rows = gdk_pixbuf_get_height (throbber->pixbuf) / throbber->height;
|
gint rows = gdk_pixbuf_get_height (throbber->pixbuf) / throbber->height;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (cols == 1 && cols == rows))
|
||||||
|
{
|
||||||
|
gdk_draw_pixbuf (event->window, NULL, throbber->pixbuf,
|
||||||
|
0, 0,
|
||||||
|
widget->allocation.x,
|
||||||
|
widget->allocation.y,
|
||||||
|
throbber->width, throbber->height,
|
||||||
|
GDK_RGB_DITHER_NONE, 0, 0);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (G_LIKELY (cols > 0 && rows > 0))
|
if (G_LIKELY (cols > 0 && rows > 0))
|
||||||
{
|
{
|
||||||
gint index = throbber->index % (cols * rows);
|
gint index = throbber->index % (cols * rows);
|
||||||
|
|
Loading…
Reference in a new issue