Fri, 24 Jul 2020 04:43:46 -0500
Fix gestures plugin
Update gestures plugin for gtkplugin.h removal.
Use correct alloc/free functions for gestures.
Use a GtkEventBox for the gestures event handling.
Convert gesture stroke drawing to Gdk/Cairo.
Always enable building the gestures plugin.
It no longer requires a platform-specific library.
Reviewed at https://reviews.imfreedom.org/r/47/
| 9609 | 1 | /* |
| 2 | * Signals test plugin. | |
| 3 | * | |
| 4 | * Copyright (C) 2003 Christian Hammond. | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU General Public License as | |
| 8 | * published by the Free Software Foundation; either version 2 of the | |
| 9 | * License, or (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, but | |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | * General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16788
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16788
diff
changeset
|
19 | * 02111-1301, USA. |
| 9609 | 20 | */ |
| 21 | #define GTK_SIGNAL_TEST_PLUGIN_ID "gtk-signals-test" | |
| 22 | ||
|
40496
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
23 | #include <glib/gi18n.h> |
|
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
24 | |
| 9609 | 25 | #include <gtk/gtk.h> |
| 26 | ||
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40222
diff
changeset
|
27 | #include <purple.h> |
| 9609 | 28 | |
| 29 | #include "gtkaccount.h" | |
|
34708
dd67596485ca
Undo renames of UI blist headers back to gntblist.h and gtkblist.h
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
30 | #include "gtkblist.h" |
| 9609 | 31 | #include "gtkconv.h" |
|
40222
40f2888f85c1
delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents:
37153
diff
changeset
|
32 | #include "pidginplugininfo.h" |
| 9609 | 33 | |
| 34 | /************************************************************************** | |
| 35 | * Account subsystem signal callbacks | |
| 36 | **************************************************************************/ | |
| 37 | static void | |
| 15884 | 38 | account_modified_cb(PurpleAccount *account, void *data) { |
| 39 | purple_debug_info("gtk-signal-test", "account modified cb\n"); | |
| 9609 | 40 | } |
| 41 | ||
| 42 | /************************************************************************** | |
| 43 | * Buddy List subsystem signal callbacks | |
| 44 | **************************************************************************/ | |
| 45 | static void | |
| 15884 | 46 | blist_created_cb(PurpleBuddyList *blist, void *data) { |
| 47 | purple_debug_info("gtk-signal-test", "buddy list created\n"); | |
| 9609 | 48 | } |
| 49 | ||
| 50 | static void | |
|
34864
0e292d8887de
Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
51 | blist_drawing_tooltip_cb(PurpleBlistNode *node, GString *str, gboolean full, void *data) { |
| 15884 | 52 | purple_debug_info("gtk-signal-test", "drawing tooltip cb\n"); |
| 9609 | 53 | } |
| 54 | ||
| 55 | /************************************************************************** | |
| 56 | * Conversation subsystem signal callbacks | |
| 57 | **************************************************************************/ | |
| 58 | static void | |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
59 | conversation_dragging_cb(PidginConvWindow *source, PidginConvWindow *destination) { |
| 15884 | 60 | purple_debug_info("gtk-signal-test", "conversation dragging cb\n"); |
| 9609 | 61 | } |
| 62 | ||
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
63 | static gboolean |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
64 | displaying_im_msg_cb(PurpleConversation *conv, PurpleMessage *pmsg, gpointer data) |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
65 | { |
| 15884 | 66 | purple_debug_misc("gtk-signals test", "displaying-im-msg (%s, %s)\n", |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
67 | purple_conversation_get_name(conv), |
|
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
68 | purple_message_get_contents(pmsg)); |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
69 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
70 | return FALSE; |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
71 | } |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
72 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
73 | static void |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
74 | displayed_im_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data) |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
75 | { |
| 15884 | 76 | purple_debug_misc("gtk-signals test", "displayed-im-msg (%s, %s)\n", |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
77 | purple_conversation_get_name(conv), |
|
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
78 | purple_message_get_contents(msg)); |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
79 | } |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
80 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
81 | static gboolean |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
82 | displaying_chat_msg_cb(PurpleConversation *conv, PurpleMessage *pmsg, gpointer data) |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
83 | { |
| 15884 | 84 | purple_debug_misc("gtk-signals test", "displaying-chat-msg (%s, %s)\n", |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
85 | purple_conversation_get_name(conv), |
|
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
86 | purple_message_get_contents(pmsg)); |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
87 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
88 | return FALSE; |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
89 | } |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
90 | |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
91 | static void |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
92 | displayed_chat_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data) |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
93 | { |
| 15884 | 94 | purple_debug_misc("gtk-signals test", "displayed-chat-msg (%s, %s)\n", |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
95 | purple_conversation_get_name(conv), |
|
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
96 | purple_message_get_contents(msg)); |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
97 | } |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
98 | |
|
12639
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
99 | static void |
| 15884 | 100 | conversation_switched_cb(PurpleConversation *conv, void *data) |
|
12639
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
101 | { |
| 15884 | 102 | purple_debug_misc("gtk-signals test", "conversation-switched (%s)\n", |
| 103 | purple_conversation_get_name(conv)); | |
|
12639
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
104 | } |
|
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
105 | |
| 9609 | 106 | /************************************************************************** |
| 107 | * Plugin stuff | |
| 108 | **************************************************************************/ | |
|
36755
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
109 | static PidginPluginInfo * |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
110 | plugin_query(GError **error) |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
111 | { |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
112 | const gchar * const authors[] = { |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
113 | "Gary Kramlich <amc_grim@users.sf.net>", |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
114 | NULL |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
115 | }; |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
116 | |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
117 | return pidgin_plugin_info_new( |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
118 | "id", GTK_SIGNAL_TEST_PLUGIN_ID, |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
119 | "name", N_("GTK Signals Test"), |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
120 | "version", DISPLAY_VERSION, |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
121 | "category", N_("Testing"), |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
122 | "summary", N_("Test to see that all ui signals are working properly."), |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
123 | "description", N_("Test to see that all ui signals are working properly."), |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
124 | "authors", authors, |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
125 | "website", PURPLE_WEBSITE, |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
126 | "abi-version", PURPLE_ABI_VERSION, |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
127 | NULL |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
128 | ); |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
129 | } |
|
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
130 | |
| 9609 | 131 | static gboolean |
|
36755
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
132 | plugin_load(PurplePlugin *plugin, GError **error) |
| 9609 | 133 | { |
|
34587
a3bc28bb4ef5
Refactored pidgin to use the GObject-based PurpleAccount API
Ankit Vani <a@nevitus.org>
parents:
28981
diff
changeset
|
134 | void *accounts_handle = pidgin_accounts_get_handle(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
135 | void *blist_handle = pidgin_blist_get_handle(); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
136 | void *conv_handle = pidgin_conversations_get_handle(); |
| 9609 | 137 | |
| 138 | /* Accounts subsystem signals */ | |
| 15884 | 139 | purple_signal_connect(accounts_handle, "account-modified", |
| 140 | plugin, PURPLE_CALLBACK(account_modified_cb), NULL); | |
| 9609 | 141 | |
| 142 | /* Buddy List subsystem signals */ | |
| 15884 | 143 | purple_signal_connect(blist_handle, "gtkblist-created", |
| 144 | plugin, PURPLE_CALLBACK(blist_created_cb), NULL); | |
| 145 | purple_signal_connect(blist_handle, "drawing-tooltip", | |
| 146 | plugin, PURPLE_CALLBACK(blist_drawing_tooltip_cb), NULL); | |
| 9609 | 147 | |
| 148 | /* Conversations subsystem signals */ | |
| 15884 | 149 | purple_signal_connect(conv_handle, "conversation-dragging", |
| 150 | plugin, PURPLE_CALLBACK(conversation_dragging_cb), NULL); | |
| 151 | purple_signal_connect(conv_handle, "displaying-im-msg", | |
| 152 | plugin, PURPLE_CALLBACK(displaying_im_msg_cb), NULL); | |
| 153 | purple_signal_connect(conv_handle, "displayed-im-msg", | |
| 154 | plugin, PURPLE_CALLBACK(displayed_im_msg_cb), NULL); | |
| 155 | purple_signal_connect(conv_handle, "displaying-chat-msg", | |
| 156 | plugin, PURPLE_CALLBACK(displaying_chat_msg_cb), NULL); | |
| 157 | purple_signal_connect(conv_handle, "displayed-chat-msg", | |
| 158 | plugin, PURPLE_CALLBACK(displayed_chat_msg_cb), NULL); | |
| 159 | purple_signal_connect(conv_handle, "conversation-switched", | |
| 160 | plugin, PURPLE_CALLBACK(conversation_switched_cb), NULL); | |
| 9609 | 161 | |
| 162 | return TRUE; | |
| 163 | } | |
| 164 | ||
| 11033 | 165 | static gboolean |
|
36755
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
166 | plugin_unload(PurplePlugin *plugin, GError **error) { |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11033
diff
changeset
|
167 | return TRUE; |
| 11033 | 168 | } |
| 169 | ||
|
36755
4826ec4c6ac5
More pidgin plugins to new API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
170 | PURPLE_PLUGIN_INIT(gtksignalstest, plugin_query, plugin_load, plugin_unload); |