Permalink
Browse files

[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...
1 parent 37d30cf commit 4302ade50ea01c3198aafcb6c6949358a150aa6c @cameronwhite cameronwhite committed Nov 18, 2012
Showing with 31 additions and 2 deletions.
  1. +17 −1 Pinta/Main.cs
  2. +14 −1 osx/Info.plist
View
@@ -140,7 +140,23 @@ private static void ExceptionManager_UnhandledException (GLib.UnhandledException
static void RegisterForAppleEvents ()
{
MacInterop.ApplicationEvents.Quit += (sender, e) => {
- Application.Quit ();
+ GLib.Timeout.Add (10, delegate {
+ PintaCore.Actions.File.Exit.Activate ();
+ return false;
+ });
+ e.Handled = true;
+ };
+
+ MacInterop.ApplicationEvents.OpenDocuments += (sender, e) => {
+ if (e.Documents != null) {
+ GLib.Timeout.Add (10, delegate {
+ foreach (string filename in e.Documents.Keys) {
+ System.Console.Error.WriteLine ("Opening: {0}", filename);
+ PintaCore.Workspace.OpenFile (filename);
+ }
+ return false;
+ });
+ }
e.Handled = true;
};
}
View
@@ -3,7 +3,20 @@
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
- <array/>
+ <array>
+ <dict>
+ <key>CFBundleTypeIconFile</key>
+ <string>pinta.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>PNG</string>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ <key>LSItemContentTypes</key>
+ <array>
+ <string>public.png</string>
+ </array>
+ </dict>
+ </array>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>

0 comments on commit 4302ade

Please sign in to comment.