summaryrefslogtreecommitdiff
path: root/debian/patches/0100-ios8.patch
blob: aab9bab166c56fae5ccd5cbf47324c53ebdbd3bf (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Description: Reset iOS 8 devices to download files
Origin: https://bugzilla.gnome.org/show_bug.cgi?id=742295#c22
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=742295
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=792016
Last-Update: 2016-02-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: trunk/src/camera/ImportPage.vala
===================================================================
--- trunk.orig/src/camera/ImportPage.vala
+++ trunk/src/camera/ImportPage.vala
@@ -765,6 +765,15 @@ public class ImportPage : CheckerboardPa
     ~ImportPage() {
         LibraryPhoto.global.contents_altered.disconnect(on_media_added_removed);
         Video.global.contents_altered.disconnect(on_media_added_removed);
+
+        // iOS 8 issue. Release the camera here
+        if (camera != null) {
+          GPhoto.Result res = camera.exit(spin_idle_context.context);
+          if (res != GPhoto.Result.OK) {
+              // log but don't fail
+              warning("ImportPage destructor: Unable to unlock camera: %s", res.to_full_string());
+          }
+        }
     }
     
     public override Gtk.Toolbar get_toolbar() {
@@ -1154,11 +1163,14 @@ public class ImportPage : CheckerboardPa
         update_status(busy, false);
         
         refresh_error = null;
-        refresh_result = camera.init(spin_idle_context.context);
-        if (refresh_result != GPhoto.Result.OK) {
-            warning("Unable to initialize camera: %s", refresh_result.to_full_string());
-            
-            return (refresh_result == GPhoto.Result.IO_LOCK) ? RefreshResult.LOCKED : RefreshResult.LIBRARY_ERROR;
+        // iOS 8 issue
+        if (camera == null) {
+          refresh_result = camera.init(spin_idle_context.context);
+          if (refresh_result != GPhoto.Result.OK) {
+              warning("Unable to initialize camera: %s", refresh_result.to_full_string());
+
+              return (refresh_result == GPhoto.Result.IO_LOCK) ? RefreshResult.LOCKED : RefreshResult.LIBRARY_ERROR;
+          }
         }
 
         update_status(true, refreshed);
@@ -1263,13 +1275,15 @@ public class ImportPage : CheckerboardPa
         progress_bar.set_ellipsize(Pango.EllipsizeMode.NONE);
         progress_bar.set_text("");
         progress_bar.set_fraction(0.0);
-        
+
+#if 0
         GPhoto.Result res = camera.exit(spin_idle_context.context);
         if (res != GPhoto.Result.OK) {
             // log but don't fail
             warning("Unable to unlock camera: %s", res.to_full_string());
         }
-        
+#endif
+
         if (refresh_result == GPhoto.Result.OK) {
             if (import_sources.get_count () == 0) {
                 this.set_page_message (this.get_view_empty_message ());
@@ -1638,11 +1652,15 @@ public class ImportPage : CheckerboardPa
     }
     
     private void import(Gee.Iterable<DataObject> items) {
-        GPhoto.Result res = camera.init(spin_idle_context.context);
-        if (res != GPhoto.Result.OK) {
-            AppWindow.error_message(_("Unable to lock camera: %s").printf(res.to_full_string()));
-            
-            return;
+        // We now keep the camera open as long as we can to
+        // work around the iOS 8 directory name shuffling issue.
+        if (camera == null) {
+          GPhoto.Result res = camera.init(spin_idle_context.context);
+          if (res != GPhoto.Result.OK) {
+              AppWindow.error_message(_("Unable to lock camera: %s").printf(res.to_full_string()));
+
+              return;
+          }
         }
 
         update_status(true, refreshed);
@@ -1778,12 +1796,15 @@ public class ImportPage : CheckerboardPa
     }
 
     private void close_import() {
+// iOS 8 issue
+#if 0
         GPhoto.Result res = camera.exit(spin_idle_context.context);
         if (res != GPhoto.Result.OK) {
             // log but don't fail
             message("Unable to unlock camera: %s", res.to_full_string());
         }
-        
+#endif
+
         update_status(false, refreshed);
         
         on_view_changed();