Replace functions which called once with their bodies
[pidgin-git.git] / pidgin / plugins / gtk-signals-test.c
blobe6c04a11a7833e0b24c4395a87a85026ab78a2cc
1 /*
2 * Signals test plugin.
4 * Copyright (C) 2003 Christian Hammond.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02111-1301, USA.
21 #define GTK_SIGNAL_TEST_PLUGIN_ID "gtk-signals-test"
23 #include "internal.h"
25 #include <gtk/gtk.h>
27 #include "debug.h"
28 #include "version.h"
30 #include "gtkaccount.h"
31 #include "gtkblist.h"
32 #include "gtkconv.h"
33 #include "gtkplugin.h"
35 /**************************************************************************
36 * Account subsystem signal callbacks
37 **************************************************************************/
38 static void
39 account_modified_cb(PurpleAccount *account, void *data) {
40 purple_debug_info("gtk-signal-test", "account modified cb\n");
43 /**************************************************************************
44 * Buddy List subsystem signal callbacks
45 **************************************************************************/
46 static void
47 blist_created_cb(PurpleBuddyList *blist, void *data) {
48 purple_debug_info("gtk-signal-test", "buddy list created\n");
51 static void
52 blist_drawing_tooltip_cb(PurpleBlistNode *node, GString *str, gboolean full, void *data) {
53 purple_debug_info("gtk-signal-test", "drawing tooltip cb\n");
56 /**************************************************************************
57 * Conversation subsystem signal callbacks
58 **************************************************************************/
59 static void
60 conversation_dragging_cb(PidginConvWindow *source, PidginConvWindow *destination) {
61 purple_debug_info("gtk-signal-test", "conversation dragging cb\n");
64 static gboolean
65 displaying_im_msg_cb(PurpleConversation *conv, PurpleMessage *pmsg, gpointer data)
67 purple_debug_misc("gtk-signals test", "displaying-im-msg (%s, %s)\n",
68 purple_conversation_get_name(conv),
69 purple_message_get_contents(pmsg));
71 return FALSE;
74 static void
75 displayed_im_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data)
77 purple_debug_misc("gtk-signals test", "displayed-im-msg (%s, %s)\n",
78 purple_conversation_get_name(conv),
79 purple_message_get_contents(msg));
82 static gboolean
83 displaying_chat_msg_cb(PurpleConversation *conv, PurpleMessage *pmsg, gpointer data)
85 purple_debug_misc("gtk-signals test", "displaying-chat-msg (%s, %s)\n",
86 purple_conversation_get_name(conv),
87 purple_message_get_contents(pmsg));
89 return FALSE;
92 static void
93 displayed_chat_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data)
95 purple_debug_misc("gtk-signals test", "displayed-chat-msg (%s, %s)\n",
96 purple_conversation_get_name(conv),
97 purple_message_get_contents(msg));
100 static void
101 conversation_switched_cb(PurpleConversation *conv, void *data)
103 purple_debug_misc("gtk-signals test", "conversation-switched (%s)\n",
104 purple_conversation_get_name(conv));
107 /**************************************************************************
108 * Plugin stuff
109 **************************************************************************/
110 static PidginPluginInfo *
111 plugin_query(GError **error)
113 const gchar * const authors[] = {
114 "Gary Kramlich <amc_grim@users.sf.net>",
115 NULL
118 return pidgin_plugin_info_new(
119 "id", GTK_SIGNAL_TEST_PLUGIN_ID,
120 "name", N_("GTK Signals Test"),
121 "version", DISPLAY_VERSION,
122 "category", N_("Testing"),
123 "summary", N_("Test to see that all ui signals are working properly."),
124 "description", N_("Test to see that all ui signals are working properly."),
125 "authors", authors,
126 "website", PURPLE_WEBSITE,
127 "abi-version", PURPLE_ABI_VERSION,
128 NULL
132 static gboolean
133 plugin_load(PurplePlugin *plugin, GError **error)
135 void *accounts_handle = pidgin_accounts_get_handle();
136 void *blist_handle = pidgin_blist_get_handle();
137 void *conv_handle = pidgin_conversations_get_handle();
139 /* Accounts subsystem signals */
140 purple_signal_connect(accounts_handle, "account-modified",
141 plugin, PURPLE_CALLBACK(account_modified_cb), NULL);
143 /* Buddy List subsystem signals */
144 purple_signal_connect(blist_handle, "gtkblist-created",
145 plugin, PURPLE_CALLBACK(blist_created_cb), NULL);
146 purple_signal_connect(blist_handle, "drawing-tooltip",
147 plugin, PURPLE_CALLBACK(blist_drawing_tooltip_cb), NULL);
149 /* Conversations subsystem signals */
150 purple_signal_connect(conv_handle, "conversation-dragging",
151 plugin, PURPLE_CALLBACK(conversation_dragging_cb), NULL);
152 purple_signal_connect(conv_handle, "displaying-im-msg",
153 plugin, PURPLE_CALLBACK(displaying_im_msg_cb), NULL);
154 purple_signal_connect(conv_handle, "displayed-im-msg",
155 plugin, PURPLE_CALLBACK(displayed_im_msg_cb), NULL);
156 purple_signal_connect(conv_handle, "displaying-chat-msg",
157 plugin, PURPLE_CALLBACK(displaying_chat_msg_cb), NULL);
158 purple_signal_connect(conv_handle, "displayed-chat-msg",
159 plugin, PURPLE_CALLBACK(displayed_chat_msg_cb), NULL);
160 purple_signal_connect(conv_handle, "conversation-switched",
161 plugin, PURPLE_CALLBACK(conversation_switched_cb), NULL);
163 return TRUE;
166 static gboolean
167 plugin_unload(PurplePlugin *plugin, GError **error) {
168 return TRUE;
171 PURPLE_PLUGIN_INIT(gtksignalstest, plugin_query, plugin_load, plugin_unload);