[gnome-software] Load larger stock icons for HiDPI screens



commit a0179e0275bbdac29db322e1d086e5ec1b3d2b45
Author: Richard Hughes <richard hughsie com>
Date:   Mon Sep 29 20:08:59 2014 +0100

    Load larger stock icons for HiDPI screens

 configure.ac                      |    2 +-
 contrib/gnome-software.spec.in    |    2 +-
 src/gs-app.c                      |    5 +++--
 src/gs-app.h                      |    1 +
 src/gs-plugin-loader.c            |    2 +-
 src/plugins/gs-plugin-appstream.c |    2 +-
 src/plugins/gs-plugin-epiphany.c  |    4 ++--
 7 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b8cf259..c177b10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,7 +89,7 @@ AM_CONDITIONAL(ENABLE_DOGTAIL, test "$enable_dogtail" != no)
 
 # this refers to the gnome-software plugin API version
 # this is not in any way related to a package or soname version
-GS_PLUGIN_API_VERSION=6
+GS_PLUGIN_API_VERSION=7
 AC_SUBST(GS_PLUGIN_API_VERSION)
 AC_DEFINE_UNQUOTED([GS_PLUGIN_API_VERSION], "$GS_PLUGIN_API_VERSION", [the plugin API version])
 
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index 6b2d4b6..d3149ea 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -30,7 +30,7 @@ BuildRequires: gsettings-desktop-schemas-devel
 BuildRequires: libappstream-glib-devel
 
 # this is not a library version
-%define gs_plugin_version               6
+%define gs_plugin_version               7
 
 %description
 gnome-software is an application that makes it easy to add, remove
diff --git a/src/gs-app.c b/src/gs-app.c
index fe6a35c..5fd2e5a 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -830,7 +830,7 @@ gs_app_set_icon_path (GsApp *app, const gchar *icon_path)
  * gs_app_load_icon:
  */
 gboolean
-gs_app_load_icon (GsApp *app, GError **error)
+gs_app_load_icon (GsApp *app, gint scale, GError **error)
 {
        GdkPixbuf *pixbuf = NULL;
        gboolean ret = TRUE;
@@ -839,7 +839,8 @@ gs_app_load_icon (GsApp *app, GError **error)
        g_return_val_if_fail (app->priv->icon != NULL, FALSE);
 
        /* either load from the theme or from a file */
-       pixbuf = gs_pixbuf_load (app->priv->icon, app->priv->icon_path, 64, error);
+       pixbuf = gs_pixbuf_load (app->priv->icon, app->priv->icon_path,
+                                64 * scale, error);
        if (pixbuf == NULL) {
                ret = FALSE;
                goto out;
diff --git a/src/gs-app.h b/src/gs-app.h
index 86251d6..4fddcbe 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -201,6 +201,7 @@ const gchar *gs_app_get_icon_path           (GsApp          *app);
 void            gs_app_set_icon_path           (GsApp          *app,
                                                 const gchar    *icon_path);
 gboolean        gs_app_load_icon               (GsApp          *app,
+                                                gint            scale,
                                                 GError         **error);
 GdkPixbuf      *gs_app_get_featured_pixbuf     (GsApp          *app);
 void            gs_app_set_featured_pixbuf     (GsApp          *app,
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 8194816..8664022 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -1538,7 +1538,7 @@ gs_plugin_loader_convert_unavailable_app (GsApp *app, const gchar *search)
        gs_app_set_kind (app, GS_APP_KIND_MISSING);
        gs_app_set_size (app, GS_APP_SIZE_MISSING);
        gs_app_set_icon (app, "dialog-question-symbolic");
-       gs_app_load_icon (app, NULL);
+       gs_app_load_icon (app, 1, NULL);
        g_string_free (tmp, TRUE);
        return TRUE;
 }
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 72c081a..30735c4 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -248,7 +248,7 @@ gs_plugin_refine_item_pixbuf (GsPlugin *plugin, GsApp *app, AsApp *item)
                break;
        case AS_ICON_KIND_STOCK:
                gs_app_set_icon (app, icon);
-               ret = gs_app_load_icon (app, &error);
+               ret = gs_app_load_icon (app, plugin->scale, &error);
                if (!ret) {
                        g_warning ("failed to load stock icon %s: %s",
                                   icon, error->message);
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index 2010c74..0bf8f46 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -155,7 +155,7 @@ gs_plugin_add_installed_file (GsPlugin *plugin,
        gs_app_set_id_kind (*app, AS_ID_KIND_WEB_APP);
        gs_app_add_source_id (*app, path);
        gs_app_set_icon (*app, icon);
-       ret = gs_app_load_icon (*app, error);
+       ret = gs_app_load_icon (*app, plugin->scale, error);
        if (!ret)
                goto out;
 out:
@@ -648,7 +648,7 @@ gs_plugin_refine_app (GsPlugin *plugin, GsApp *app, GError **error)
 
        /* set local icon name */
        gs_app_set_icon (app, filename_icon);
-       ret = gs_app_load_icon (app, error);
+       ret = gs_app_load_icon (app, plugin->scale, error);
        if (!ret)
                goto out;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]