summaryrefslogtreecommitdiff
path: root/libraries/libfm/patches/0011-smb-symlinked-locations-cannot-be-launched-from-fold.patch
blob: a980e81668a4cabcb72f8ac63664484d02c47540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 690e15ba4367784f3ac2134c5e68d52ee05e6cbb Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Thu, 15 Nov 2012 21:08:51 +0200
Subject: [PATCH 11/22] smb:// symlinked locations cannot be launched from
 folder view.

This is because we don't assume each symlink is a folder anymore
(that assuming was stupid anyway) so we check how to handle the
symlink target. We have to get info on the target. If target isn't
mounted we cannot retrieve info on it and FmFileInfoJob fails.
Therefore we cannot launch the location.
The commit adds creation of simplest file info which contains only
name and type (directory) for not mounted location.
---
 src/job/fm-file-info-job.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/job/fm-file-info-job.c b/src/job/fm-file-info-job.c
index 19acb1b..69eb37d 100644
--- a/src/job/fm-file-info-job.c
+++ b/src/job/fm-file-info-job.c
@@ -165,6 +165,24 @@ static gboolean fm_file_info_job_run(FmJob* fmjob)
             gf = fm_path_to_gfile(path);
             if(!_fm_file_info_job_get_info_for_gfile(fmjob, fi, gf, &err))
             {
+              if(err->domain == G_IO_ERROR && err->code == G_IO_ERROR_NOT_MOUNTED)
+              {
+                GFileInfo *inf;
+                /* location by link isn't mounted; unfortunately we cannot
+                   launch a target if we don't know what kind of target we
+                   have; lets make a simplest directory-kind GFIleInfo */
+                /* FIXME: this may be dirty a bit */
+                g_error_free(err);
+                err = NULL;
+                inf = g_file_info_new();
+                g_file_info_set_file_type(inf, G_FILE_TYPE_DIRECTORY);
+                g_file_info_set_name(inf, fm_path_get_basename(path));
+                g_file_info_set_display_name(inf, fm_path_get_basename(path));
+                fm_file_info_set_from_gfileinfo(fi, inf);
+                g_object_unref(inf);
+              }
+              else
+              {
                 FmJobErrorAction act = fm_job_emit_error(fmjob, err, FM_JOB_ERROR_MILD);
                 g_error_free(err);
                 err = NULL;
@@ -175,6 +193,7 @@ static gboolean fm_file_info_job_run(FmJob* fmjob)
                 }
 
                 fm_file_info_list_delete_link(job->file_infos, l); /* also calls unref */
+              }
             }
             g_object_unref(gf);
         }
-- 
1.8.0.1