Merge lp:~optimisme/pantheon-files/1067061 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Albert
Status: Merged
Merged at revision: 1178
Proposed branch: lp:~optimisme/pantheon-files/1067061
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 48 lines (+13/-11)
2 files modified
libcore/gof-file.c (+10/-9)
src/marlin-thumbnailer.c (+3/-2)
To merge this branch: bzr merge lp:~optimisme/pantheon-files/1067061
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Review via email: mp+164572@code.launchpad.net

Description of the change

Check if a file is remote before asking for a thumbnail, and improved/modified remote scheme test

To post a comment you must log in.
lp:~optimisme/pantheon-files/1067061 updated
1173. By Albert

added smb scheme to the list of remote schemes

Revision history for this message
Victor Martinez (victored) wrote :

Looks good Albert!

Generally, we prefer:

> if (condition_a
> || condition_b
> || condition_c)
> {
> // do something
> }

Over:

> if (condition_a) {
> // do something
> }
>
> if (condition_b) {
> // do something
> }
>
> if (condition_c) {
> // do something
> }

so that the code in "do something" is not repeated

We also encourage:

> if (condition_a && condition_b)
> // do something

instead of:

> if (condition_a)
> if (condition_b)
> // do something

lp:~optimisme/pantheon-files/1067061 updated
1174. By Albert

fixed source style

Revision history for this message
Cody Garver (codygarver) wrote :

Great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libcore/gof-file.c'
2--- libcore/gof-file.c 2013-03-07 04:19:41 +0000
3+++ libcore/gof-file.c 2013-05-18 08:59:28 +0000
4@@ -180,18 +180,19 @@
5 /* try to determinate what appear to be remote. This is quite hazardous but gio doesn't offer any better option */
6 char *scheme = g_file_get_uri_scheme (file->location);
7
8- //g_message ("%s %s", G_STRFUNC, scheme);
9- if (!strcmp (scheme, "trash")) {
10- g_free (scheme);
11- return FALSE;
12- }
13- if (!strcmp (scheme, "archive")) {
14- g_free (scheme);
15- return FALSE;
16+ /* g_vfs does not have a function to know if a supported protocol is remote */
17+ if (!strcmp (scheme, "afp")
18+ || !strcmp (scheme, "dav")
19+ || !strcmp (scheme, "davs")
20+ || !strcmp (scheme, "ftp")
21+ || !strcmp (scheme, "sftp")
22+ || !strcmp (scheme, "smb")) {
23+ g_free (scheme);
24+ return TRUE;
25 }
26
27 g_free (scheme);
28- return TRUE;
29+ return FALSE;
30 }
31
32 void gof_file_get_folder_icon_from_uri_or_path (GOFFile *file)
33
34=== modified file 'src/marlin-thumbnailer.c'
35--- src/marlin-thumbnailer.c 2012-05-30 18:28:41 +0000
36+++ src/marlin-thumbnailer.c 2013-05-18 08:59:28 +0000
37@@ -846,8 +846,9 @@
38 * processed (and awaiting to be refreshed) */
39 for (lp = g_list_last (files); lp != NULL; lp = lp->prev)
40 {
41- if (marlin_thumbnailer_file_is_supported (thumbnailer, lp->data))
42- supported_files = g_list_prepend (supported_files, lp->data);
43+ /* 1067061 - Do not thumbnail network files */
44+ if (!gof_file_is_remote_uri_scheme(lp->data) && marlin_thumbnailer_file_is_supported (thumbnailer, lp->data))
45+ supported_files = g_list_prepend (supported_files, lp->data);
46 }
47
48 /* determine how many URIs are in the wait queue */

Subscribers

People subscribed via source and target branches

to all changes: