Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nemo-file.c: "Always" show preview now literally means "always" #3467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gresources/nemo-file-management-properties.glade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2
<!-- Generated with glade 3.40.0

Copyright (C)

Expand Down Expand Up @@ -363,6 +363,9 @@ along with . If not, see <http://www.gnu.org/licenses/>.
<row>
<col id="0" translatable="yes">Yes</col>
</row>
<row>
<col id="0" translatable="yes">Recommended Only</col>
</row>
<row>
<col id="0" translatable="yes">Local Files Only</col>
</row>
Expand Down
39 changes: 24 additions & 15 deletions libnemo-private/nemo-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -4380,20 +4380,18 @@ is_local_favorite (NemoFile *file)
gboolean
nemo_file_should_show_thumbnail (NemoFile *file)
{
GFilesystemPreviewType use_preview;
GFilesystemPreviewType use_preview;
NemoFile *dir = NULL;
char* metadata_str = NULL;

if (show_image_thumbs == NEMO_SPEED_TRADEOFF_NEVER) {
return FALSE;
}

if (!NEMO_IS_FILE (file)) {
return FALSE;
}

use_preview = nemo_file_get_filesystem_use_preview (file);
if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER) {
/* file system says to never thumbnail anything */
return FALSE;
}

/* Only care about the file size, if the thumbnail has not been created yet */
if (file->details->thumbnail_path == NULL &&
nemo_file_get_size (file) > cached_thumbnail_limit) {
Expand Down Expand Up @@ -4462,9 +4460,16 @@ nemo_file_should_show_thumbnail (NemoFile *file)
if (show_image_thumbs == NEMO_SPEED_TRADEOFF_ALWAYS) {
return TRUE;
}
if (show_image_thumbs == NEMO_SPEED_TRADEOFF_NEVER) {
return FALSE;
}

use_preview = nemo_file_get_filesystem_use_preview (file);
if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER) {
/* file system says to never thumbnail anything */
return FALSE;
}

if (show_image_thumbs == NEMO_SPEED_TRADEOFF_RECOMMENDED_ONLY)
return use_preview == G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS ? TRUE : FALSE;

if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL) {
// favorites:/// can have local and non-local files.
// we check if each individual file is local (nemo_file_is_local()
Expand Down Expand Up @@ -5290,17 +5295,21 @@ get_speed_tradeoff_preference_for_file (NemoFile *file, NemoSpeedTradeoffValue v
use_preview = nemo_file_get_filesystem_use_preview (file);

if (value == NEMO_SPEED_TRADEOFF_ALWAYS) {
if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER) {
return FALSE;
} else {
return TRUE;
}
return TRUE;
}

if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER) {
return FALSE;
}

if (value == NEMO_SPEED_TRADEOFF_NEVER) {
return FALSE;
}

if (value == NEMO_SPEED_TRADEOFF_RECOMMENDED_ONLY) {
return use_preview == G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS ? TRUE : FALSE;
}

g_assert (value == NEMO_SPEED_TRADEOFF_LOCAL_ONLY);

if (use_preview == G_FILESYSTEM_PREVIEW_TYPE_NEVER) {
Expand Down
3 changes: 2 additions & 1 deletion libnemo-private/nemo-global-preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ enum
typedef enum
{
NEMO_SPEED_TRADEOFF_ALWAYS,
NEMO_SPEED_TRADEOFF_RECOMMENDED_ONLY,
NEMO_SPEED_TRADEOFF_LOCAL_ONLY,
NEMO_SPEED_TRADEOFF_NEVER
NEMO_SPEED_TRADEOFF_NEVER
} NemoSpeedTradeoffValue;

#define NEMO_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS "show-directory-item-counts"
Expand Down