[gnome-software] Allow gs_app_set_icon_name() to open non-themed icons
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Allow gs_app_set_icon_name() to open non-themed icons
- Date: Thu, 17 Oct 2013 21:16:15 +0000 (UTC)
commit e1c1cf969d5c88695aa2a40d9091cddff827badc
Author: Richard Hughes <richard hughsie com>
Date: Thu Oct 17 20:21:28 2013 +0100
Allow gs_app_set_icon_name() to open non-themed icons
src/gs-app.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index ddb1a9b..d6322b4 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -566,13 +566,19 @@ gs_app_set_icon_name (GsApp *app, const gchar *icon_name, GError **error)
g_return_val_if_fail (GS_IS_APP (app), FALSE);
g_return_val_if_fail (icon_name != NULL, FALSE);
- /* just load from the theme */
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- icon_name,
- 64,
- GTK_ICON_LOOKUP_USE_BUILTIN |
- GTK_ICON_LOOKUP_FORCE_SIZE,
- error);
+ /* either load from the theme or from a file */
+ if (icon_name[0] == '/') {
+ pixbuf = gdk_pixbuf_new_from_file_at_size (icon_name,
+ 64, 64,
+ error);
+ } else {
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ icon_name,
+ 64,
+ GTK_ICON_LOOKUP_USE_BUILTIN |
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ error);
+ }
if (pixbuf == NULL) {
ret = FALSE;
goto out;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]