Skip to content

Commit f92549f

Browse files
authored
Merge pull request #13 from Agalin/swiftify
Swiftify
2 parents 0479843 + 39cd82e commit f92549f

File tree

13 files changed

+89
-221
lines changed

13 files changed

+89
-221
lines changed

PidginMacOSIntegration-Bridging-Header.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
// Bridge fileś
2828
#import "PluginLoad.h"
29-
#import "Callback.h"
3029
#import "Log.h"
3130
#import "Menu.h"
3231
#import "GtkTree.h"

PidginMacOSIntegration.xcodeproj/project.pbxproj

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
DF32486424CF5874003E4F23 /* Callback.m in Sources */ = {isa = PBXBuildFile; fileRef = DF32486324CF5874003E4F23 /* Callback.m */; };
10+
DF0215C924D1F2A100B1437C /* Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF0215C824D1F2A100B1437C /* Menu.swift */; };
1111
DF32486924CF59CE003E4F23 /* Log.m in Sources */ = {isa = PBXBuildFile; fileRef = DF32486824CF59CE003E4F23 /* Log.m */; };
12-
DF32486C24CF5C33003E4F23 /* Menu.m in Sources */ = {isa = PBXBuildFile; fileRef = DF32486B24CF5C33003E4F23 /* Menu.m */; };
13-
DF32486F24CF5E8F003E4F23 /* GtkTree.m in Sources */ = {isa = PBXBuildFile; fileRef = DF32486E24CF5E8F003E4F23 /* GtkTree.m */; };
14-
DF32487424CF5FBE003E4F23 /* GtkWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = DF32487324CF5FBE003E4F23 /* GtkWindow.m */; };
1512
DF32487824CF6288003E4F23 /* PidginConversation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF32487724CF6288003E4F23 /* PidginConversation.swift */; };
1613
DF32487B24CF6394003E4F23 /* GlibEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF32487A24CF6394003E4F23 /* GlibEnum.swift */; };
1714
DF32487E24CF63EC003E4F23 /* PurpleMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF32487D24CF63EC003E4F23 /* PurpleMessage.swift */; };
@@ -20,6 +17,7 @@
2017
DF32488424CF659C003E4F23 /* GlibGList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF32488324CF659C003E4F23 /* GlibGList.swift */; };
2118
DF32488624CF65D6003E4F23 /* PointerCast.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF32488524CF65D6003E4F23 /* PointerCast.swift */; };
2219
DF496AEC211E76020059EE2C /* Main.c in Sources */ = {isa = PBXBuildFile; fileRef = DF496AEB211E76020059EE2C /* Main.c */; };
20+
DFAB7D9924D0B24600BED1F9 /* Callback.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFAB7D9824D0B24600BED1F9 /* Callback.swift */; };
2321
DFE300C5211E5B89000E188E /* Plugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFE300C4211E5B89000E188E /* Plugin.swift */; };
2422
DFE300CD211E5BFC000E188E /* PluginLoad.m in Sources */ = {isa = PBXBuildFile; fileRef = DFE300CC211E5BFC000E188E /* PluginLoad.m */; };
2523
/* End PBXBuildFile section */
@@ -37,17 +35,10 @@
3735
/* End PBXCopyFilesBuildPhase section */
3836

