[gnome-software] details: Use different icons for repo packages and addons



commit e488429c32834ca6531d6a02175f0e051ac9a914
Author: Kalev Lember <kalevlember gmail com>
Date:   Fri Feb 28 13:01:54 2014 +0100

    details: Use different icons for repo packages and addons
    
    This makes use of the new x-package-repository and application-x-addon
    icons.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724669

 src/gs-shell-details.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 00236e2..7cb0ece 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -488,6 +488,21 @@ out:
 }
 
 /**
+ * gs_shell_details_is_addon_id_kind
+ **/
+static gboolean
+gs_shell_details_is_addon_id_kind (GsApp *app)
+{
+        GsAppIdKind id_kind;
+        id_kind = gs_app_get_id_kind (app);
+        if (id_kind == GS_APP_ID_KIND_DESKTOP)
+                return FALSE;
+        if (id_kind == GS_APP_ID_KIND_WEBAPP)
+                return FALSE;
+        return TRUE;
+}
+
+/**
  * gs_shell_details_refresh_all:
  **/
 static void
@@ -540,8 +555,14 @@ gs_shell_details_refresh_all (GsShellDetails *shell_details)
        }
        if (pixbuf == NULL)
                pixbuf = gs_app_get_pixbuf (priv->app);
-       if( pixbuf == NULL && gs_app_get_state (priv->app) == GS_APP_STATE_LOCAL)
-               pixbuf = gs_pixbuf_load ("application-x-executable", 96, NULL);
+       if (pixbuf == NULL && gs_app_get_state (priv->app) == GS_APP_STATE_LOCAL) {
+               if (gs_app_get_kind (priv->app) == GS_APP_KIND_SOURCE)
+                       pixbuf = gs_pixbuf_load ("x-package-repository", 96, NULL);
+               else if (gs_shell_details_is_addon_id_kind (priv->app))
+                       pixbuf = gs_pixbuf_load ("application-x-addon", 96, NULL);
+               else
+                       pixbuf = gs_pixbuf_load ("application-x-executable", 96, NULL);
+       }
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_icon"));
        if (pixbuf != NULL) {
                gtk_image_set_from_pixbuf (GTK_IMAGE (widget), pixbuf);


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