Maemo: Improved icon loading in status applet.
This commit is contained in:
@@ -146,22 +146,36 @@ button_clicked (HildonButton *button, StrongswanStatus *plugin)
|
|||||||
gtk_widget_show_all (priv->dialog);
|
gtk_widget_show_all (priv->dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GdkPixbuf*
|
||||||
|
load_icon (GtkIconTheme *theme, const gchar *name, gint size)
|
||||||
|
{
|
||||||
|
GdkPixbuf *icon = NULL;
|
||||||
|
GdkPixbuf *loaded = gtk_icon_theme_load_icon (theme, name, size,
|
||||||
|
GTK_ICON_LOOKUP_NO_SVG, NULL);
|
||||||
|
if (loaded)
|
||||||
|
{ /* so we don't have to listen for theme changes, we copy the icon */
|
||||||
|
icon = gdk_pixbuf_copy (loaded);
|
||||||
|
g_object_unref (loaded);
|
||||||
|
}
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_icons (StrongswanStatusPrivate *priv)
|
load_icons (StrongswanStatusPrivate *priv)
|
||||||
{
|
{
|
||||||
GtkIconTheme *theme = gtk_icon_theme_get_default ();
|
GtkIconTheme *theme = gtk_icon_theme_get_default ();
|
||||||
priv->icons.status_open = gtk_icon_theme_load_icon (theme,
|
priv->icons.status_open = load_icon (theme, "strongswan_lock_open",
|
||||||
"strongswan_lock_open",
|
ICON_SIZE_STATUS);
|
||||||
ICON_SIZE_STATUS, GTK_ICON_LOOKUP_NO_SVG, NULL);
|
priv->icons.status_close = load_icon (theme, "strongswan_lock_close",
|
||||||
priv->icons.status_close = gtk_icon_theme_load_icon (theme,
|
ICON_SIZE_STATUS);
|
||||||
"strongswan_lock_close",
|
priv->icons.button_open = load_icon (theme, "strongswan_lock_open",
|
||||||
ICON_SIZE_STATUS, GTK_ICON_LOOKUP_NO_SVG, NULL);
|
ICON_SIZE_BUTTON);
|
||||||
priv->icons.button_open = gtk_icon_theme_load_icon (theme,
|
priv->icons.button_close = load_icon (theme, "strongswan_lock_close",
|
||||||
"strongswan_lock_open",
|
ICON_SIZE_BUTTON);
|
||||||
ICON_SIZE_BUTTON, GTK_ICON_LOOKUP_NO_SVG, NULL);
|
if (!priv->icons.status_open || !priv->icons.button_open)
|
||||||
priv->icons.button_close = gtk_icon_theme_load_icon (theme,
|
{
|
||||||
"strongswan_lock_close",
|
hildon_banner_show_information (NULL, NULL, "failed to load icons");
|
||||||
ICON_SIZE_BUTTON, GTK_ICON_LOOKUP_NO_SVG, NULL);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user