Mercurial > pidgin.yaz
annotate plugins/gtk-signals-test.c @ 13194:7099a443131d
[gaim-migrate @ 15557]
The other half of sf patch #1414103, from Sadrul Habib Chowdhury
"Make the initial selection in the substatus-
edit dialog correct (currently it always opens with the
last status in the list selected)."
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 09 Feb 2006 00:00:08 +0000 |
parents | e3b4e6787dff |
children | f09c6e8df82c |
rev | line source |
---|---|
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 | |
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 * 02111-1307, USA. | |
20 */ | |
21 #define GTK_SIGNAL_TEST_PLUGIN_ID "gtk-signals-test" | |
22 | |
23 #include <gtk/gtk.h> | |
24 | |
25 #include "internal.h" | |
26 #include "debug.h" | |
9954 | 27 #include "version.h" |
9609 | 28 |
29 #include "gtkaccount.h" | |
30 #include "gtkblist.h" | |
31 #include "gtkconv.h" | |
32 #include "gtkplugin.h" | |
33 | |
34 /************************************************************************** | |
35 * Account subsystem signal callbacks | |
36 **************************************************************************/ | |
37 static void | |
38 account_modified_cb(GaimAccount *account, void *data) { | |
39 gaim_debug_info("gtk-signal-test", "account modified cb\n"); | |
40 } | |
41 | |
42 /************************************************************************** | |
43 * Buddy List subsystem signal callbacks | |
44 **************************************************************************/ | |
45 static void | |
46 blist_created_cb(GaimBuddyList *blist, void *data) { | |
47 gaim_debug_info("gtk-signal-test", "buddy list created\n"); | |
48 } | |
49 | |
50 static void | |
12898
e3b4e6787dff
[gaim-migrate @ 15251]
Richard Laager <rlaager@wiktel.com>
parents:
12639
diff
changeset
|
51 blist_drawing_tooltip_cb(GaimBlistNode *node, GString *str, gboolean full, void *data) { |
9609 | 52 gaim_debug_info("gtk-signal-test", "drawing tooltip cb\n"); |
53 } | |
54 | |
55 /************************************************************************** | |
56 * Conversation subsystem signal callbacks | |
57 **************************************************************************/ | |
58 static void | |
11848
434181b96f44
[gaim-migrate @ 14139]
Gary Kramlich <grim@reaperworld.com>
parents:
11447
diff
changeset
|
59 conversation_dragging_cb(GaimGtkWindow *source, GaimGtkWindow *destination) { |
11447
ef6e94bdda08
[gaim-migrate @ 13686]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
60 gaim_debug_info("gtk-signal-test", "conversation dragging cb\n"); |
9609 | 61 } |
62 | |
12604
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
63 static gboolean |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
64 displaying_im_msg_cb(GaimAccount *account, GaimConversation *conv, |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
65 char **buffer, int flags, void *data) |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
66 { |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
67 gaim_debug_misc("gtk-signals test", "displaying-im-msg (%s, %s)\n", |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
68 gaim_conversation_get_name(conv), *buffer); |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
69 |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
70 return FALSE; |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
71 } |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
72 |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
73 static void |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
74 displayed_im_msg_cb(GaimAccount *account, GaimConversation *conv, const char *buffer, int flags, void *data) |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
75 { |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
76 gaim_debug_misc("gtk-signals test", "displayed-im-msg (%s, %s)\n", |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
77 gaim_conversation_get_name(conv), buffer); |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
78 } |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
79 |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
80 static gboolean |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
81 displaying_chat_msg_cb(GaimAccount *account, GaimConversation *conv, |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
82 char **buffer, int flags, void *data) |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
83 { |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
84 gaim_debug_misc("gtk-signals test", "displaying-chat-msg (%s, %s)\n", |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
85 gaim_conversation_get_name(conv), *buffer); |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
86 |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
87 return FALSE; |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
88 } |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
89 |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
90 static void |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
91 displayed_chat_msg_cb(GaimAccount *account, GaimConversation *conv, const char *buffer, int flags, void *data) |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
92 { |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
93 gaim_debug_misc("gtk-signals test", "displayed-chat-msg (%s, %s)\n", |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
94 gaim_conversation_get_name(conv), buffer); |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
95 } |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
96 |
12639
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
97 static void |
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
98 conversation_switched_cb(GaimConversation *conv, void *data) |
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
99 { |
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
100 gaim_debug_misc("gtk-signals test", "conversation-switched (%s)\n", |
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
101 gaim_conversation_get_name(conv)); |
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
102 } |
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
103 |
9609 | 104 /************************************************************************** |
105 * Plugin stuff | |
106 **************************************************************************/ | |
107 static gboolean | |
108 plugin_load(GaimPlugin *plugin) | |
109 { | |
110 void *accounts_handle = gaim_gtk_account_get_handle(); | |
111 void *blist_handle = gaim_gtk_blist_get_handle(); | |
112 void *conv_handle = gaim_gtk_conversations_get_handle(); | |
113 | |
114 /* Accounts subsystem signals */ | |
115 gaim_signal_connect(accounts_handle, "account-modified", | |
116 plugin, GAIM_CALLBACK(account_modified_cb), NULL); | |
117 | |
118 /* Buddy List subsystem signals */ | |
119 gaim_signal_connect(blist_handle, "gtkblist-created", | |
120 plugin, GAIM_CALLBACK(blist_created_cb), NULL); | |
121 gaim_signal_connect(blist_handle, "drawing-tooltip", | |
122 plugin, GAIM_CALLBACK(blist_drawing_tooltip_cb), NULL); | |
123 | |
124 /* Conversations subsystem signals */ | |
11447
ef6e94bdda08
[gaim-migrate @ 13686]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
125 gaim_signal_connect(conv_handle, "conversation-dragging", |
ef6e94bdda08
[gaim-migrate @ 13686]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
126 plugin, GAIM_CALLBACK(conversation_dragging_cb), NULL); |
12604
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
127 gaim_signal_connect(conv_handle, "displaying-im-msg", |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
128 plugin, GAIM_CALLBACK(displaying_im_msg_cb), NULL); |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
129 gaim_signal_connect(conv_handle, "displayed-im-msg", |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
130 plugin, GAIM_CALLBACK(displayed_im_msg_cb), NULL); |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
131 gaim_signal_connect(conv_handle, "displaying-chat-msg", |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
132 plugin, GAIM_CALLBACK(displaying_chat_msg_cb), NULL); |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
133 gaim_signal_connect(conv_handle, "displayed-chat-msg", |
71299d63801d
[gaim-migrate @ 14939]
Richard Laager <rlaager@wiktel.com>
parents:
11848
diff
changeset
|
134 plugin, GAIM_CALLBACK(displayed_chat_msg_cb), NULL); |
12639
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
135 gaim_signal_connect(conv_handle, "conversation-switched", |
366326fa9cb4
[gaim-migrate @ 14975]
Richard Laager <rlaager@wiktel.com>
parents:
12604
diff
changeset
|
136 plugin, GAIM_CALLBACK(conversation_switched_cb), NULL); |
9609 | 137 |
138 return TRUE; | |
139 } | |
140 | |
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
9954
diff
changeset
|
141 static gboolean |
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11033
diff
changeset
|
142 plugin_unload(GaimPlugin *plugin) { |
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11033
diff
changeset
|
143 return TRUE; |
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
9954
diff
changeset
|
144 } |
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
9954
diff
changeset
|
145 |
9609 | 146 static GaimPluginInfo info = |
147 { | |
9954 | 148 GAIM_PLUGIN_MAGIC, |
149 GAIM_MAJOR_VERSION, | |
150 GAIM_MINOR_VERSION, | |
9609 | 151 GAIM_PLUGIN_STANDARD, /**< type */ |
152 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ | |
153 0, /**< flags */ | |
154 NULL, /**< dependencies */ | |
155 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
156 | |
157 GTK_SIGNAL_TEST_PLUGIN_ID, /**< id */ | |
158 N_("GTK Signals Test"), /**< name */ | |
159 VERSION, /**< version */ | |
160 /** summary */ | |
161 N_("Test to see that all ui signals are working properly."), | |
162 /** description */ | |
163 N_("Test to see that all ui signals are working properly."), | |
164 "Gary Kramlich <amc_grim@users.sf.net>", /**< author */ | |
165 GAIM_WEBSITE, /**< homepage */ | |
166 | |
167 plugin_load, /**< load */ | |
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
9954
diff
changeset
|
168 plugin_unload, /**< unload */ |
9609 | 169 NULL, /**< destroy */ |
170 | |
171 NULL, /**< ui_info */ | |
172 NULL, /**< extra_info */ | |
173 NULL, | |
174 NULL | |
175 }; | |
176 | |
177 static void | |
178 init_plugin(GaimPlugin *plugin) | |
179 { | |
180 } | |
181 | |
182 GAIM_INIT_PLUGIN(gtksignalstest, init_plugin, info) |