{"action":"created","comment":{"url":"https://api.github.com/repos/endlessm/gnome-software/pulls/comments/191916880","pull_request_review_id":124585671,"id":191916880,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MTkxNjg4MA==","diff_hunk":"@@ -687,62 +703,89 @@ gs_details_page_refresh_screenshots (GsDetailsPage *self)\n \t\tbreak;\n \t}\n \n-\t/* set screenshots */\n+\t/* reset screenshots */\n \tgs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_main));\n-\tif (screenshots->len == 0) {\n-\t\tgs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_thumbnails));\n-\t\treturn;\n-\t}\n-\n-\t/* set the default image */\n-\tss = g_ptr_array_index (screenshots, 0);\n-\tssimg = gs_screenshot_image_new (self->session);\n-\tgtk_widget_set_can_focus (gtk_bin_get_child (GTK_BIN (ssimg)), FALSE);\n-\tgs_screenshot_image_set_screenshot (GS_SCREENSHOT_IMAGE (ssimg), ss);\n-\n-\t/* use a slightly larger screenshot if it's the only screenshot */\n-\tif (screenshots->len == 1) {\n-\t\tgs_screenshot_image_set_size (GS_SCREENSHOT_IMAGE (ssimg),\n-\t\t\t\t\t      AS_IMAGE_LARGE_WIDTH,\n-\t\t\t\t\t      AS_IMAGE_LARGE_HEIGHT);\n-\t} else {\n-\t\tgs_screenshot_image_set_size (GS_SCREENSHOT_IMAGE (ssimg),\n-\t\t\t\t\t      AS_IMAGE_NORMAL_WIDTH,\n-\t\t\t\t\t      AS_IMAGE_NORMAL_HEIGHT);\n-\t}\n-\tgs_screenshot_image_load_async (GS_SCREENSHOT_IMAGE (ssimg), NULL);\n-\tgtk_box_pack_start (GTK_BOX (self->box_details_screenshot_main), ssimg, FALSE, FALSE, 0);\n-\tgtk_widget_set_visible (ssimg, TRUE);\n-\n-\t/* set all the thumbnails */\n \tgs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_thumbnails));\n-\tif (screenshots->len < 2)\n+\n+\tif (screenshots->len == 0)\n \t\treturn;\n \n \tlist = gtk_list_box_new ();\n \tgtk_style_context_add_class (gtk_widget_get_style_context (list), \"image-list\");\n \tgtk_widget_show (list);\n \tgtk_box_pack_start (GTK_BOX (self->box_details_screenshot_thumbnails), list, FALSE, FALSE, 0);\n+\n \tfor (i = 0; i < screenshots->len; i++) {\n \t\tss = g_ptr_array_index (screenshots, i);\n+\n+\t\t/* we need to load the main screenshot only once if we're online\n+\t\t * but all times if we're offline (to check which are cached and\n+\t\t * hide those who aren't) */\n+\t\tif (is_offline || main_screenshot == NULL) {\n+\t\t\tGtkWidget *ssmain = gs_screenshot_image_new (self->session);\n+\t\t\tgtk_widget_set_can_focus (gtk_bin_get_child (GTK_BIN (ssmain)), FALSE);\n+\t\t\tgs_screenshot_image_set_screenshot (GS_SCREENSHOT_IMAGE (ssmain), ss);\n+\t\t\tgs_screenshot_image_set_size (GS_SCREENSHOT_IMAGE (ssmain),\n+\t\t\t\t\t\t      AS_IMAGE_NORMAL_WIDTH,\n+\t\t\t\t\t\t      AS_IMAGE_NORMAL_HEIGHT);\n+\t\t\tgs_screenshot_image_load_async (GS_SCREENSHOT_IMAGE (ssmain), NULL);\n+\n+\t\t\t/* when we're offline, the load will be immediate, so we\n+\t\t\t * can check if it succeeded, and just skip it and its\n+\t\t\t * thumbnails otherwise */\n+\t\t\tif (is_offline &&\n+\t\t\t    !gs_screenshot_image_is_showing (GS_SCREENSHOT_IMAGE (ssmain)))\n+\t\t\t\tcontinue;","path":"src/gs-details-page.c","position":121,"original_position":121,"commit_id":"8257edaedda4fde12c839dbbf2afc4f1954eef9b","original_commit_id":"8257edaedda4fde12c839dbbf2afc4f1954eef9b","user":{"login":"rshuler","id":2050162,"node_id":"MDQ6VXNlcjIwNTAxNjI=","avatar_url":"https://avatars0.githubusercontent.com/u/2050162?v=4","gravatar_id":"","url":"https://api.github.com/users/rshuler","html_url":"https://github.com/rshuler","followers_url":"https://api.github.com/users/rshuler/followers","following_url":"https://api.github.com/users/rshuler/following{/other_user}","gists_url":"https://api.github.com/users/rshuler/gists{/gist_id}","starred_url":"https://api.github.com/users/rshuler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rshuler/subscriptions","organizations_url":"https://api.github.com/users/rshuler/orgs","repos_url":"https://api.github.com/users/rshuler/repos","events_url":"https://api.github.com/users/rshuler/events{/privacy}","received_events_url":"https://api.github.com/users/rshuler/received_events","type":"User","site_admin":false},"body":"Is it okay that we continue here without incrementing num_screenshots_loaded?  I'm guessing not.","created_at":"2018-05-30T20:45:11Z","updated_at":"2018-05-30T20:45:11Z","html_url":"https://github.com/endlessm/gnome-software/pull/372#discussion_r191916880","pull_request_url":"https://api.github.com/repos/endlessm/gnome-software/pulls/372","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/endlessm/gnome-software/pulls/comments/191916880"},"html":{"href":"https://github.com/endlessm/gnome-software/pull/372#discussion_r191916880"},"pull_request":{"href":"https://api.github.com/repos/endlessm/gnome-software/pulls/372"}}},"pull_request":{"url":"https://api.github.com/repos/endlessm/gnome-software/pulls/372","id":189406613,"node_id":"MDExOlB1bGxSZXF1ZXN0MTg5NDA2NjEz","html_url":"https://github.com/endlessm/gnome-software/pull/372","diff_url":"https://github.com/endlessm/gnome-software/pull/372.diff","patch_url":"https://github.com/endlessm/gnome-software/pull/372.patch","issue_url":"https://api.github.com/repos/endlessm/gnome-software/issues/372","number":372,"state":"open","locked":false,"title":"Refactor screenshots and hide those unavailable when offline","user":{"login":"joaquimrocha","id":1029635,"node_id":"MDQ6VXNlcjEwMjk2MzU=","avatar_url":"https://avatars2.githubusercontent.com/u/1029635?v=4","gravatar_id":"","url":"https://api.github.com/users/joaquimrocha","html_url":"https://github.com/joaquimrocha","followers_url":"https://api.github.com/users/joaquimrocha/followers","following_url":"https://api.github.com/users/joaquimrocha/following{/other_user}","gists_url":"https://api.github.com/users/joaquimrocha/gists{/gist_id}","starred_url":"https://api.github.com/users/joaquimrocha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaquimrocha/subscriptions","organizations_url":"https://api.github.com/users/joaquimrocha/orgs","repos_url":"https://api.github.com/users/joaquimrocha/repos","events_url":"https://api.github.com/users/joaquimrocha/events{/privacy}","received_events_url":"https://api.github.com/users/joaquimrocha/received_events","type":"User","site_admin":false},"body":"The details page displays a number of screenshots for regular apps and\r\nit works offline as long as the screenshots have been previously cached.\r\nHowever, if the screenshots have not been cached, an error screenshot\r\nplaceholder is shown instead. This is a problem for many users who are\r\nconstantly offline, as most of their apps will display the error\r\nscreenshot and thus affect the UX negatively as every app appears to\r\nhave an issue.\r\n\r\nTo help provide a cleaner UX, this patch hides screenshots if they\r\ncannot be loaded when the user is offline. In the process these changes\r\nalso refactor the logic around showing the screenshots.\r\n\r\nhttps://phabricator.endlessm.com/T19887","created_at":"2018-05-21T15:09:05Z","updated_at":"2018-05-30T20:45:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15d377b4116f63bb86ad820beacb411d3310e5b4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/endlessm/gnome-software/pulls/372/commits","review_comments_url":"https://api.github.com/repos/endlessm/gnome-software/pulls/372/comments","review_comment_url":"https://api.github.com/repos/endlessm/gnome-software/pulls/comments{/number}","comments_url":"https://api.github.com/repos/endlessm/gnome-software/issues/372/comments","statuses_url":"https://api.github.com/repos/endlessm/gnome-software/statuses/8257edaedda4fde12c839dbbf2afc4f1954eef9b","head":{"label":"endlessm:T19887","ref":"T19887","sha":"8257edaedda4fde12c839dbbf2afc4f1954eef9b","user":{"login":"endlessm","id":1930958,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MzA5NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1930958?v=4","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"repo":{"id":51603051,"node_id":"MDEwOlJlcG9zaXRvcnk1MTYwMzA1MQ==","name":"gnome-software","full_name":"endlessm/gnome-software","owner":{"login":"endlessm","id":1930958,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MzA5NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1930958?v=4","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/endlessm/gnome-software","description":"Fork of https://git.gnome.org/browse/gnome-software","fork":false,"url":"https://api.github.com/repos/endlessm/gnome-software","forks_url":"https://api.github.com/repos/endlessm/gnome-software/forks","keys_url":"https://api.github.com/repos/endlessm/gnome-software/keys{/key_id}","collaborators_url":"https://api.github.com/repos/endlessm/gnome-software/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/endlessm/gnome-software/teams","hooks_url":"https://api.github.com/repos/endlessm/gnome-software/hooks","issue_events_url":"https://api.github.com/repos/endlessm/gnome-software/issues/events{/number}","events_url":"https://api.github.com/repos/endlessm/gnome-software/events","assignees_url":"https://api.github.com/repos/endlessm/gnome-software/assignees{/user}","branches_url":"https://api.github.com/repos/endlessm/gnome-software/branches{/branch}","tags_url":"https://api.github.com/repos/endlessm/gnome-software/tags","blobs_url":"https://api.github.com/repos/endlessm/gnome-software/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/endlessm/gnome-software/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/endlessm/gnome-software/git/refs{/sha}","trees_url":"https://api.github.com/repos/endlessm/gnome-software/git/trees{/sha}","statuses_url":"https://api.github.com/repos/endlessm/gnome-software/statuses/{sha}","languages_url":"https://api.github.com/repos/endlessm/gnome-software/languages","stargazers_url":"https://api.github.com/repos/endlessm/gnome-software/stargazers","contributors_url":"https://api.github.com/repos/endlessm/gnome-software/contributors","subscribers_url":"https://api.github.com/repos/endlessm/gnome-software/subscribers","subscription_url":"https://api.github.com/repos/endlessm/gnome-software/subscription","commits_url":"https://api.github.com/repos/endlessm/gnome-software/commits{/sha}","git_commits_url":"https://api.github.com/repos/endlessm/gnome-software/git/commits{/sha}","comments_url":"https://api.github.com/repos/endlessm/gnome-software/comments{/number}","issue_comment_url":"https://api.github.com/repos/endlessm/gnome-software/issues/comments{/number}","contents_url":"https://api.github.com/repos/endlessm/gnome-software/contents/{+path}","compare_url":"https://api.github.com/repos/endlessm/gnome-software/compare/{base}...{head}","merges_url":"https://api.github.com/repos/endlessm/gnome-software/merges","archive_url":"https://api.github.com/repos/endlessm/gnome-software/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/endlessm/gnome-software/downloads","issues_url":"https://api.github.com/repos/endlessm/gnome-software/issues{/number}","pulls_url":"https://api.github.com/repos/endlessm/gnome-software/pulls{/number}","milestones_url":"https://api.github.com/repos/endlessm/gnome-software/milestones{/number}","notifications_url":"https://api.github.com/repos/endlessm/gnome-software/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/endlessm/gnome-software/labels{/name}","releases_url":"https://api.github.com/repos/endlessm/gnome-software/releases{/id}","deployments_url":"https://api.github.com/repos/endlessm/gnome-software/deployments","created_at":"2016-02-12T17:04:47Z","updated_at":"2018-05-24T21:41:34Z","pushed_at":"2018-05-26T04:54:12Z","git_url":"git://github.com/endlessm/gnome-software.git","ssh_url":"git@github.com:endlessm/gnome-software.git","clone_url":"https://github.com/endlessm/gnome-software.git","svn_url":"https://github.com/endlessm/gnome-software","homepage":null,"size":33477,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":3,"open_issues":11,"watchers":3,"default_branch":"master"}},"base":{"label":"endlessm:master","ref":"master","sha":"1c834ac8dc265d6b977f333c6754f35434129159","user":{"login":"endlessm","id":1930958,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MzA5NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1930958?v=4","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"repo":{"id":51603051,"node_id":"MDEwOlJlcG9zaXRvcnk1MTYwMzA1MQ==","name":"gnome-software","full_name":"endlessm/gnome-software","owner":{"login":"endlessm","id":1930958,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MzA5NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1930958?v=4","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/endlessm/gnome-software","description":"Fork of https://git.gnome.org/browse/gnome-software","fork":false,"url":"https://api.github.com/repos/endlessm/gnome-software","forks_url":"https://api.github.com/repos/endlessm/gnome-software/forks","keys_url":"https://api.github.com/repos/endlessm/gnome-software/keys{/key_id}","collaborators_url":"https://api.github.com/repos/endlessm/gnome-software/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/endlessm/gnome-software/teams","hooks_url":"https://api.github.com/repos/endlessm/gnome-software/hooks","issue_events_url":"https://api.github.com/repos/endlessm/gnome-software/issues/events{/number}","events_url":"https://api.github.com/repos/endlessm/gnome-software/events","assignees_url":"https://api.github.com/repos/endlessm/gnome-software/assignees{/user}","branches_url":"https://api.github.com/repos/endlessm/gnome-software/branches{/branch}","tags_url":"https://api.github.com/repos/endlessm/gnome-software/tags","blobs_url":"https://api.github.com/repos/endlessm/gnome-software/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/endlessm/gnome-software/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/endlessm/gnome-software/git/refs{/sha}","trees_url":"https://api.github.com/repos/endlessm/gnome-software/git/trees{/sha}","statuses_url":"https://api.github.com/repos/endlessm/gnome-software/statuses/{sha}","languages_url":"https://api.github.com/repos/endlessm/gnome-software/languages","stargazers_url":"https://api.github.com/repos/endlessm/gnome-software/stargazers","contributors_url":"https://api.github.com/repos/endlessm/gnome-software/contributors","subscribers_url":"https://api.github.com/repos/endlessm/gnome-software/subscribers","subscription_url":"https://api.github.com/repos/endlessm/gnome-software/subscription","commits_url":"https://api.github.com/repos/endlessm/gnome-software/commits{/sha}","git_commits_url":"https://api.github.com/repos/endlessm/gnome-software/git/commits{/sha}","comments_url":"https://api.github.com/repos/endlessm/gnome-software/comments{/number}","issue_comment_url":"https://api.github.com/repos/endlessm/gnome-software/issues/comments{/number}","contents_url":"https://api.github.com/repos/endlessm/gnome-software/contents/{+path}","compare_url":"https://api.github.com/repos/endlessm/gnome-software/compare/{base}...{head}","merges_url":"https://api.github.com/repos/endlessm/gnome-software/merges","archive_url":"https://api.github.com/repos/endlessm/gnome-software/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/endlessm/gnome-software/downloads","issues_url":"https://api.github.com/repos/endlessm/gnome-software/issues{/number}","pulls_url":"https://api.github.com/repos/endlessm/gnome-software/pulls{/number}","milestones_url":"https://api.github.com/repos/endlessm/gnome-software/milestones{/number}","notifications_url":"https://api.github.com/repos/endlessm/gnome-software/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/endlessm/gnome-software/labels{/name}","releases_url":"https://api.github.com/repos/endlessm/gnome-software/releases{/id}","deployments_url":"https://api.github.com/repos/endlessm/gnome-software/deployments","created_at":"2016-02-12T17:04:47Z","updated_at":"2018-05-24T21:41:34Z","pushed_at":"2018-05-26T04:54:12Z","git_url":"git://github.com/endlessm/gnome-software.git","ssh_url":"git@github.com:endlessm/gnome-software.git","clone_url":"https://github.com/endlessm/gnome-software.git","svn_url":"https://github.com/endlessm/gnome-software","homepage":null,"size":33477,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":3,"open_issues":11,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/endlessm/gnome-software/pulls/372"},"html":{"href":"https://github.com/endlessm/gnome-software/pull/372"},"issue":{"href":"https://api.github.com/repos/endlessm/gnome-software/issues/372"},"comments":{"href":"https://api.github.com/repos/endlessm/gnome-software/issues/372/comments"},"review_comments":{"href":"https://api.github.com/repos/endlessm/gnome-software/pulls/372/comments"},"review_comment":{"href":"https://api.github.com/repos/endlessm/gnome-software/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/endlessm/gnome-software/pulls/372/commits"},"statuses":{"href":"https://api.github.com/repos/endlessm/gnome-software/statuses/8257edaedda4fde12c839dbbf2afc4f1954eef9b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rshuler"}}