[gnome-software] Rework the featured css yet again



commit 2854533bd4b11fabd07471d19b81a3db68b9f938
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Sep 10 13:16:19 2013 -0400

    Rework the featured css yet again
    
    The entire background is now customizable. This will be
    used for the gnome-weather background in the near future.

 data/featured.ini.in                       |   20 +++-----------
 src/gs-feature-tile.c                      |   24 +----------------
 src/plugins/gs-plugin-hardcoded-featured.c |   38 +--------------------------
 3 files changed, 8 insertions(+), 74 deletions(-)
---
diff --git a/data/featured.ini.in b/data/featured.ini.in
index 5f188ef..8cd2433 100644
--- a/data/featured.ini.in
+++ b/data/featured.ini.in
@@ -1,26 +1,14 @@
 [darktable]
-image=darktable.png
-size=100% auto
-position=center 20%
-gradient1=#393d39
-gradient2=#5a5e58
+background=url('/home/mclasen/gnome/share/gnome-software/darktable.png') left 20% / 50% auto no-repeat, 
linear-gradient(to bottom, #393d39, #5a5e58)
 stroke=#1f2122
-text=#ffffff;
+text=#ffffff
 
 [gimp]
-image=featured-gimp.png
-size=100% auto
-position=center 20%
-gradient1=#8ac674
-gradient2=#cbddc3
+background=url('/home/mclasen/gnome/share/gnome-software/featured-gimp.png') left 20% / 50% auto no-repeat, 
linear-gradient(to bottom, #8ac674, #cbddc3)
 stroke=#2a6c10
 text=#000000
 
 [mypaint]
-image=mypaint.png
-size=100% auto
-position=center 67%
-gradient1=#8fa5d9
-gradient2=#d8e0ef
+background=url('/home/mclasen/gnome/share/gnome-software/mypaint.png') left 67% / 50% auto no-repeat, 
linear-gradient(to bottom, #8fa5d9, #d8e0ef)
 stroke=#4c52aa
 text=#362d89
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
index 2cf730a..3c6a7be 100644
--- a/src/gs-feature-tile.c
+++ b/src/gs-feature-tile.c
@@ -73,11 +73,6 @@ gs_feature_tile_set_app (GsFeatureTile *tile, GsApp *app)
         gtk_label_set_label (GTK_LABEL (priv->title), gs_app_get_name (app));
         gtk_label_set_label (GTK_LABEL (priv->subtitle), gs_app_get_summary (app));
         data = g_strdup_printf (
-                ".featured-image {\n"
-                "  background-image: url('%s');\n"
-                "  background-size: %s;\n"
-                "  background-position: %s;\n"
-                "}\n"
                 ".button.featured-tile {\n"
                 "  padding: 0;\n"
                 "  border-radius: 0;\n"
@@ -89,27 +84,12 @@ gs_feature_tile_set_app (GsFeatureTile *tile, GsApp *app)
                 "  outline-color: alpha(%s, 0.75);\n"
                 "  outline-style: dashed;\n"
                 "  outline-offset: 2px;\n"
-                "  background-image: -gtk-gradient(linear,\n"
-                "                       0 0, 0 1,\n"
-                "                       color-stop(0,%s),\n"
-                "                       color-stop(1,%s));\n"
-                "}\n"
-                ".button.featured-tile:hover {\n"
-                "  background-image: -gtk-gradient(linear,\n"
-                "                       0 0, 0 1,\n"
-                "                       color-stop(0,alpha(%s,0.80)),\n"
-                "                       color-stop(1,alpha(%s,0.80)));\n"
+                "  background: %s;\n"
                 "}\n",
-                gs_app_get_metadata_item (app, "Featured::image-path"),
-                gs_app_get_metadata_item (app, "Featured::image-size"),
-                gs_app_get_metadata_item (app, "Featured::image-position"),
                 gs_app_get_metadata_item (app, "Featured::stroke-color"),
                 gs_app_get_metadata_item (app, "Featured::text-color"),
                 gs_app_get_metadata_item (app, "Featured::text-color"),
-                gs_app_get_metadata_item (app, "Featured::gradient1-color"),
-                gs_app_get_metadata_item (app, "Featured::gradient2-color"),
-                gs_app_get_metadata_item (app, "Featured::gradient1-color"),
-                gs_app_get_metadata_item (app, "Featured::gradient2-color"));
+                gs_app_get_metadata_item (app, "Featured::background"));
 
         gtk_css_provider_load_from_data (priv->provider, data, -1, NULL);
         g_free (data);
diff --git a/src/plugins/gs-plugin-hardcoded-featured.c b/src/plugins/gs-plugin-hardcoded-featured.c
index 1d4025b..b223bdc 100644
--- a/src/plugins/gs-plugin-hardcoded-featured.c
+++ b/src/plugins/gs-plugin-hardcoded-featured.c
@@ -52,7 +52,6 @@ gs_plugin_add_featured (GsPlugin *plugin,
 {
        gboolean ret = TRUE;
        gchar *path;
-       GdkPixbuf *pixbuf;
        GsApp *app;
        guint i;
         GDateTime *date;
@@ -104,40 +103,10 @@ gs_plugin_add_featured (GsPlugin *plugin,
                 group = apps[i];
         }
 
-        s = g_key_file_get_string (kf, group, "image", NULL);
-       path = g_build_filename (DATADIR, "gnome-software", s, NULL);
-        g_free (s);
-       pixbuf = gdk_pixbuf_new_from_file_at_scale (path, -1, -1, TRUE, &local_error);
-       if (pixbuf == NULL) {
-                g_warning ("Failed to load %s: %s", path, local_error->message);
-                g_propagate_error (error, local_error);
-                g_key_file_unref (kf);
-                g_free (path);
-               ret = FALSE;
-               goto out;
-       }
-
         app = gs_app_new (group);
-       gs_app_set_featured_pixbuf (app, pixbuf);
-        gs_app_set_metadata (app, "Featured::image-path", path);
-        s = g_key_file_get_string (kf, group, "size", NULL);
-        if (s) {
-                gs_app_set_metadata (app, "Featured::image-size", s);
-                g_free (s);
-        }
-        s = g_key_file_get_string (kf, group, "position", NULL);
+        s = g_key_file_get_string (kf, group, "background", NULL);
         if (s) {
-                gs_app_set_metadata (app, "Featured::image-position", s);
-                g_free (s);
-        }
-        s = g_key_file_get_string (kf, group, "gradient1", NULL);
-        if (s) {
-                gs_app_set_metadata (app, "Featured::gradient1-color", s);
-                g_free (s);
-        }
-        s = g_key_file_get_string (kf, group, "gradient2", NULL);
-        if (s) {
-                gs_app_set_metadata (app, "Featured::gradient2-color", s);
+                gs_app_set_metadata (app, "Featured::background", s);
                 g_free (s);
         }
         s = g_key_file_get_string (kf, group, "stroke", NULL);
@@ -150,10 +119,7 @@ gs_plugin_add_featured (GsPlugin *plugin,
                 gs_app_set_metadata (app, "Featured::text-color", s);
                 g_free (s);
         }
-
-               g_object_unref (pixbuf);
        gs_plugin_add_app (list, app);
-       g_free (path);
 
 out:
         g_strfreev (apps);


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