Tue, 17 Oct 2006 08:13:41 +0000
[gaim-migrate @ 17495]
This should fix the statusbox issues that were keeping us from releasing beta
4 (and which were just really annoying). Thakn sadrul for most of this, I just
added the if (index == -1) bit. Anyway, the way this works now is that for
saved/popular statuses the primitive underlying that status is where the
dropdown for the statusbox starts. If we don't like that we can change it but
I'm not sure we'll find something better.
Also, this might plug a couple leaks, I'm not really sure but it certainly
looks right.
Up next, the patch to make the docklet use the per-protocol statuses in the
top section.
| 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
115794987a96
[gaim-migrate @ 15251]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
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
1ac2dab0cddd
[gaim-migrate @ 14139]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11447
diff
changeset
|
59 | conversation_dragging_cb(GaimGtkWindow *source, GaimGtkWindow *destination) { |
|
11447
23594a754163
[gaim-migrate @ 13686]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
60 | gaim_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 |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12898
diff
changeset
|
64 | displaying_im_msg_cb(GaimAccount *account, const char *who, char **buffer, |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12898
diff
changeset
|
65 | GaimConversation *conv, GaimMessageFlags flags, void *data) |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
66 | { |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
67 | gaim_debug_misc("gtk-signals test", "displaying-im-msg (%s, %s)\n", |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
68 | gaim_conversation_get_name(conv), *buffer); |
|
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 |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12898
diff
changeset
|
74 | displayed_im_msg_cb(GaimAccount *account, const char *who, const char *buffer, |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12898
diff
changeset
|
75 | GaimConversation *conv, GaimMessageFlags flags, void *data) |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
76 | { |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
77 | gaim_debug_misc("gtk-signals test", "displayed-im-msg (%s, %s)\n", |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
78 | gaim_conversation_get_name(conv), buffer); |
|
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 |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12898
diff
changeset
|
82 | displaying_chat_msg_cb(GaimAccount *account, const char *who, char **buffer, |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12898
diff
changeset
|
83 | GaimConversation *conv, GaimMessageFlags flags, void *data) |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
84 | { |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
85 | gaim_debug_misc("gtk-signals test", "displaying-chat-msg (%s, %s)\n", |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
86 | gaim_conversation_get_name(conv), *buffer); |
|
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 |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12898
diff
changeset
|
92 | displayed_chat_msg_cb(GaimAccount *account, const char *who, const char *buffer, |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12898
diff
changeset
|
93 | GaimConversation *conv, GaimMessageFlags flags, void *data) |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
94 | { |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
95 | gaim_debug_misc("gtk-signals test", "displayed-chat-msg (%s, %s)\n", |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
96 | gaim_conversation_get_name(conv), buffer); |
|
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 |
|
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
100 | conversation_switched_cb(GaimConversation *conv, void *data) |
|
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
101 | { |
|
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
102 | gaim_debug_misc("gtk-signals test", "conversation-switched (%s)\n", |
|
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
103 | gaim_conversation_get_name(conv)); |
|
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 | **************************************************************************/ | |
| 109 | static gboolean | |
| 110 | plugin_load(GaimPlugin *plugin) | |
| 111 | { | |
| 112 | void *accounts_handle = gaim_gtk_account_get_handle(); | |
| 113 | void *blist_handle = gaim_gtk_blist_get_handle(); | |
| 114 | void *conv_handle = gaim_gtk_conversations_get_handle(); | |
| 115 | ||
| 116 | /* Accounts subsystem signals */ | |
| 117 | gaim_signal_connect(accounts_handle, "account-modified", | |
| 118 | plugin, GAIM_CALLBACK(account_modified_cb), NULL); | |
| 119 | ||
| 120 | /* Buddy List subsystem signals */ | |
| 121 | gaim_signal_connect(blist_handle, "gtkblist-created", | |
| 122 | plugin, GAIM_CALLBACK(blist_created_cb), NULL); | |
| 123 | gaim_signal_connect(blist_handle, "drawing-tooltip", | |
| 124 | plugin, GAIM_CALLBACK(blist_drawing_tooltip_cb), NULL); | |
| 125 | ||
| 126 | /* Conversations subsystem signals */ | |
|
11447
23594a754163
[gaim-migrate @ 13686]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
127 | gaim_signal_connect(conv_handle, "conversation-dragging", |
|
23594a754163
[gaim-migrate @ 13686]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
128 | plugin, GAIM_CALLBACK(conversation_dragging_cb), NULL); |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
129 | gaim_signal_connect(conv_handle, "displaying-im-msg", |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
130 | plugin, GAIM_CALLBACK(displaying_im_msg_cb), NULL); |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
131 | gaim_signal_connect(conv_handle, "displayed-im-msg", |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
132 | plugin, GAIM_CALLBACK(displayed_im_msg_cb), NULL); |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
133 | gaim_signal_connect(conv_handle, "displaying-chat-msg", |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
134 | plugin, GAIM_CALLBACK(displaying_chat_msg_cb), NULL); |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
135 | gaim_signal_connect(conv_handle, "displayed-chat-msg", |
|
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11848
diff
changeset
|
136 | plugin, GAIM_CALLBACK(displayed_chat_msg_cb), NULL); |
|
12639
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
137 | gaim_signal_connect(conv_handle, "conversation-switched", |
|
7df970d037c3
[gaim-migrate @ 14975]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12604
diff
changeset
|
138 | plugin, GAIM_CALLBACK(conversation_switched_cb), NULL); |
| 9609 | 139 | |
| 140 | return TRUE; | |
| 141 | } | |
| 142 | ||
| 11033 | 143 | static gboolean |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11033
diff
changeset
|
144 | plugin_unload(GaimPlugin *plugin) { |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11033
diff
changeset
|
145 | return TRUE; |
| 11033 | 146 | } |
| 147 | ||
| 9609 | 148 | static GaimPluginInfo info = |
| 149 | { | |
| 9954 | 150 | GAIM_PLUGIN_MAGIC, |
| 151 | GAIM_MAJOR_VERSION, | |
| 152 | GAIM_MINOR_VERSION, | |
| 9609 | 153 | GAIM_PLUGIN_STANDARD, /**< type */ |
| 154 | GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ | |
| 155 | 0, /**< flags */ | |
| 156 | NULL, /**< dependencies */ | |
| 157 | GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 158 | ||
| 159 | GTK_SIGNAL_TEST_PLUGIN_ID, /**< id */ | |
| 160 | N_("GTK Signals Test"), /**< name */ | |
| 161 | VERSION, /**< version */ | |
| 162 | /** summary */ | |
| 163 | N_("Test to see that all ui signals are working properly."), | |
| 164 | /** description */ | |
| 165 | N_("Test to see that all ui signals are working properly."), | |
| 166 | "Gary Kramlich <amc_grim@users.sf.net>", /**< author */ | |
| 167 | GAIM_WEBSITE, /**< homepage */ | |
| 168 | ||
| 169 | plugin_load, /**< load */ | |
| 11033 | 170 | plugin_unload, /**< unload */ |
| 9609 | 171 | NULL, /**< destroy */ |
| 172 | ||
| 173 | NULL, /**< ui_info */ | |
| 174 | NULL, /**< extra_info */ | |
| 175 | NULL, | |
| 176 | NULL | |
| 177 | }; | |
| 178 | ||
| 179 | static void | |
| 180 | init_plugin(GaimPlugin *plugin) | |
| 181 | { | |
| 182 | } | |
| 183 | ||
| 184 | GAIM_INIT_PLUGIN(gtksignalstest, init_plugin, info) |