[gnome-software: 5/10] gs-screenshot-carousel: Drop special case for font screenshots




commit aae79a81c76b01d976a19b50f0c2ae35800c56fb
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Aug 20 12:22:08 2021 +0100

    gs-screenshot-carousel: Drop special case for font screenshots
    
    Previously, this added an additional caption label which showed the
    sample text in the current system font, for comparison. That’s no longer
    easily possible with `GsScreenshotImage`, and the special casing code
    was instead adding extra broken entries into the carousel and making the
    other screenshots render too wide.
    
    Fix that by dropping the special casing. The normal screenshot code
    produces good carousels for fonts anyway.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #1383

 src/gs-screenshot-carousel.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)
---
diff --git a/src/gs-screenshot-carousel.c b/src/gs-screenshot-carousel.c
index 045db959b..f6b0da0df 100644
--- a/src/gs-screenshot-carousel.c
+++ b/src/gs-screenshot-carousel.c
@@ -103,41 +103,6 @@ gs_screenshot_carousel_load_screenshots (GsScreenshotCarousel *self, GsApp *app,
        g_return_if_fail (GS_IS_SCREENSHOT_CAROUSEL (self));
        g_return_if_fail (GS_IS_APP (app));
 
-       /* treat screenshots differently */
-       if (gs_app_get_kind (app) == AS_COMPONENT_KIND_FONT) {
-               gs_container_remove_all (GTK_CONTAINER (self->carousel));
-               screenshots = gs_app_get_screenshots (app);
-               for (guint i = 0; i < screenshots->len && !g_cancellable_is_cancelled (cancellable); i++) {
-                       AsScreenshot *ss = g_ptr_array_index (screenshots, i);
-                       GtkWidget *ssimg;
-                       GtkWidget *label;
-
-                       /* set caption */
-                       label = gtk_label_new (as_screenshot_get_caption (ss));
-                       g_object_set (label,
-                                     "xalign", 0.0,
-                                     "max-width-chars", 10,
-                                     "wrap", TRUE,
-                                     NULL);
-                       gtk_container_add (GTK_CONTAINER (self->carousel), label);
-                       gtk_widget_set_visible (label, TRUE);
-
-                       /* set images */
-                       ssimg = gs_screenshot_image_new (self->session);
-                       gs_screenshot_image_set_screenshot (GS_SCREENSHOT_IMAGE (ssimg), ss);
-                       gs_screenshot_image_set_size (GS_SCREENSHOT_IMAGE (ssimg),
-                                                     640,
-                                                     48);
-                       gs_screenshot_image_load_async (GS_SCREENSHOT_IMAGE (ssimg), cancellable);
-                       gtk_container_add (GTK_CONTAINER (self->carousel), ssimg);
-                       gtk_widget_set_visible (ssimg, TRUE);
-                       gs_screenshot_image_set_description (GS_SCREENSHOT_IMAGE (ssimg),
-                                                            as_screenshot_get_caption (ss));
-               }
-               _set_state (self, screenshots->len, TRUE, is_online);
-               return;
-       }
-
        /* fallback warning */
        screenshots = gs_app_get_screenshots (app);
        switch (gs_app_get_kind (app)) {


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