comparison pidgin/gtkdocklet.c @ 15823:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 84b0f9b23ede
children 07554cc5d090 ab086aa2e210
comparison
equal deleted inserted replaced
15822:84b0f9b23ede 15823:32c366eeeb99
1 /* 1 /*
2 * System tray icon (aka docklet) plugin for Gaim 2 * System tray icon (aka docklet) plugin for Purple
3 * 3 *
4 * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org> 4 * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org>
5 * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com> 5 * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com>
6 * Inspired by a similar plugin by: 6 * Inspired by a similar plugin by:
7 * John (J5) Palmieri <johnp@martianrock.com> 7 * John (J5) Palmieri <johnp@martianrock.com>
90 get_pending_list(guint max) 90 get_pending_list(guint max)
91 { 91 {
92 GList *l_im = NULL; 92 GList *l_im = NULL;
93 GList *l_chat = NULL; 93 GList *l_chat = NULL;
94 94
95 l_im = pidgin_conversations_find_unseen_list(GAIM_CONV_TYPE_IM, 95 l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
96 PIDGIN_UNSEEN_TEXT, 96 PIDGIN_UNSEEN_TEXT,
97 FALSE, max); 97 FALSE, max);
98 98
99 l_chat = pidgin_conversations_find_unseen_list(GAIM_CONV_TYPE_CHAT, 99 l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
100 PIDGIN_UNSEEN_NICK, 100 PIDGIN_UNSEEN_NICK,
101 FALSE, max); 101 FALSE, max);
102 102
103 if (l_im != NULL && l_chat != NULL) 103 if (l_im != NULL && l_chat != NULL)
104 return g_list_concat(l_im, l_chat); 104 return g_list_concat(l_im, l_chat);
111 static gboolean 111 static gboolean
112 docklet_update_status() 112 docklet_update_status()
113 { 113 {
114 GList *convs, *l; 114 GList *convs, *l;
115 int count; 115 int count;
116 GaimSavedStatus *saved_status; 116 PurpleSavedStatus *saved_status;
117 GaimStatusPrimitive prim; 117 PurpleStatusPrimitive prim;
118 DockletStatus newstatus = DOCKLET_STATUS_OFFLINE; 118 DockletStatus newstatus = DOCKLET_STATUS_OFFLINE;
119 gboolean pending = FALSE, connecting = FALSE; 119 gboolean pending = FALSE, connecting = FALSE;
120 120
121 /* determine if any ims have unseen messages */ 121 /* determine if any ims have unseen messages */
122 convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); 122 convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT);
123 123
124 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/docklet/show"), "pending")) { 124 if (!strcmp(purple_prefs_get_string("/purple/gtk/docklet/show"), "pending")) {
125 if (convs && ui_ops->create && !visible) { 125 if (convs && ui_ops->create && !visible) {
126 g_list_free(convs); 126 g_list_free(convs);
127 ui_ops->create(); 127 ui_ops->create();
128 return FALSE; 128 return FALSE;
129 } else if (!convs && ui_ops->destroy && visible) { 129 } else if (!convs && ui_ops->destroy && visible) {
143 /* set tooltip if messages are pending */ 143 /* set tooltip if messages are pending */
144 if (ui_ops->set_tooltip) { 144 if (ui_ops->set_tooltip) {
145 GString *tooltip_text = g_string_new(""); 145 GString *tooltip_text = g_string_new("");
146 for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { 146 for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) {
147 if (PIDGIN_IS_PIDGIN_CONVERSATION(l->data)) { 147 if (PIDGIN_IS_PIDGIN_CONVERSATION(l->data)) {
148 PidginConversation *gtkconv = PIDGIN_CONVERSATION((GaimConversation *)l->data); 148 PidginConversation *gtkconv = PIDGIN_CONVERSATION((PurpleConversation *)l->data);
149 if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) 149 if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1)
150 g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); 150 g_string_append(tooltip_text, _("Right-click for more unread messages...\n"));
151 else 151 else
152 g_string_append_printf(tooltip_text, 152 g_string_append_printf(tooltip_text,
153 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), 153 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
169 169
170 } else if (ui_ops->set_tooltip) { 170 } else if (ui_ops->set_tooltip) {
171 ui_ops->set_tooltip(NULL); 171 ui_ops->set_tooltip(NULL);
172 } 172 }
173 173
174 for(l = gaim_accounts_get_all(); l != NULL; l = l->next) { 174 for(l = purple_accounts_get_all(); l != NULL; l = l->next) {
175 175
176 GaimAccount *account = (GaimAccount*)l->data; 176 PurpleAccount *account = (PurpleAccount*)l->data;
177 GaimStatus *account_status; 177 PurpleStatus *account_status;
178 178
179 if (!gaim_account_get_enabled(account, PIDGIN_UI)) 179 if (!purple_account_get_enabled(account, PIDGIN_UI))
180 continue; 180 continue;
181 181
182 if (gaim_account_is_disconnected(account)) 182 if (purple_account_is_disconnected(account))
183 continue; 183 continue;
184 184
185 account_status = gaim_account_get_active_status(account); 185 account_status = purple_account_get_active_status(account);
186 if (gaim_account_is_connecting(account)) 186 if (purple_account_is_connecting(account))
187 connecting = TRUE; 187 connecting = TRUE;
188 } 188 }
189 189
190 saved_status = gaim_savedstatus_get_current(); 190 saved_status = purple_savedstatus_get_current();
191 prim = gaim_savedstatus_get_type(saved_status); 191 prim = purple_savedstatus_get_type(saved_status);
192 if (pending) 192 if (pending)
193 newstatus = DOCKLET_STATUS_PENDING; 193 newstatus = DOCKLET_STATUS_PENDING;
194 else if (connecting) 194 else if (connecting)
195 newstatus = DOCKLET_STATUS_CONNECTING; 195 newstatus = DOCKLET_STATUS_CONNECTING;
196 else if (prim == GAIM_STATUS_UNAVAILABLE) 196 else if (prim == PURPLE_STATUS_UNAVAILABLE)
197 newstatus = DOCKLET_STATUS_BUSY; 197 newstatus = DOCKLET_STATUS_BUSY;
198 else if (prim == GAIM_STATUS_AWAY) 198 else if (prim == PURPLE_STATUS_AWAY)
199 newstatus = DOCKLET_STATUS_AWAY; 199 newstatus = DOCKLET_STATUS_AWAY;
200 else if (prim == GAIM_STATUS_EXTENDED_AWAY) 200 else if (prim == PURPLE_STATUS_EXTENDED_AWAY)
201 newstatus = DOCKLET_STATUS_XA; 201 newstatus = DOCKLET_STATUS_XA;
202 else if (prim == GAIM_STATUS_OFFLINE) 202 else if (prim == PURPLE_STATUS_OFFLINE)
203 newstatus = DOCKLET_STATUS_OFFLINE; 203 newstatus = DOCKLET_STATUS_OFFLINE;
204 else 204 else
205 newstatus = DOCKLET_STATUS_AVAILABLE; 205 newstatus = DOCKLET_STATUS_AVAILABLE;
206 206
207 /* update the icon if we changed status */ 207 /* update the icon if we changed status */
210 210
211 if (ui_ops && ui_ops->update_icon) 211 if (ui_ops && ui_ops->update_icon)
212 ui_ops->update_icon(status); 212 ui_ops->update_icon(status);
213 213
214 /* and schedule the blinker function if messages are pending */ 214 /* and schedule the blinker function if messages are pending */
215 if (gaim_prefs_get_bool("/gaim/gtk/docklet/blink") && 215 if (purple_prefs_get_bool("/purple/gtk/docklet/blink") &&
216 status == DOCKLET_STATUS_PENDING 216 status == DOCKLET_STATUS_PENDING
217 && docklet_blinking_timer == 0) { 217 && docklet_blinking_timer == 0) {
218 docklet_blinking_timer = g_timeout_add(500, docklet_blink_icon, NULL); 218 docklet_blinking_timer = g_timeout_add(500, docklet_blink_icon, NULL);
219 } 219 }
220 } 220 }
224 224
225 static gboolean 225 static gboolean
226 online_account_supports_chat() 226 online_account_supports_chat()
227 { 227 {
228 GList *c = NULL; 228 GList *c = NULL;
229 c = gaim_connections_get_all(); 229 c = purple_connections_get_all();
230 230
231 while(c != NULL) { 231 while(c != NULL) {
232 GaimConnection *gc = c->data; 232 PurpleConnection *gc = c->data;
233 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 233 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
234 if (prpl_info != NULL && prpl_info->chat_info != NULL) 234 if (prpl_info != NULL && prpl_info->chat_info != NULL)
235 return TRUE; 235 return TRUE;
236 c = c->next; 236 c = c->next;
237 } 237 }
238 238
255 { 255 {
256 docklet_update_status(); 256 docklet_update_status();
257 } 257 }
258 258
259 static void 259 static void
260 docklet_conv_updated_cb(GaimConversation *conv, GaimConvUpdateType type) 260 docklet_conv_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type)
261 { 261 {
262 if (type == GAIM_CONV_UPDATE_UNSEEN) 262 if (type == PURPLE_CONV_UPDATE_UNSEEN)
263 docklet_update_status(); 263 docklet_update_status();
264 } 264 }
265 265
266 static void 266 static void
267 docklet_signed_on_cb(GaimConnection *gc) 267 docklet_signed_on_cb(PurpleConnection *gc)
268 { 268 {
269 if (!enable_join_chat) { 269 if (!enable_join_chat) {
270 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) 270 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
271 enable_join_chat = TRUE; 271 enable_join_chat = TRUE;
272 } 272 }
273 docklet_update_status(); 273 docklet_update_status();
274 } 274 }
275 275
276 static void 276 static void
277 docklet_signed_off_cb(GaimConnection *gc) 277 docklet_signed_off_cb(PurpleConnection *gc)
278 { 278 {
279 if (enable_join_chat) { 279 if (enable_join_chat) {
280 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) 280 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
281 enable_join_chat = online_account_supports_chat(); 281 enable_join_chat = online_account_supports_chat();
282 } 282 }
283 docklet_update_status(); 283 docklet_update_status();
284 } 284 }
285 285
286 static void 286 static void
287 docklet_show_pref_changed_cb(const char *name, GaimPrefType type, 287 docklet_show_pref_changed_cb(const char *name, PurplePrefType type,
288 gconstpointer value, gpointer data) 288 gconstpointer value, gpointer data)
289 { 289 {
290 const char *val = value; 290 const char *val = value;
291 if (!strcmp(val, "always")) { 291 if (!strcmp(val, "always")) {
292 if (ui_ops->create) { 292 if (ui_ops->create) {
314 * docklet pop-up menu 314 * docklet pop-up menu
315 **************************************************************************/ 315 **************************************************************************/
316 static void 316 static void
317 docklet_toggle_mute(GtkWidget *toggle, void *data) 317 docklet_toggle_mute(GtkWidget *toggle, void *data)
318 { 318 {
319 gaim_prefs_set_bool("/gaim/gtk/sound/mute", GTK_CHECK_MENU_ITEM(toggle)->active); 319 purple_prefs_set_bool("/purple/gtk/sound/mute", GTK_CHECK_MENU_ITEM(toggle)->active);
320 } 320 }
321 321
322 static void 322 static void
323 docklet_toggle_blink(GtkWidget *toggle, void *data) 323 docklet_toggle_blink(GtkWidget *toggle, void *data)
324 { 324 {
325 gaim_prefs_set_bool("/gaim/gtk/docklet/blink", GTK_CHECK_MENU_ITEM(toggle)->active); 325 purple_prefs_set_bool("/purple/gtk/docklet/blink", GTK_CHECK_MENU_ITEM(toggle)->active);
326 } 326 }
327 327
328 static void 328 static void
329 docklet_toggle_blist(GtkWidget *toggle, void *data) 329 docklet_toggle_blist(GtkWidget *toggle, void *data)
330 { 330 {
331 gaim_blist_set_visible(GTK_CHECK_MENU_ITEM(toggle)->active); 331 purple_blist_set_visible(GTK_CHECK_MENU_ITEM(toggle)->active);
332 } 332 }
333 333
334 #ifdef _WIN32 334 #ifdef _WIN32
335 /* This is a workaround for a bug in windows GTK+. Clicking outside of the 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 336 menu does not get rid of it, so instead we get rid of it as soon as the
347 static gboolean 347 static gboolean
348 docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data) 348 docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data)
349 { 349 {
350 static guint hide_docklet_timer = 0; 350 static guint hide_docklet_timer = 0;
351 if (event->type == GDK_LEAVE_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { 351 if (event->type == GDK_LEAVE_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) {
352 gaim_debug(GAIM_DEBUG_INFO, "docklet", "menu leave-notify-event\n"); 352 purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu leave-notify-event\n");
353 /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */ 353 /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */
354 if (hide_docklet_timer == 0) { 354 if (hide_docklet_timer == 0) {
355 hide_docklet_timer = gaim_timeout_add(500, 355 hide_docklet_timer = purple_timeout_add(500,
356 hide_docklet_menu, menu); 356 hide_docklet_menu, menu);
357 } 357 }
358 } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { 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"); 359 purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu enter-notify-event\n");
360 if (hide_docklet_timer != 0) { 360 if (hide_docklet_timer != 0) {
361 /* Cancel the hiding if we reenter */ 361 /* Cancel the hiding if we reenter */
362 362
363 gaim_timeout_remove(hide_docklet_timer); 363 purple_timeout_remove(hide_docklet_timer);
364 hide_docklet_timer = 0; 364 hide_docklet_timer = 0;
365 } 365 }
366 } 366 }
367 return FALSE; 367 return FALSE;
368 } 368 }
369 #endif 369 #endif
370 370
371 static void 371 static void
372 show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data) 372 show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data)
373 { 373 {
374 GaimSavedStatus *saved_status; 374 PurpleSavedStatus *saved_status;
375 saved_status = gaim_savedstatus_get_current(); 375 saved_status = purple_savedstatus_get_current();
376 pidgin_status_editor_show(FALSE, 376 pidgin_status_editor_show(FALSE,
377 gaim_savedstatus_is_transient(saved_status) ? saved_status : NULL); 377 purple_savedstatus_is_transient(saved_status) ? saved_status : NULL);
378 } 378 }
379 379
380 static void 380 static void
381 activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data) 381 activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data)
382 { 382 {
383 GaimStatusPrimitive primitive; 383 PurpleStatusPrimitive primitive;
384 GaimSavedStatus *saved_status; 384 PurpleSavedStatus *saved_status;
385 385
386 primitive = GPOINTER_TO_INT(user_data); 386 primitive = GPOINTER_TO_INT(user_data);
387 387
388 /* Try to lookup an already existing transient saved status */ 388 /* Try to lookup an already existing transient saved status */
389 saved_status = gaim_savedstatus_find_transient_by_type_and_message(primitive, NULL); 389 saved_status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL);
390 390
391 /* Create a new transient saved status if we weren't able to find one */ 391 /* Create a new transient saved status if we weren't able to find one */
392 if (saved_status == NULL) 392 if (saved_status == NULL)
393 saved_status = gaim_savedstatus_new(NULL, primitive); 393 saved_status = purple_savedstatus_new(NULL, primitive);
394 394
395 /* Set the status for each account */ 395 /* Set the status for each account */
396 gaim_savedstatus_activate(saved_status); 396 purple_savedstatus_activate(saved_status);
397 } 397 }
398 398
399 static void 399 static void
400 activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data) 400 activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data)
401 { 401 {
402 time_t creation_time; 402 time_t creation_time;
403 GaimSavedStatus *saved_status; 403 PurpleSavedStatus *saved_status;
404 404
405 creation_time = GPOINTER_TO_INT(user_data); 405 creation_time = GPOINTER_TO_INT(user_data);
406 saved_status = gaim_savedstatus_find_by_creation_time(creation_time); 406 saved_status = purple_savedstatus_find_by_creation_time(creation_time);
407 if (saved_status != NULL) 407 if (saved_status != NULL)
408 gaim_savedstatus_activate(saved_status); 408 purple_savedstatus_activate(saved_status);
409 } 409 }
410 410
411 static GtkWidget * 411 static GtkWidget *
412 new_menu_item_with_status_icon(GtkWidget *menu, const char *str, GaimStatusPrimitive primitive, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod) 412 new_menu_item_with_status_icon(GtkWidget *menu, const char *str, PurpleStatusPrimitive primitive, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
413 { 413 {
414 GtkWidget *menuitem; 414 GtkWidget *menuitem;
415 GdkPixbuf *pixbuf; 415 GdkPixbuf *pixbuf;
416 GtkWidget *image; 416 GtkWidget *image;
417 417
442 submenu = gtk_menu_new(); 442 submenu = gtk_menu_new();
443 menuitem = gtk_menu_item_new_with_label(_("Change Status")); 443 menuitem = gtk_menu_item_new_with_label(_("Change Status"));
444 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); 444 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
445 445
446 new_menu_item_with_status_icon(submenu, _("Available"), 446 new_menu_item_with_status_icon(submenu, _("Available"),
447 GAIM_STATUS_AVAILABLE, G_CALLBACK(activate_status_primitive_cb), 447 PURPLE_STATUS_AVAILABLE, G_CALLBACK(activate_status_primitive_cb),
448 GINT_TO_POINTER(GAIM_STATUS_AVAILABLE), 0, 0, NULL); 448 GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE), 0, 0, NULL);
449 449
450 new_menu_item_with_status_icon(submenu, _("Away"), 450 new_menu_item_with_status_icon(submenu, _("Away"),
451 GAIM_STATUS_AWAY, G_CALLBACK(activate_status_primitive_cb), 451 PURPLE_STATUS_AWAY, G_CALLBACK(activate_status_primitive_cb),
452 GINT_TO_POINTER(GAIM_STATUS_AWAY), 0, 0, NULL); 452 GINT_TO_POINTER(PURPLE_STATUS_AWAY), 0, 0, NULL);
453 453
454 new_menu_item_with_status_icon(submenu, _("Invisible"), 454 new_menu_item_with_status_icon(submenu, _("Invisible"),
455 GAIM_STATUS_INVISIBLE, G_CALLBACK(activate_status_primitive_cb), 455 PURPLE_STATUS_INVISIBLE, G_CALLBACK(activate_status_primitive_cb),
456 GINT_TO_POINTER(GAIM_STATUS_INVISIBLE), 0, 0, NULL); 456 GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE), 0, 0, NULL);
457 457
458 new_menu_item_with_status_icon(submenu, _("Offline"), 458 new_menu_item_with_status_icon(submenu, _("Offline"),
459 GAIM_STATUS_OFFLINE, G_CALLBACK(activate_status_primitive_cb), 459 PURPLE_STATUS_OFFLINE, G_CALLBACK(activate_status_primitive_cb),
460 GINT_TO_POINTER(GAIM_STATUS_OFFLINE), 0, 0, NULL); 460 GINT_TO_POINTER(PURPLE_STATUS_OFFLINE), 0, 0, NULL);
461 461
462 popular_statuses = gaim_savedstatuses_get_popular(6); 462 popular_statuses = purple_savedstatuses_get_popular(6);
463 if (popular_statuses != NULL) 463 if (popular_statuses != NULL)
464 pidgin_separator(submenu); 464 pidgin_separator(submenu);
465 for (cur = popular_statuses; cur != NULL; cur = cur->next) 465 for (cur = popular_statuses; cur != NULL; cur = cur->next)
466 { 466 {
467 GaimSavedStatus *saved_status = cur->data; 467 PurpleSavedStatus *saved_status = cur->data;
468 time_t creation_time = gaim_savedstatus_get_creation_time(saved_status); 468 time_t creation_time = purple_savedstatus_get_creation_time(saved_status);
469 new_menu_item_with_status_icon(submenu, 469 new_menu_item_with_status_icon(submenu,
470 gaim_savedstatus_get_title(saved_status), 470 purple_savedstatus_get_title(saved_status),
471 gaim_savedstatus_get_type(saved_status), G_CALLBACK(activate_saved_status_cb), 471 purple_savedstatus_get_type(saved_status), G_CALLBACK(activate_saved_status_cb),
472 GINT_TO_POINTER(creation_time), 0, 0, NULL); 472 GINT_TO_POINTER(creation_time), 0, 0, NULL);
473 } 473 }
474 g_list_free(popular_statuses); 474 g_list_free(popular_statuses);
475 475
476 pidgin_separator(submenu); 476 pidgin_separator(submenu);
477 477
478 new_menu_item_with_status_icon(submenu, _("New..."), GAIM_STATUS_AVAILABLE, G_CALLBACK(show_custom_status_editor_cb), NULL, 0, 0, NULL); 478 new_menu_item_with_status_icon(submenu, _("New..."), PURPLE_STATUS_AVAILABLE, G_CALLBACK(show_custom_status_editor_cb), NULL, 0, 0, NULL);
479 new_menu_item_with_status_icon(submenu, _("Saved..."), GAIM_STATUS_AVAILABLE, G_CALLBACK(pidgin_status_window_show), NULL, 0, 0, NULL); 479 new_menu_item_with_status_icon(submenu, _("Saved..."), PURPLE_STATUS_AVAILABLE, G_CALLBACK(pidgin_status_window_show), NULL, 0, 0, NULL);
480 480
481 return menuitem; 481 return menuitem;
482 } 482 }
483 483
484 static void 484 static void
491 } 491 }
492 492
493 menu = gtk_menu_new(); 493 menu = gtk_menu_new();
494 494
495 menuitem = gtk_check_menu_item_new_with_label(_("Show Buddy List")); 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")); 496 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool("/purple/gtk/blist/list_visible"));
497 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL); 497 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL);
498 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 498 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
499 499
500 menuitem = gtk_menu_item_new_with_label(_("Unread Messages")); 500 menuitem = gtk_menu_item_new_with_label(_("Unread Messages"));
501 501
502 if (status == DOCKLET_STATUS_PENDING) { 502 if (status == DOCKLET_STATUS_PENDING) {
503 GtkWidget *submenu = gtk_menu_new(); 503 GtkWidget *submenu = gtk_menu_new();
504 GList *l = get_pending_list(0); 504 GList *l = get_pending_list(0);
505 if (l == NULL) { 505 if (l == NULL) {
506 gtk_widget_set_sensitive(menuitem, FALSE); 506 gtk_widget_set_sensitive(menuitem, FALSE);
507 gaim_debug_warning("docklet", 507 purple_debug_warning("docklet",
508 "status indicates messages pending, but no conversations with unseen messages were found."); 508 "status indicates messages pending, but no conversations with unseen messages were found.");
509 } else { 509 } else {
510 pidgin_conversations_fill_menu(submenu, l); 510 pidgin_conversations_fill_menu(submenu, l);
511 g_list_free(l); 511 g_list_free(l);
512 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); 512 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
532 pidgin_new_item_from_stock(menu, _("Preferences"), GTK_STOCK_PREFERENCES, G_CALLBACK(pidgin_prefs_show), NULL, 0, 0, NULL); 532 pidgin_new_item_from_stock(menu, _("Preferences"), GTK_STOCK_PREFERENCES, G_CALLBACK(pidgin_prefs_show), NULL, 0, 0, NULL);
533 533
534 pidgin_separator(menu); 534 pidgin_separator(menu);
535 535
536 menuitem = gtk_check_menu_item_new_with_label(_("Mute Sounds")); 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")); 537 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool("/purple/gtk/sound/mute"));
538 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")) 538 if (!strcmp(purple_prefs_get_string("/purple/gtk/sound/method"), "none"))
539 gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE); 539 gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE);
540 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); 540 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL);
541 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 541 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
542 542
543 menuitem = gtk_check_menu_item_new_with_label(_("Blink on new message")); 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")); 544 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool("/purple/gtk/docklet/blink"));
545 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blink), NULL); 545 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blink), NULL);
546 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 546 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
547 547
548 pidgin_separator(menu); 548 pidgin_separator(menu);
549 549
550 /* TODO: need a submenu to change status, this needs to "link" 550 /* TODO: need a submenu to change status, this needs to "link"
551 * to the status in the buddy list gtkstatusbox 551 * to the status in the buddy list gtkstatusbox
552 */ 552 */
553 553
554 pidgin_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(gaim_core_quit), NULL, 0, 0, NULL); 554 pidgin_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(purple_core_quit), NULL, 0, 0, NULL);
555 555
556 #ifdef _WIN32 556 #ifdef _WIN32
557 g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); 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); 558 g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL);
559 #endif 559 #endif
572 switch (button_type) { 572 switch (button_type) {
573 case 1: 573 case 1:
574 if (status == DOCKLET_STATUS_PENDING) { 574 if (status == DOCKLET_STATUS_PENDING) {
575 GList *l = get_pending_list(1); 575 GList *l = get_pending_list(1);
576 if (l != NULL) { 576 if (l != NULL) {
577 gaim_conversation_present((GaimConversation *)l->data); 577 purple_conversation_present((PurpleConversation *)l->data);
578 g_list_free(l); 578 g_list_free(l);
579 } 579 }
580 } else { 580 } else {
581 pidgin_blist_toggle_visibility(); 581 pidgin_blist_toggle_visibility();
582 } 582 }
589 589
590 void 590 void
591 pidgin_docklet_embedded() 591 pidgin_docklet_embedded()
592 { 592 {
593 if (!visibility_manager 593 if (!visibility_manager
594 && strcmp(gaim_prefs_get_string("/gaim/gtk/docklet/show"), "pending")) { 594 && strcmp(purple_prefs_get_string("/purple/gtk/docklet/show"), "pending")) {
595 pidgin_blist_visibility_manager_add(); 595 pidgin_blist_visibility_manager_add();
596 visibility_manager = TRUE; 596 visibility_manager = TRUE;
597 } 597 }
598 visible = TRUE; 598 visible = TRUE;
599 docklet_update_status(); 599 docklet_update_status();
632 } 632 }
633 633
634 void 634 void
635 pidgin_docklet_init() 635 pidgin_docklet_init()
636 { 636 {
637 void *conn_handle = gaim_connections_get_handle(); 637 void *conn_handle = purple_connections_get_handle();
638 void *conv_handle = gaim_conversations_get_handle(); 638 void *conv_handle = purple_conversations_get_handle();
639 void *accounts_handle = gaim_accounts_get_handle(); 639 void *accounts_handle = purple_accounts_get_handle();
640 void *docklet_handle = pidgin_docklet_get_handle(); 640 void *docklet_handle = pidgin_docklet_get_handle();
641 641
642 gaim_prefs_add_none("/gaim/gtk/docklet"); 642 purple_prefs_add_none("/purple/gtk/docklet");
643 gaim_prefs_add_bool("/gaim/gtk/docklet/blink", FALSE); 643 purple_prefs_add_bool("/purple/gtk/docklet/blink", FALSE);
644 gaim_prefs_add_string("/gaim/gtk/docklet/show", "always"); 644 purple_prefs_add_string("/purple/gtk/docklet/show", "always");
645 gaim_prefs_connect_callback(docklet_handle, "/gaim/gtk/docklet/show", 645 purple_prefs_connect_callback(docklet_handle, "/purple/gtk/docklet/show",
646 docklet_show_pref_changed_cb, NULL); 646 docklet_show_pref_changed_cb, NULL);
647 647
648 docklet_ui_init(); 648 docklet_ui_init();
649 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/docklet/show"), "always") && ui_ops && ui_ops->create) 649 if (!strcmp(purple_prefs_get_string("/purple/gtk/docklet/show"), "always") && ui_ops && ui_ops->create)
650 ui_ops->create(); 650 ui_ops->create();
651 651
652 gaim_signal_connect(conn_handle, "signed-on", 652 purple_signal_connect(conn_handle, "signed-on",
653 docklet_handle, GAIM_CALLBACK(docklet_signed_on_cb), NULL); 653 docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL);
654 gaim_signal_connect(conn_handle, "signed-off", 654 purple_signal_connect(conn_handle, "signed-off",
655 docklet_handle, GAIM_CALLBACK(docklet_signed_off_cb), NULL); 655 docklet_handle, PURPLE_CALLBACK(docklet_signed_off_cb), NULL);
656 gaim_signal_connect(accounts_handle, "account-status-changed", 656 purple_signal_connect(accounts_handle, "account-status-changed",
657 docklet_handle, GAIM_CALLBACK(docklet_update_status_cb), NULL); 657 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
658 gaim_signal_connect(conv_handle, "received-im-msg", 658 purple_signal_connect(conv_handle, "received-im-msg",
659 docklet_handle, GAIM_CALLBACK(docklet_update_status_cb), NULL); 659 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
660 gaim_signal_connect(conv_handle, "conversation-created", 660 purple_signal_connect(conv_handle, "conversation-created",
661 docklet_handle, GAIM_CALLBACK(docklet_update_status_cb), NULL); 661 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
662 gaim_signal_connect(conv_handle, "deleting-conversation", 662 purple_signal_connect(conv_handle, "deleting-conversation",
663 docklet_handle, GAIM_CALLBACK(docklet_update_status_cb), NULL); 663 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
664 gaim_signal_connect(conv_handle, "conversation-updated", 664 purple_signal_connect(conv_handle, "conversation-updated",
665 docklet_handle, GAIM_CALLBACK(docklet_conv_updated_cb), NULL); 665 docklet_handle, PURPLE_CALLBACK(docklet_conv_updated_cb), NULL);
666 #if 0 666 #if 0
667 gaim_signal_connect(gaim_get_core(), "quitting", 667 purple_signal_connect(purple_get_core(), "quitting",
668 docklet_handle, GAIM_CALLBACK(gaim_quit_cb), NULL); 668 docklet_handle, PURPLE_CALLBACK(purple_quit_cb), NULL);
669 #endif 669 #endif
670 670
671 enable_join_chat = online_account_supports_chat(); 671 enable_join_chat = online_account_supports_chat();
672 } 672 }
673 673