diff options
author | Tobias Brunner <tobias@strongswan.org> | 2010-09-20 18:42:40 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2010-10-14 17:36:18 +0200 |
commit | ab02058d7830e1868823b266afae32d03b0a05ea (patch) | |
tree | bed757cb278df33a9ab92afddb7778153a0ccb68 /src | |
parent | df4f82a9ad29f4572aa1e8f1fb508ff00627ea73 (diff) | |
download | strongswan-ab02058d7830e1868823b266afae32d03b0a05ea.tar.bz2 strongswan-ab02058d7830e1868823b266afae32d03b0a05ea.tar.xz |
Maemo: Improved icon loading in status applet.
Diffstat (limited to 'src')
-rw-r--r-- | src/frontends/maemo/src/strongswan-status.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/src/frontends/maemo/src/strongswan-status.c b/src/frontends/maemo/src/strongswan-status.c index cf8964a6a..48a8c7492 100644 --- a/src/frontends/maemo/src/strongswan-status.c +++ b/src/frontends/maemo/src/strongswan-status.c @@ -146,22 +146,36 @@ button_clicked (HildonButton *button, StrongswanStatus *plugin) 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 load_icons (StrongswanStatusPrivate *priv) { GtkIconTheme *theme = gtk_icon_theme_get_default (); - priv->icons.status_open = gtk_icon_theme_load_icon (theme, - "strongswan_lock_open", - ICON_SIZE_STATUS, GTK_ICON_LOOKUP_NO_SVG, NULL); - priv->icons.status_close = gtk_icon_theme_load_icon (theme, - "strongswan_lock_close", - ICON_SIZE_STATUS, GTK_ICON_LOOKUP_NO_SVG, NULL); - priv->icons.button_open = gtk_icon_theme_load_icon (theme, - "strongswan_lock_open", - ICON_SIZE_BUTTON, GTK_ICON_LOOKUP_NO_SVG, NULL); - priv->icons.button_close = gtk_icon_theme_load_icon (theme, - "strongswan_lock_close", - ICON_SIZE_BUTTON, GTK_ICON_LOOKUP_NO_SVG, NULL); + priv->icons.status_open = load_icon (theme, "strongswan_lock_open", + ICON_SIZE_STATUS); + priv->icons.status_close = load_icon (theme, "strongswan_lock_close", + ICON_SIZE_STATUS); + priv->icons.button_open = load_icon (theme, "strongswan_lock_open", + ICON_SIZE_BUTTON); + priv->icons.button_close = load_icon (theme, "strongswan_lock_close", + ICON_SIZE_BUTTON); + if (!priv->icons.status_open || !priv->icons.button_open) + { + hildon_banner_show_information (NULL, NULL, "failed to load icons"); + } } static void |