Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[Partial fix for bug #772195] Open files that are dragged onto the dock.

This is based off of MonoDevelop's file opening code, and I've only
implemented support for png files until some testing can be done.
Also fixed the dock quit behaviour, which previously wouldn't prompt
the user to save.
  • Loading branch information...
commit 4302ade50ea01c3198aafcb6c6949358a150aa6c 1 parent 37d30cf
Cameron White authored November 17, 2012
18  Pinta/Main.cs
@@ -140,7 +140,23 @@ private static void ExceptionManager_UnhandledException (GLib.UnhandledException
140 140
 		static void RegisterForAppleEvents ()
141 141
 		{
142 142
 			MacInterop.ApplicationEvents.Quit += (sender, e) => {
143  
-				Application.Quit ();
  143
+				GLib.Timeout.Add (10, delegate {
  144
+					PintaCore.Actions.File.Exit.Activate ();
  145
+					return false;
  146
+				});
  147
+				e.Handled = true;
  148
+			};
  149
+
  150
+			MacInterop.ApplicationEvents.OpenDocuments += (sender, e) => {
  151
+				if (e.Documents != null) {
  152
+					GLib.Timeout.Add (10, delegate {
  153
+						foreach (string filename in e.Documents.Keys) {
  154
+							System.Console.Error.WriteLine ("Opening: {0}", filename);
  155
+							PintaCore.Workspace.OpenFile (filename);
  156
+						}
  157
+						return false;
  158
+					});
  159
+				}
144 160
 				e.Handled = true;
145 161
 			};
146 162
 		}
15  osx/Info.plist
@@ -3,7 +3,20 @@
3 3
 <plist version="1.0">
4 4
 <dict>
5 5
 	<key>CFBundleDocumentTypes</key>
6  
-	<array/>
  6
+	<array>
  7
+            <dict>
  8
+                <key>CFBundleTypeIconFile</key>
  9
+                <string>pinta.icns</string>
  10
+                <key>CFBundleTypeName</key>
  11
+                <string>PNG</string>
  12
+                <key>CFBundleTypeRole</key>
  13
+                <string>Editor</string>
  14
+                <key>LSItemContentTypes</key>
  15
+                <array>
  16
+                    <string>public.png</string>
  17
+                </array>
  18
+            </dict>
  19
+        </array>
7 20
 	<key>CFBundleDevelopmentRegion</key>
8 21
 	<string>English</string>
9 22
 	<key>CFBundleExecutable</key>

0 notes on commit 4302ade

Please sign in to comment.
Something went wrong with that request. Please try again.