Commit c2031879 authored by Adrien Plazas's avatar Adrien Plazas

librem5: details-page: Drop the screenshots

It's not worth showing poorly sized desktop screenshots on a phone.
parent 205b865b
Pipeline #32378 failed with stage
......@@ -477,136 +477,6 @@ gs_details_page_screenshot_selected_cb (GtkListBox *list,
gs_screenshot_image_load_async (ssmain, NULL);
}
static void
gs_details_page_refresh_screenshots (GsDetailsPage *self)
{
GPtrArray *screenshots;
AsScreenshot *ss;
GtkWidget *label;
GtkWidget *list;
GtkWidget *ssimg;
guint i;
/* treat screenshots differently */
if (gs_app_get_kind (self->app) == AS_APP_KIND_FONT) {
gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_thumbnails));
gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_main));
screenshots = gs_app_get_screenshots (self->app);
for (i = 0; i < screenshots->len; i++) {
ss = g_ptr_array_index (screenshots, i);
/* set caption */
label = gtk_label_new (as_screenshot_get_caption (ss, NULL));
g_object_set (label,
"xalign", 0.0,
"max-width-chars", 10,
"wrap", TRUE,
NULL);
gtk_container_add (GTK_CONTAINER (self->box_details_screenshot_main), 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_set_use_desktop_background (GS_SCREENSHOT_IMAGE (ssimg), FALSE);
gs_screenshot_image_load_async (GS_SCREENSHOT_IMAGE (ssimg), NULL);
gtk_container_add (GTK_CONTAINER (self->box_details_screenshot_main), ssimg);
gtk_widget_set_visible (ssimg, TRUE);
}
gtk_widget_set_visible (self->box_details_screenshot,
screenshots->len > 0);
gtk_widget_set_visible (self->box_details_screenshot_fallback,
screenshots->len == 0);
return;
}
/* fallback warning */
screenshots = gs_app_get_screenshots (self->app);
switch (gs_app_get_kind (self->app)) {
case AS_APP_KIND_GENERIC:
case AS_APP_KIND_CODEC:
case AS_APP_KIND_ADDON:
case AS_APP_KIND_SOURCE:
case AS_APP_KIND_FIRMWARE:
case AS_APP_KIND_DRIVER:
case AS_APP_KIND_INPUT_METHOD:
case AS_APP_KIND_LOCALIZATION:
case AS_APP_KIND_RUNTIME:
gtk_widget_set_visible (self->box_details_screenshot_fallback, FALSE);
break;
default:
gtk_widget_set_visible (self->box_details_screenshot_fallback,
screenshots->len == 0);
break;
}
/* set screenshots */
gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_main));
gtk_widget_set_visible (self->box_details_screenshot,
screenshots->len > 0);
if (screenshots->len == 0) {
gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_thumbnails));
gtk_widget_hide (self->box_details_screenshot_scrolledwindow);
return;
}
/* set the default image */
ss = g_ptr_array_index (screenshots, 0);
ssimg = gs_screenshot_image_new (self->session);
gtk_widget_set_can_focus (gtk_bin_get_child (GTK_BIN (ssimg)), FALSE);
gs_screenshot_image_set_screenshot (GS_SCREENSHOT_IMAGE (ssimg), ss);
/* use a slightly larger screenshot if it's the only screenshot */
if (screenshots->len == 1) {
gs_screenshot_image_set_size (GS_SCREENSHOT_IMAGE (ssimg),
AS_IMAGE_LARGE_WIDTH,
AS_IMAGE_LARGE_HEIGHT);
} else {
gs_screenshot_image_set_size (GS_SCREENSHOT_IMAGE (ssimg),
AS_IMAGE_NORMAL_WIDTH,
AS_IMAGE_NORMAL_HEIGHT);
}
gs_screenshot_image_load_async (GS_SCREENSHOT_IMAGE (ssimg), NULL);
gtk_container_add (GTK_CONTAINER (self->box_details_screenshot_main), ssimg);
gtk_widget_set_visible (ssimg, TRUE);
/* set all the thumbnails */
gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_thumbnails));
if (screenshots->len < 2) {
gtk_widget_hide (self->box_details_screenshot_scrolledwindow);
return;
}
list = gtk_list_box_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (list), "image-list");
gtk_widget_show (list);
gtk_widget_show (self->box_details_screenshot_scrolledwindow);
gtk_container_add (GTK_CONTAINER (self->box_details_screenshot_thumbnails), list);
for (i = 0; i < screenshots->len; i++) {
ss = g_ptr_array_index (screenshots, i);
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),
AS_IMAGE_THUMBNAIL_WIDTH,
AS_IMAGE_THUMBNAIL_HEIGHT);
gtk_style_context_add_class (gtk_widget_get_style_context (ssimg),
"screenshot-image-thumb");
gs_screenshot_image_load_async (GS_SCREENSHOT_IMAGE (ssimg), NULL);
gtk_list_box_insert (GTK_LIST_BOX (list), ssimg, -1);
gtk_widget_set_visible (ssimg, TRUE);
}
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_BROWSE);
gtk_list_box_select_row (GTK_LIST_BOX (list),
gtk_list_box_get_row_at_index (GTK_LIST_BOX (list), 0));
g_signal_connect (list, "row-selected",
G_CALLBACK (gs_details_page_screenshot_selected_cb),
self);
}
static void
gs_details_page_website_cb (GtkWidget *widget, GsDetailsPage *self)
{
......@@ -1745,7 +1615,6 @@ gs_details_page_load_stage2 (GsDetailsPage *self)
/* update UI */
gs_details_page_set_state (self, GS_DETAILS_PAGE_STATE_READY);
gs_details_page_refresh_screenshots (self);
gs_details_page_refresh_addons (self);
gs_details_page_refresh_reviews (self);
gs_details_page_refresh_all (self);
......
......@@ -290,7 +290,6 @@
<child>
<object class="GtkBox" id="box_details_screenshot">
<property name="visible">True</property>
<property name="margin_bottom">14</property>
<property name="spacing">9</property>
<child>
......@@ -327,7 +326,6 @@
</child>
<child>
<object class="GtkBox" id="box_details_screenshot_fallback">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="width_request">752</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment