Sun, 25 Feb 2007 19:11:00 +0000
Add plugins stock icon to docklet menu
| 14743 | 1 | /* |
| 2 | * System tray icon (aka docklet) plugin for Gaim | |
| 3 | * | |
| 4 | * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org> | |
| 5 | * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com> | |
| 6 | * Inspired by a similar plugin by: | |
| 7 | * John (J5) Palmieri <johnp@martianrock.com> | |
| 8 | * | |
| 9 | * This program is free software; you can redistribute it and/or | |
| 10 | * modify it under the terms of the GNU General Public License as | |
| 11 | * published by the Free Software Foundation; either version 2 of the | |
| 12 | * License, or (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, but | |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 17 | * General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
| 20 | * along with this program; if not, write to the Free Software | |
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
| 22 | * 02111-1307, USA. | |
| 23 | */ | |
| 24 | #include "internal.h" | |
| 15577 | 25 | #include "pidgin.h" |
| 14743 | 26 | |
| 27 | #include "core.h" | |
| 28 | #include "conversation.h" | |
| 29 | #include "debug.h" | |
| 30 | #include "prefs.h" | |
| 31 | #include "signals.h" | |
| 32 | #include "sound.h" | |
| 33 | ||
| 34 | #include "gtkaccount.h" | |
| 35 | #include "gtkblist.h" | |
| 36 | #include "gtkconv.h" | |
| 37 | #include "gtkplugin.h" | |
| 38 | #include "gtkprefs.h" | |
| 39 | #include "gtksavedstatuses.h" | |
| 40 | #include "gtksound.h" | |
| 41 | #include "gtkutils.h" | |
| 42 | #include "gaimstock.h" | |
| 43 | #include "gtkdocklet.h" | |
| 44 | #include "gtkdialogs.h" | |
| 45 | ||
| 46 | #ifndef DOCKLET_TOOLTIP_LINE_LIMIT | |
| 47 | #define DOCKLET_TOOLTIP_LINE_LIMIT 5 | |
| 48 | #endif | |
| 49 | ||
| 50 | /* globals */ | |
| 51 | static struct docklet_ui_ops *ui_ops = NULL; | |
| 52 | static DockletStatus status = DOCKLET_STATUS_OFFLINE; | |
| 53 | static gboolean enable_join_chat = FALSE; | |
| 54 | static guint docklet_blinking_timer = 0; | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
55 | static gboolean visible = FALSE; |
| 14743 | 56 | static gboolean visibility_manager = FALSE; |
| 57 | ||
| 58 | /************************************************************************** | |
| 59 | * docklet status and utility functions | |
| 60 | **************************************************************************/ | |
| 61 | static gboolean | |
| 62 | docklet_blink_icon() | |
| 63 | { | |
| 64 | static gboolean blinked = FALSE; | |
| 65 | gboolean ret = FALSE; /* by default, don't keep blinking */ | |
| 66 | ||
| 67 | blinked = !blinked; | |
| 68 | ||
| 69 | switch (status) { | |
| 15731 | 70 | case DOCKLET_STATUS_PENDING: |
| 14743 | 71 | if (blinked) { |
| 72 | if (ui_ops && ui_ops->blank_icon) | |
| 73 | ui_ops->blank_icon(); | |
| 74 | } else { | |
| 75 | if (ui_ops && ui_ops->update_icon) | |
| 76 | ui_ops->update_icon(status); | |
| 77 | } | |
| 78 | ret = TRUE; /* keep blinking */ | |
| 79 | break; | |
| 80 | default: | |
| 81 | docklet_blinking_timer = 0; | |
| 82 | blinked = FALSE; | |
| 83 | break; | |
| 84 | } | |
| 85 | ||
| 86 | return ret; | |
| 87 | } | |
| 88 | ||
| 89 | static GList * | |
| 90 | get_pending_list(guint max) | |
| 91 | { | |
| 92 | GList *l_im = NULL; | |
| 93 | GList *l_chat = NULL; | |
| 94 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
95 | l_im = pidgin_conversations_find_unseen_list(GAIM_CONV_TYPE_IM, |
|
15566
ce486027d329
GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@pidgin.im>
parents:
15563
diff
changeset
|
96 | PIDGIN_UNSEEN_TEXT, |
|
14813
c24dda7fb69e
[gaim-migrate @ 17508]
Casey Harkins <charkins@pidgin.im>
parents:
14745
diff
changeset
|
97 | FALSE, max); |
| 14743 | 98 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
99 | l_chat = pidgin_conversations_find_unseen_list(GAIM_CONV_TYPE_CHAT, |
|
15566
ce486027d329
GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@pidgin.im>
parents:
15563
diff
changeset
|
100 | PIDGIN_UNSEEN_NICK, |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
101 | FALSE, max); |
| 14743 | 102 | |
| 103 | if (l_im != NULL && l_chat != NULL) | |
| 104 | return g_list_concat(l_im, l_chat); | |
| 105 | else if (l_im != NULL) | |
| 106 | return l_im; | |
| 107 | else | |
| 108 | return l_chat; | |
| 109 | } | |
| 110 | ||
| 111 | static gboolean | |
| 112 | docklet_update_status() | |
| 113 | { | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
114 | GList *convs, *l; |
| 14743 | 115 | int count; |
| 15731 | 116 | GaimSavedStatus *saved_status; |
| 117 | GaimStatusPrimitive prim; | |
| 14743 | 118 | DockletStatus newstatus = DOCKLET_STATUS_OFFLINE; |
| 15731 | 119 | gboolean pending = FALSE, connecting = FALSE; |
| 14743 | 120 | |
| 121 | /* determine if any ims have unseen messages */ | |
| 122 | convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); | |
| 123 | ||
| 14935 | 124 | if (!strcmp(gaim_prefs_get_string("/gaim/gtk/docklet/show"), "pending")) { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
125 | if (convs && ui_ops->create && !visible) { |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
126 | g_list_free(convs); |
|
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
127 | ui_ops->create(); |
|
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
128 | return FALSE; |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
129 | } else if (!convs && ui_ops->destroy && visible) { |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
130 | ui_ops->destroy(); |
|
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
131 | return FALSE; |
| 14935 | 132 | } |
| 133 | } | |
| 134 | ||
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
135 | if (!visible) { |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
136 | g_list_free(convs); |
| 14947 | 137 | return FALSE; |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
138 | } |
| 14947 | 139 | |
| 14743 | 140 | if (convs != NULL) { |
| 141 | pending = TRUE; | |
| 142 | ||
| 143 | /* set tooltip if messages are pending */ | |
| 144 | if (ui_ops->set_tooltip) { | |
| 145 | GString *tooltip_text = g_string_new(""); | |
| 146 | for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { | |
|
15692
ecda27df58b9
Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents:
15670
diff
changeset
|
147 | if (PIDGIN_IS_PIDGIN_CONVERSATION(l->data)) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
148 | PidginConversation *gtkconv = PIDGIN_CONVERSATION((GaimConversation *)l->data); |
| 14743 | 149 | if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) |
| 150 | g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); | |
| 151 | else | |
| 152 | g_string_append_printf(tooltip_text, | |
| 153 | ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), | |
| 154 | gtkconv->unseen_count, | |
| 155 | gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); | |
| 156 | } | |
| 157 | } | |
| 158 | ||
| 159 | /* get rid of the last newline */ | |
| 160 | if (tooltip_text->len > 0) | |
| 161 | tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); | |
| 162 | ||
| 163 | ui_ops->set_tooltip(tooltip_text->str); | |
| 164 | ||
| 165 | g_string_free(tooltip_text, TRUE); | |
| 166 | } | |
| 167 | ||
| 168 | g_list_free(convs); | |
| 169 | ||
| 170 | } else if (ui_ops->set_tooltip) { | |
| 171 | ui_ops->set_tooltip(NULL); | |
| 172 | } | |
| 173 | ||
| 174 | for(l = gaim_accounts_get_all(); l != NULL; l = l->next) { | |
| 175 | ||
| 176 | GaimAccount *account = (GaimAccount*)l->data; | |
| 177 | GaimStatus *account_status; | |
| 178 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
179 | if (!gaim_account_get_enabled(account, PIDGIN_UI)) |
| 14743 | 180 | continue; |
| 181 | ||
| 182 | if (gaim_account_is_disconnected(account)) | |
| 183 | continue; | |
| 184 | ||
| 185 | account_status = gaim_account_get_active_status(account); | |
| 15731 | 186 | if (gaim_account_is_connecting(account)) |
| 187 | connecting = TRUE; | |
| 14743 | 188 | } |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15760
diff
changeset
|
189 | |
| 15731 | 190 | saved_status = gaim_savedstatus_get_current(); |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15760
diff
changeset
|
191 | prim = gaim_savedstatus_get_type(saved_status); |
| 15760 | 192 | if (pending) |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15760
diff
changeset
|
193 | newstatus = DOCKLET_STATUS_PENDING; |
| 15760 | 194 | else if (connecting) |
| 15731 | 195 | newstatus = DOCKLET_STATUS_CONNECTING; |
| 196 | else if (prim == GAIM_STATUS_UNAVAILABLE) | |
| 197 | newstatus = DOCKLET_STATUS_BUSY; | |
| 198 | else if (prim == GAIM_STATUS_AWAY) | |
| 199 | newstatus = DOCKLET_STATUS_AWAY; | |
| 200 | else if (prim == GAIM_STATUS_EXTENDED_AWAY) | |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15760
diff
changeset
|
201 | newstatus = DOCKLET_STATUS_XA; |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15760
diff
changeset
|
202 | else if (prim == GAIM_STATUS_OFFLINE) |
|
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15760
diff
changeset
|
203 | newstatus = DOCKLET_STATUS_OFFLINE; |
| 15731 | 204 | else |
| 205 | newstatus = DOCKLET_STATUS_AVAILABLE; | |
|
15765
f281403e98cf
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <datallah@pidgin.im>
parents:
15760
diff
changeset
|
206 | |
| 14743 | 207 | /* update the icon if we changed status */ |
| 208 | if (status != newstatus) { | |
| 209 | status = newstatus; | |
| 210 | ||
| 211 | if (ui_ops && ui_ops->update_icon) | |
| 212 | ui_ops->update_icon(status); | |
| 213 | ||
| 214 | /* and schedule the blinker function if messages are pending */ | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
215 | if (gaim_prefs_get_bool("/gaim/gtk/docklet/blink") && |
| 15731 | 216 | status == DOCKLET_STATUS_PENDING |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
217 | && docklet_blinking_timer == 0) { |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
218 | docklet_blinking_timer = g_timeout_add(500, docklet_blink_icon, NULL); |
| 14743 | 219 | } |
| 220 | } | |
| 221 | ||
| 222 | return FALSE; /* for when we're called by the glib idle handler */ | |
| 223 | } | |
| 224 | ||
| 225 | static gboolean | |
| 226 | online_account_supports_chat() | |
| 227 | { | |
| 228 | GList *c = NULL; | |
| 229 | c = gaim_connections_get_all(); | |
| 230 | ||
| 231 | while(c != NULL) { | |
| 232 | GaimConnection *gc = c->data; | |
| 233 | GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
| 234 | if (prpl_info != NULL && prpl_info->chat_info != NULL) | |
| 235 | return TRUE; | |
| 236 | c = c->next; | |
| 237 | } | |
| 238 | ||
| 239 | return FALSE; | |
| 240 | } | |
| 241 | ||
| 242 | /************************************************************************** | |
| 243 | * callbacks and signal handlers | |
| 244 | **************************************************************************/ | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
245 | #if 0 |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
246 | static void |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
247 | gaim_quit_cb() |
| 14743 | 248 | { |
| 249 | /* TODO: confirm quit while pending */ | |
| 250 | } | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
251 | #endif |
| 14743 | 252 | |
| 253 | static void | |
| 254 | docklet_update_status_cb(void *data) | |
| 255 | { | |
| 256 | docklet_update_status(); | |
| 257 | } | |
| 258 | ||
| 259 | static void | |
| 260 | docklet_conv_updated_cb(GaimConversation *conv, GaimConvUpdateType type) | |
| 261 | { | |
| 262 | if (type == GAIM_CONV_UPDATE_UNSEEN) | |
| 263 | docklet_update_status(); | |
| 264 | } | |
| 265 | ||
| 266 | static void | |
| 267 | docklet_signed_on_cb(GaimConnection *gc) | |
| 268 | { | |
| 269 | if (!enable_join_chat) { | |
| 270 | if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) | |
| 271 | enable_join_chat = TRUE; | |
| 272 | } | |
| 273 | docklet_update_status(); | |
| 274 | } | |
| 275 | ||
| 276 | static void | |
| 277 | docklet_signed_off_cb(GaimConnection *gc) | |
| 278 | { | |
| 279 | if (enable_join_chat) { | |
| 280 | if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) | |
| 281 | enable_join_chat = online_account_supports_chat(); | |
| 282 | } | |
| 283 | docklet_update_status(); | |
| 284 | } | |
| 285 | ||
| 14947 | 286 | static void |
| 287 | docklet_show_pref_changed_cb(const char *name, GaimPrefType type, | |
| 288 | gconstpointer value, gpointer data) | |
| 289 | { | |
| 290 | const char *val = value; | |
| 291 | if (!strcmp(val, "always")) { | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
292 | if (ui_ops->create) { |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
293 | if (!visible) |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
294 | ui_ops->create(); |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
295 | else if (!visibility_manager) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
296 | pidgin_blist_visibility_manager_add(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
297 | visibility_manager = TRUE; |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
298 | } |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
299 | } |
| 14947 | 300 | } else if (!strcmp(val, "never")) { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
301 | if (visible && ui_ops->destroy) |
| 14947 | 302 | ui_ops->destroy(); |
| 303 | } else { | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
304 | if (visibility_manager) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
305 | pidgin_blist_visibility_manager_remove(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
306 | visibility_manager = FALSE; |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
307 | } |
| 14947 | 308 | docklet_update_status(); |
| 309 | } | |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
310 | |
| 14947 | 311 | } |
| 312 | ||
| 14743 | 313 | /************************************************************************** |
| 314 | * docklet pop-up menu | |
| 315 | **************************************************************************/ | |
| 316 | static void | |
| 317 | docklet_toggle_mute(GtkWidget *toggle, void *data) | |
| 318 | { | |
| 319 | gaim_prefs_set_bool("/gaim/gtk/sound/mute", GTK_CHECK_MENU_ITEM(toggle)->active); | |
| 320 | } | |
| 321 | ||
| 322 | static void | |
| 14875 | 323 | docklet_toggle_blink(GtkWidget *toggle, void *data) |
| 324 | { | |
| 325 | gaim_prefs_set_bool("/gaim/gtk/docklet/blink", GTK_CHECK_MENU_ITEM(toggle)->active); | |
| 326 | } | |
| 327 | ||
| 328 | static void | |
| 14743 | 329 | docklet_toggle_blist(GtkWidget *toggle, void *data) |
| 330 | { | |
| 331 | gaim_blist_set_visible(GTK_CHECK_MENU_ITEM(toggle)->active); | |
| 332 | } | |
| 333 | ||
| 334 | #ifdef _WIN32 | |
| 335 | /* This is a workaround for a bug in windows GTK+. Clicking outside of the | |
| 336 | menu does not get rid of it, so instead we get rid of it as soon as the | |
| 337 | pointer leaves the menu. */ | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
338 | static gboolean |
| 14743 | 339 | hide_docklet_menu(gpointer data) |
| 340 | { | |
| 341 | if (data != NULL) { | |
| 342 | gtk_menu_popdown(GTK_MENU(data)); | |
| 343 | } | |
| 344 | return FALSE; | |
| 345 | } | |
| 346 | ||
| 347 | static gboolean | |
| 348 | docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data) | |
| 349 | { | |
| 350 | static guint hide_docklet_timer = 0; | |
| 351 | if (event->type == GDK_LEAVE_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { | |
| 352 | gaim_debug(GAIM_DEBUG_INFO, "docklet", "menu leave-notify-event\n"); | |
| 353 | /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */ | |
| 354 | if (hide_docklet_timer == 0) { | |
| 355 | hide_docklet_timer = gaim_timeout_add(500, | |
| 356 | hide_docklet_menu, menu); | |
| 357 | } | |
| 358 | } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { | |
| 359 | gaim_debug(GAIM_DEBUG_INFO, "docklet", "menu enter-notify-event\n"); | |
| 360 | if (hide_docklet_timer != 0) { | |
| 361 | /* Cancel the hiding if we reenter */ | |
| 362 | ||
| 363 | gaim_timeout_remove(hide_docklet_timer); | |
| 364 | hide_docklet_timer = 0; | |
| 365 | } | |
| 366 | } | |
| 367 | return FALSE; | |
| 368 | } | |
| 369 | #endif | |
| 370 | ||
| 371 | static void | |
| 372 | show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 373 | { | |
| 374 | GaimSavedStatus *saved_status; | |
| 375 | saved_status = gaim_savedstatus_get_current(); | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
376 | pidgin_status_editor_show(FALSE, |
| 14743 | 377 | gaim_savedstatus_is_transient(saved_status) ? saved_status : NULL); |
| 378 | } | |
| 379 | ||
| 380 | static void | |
| 381 | activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 382 | { | |
| 383 | GaimStatusPrimitive primitive; | |
| 384 | GaimSavedStatus *saved_status; | |
| 385 | ||
| 386 | primitive = GPOINTER_TO_INT(user_data); | |
| 387 | ||
| 388 | /* Try to lookup an already existing transient saved status */ | |
| 389 | saved_status = gaim_savedstatus_find_transient_by_type_and_message(primitive, NULL); | |
| 390 | ||
| 391 | /* Create a new transient saved status if we weren't able to find one */ | |
| 392 | if (saved_status == NULL) | |
| 393 | saved_status = gaim_savedstatus_new(NULL, primitive); | |
| 394 | ||
| 395 | /* Set the status for each account */ | |
| 396 | gaim_savedstatus_activate(saved_status); | |
| 397 | } | |
| 398 | ||
| 399 | static void | |
| 400 | activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 401 | { | |
| 402 | time_t creation_time; | |
| 403 | GaimSavedStatus *saved_status; | |
| 404 | ||
| 405 | creation_time = GPOINTER_TO_INT(user_data); | |
| 406 | saved_status = gaim_savedstatus_find_by_creation_time(creation_time); | |
| 407 | if (saved_status != NULL) | |
| 408 | gaim_savedstatus_activate(saved_status); | |
| 409 | } | |
| 410 | ||
| 411 | static GtkWidget * | |
| 412 | new_menu_item_with_gaim_icon(GtkWidget *menu, const char *str, GaimStatusPrimitive primitive, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod) | |
| 413 | { | |
| 414 | GtkWidget *menuitem; | |
| 415 | GdkPixbuf *pixbuf; | |
| 416 | GtkWidget *image; | |
| 417 | ||
| 418 | menuitem = gtk_image_menu_item_new_with_mnemonic(str); | |
| 419 | ||
| 420 | if (menu) | |
| 421 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 422 | ||
| 423 | if (sf) | |
| 424 | g_signal_connect(G_OBJECT(menuitem), "activate", sf, data); | |
| 425 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
426 | pixbuf = pidgin_create_gaim_icon_with_status(primitive, 0.5); |
| 14743 | 427 | image = gtk_image_new_from_pixbuf(pixbuf); |
| 428 | g_object_unref(pixbuf); | |
| 429 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); | |
| 430 | ||
| 431 | gtk_widget_show_all(menuitem); | |
| 432 | ||
| 433 | return menuitem; | |
| 434 | } | |
| 435 | ||
| 436 | static GtkWidget * | |
| 437 | docklet_status_submenu() | |
| 438 | { | |
| 439 | GtkWidget *submenu, *menuitem; | |
| 440 | GList *popular_statuses, *cur; | |
| 441 | ||
| 442 | submenu = gtk_menu_new(); | |
| 443 | menuitem = gtk_menu_item_new_with_label(_("Change Status")); | |
| 444 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); | |
| 445 | ||
| 446 | new_menu_item_with_gaim_icon(submenu, _("Available"), | |
| 447 | GAIM_STATUS_AVAILABLE, G_CALLBACK(activate_status_primitive_cb), | |
| 448 | GINT_TO_POINTER(GAIM_STATUS_AVAILABLE), 0, 0, NULL); | |
| 449 | ||
| 450 | new_menu_item_with_gaim_icon(submenu, _("Away"), | |
| 451 | GAIM_STATUS_AWAY, G_CALLBACK(activate_status_primitive_cb), | |
| 452 | GINT_TO_POINTER(GAIM_STATUS_AWAY), 0, 0, NULL); | |
| 453 | ||
| 454 | new_menu_item_with_gaim_icon(submenu, _("Invisible"), | |
| 455 | GAIM_STATUS_INVISIBLE, G_CALLBACK(activate_status_primitive_cb), | |
| 456 | GINT_TO_POINTER(GAIM_STATUS_INVISIBLE), 0, 0, NULL); | |
| 457 | ||
| 458 | new_menu_item_with_gaim_icon(submenu, _("Offline"), | |
| 459 | GAIM_STATUS_OFFLINE, G_CALLBACK(activate_status_primitive_cb), | |
| 460 | GINT_TO_POINTER(GAIM_STATUS_OFFLINE), 0, 0, NULL); | |
| 461 | ||
| 462 | popular_statuses = gaim_savedstatuses_get_popular(6); | |
| 463 | if (popular_statuses != NULL) | |
| 15568 | 464 | pidgin_separator(submenu); |
| 14743 | 465 | for (cur = popular_statuses; cur != NULL; cur = cur->next) |
| 466 | { | |
| 467 | GaimSavedStatus *saved_status = cur->data; | |
| 468 | time_t creation_time = gaim_savedstatus_get_creation_time(saved_status); | |
| 469 | new_menu_item_with_gaim_icon(submenu, | |
| 470 | gaim_savedstatus_get_title(saved_status), | |
| 471 | gaim_savedstatus_get_type(saved_status), G_CALLBACK(activate_saved_status_cb), | |
| 472 | GINT_TO_POINTER(creation_time), 0, 0, NULL); | |
| 473 | } | |
| 474 | g_list_free(popular_statuses); | |
| 475 | ||
| 15568 | 476 | pidgin_separator(submenu); |
| 14743 | 477 | |
| 478 | new_menu_item_with_gaim_icon(submenu, _("New..."), GAIM_STATUS_AVAILABLE, G_CALLBACK(show_custom_status_editor_cb), NULL, 0, 0, NULL); | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
479 | new_menu_item_with_gaim_icon(submenu, _("Saved..."), GAIM_STATUS_AVAILABLE, G_CALLBACK(pidgin_status_window_show), NULL, 0, 0, NULL); |
| 14743 | 480 | |
| 481 | return menuitem; | |
| 482 | } | |
| 483 | ||
| 484 | static void | |
| 485 | docklet_menu() { | |
| 486 | static GtkWidget *menu = NULL; | |
| 487 | GtkWidget *menuitem; | |
| 488 | ||
| 489 | if (menu) { | |
| 490 | gtk_widget_destroy(menu); | |
| 491 | } | |
| 492 | ||
| 493 | menu = gtk_menu_new(); | |
| 494 | ||
| 495 | menuitem = gtk_check_menu_item_new_with_label(_("Show Buddy List")); | |
| 496 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), gaim_prefs_get_bool("/gaim/gtk/blist/list_visible")); | |
| 497 | g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL); | |
| 498 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 499 | ||
| 500 | menuitem = gtk_menu_item_new_with_label(_("Unread Messages")); | |
| 501 | ||
| 15731 | 502 | if (status == DOCKLET_STATUS_PENDING) { |
| 14743 | 503 | GtkWidget *submenu = gtk_menu_new(); |
| 504 | GList *l = get_pending_list(0); | |
| 505 | if (l == NULL) { | |
| 506 | gtk_widget_set_sensitive(menuitem, FALSE); | |
| 507 | gaim_debug_warning("docklet", | |
| 508 | "status indicates messages pending, but no conversations with unseen messages were found."); | |
| 509 | } else { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
510 | pidgin_conversations_fill_menu(submenu, l); |
| 14743 | 511 | g_list_free(l); |
| 512 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); | |
| 513 | } | |
| 514 | } else { | |
| 515 | gtk_widget_set_sensitive(menuitem, FALSE); | |
| 516 | } | |
| 517 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 518 | ||
| 15568 | 519 | pidgin_separator(menu); |
| 14743 | 520 | |
|
15623
bf485c598199
toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents:
15577
diff
changeset
|
521 | menuitem = pidgin_new_item_from_stock(menu, _("New Message..."), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, G_CALLBACK(pidgindialogs_im), NULL, 0, 0, NULL); |
| 14743 | 522 | if (status == DOCKLET_STATUS_OFFLINE) |
| 523 | gtk_widget_set_sensitive(menuitem, FALSE); | |
| 524 | ||
| 525 | menuitem = docklet_status_submenu(); | |
| 526 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 527 | ||
| 15568 | 528 | pidgin_separator(menu); |
| 14743 | 529 | |
|
15623
bf485c598199
toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents:
15577
diff
changeset
|
530 | pidgin_new_item_from_stock(menu, _("Accounts"), NULL, G_CALLBACK(pidgin_accounts_window_show), NULL, 0, 0, NULL); |
|
15766
271f5a57657b
Add plugins stock icon to docklet menu
Daniel Atallah <datallah@pidgin.im>
parents:
15765
diff
changeset
|
531 | pidgin_new_item_from_stock(menu, _("Plugins"), PIDGIN_STOCK_TOOLBAR_PLUGINS, G_CALLBACK(pidgin_plugin_dialog_show), NULL, 0, 0, NULL); |
| 15568 | 532 | pidgin_new_item_from_stock(menu, _("Preferences"), GTK_STOCK_PREFERENCES, G_CALLBACK(pidgin_prefs_show), NULL, 0, 0, NULL); |
| 14743 | 533 | |
| 15568 | 534 | pidgin_separator(menu); |
| 14743 | 535 | |
| 536 | menuitem = gtk_check_menu_item_new_with_label(_("Mute Sounds")); | |
| 537 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), gaim_prefs_get_bool("/gaim/gtk/sound/mute")); | |
| 538 | if (!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")) | |
| 539 | gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE); | |
| 540 | g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); | |
| 541 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
542 | |
| 14875 | 543 | menuitem = gtk_check_menu_item_new_with_label(_("Blink on new message")); |
| 544 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), gaim_prefs_get_bool("/gaim/gtk/docklet/blink")); | |
| 545 | g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blink), NULL); | |
| 546 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 14743 | 547 | |
| 15568 | 548 | pidgin_separator(menu); |
| 14743 | 549 | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
550 | /* TODO: need a submenu to change status, this needs to "link" |
| 14743 | 551 | * to the status in the buddy list gtkstatusbox |
| 552 | */ | |
| 553 | ||
| 15568 | 554 | pidgin_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(gaim_core_quit), NULL, 0, 0, NULL); |
| 14743 | 555 | |
| 556 | #ifdef _WIN32 | |
| 557 | g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); | |
| 558 | g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); | |
| 559 | #endif | |
| 560 | gtk_widget_show_all(menu); | |
| 561 | gtk_menu_popup(GTK_MENU(menu), NULL, NULL, | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
562 | ui_ops->position_menu, |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
563 | NULL, 0, gtk_get_current_event_time()); |
| 14743 | 564 | } |
| 565 | ||
| 566 | /************************************************************************** | |
| 567 | * public api for ui_ops | |
| 568 | **************************************************************************/ | |
| 569 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
570 | pidgin_docklet_clicked(int button_type) |
| 14743 | 571 | { |
| 572 | switch (button_type) { | |
| 573 | case 1: | |
| 15731 | 574 | if (status == DOCKLET_STATUS_PENDING) { |
| 14743 | 575 | GList *l = get_pending_list(1); |
| 576 | if (l != NULL) { | |
|
15670
25536d2aca5c
Let's use the core function instead of using the uiops function directly when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15623
diff
changeset
|
577 | gaim_conversation_present((GaimConversation *)l->data); |
| 14743 | 578 | g_list_free(l); |
| 579 | } | |
| 580 | } else { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
581 | pidgin_blist_toggle_visibility(); |
| 14743 | 582 | } |
| 583 | break; | |
| 584 | case 3: | |
| 585 | docklet_menu(); | |
| 586 | break; | |
| 587 | } | |
| 588 | } | |
| 589 | ||
| 590 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
591 | pidgin_docklet_embedded() |
| 14743 | 592 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
593 | if (!visibility_manager |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
594 | && strcmp(gaim_prefs_get_string("/gaim/gtk/docklet/show"), "pending")) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
595 | pidgin_blist_visibility_manager_add(); |
| 14743 | 596 | visibility_manager = TRUE; |
| 597 | } | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
598 | visible = TRUE; |
| 14743 | 599 | docklet_update_status(); |
| 600 | if (ui_ops && ui_ops->update_icon) | |
| 601 | ui_ops->update_icon(status); | |
| 602 | } | |
| 603 | ||
| 604 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
605 | pidgin_docklet_remove() |
| 14743 | 606 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
607 | if (visible) { |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
608 | if (visibility_manager) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
609 | pidgin_blist_visibility_manager_remove(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
610 | visibility_manager = FALSE; |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
611 | } |
| 14935 | 612 | if (docklet_blinking_timer) { |
| 613 | g_source_remove(docklet_blinking_timer); | |
| 614 | docklet_blinking_timer = 0; | |
| 615 | } | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
616 | visible = FALSE; |
| 14935 | 617 | status = DOCKLET_STATUS_OFFLINE; |
| 14743 | 618 | } |
| 619 | } | |
| 620 | ||
| 621 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
622 | pidgin_docklet_set_ui_ops(struct docklet_ui_ops *ops) |
| 14743 | 623 | { |
| 624 | ui_ops = ops; | |
| 625 | } | |
| 626 | ||
| 627 | void* | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
628 | pidgin_docklet_get_handle() |
| 14743 | 629 | { |
| 630 | static int i; | |
| 631 | return &i; | |
| 632 | } | |
| 633 | ||
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
634 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
635 | pidgin_docklet_init() |
| 14743 | 636 | { |
| 637 | void *conn_handle = gaim_connections_get_handle(); | |
| 638 | void *conv_handle = gaim_conversations_get_handle(); | |
| 639 | void *accounts_handle = gaim_accounts_get_handle(); | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
640 | void *docklet_handle = pidgin_docklet_get_handle(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
641 | |
| 14875 | 642 | gaim_prefs_add_none("/gaim/gtk/docklet"); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
643 | gaim_prefs_add_bool("/gaim/gtk/docklet/blink", FALSE); |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
644 | gaim_prefs_add_string("/gaim/gtk/docklet/show", "always"); |
| 14947 | 645 | gaim_prefs_connect_callback(docklet_handle, "/gaim/gtk/docklet/show", |
| 646 | docklet_show_pref_changed_cb, NULL); | |
| 14743 | 647 | |
| 648 | docklet_ui_init(); | |
| 14935 | 649 | if (!strcmp(gaim_prefs_get_string("/gaim/gtk/docklet/show"), "always") && ui_ops && ui_ops->create) |
| 14743 | 650 | ui_ops->create(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
651 | |
| 14743 | 652 | gaim_signal_connect(conn_handle, "signed-on", |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
653 | docklet_handle, GAIM_CALLBACK(docklet_signed_on_cb), NULL); |
| 14743 | 654 | gaim_signal_connect(conn_handle, "signed-off", |
| 655 | docklet_handle, GAIM_CALLBACK(docklet_signed_off_cb), NULL); | |
| 656 | gaim_signal_connect(accounts_handle, "account-status-changed", | |
| 657 | docklet_handle, GAIM_CALLBACK(docklet_update_status_cb), NULL); | |
| 658 | gaim_signal_connect(conv_handle, "received-im-msg", | |
| 659 | docklet_handle, GAIM_CALLBACK(docklet_update_status_cb), NULL); | |
| 660 | gaim_signal_connect(conv_handle, "conversation-created", | |
| 661 | docklet_handle, GAIM_CALLBACK(docklet_update_status_cb), NULL); | |
| 662 | gaim_signal_connect(conv_handle, "deleting-conversation", | |
| 663 | docklet_handle, GAIM_CALLBACK(docklet_update_status_cb), NULL); | |
| 664 | gaim_signal_connect(conv_handle, "conversation-updated", | |
| 665 | docklet_handle, GAIM_CALLBACK(docklet_conv_updated_cb), NULL); | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
666 | #if 0 |
|
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
667 | gaim_signal_connect(gaim_get_core(), "quitting", |
|
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
668 | docklet_handle, GAIM_CALLBACK(gaim_quit_cb), NULL); |
|
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
669 | #endif |
| 14743 | 670 | |
| 671 | enable_join_chat = online_account_supports_chat(); | |
| 672 | } | |
| 673 | ||
| 674 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
675 | pidgin_docklet_uninit() |
| 14743 | 676 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
677 | if (visible && ui_ops && ui_ops->destroy) |
| 14743 | 678 | ui_ops->destroy(); |
| 679 | } |