3937
/* Begin PBXFileReference section */
38+
DF0215C824D1F2A100B1437C /* Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = "<group>"; };
4039
DF05113E212621A000B993BA /* PluginLoad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PluginLoad.h; sourceTree = "<group>"; };
41-
DF32486324CF5874003E4F23 /* Callback.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Callback.m; sourceTree = "<group>"; };
42-
DF32486524CF58D2003E4F23 /* Callback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Callback.h; sourceTree = "<group>"; };
4340
DF32486824CF59CE003E4F23 /* Log.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Log.m; sourceTree = "<group>"; };
4441
DF32486A24CF59E0003E4F23 /* Log.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Log.h; sourceTree = "<group>"; };
45-
DF32486B24CF5C33003E4F23 /* Menu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Menu.m; sourceTree = "<group>"; };
46-
DF32486D24CF5D83003E4F23 /* Menu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Menu.h; sourceTree = "<group>"; };
47-
DF32486E24CF5E8F003E4F23 /* GtkTree.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GtkTree.m; sourceTree = "<group>"; };
48-
DF32487024CF5EA0003E4F23 /* GtkTree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GtkTree.h; sourceTree = "<group>"; };
49-
DF32487224CF5F87003E4F23 /* GtkWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GtkWindow.h; sourceTree = "<group>"; };
50-
DF32487324CF5FBE003E4F23 /* GtkWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GtkWindow.m; sourceTree = "<group>"; };
5142
DF32487624CF6068003E4F23 /* PidginImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PidginImage.h; sourceTree = "<group>"; };
5243
DF32487724CF6288003E4F23 /* PidginConversation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PidginConversation.swift; sourceTree = "<group>"; };
5344
DF32487A24CF6394003E4F23 /* GlibEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlibEnum.swift; sourceTree = "<group>"; };
@@ -58,6 +49,7 @@
5849
DF32488524CF65D6003E4F23 /* PointerCast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointerCast.swift; sourceTree = "<group>"; };
5950
DF496AEA211E76020059EE2C /* Main.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Main.h; sourceTree = "<group>"; };
6051
DF496AEB211E76020059EE2C /* Main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Main.c; sourceTree = "<group>"; };
52+
DFAB7D9824D0B24600BED1F9 /* Callback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Callback.swift; sourceTree = "<group>"; };
6153
DFD69E6F2126633300532B79 /* sendbutton.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = sendbutton.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/sendbutton.so; sourceTree = "<group>"; };
6254
DFD69E702126633300532B79 /* history.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = history.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/history.so; sourceTree = "<group>"; };
6355
DFD69E712126633300532B79 /* relnot.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = relnot.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/relnot.so; sourceTree = "<group>"; };
@@ -99,10 +91,6 @@
9991
DF32487124CF5F27003E4F23 /* Gtk */ = {
10092
isa = PBXGroup;
10193
children = (
102-
DF32486E24CF5E8F003E4F23 /* GtkTree.m */,
103-
DF32487024CF5EA0003E4F23 /* GtkTree.h */,
104-
DF32487224CF5F87003E4F23 /* GtkWindow.h */,
105-
DF32487324CF5FBE003E4F23 /* GtkWindow.m */,
10694
);
10795
path = Gtk;
10896
sourceTree = "<group>";
@@ -193,13 +181,11 @@
193181
DF32488524CF65D6003E4F23 /* PointerCast.swift */,
194182
DF496AEA211E76020059EE2C /* Main.h */,
195183
DF496AEB211E76020059EE2C /* Main.c */,
196-
DF32486324CF5874003E4F23 /* Callback.m */,
197-
DF32486524CF58D2003E4F23 /* Callback.h */,
184+
DFAB7D9824D0B24600BED1F9 /* Callback.swift */,
198185
DF32486824CF59CE003E4F23 /* Log.m */,
199186
DF32486A24CF59E0003E4F23 /* Log.h */,
200187
DF32488124CF6528003E4F23 /* Log.swift */,
201-
DF32486B24CF5C33003E4F23 /* Menu.m */,
202-
DF32486D24CF5D83003E4F23 /* Menu.h */,
188+
DF0215C824D1F2A100B1437C /* Menu.swift */,
203189
);
204190
path = PidginMacOSItegration;
205191
sourceTree = "<group>";
@@ -267,14 +253,12 @@
267253
DF32488624CF65D6003E4F23 /* PointerCast.swift in Sources */,
268254
DF32488224CF6528003E4F23 /* Log.swift in Sources */,
269255
DFE300C5211E5B89000E188E /* Plugin.swift in Sources */,
270-
DF32486C24CF5C33003E4F23 /* Menu.m in Sources */,
256+
DFAB7D9924D0B24600BED1F9 /* Callback.swift in Sources */,
271257
DFE300CD211E5BFC000E188E /* PluginLoad.m in Sources */,
272258
DF32487B24CF6394003E4F23 /* GlibEnum.swift in Sources */,
273259
DF32488424CF659C003E4F23 /* GlibGList.swift in Sources */,
260+
DF0215C924D1F2A100B1437C /* Menu.swift in Sources */,
274261
DF32488024CF649C003E4F23 /* ConfigWindow.swift in Sources */,
275-
DF32487424CF5FBE003E4F23 /* GtkWindow.m in Sources */,
276-
DF32486424CF5874003E4F23 /* Callback.m in Sources */,
277-
DF32486F24CF5E8F003E4F23 /* GtkTree.m in Sources */,
278262
DF496AEC211E76020059EE2C /* Main.c in Sources */,
279263
DF32487824CF6288003E4F23 /* PidginConversation.swift in Sources */,
280264
);

