diff options
author | Perberos <[email protected]> | 2011-11-07 19:52:18 -0300 |
---|---|---|
committer | Perberos <[email protected]> | 2011-11-07 19:52:18 -0300 |
commit | 5ded9cba8563f336939400303d6a841d5089b107 (patch) | |
tree | c5676588cff26ba37e12369fe4de24b54e9f6682 /gedit/osx/gedit-osx-delegate.m | |
parent | f00b3a11a199f9f85a4d46a600f9d14179b37dbf (diff) | |
download | pluma-5ded9cba8563f336939400303d6a841d5089b107.tar.bz2 pluma-5ded9cba8563f336939400303d6a841d5089b107.tar.xz |
renaming from gedit to pluma
Diffstat (limited to 'gedit/osx/gedit-osx-delegate.m')
-rwxr-xr-x | gedit/osx/gedit-osx-delegate.m | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/gedit/osx/gedit-osx-delegate.m b/gedit/osx/gedit-osx-delegate.m deleted file mode 100755 index 41b0b262..00000000 --- a/gedit/osx/gedit-osx-delegate.m +++ /dev/null @@ -1,84 +0,0 @@ -#import "gedit-osx-delegate.h" -#import <Foundation/NSAppleEventManager.h> -#import <Foundation/NSAppleEventDescriptor.h> -#import <Foundation/NSData.h> -#include <glib.h> -#include <gedit/gedit-app.h> -#include <gedit/gedit-commands.h> - -@implementation GeditOSXDelegate --(id)init -{ - if ((self = [super init])) - { - NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager]; - - [em setEventHandler:self - andSelector:@selector(openFiles:withReply:) - forEventClass:kCoreEventClass - andEventID:kAEOpenDocuments]; - } - - return self; -} - -static GeditWindow * -get_window(NSAppleEventDescriptor *event) -{ - GeditApp *app = gedit_app_get_default (); - return gedit_app_get_active_window (app); -} - -- (void)openFiles:(NSAppleEventDescriptor*)event - withReply:(NSAppleEventDescriptor*)reply -{ - NSAppleEventDescriptor *fileList = [event paramDescriptorForKeyword:keyDirectObject]; - NSInteger i; - GSList *uris = NULL; - - if (!fileList) - { - return; - } - - for (i = 1; i <= [fileList numberOfItems]; ++i) - { - NSAppleEventDescriptor *fileAliasDesc = [fileList descriptorAtIndex:i]; - NSAppleEventDescriptor *fileURLDesc; - NSData *fileURLData; - gchar *url; - - if (!fileAliasDesc) - { - continue; - } - - fileURLDesc = [fileAliasDesc coerceToDescriptorType:typeFileURL]; - - if (!fileURLDesc) - { - continue; - } - - fileURLData = [fileURLDesc data]; - - if (!fileURLData) - { - continue; - } - - url = g_strndup([fileURLData bytes], [fileURLData length]); - uris = g_slist_prepend (uris, url); - } - - if (uris != NULL) - { - GeditWindow *window = get_window (event); - gedit_commands_load_uris (window, uris, NULL, 0); - - g_slist_foreach (uris, (GFunc)g_free, NULL); - g_slist_free (uris); - } -} - -@end
\ No newline at end of file |