PidginMacOSItegration/Callback.h

Lines changed: 0 additions & 25 deletions
This file was deleted.

PidginMacOSItegration/Callback.m

Lines changed: 0 additions & 63 deletions
This file was deleted.

PidginMacOSItegration/Callback.swift

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//
2+
// Callback.swift
3+
// PidginMacOSIntegration
4+
//
5+
// Created by Agalin on 28/07/2020.
6+
// Copyright © 2020 Agalin. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
12+
func registerCallbackFor(_ plugin: UnsafeMutablePointer<PurplePlugin>!, onSignal signal: String, with data: UnsafeMutableRawPointer!,callback: (@convention(c)(UnsafeMutablePointer<PurpleAccount>?, UnsafeMutablePointer<CString>?, UnsafeMutablePointer<CString>?, UnsafeMutablePointer<PurpleConversation>?, UnsafeMutablePointer<PurpleMessageFlags>?, UnsafeMutableRawPointer?) -> gboolean)!)
13+
{
14+
log_callback("macos", "Registering callback %s for conversation...\n", signal);
15+
purple_signal_connect(purple_conversations_get_handle(), signal, plugin, unsafeBitCast(callback, to: PurpleCallback.self), data);
16+
log_all("macos", "Registered");
17+
}
18+
19+
func registerConversationCreatedCallbackFor(_ plugin: UnsafeMutablePointer<PurplePlugin>!, onSignal signal: String, with data: UnsafeMutableRawPointer!,callback: (@convention(c)(UnsafeMutablePointer<PurpleConversation>?, UnsafeMutableRawPointer?) -> gboolean)!)
20+
{
21+
log_callback("macos", "Registering callback %s for conversation...\n", signal);
22+
purple_signal_connect(purple_conversations_get_handle(), signal, plugin, unsafeBitCast(callback, to: PurpleCallback.self), data);
23+
log_all("macos", "Registered");
24+
}
25+
26+
func registerBuddyListCreatedCallbackFor(_ plugin: UnsafeMutablePointer<PurplePlugin>!, onSignal signal: String, with data: UnsafeMutableRawPointer!,callback: (@convention(c)(UnsafeMutablePointer<PurpleBuddyList>?, UnsafeMutableRawPointer?) -> gboolean)!)
27+
{
28+
log_callback("macos", "Registering callback %s for conversation...\n", signal);
29+
purple_signal_connect(pidgin_blist_get_handle(), signal, plugin, unsafeBitCast(callback, to: PurpleCallback.self), data);
30+
log_all("macos", "Registered");
31+
}
32+
33+
func registerSwitchPageCallbackFor(_ notebook: UnsafeMutablePointer<GtkWidget>!,in window: UnsafeMutablePointer<GtkWidget>!, onSignal signal: String, callback: (@convention(c)(UnsafeMutablePointer<GtkWidget>?, OpaquePointer?, Int32, UnsafeMutablePointer<GtkWidget>?) -> gboolean)! )
34+
{
35+
log_callback("macos", "Registering %s callback for window...\n", signal);
36+
if(g_signal_connect_data (notebook, signal, unsafeBitCast(callback, to: GCallback.self), window, nil, G_CONNECT_AFTER) != 0){
37+
log_all("macos", "Success.");
38+
}
39+
else {
40+
log_all("macos", "Failure.");
41+
}
42+
}
43+
44+
func registerConfigurationEventCallbackFor(_ window: UnsafeMutablePointer<GtkWidget>!, callback: (@convention(c)(UnsafeMutablePointer<GtkWidget>?, UnsafeMutablePointer<GdkEvent>?, gpointer?) -> gboolean)!)
45+
{
46+
log_all("macos", "Registering configure-event callback for window...");
47+
if(g_signal_connect_data(window, "configure-event", unsafeBitCast(callback, to: GCallback.self), nil, nil, G_CONNECT_AFTER) != 0) {
48+
log_all("macos", "Success.");
49+
}
50+
else {
51+
log_all("macos", "Failure.");
52+
}
53+
}

PidginMacOSItegration/Gtk/GtkTree.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

PidginMacOSItegration/Gtk/GtkTree.m

Lines changed: 0 additions & 18 deletions
This file was deleted.

PidginMacOSItegration/Gtk/GtkWindow.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

PidginMacOSItegration/Gtk/GtkWindow.m

Lines changed: 0 additions & 14 deletions
This file was deleted.

PidginMacOSItegration/Menu.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)