comparison pidgin/gtkconv.c @ 15501:d75099d2567e

gaim_gtk to pidgin. I hope
author Sean Egan <seanegan@gmail.com>
date Sat, 03 Feb 2007 07:23:11 +0000
parents 0d4890637238
children 6fde15c1dcfc
comparison
equal deleted inserted replaced
15500:45ecefd0ce3a 15501:d75099d2567e
70 70
71 #define AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : " 71 #define AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : "
72 72
73 typedef enum 73 typedef enum
74 { 74 {
75 GAIM_GTKCONV_SET_TITLE = 1 << 0, 75 PIDGINCONV_SET_TITLE = 1 << 0,
76 GAIM_GTKCONV_BUDDY_ICON = 1 << 1, 76 PIDGINCONV_BUDDY_ICON = 1 << 1,
77 GAIM_GTKCONV_MENU = 1 << 2, 77 PIDGINCONV_MENU = 1 << 2,
78 GAIM_GTKCONV_TAB_ICON = 1 << 3, 78 PIDGINCONV_TAB_ICON = 1 << 3,
79 GAIM_GTKCONV_TOPIC = 1 << 4, 79 PIDGINCONV_TOPIC = 1 << 4,
80 GAIM_GTKCONV_SMILEY_THEME = 1 << 5, 80 PIDGINCONV_SMILEY_THEME = 1 << 5,
81 GAIM_GTKCONV_COLORIZE_TITLE = 1 << 6 81 PIDGINCONV_COLORIZE_TITLE = 1 << 6
82 }GaimGtkConvFields; 82 }PidginConvFields;
83 83
84 #define GAIM_GTKCONV_ALL ((1 << 7) - 1) 84 #define PIDGINCONV_ALL ((1 << 7) - 1)
85 85
86 #define SEND_COLOR "#204a87" 86 #define SEND_COLOR "#204a87"
87 #define RECV_COLOR "#cc0000" 87 #define RECV_COLOR "#cc0000"
88 #define HIGHLIGHT_COLOR "#AF7F00" 88 #define HIGHLIGHT_COLOR "#AF7F00"
89 89
141 } InviteBuddyInfo; 141 } InviteBuddyInfo;
142 142
143 static GtkWidget *invite_dialog = NULL; 143 static GtkWidget *invite_dialog = NULL;
144 static GtkWidget *warn_close_dialog = NULL; 144 static GtkWidget *warn_close_dialog = NULL;
145 145
146 static GaimGtkWindow *hidden_convwin = NULL; 146 static PidginWindow *hidden_convwin = NULL;
147 static GList *window_list = NULL; 147 static GList *window_list = NULL;
148 148
149 149
150 static gboolean update_send_to_selection(GaimGtkWindow *win); 150 static gboolean update_send_to_selection(PidginWindow *win);
151 static void generate_send_to_items(GaimGtkWindow *win); 151 static void generate_send_to_items(PidginWindow *win);
152 152
153 /* Prototypes. <-- because Paco-Paco hates this comment. */ 153 /* Prototypes. <-- because Paco-Paco hates this comment. */
154 static void got_typing_keypress(GaimGtkConversation *gtkconv, gboolean first); 154 static void got_typing_keypress(PidginConversation *gtkconv, gboolean first);
155 static void gray_stuff_out(GaimGtkConversation *gtkconv); 155 static void gray_stuff_out(PidginConversation *gtkconv);
156 static GList *generate_invite_user_names(GaimConnection *gc); 156 static GList *generate_invite_user_names(GaimConnection *gc);
157 static void add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name); 157 static void add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name);
158 static gboolean tab_complete(GaimConversation *conv); 158 static gboolean tab_complete(GaimConversation *conv);
159 static void gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type); 159 static void pidginconv_updated(GaimConversation *conv, GaimConvUpdateType type);
160 static void gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state); 160 static void gtkconv_set_unseen(PidginConversation *gtkconv, GaimUnseenState state);
161 static void update_typing_icon(GaimGtkConversation *gtkconv); 161 static void update_typing_icon(PidginConversation *gtkconv);
162 static const char *item_factory_translate_func (const char *path, gpointer func_data); 162 static const char *item_factory_translate_func (const char *path, gpointer func_data);
163 gboolean gaim_gtkconv_has_focus(GaimConversation *conv); 163 gboolean pidginconv_has_focus(GaimConversation *conv);
164 static void gaim_gtkconv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data); 164 static void pidginconv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data);
165 static void gaim_gtkconv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data); 165 static void pidginconv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data);
166 static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background); 166 static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background);
167 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); 167 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast);
168 static void gaim_gtkconv_update_fields(GaimConversation *conv, GaimGtkConvFields fields); 168 static void pidginconv_update_fields(GaimConversation *conv, PidginConvFields fields);
169 static void focus_out_from_menubar(GtkWidget *wid, GaimGtkWindow *win); 169 static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win);
170 170
171 static GdkColor *get_nick_color(GaimGtkConversation *gtkconv, const char *name) { 171 static GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) {
172 static GdkColor col; 172 static GdkColor col;
173 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml); 173 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml);
174 float scale; 174 float scale;
175 175
176 col = nick_colors[g_str_hash(name) % nbr_nick_colors]; 176 col = nick_colors[g_str_hash(name) % nbr_nick_colors];
190 /************************************************************************** 190 /**************************************************************************
191 * Callbacks 191 * Callbacks
192 **************************************************************************/ 192 **************************************************************************/
193 193
194 static gint 194 static gint
195 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 195 close_conv_cb(GtkWidget *w, PidginConversation *gtkconv)
196 { 196 {
197 GList *list = g_list_copy(gtkconv->convs); 197 GList *list = g_list_copy(gtkconv->convs);
198 198
199 g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL); 199 g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL);
200 g_list_free(list); 200 g_list_free(list);
209 209
210 return FALSE; 210 return FALSE;
211 } 211 }
212 212
213 static gboolean 213 static gboolean
214 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimGtkConversation *gtkconv) 214 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv)
215 { 215 {
216 GaimConversation *conv = gtkconv->active_conv; 216 GaimConversation *conv = gtkconv->active_conv;
217 217
218 if (!GTK_WIDGET_VISIBLE(w)) 218 if (!GTK_WIDGET_VISIBLE(w))
219 return FALSE; 219 return FALSE;
252 252
253 return FALSE; 253 return FALSE;
254 } 254 }
255 255
256 static void 256 static void
257 default_formatize(GaimGtkConversation *c) 257 default_formatize(PidginConversation *c)
258 { 258 {
259 GaimConversation *conv = c->active_conv; 259 GaimConversation *conv = c->active_conv;
260 260
261 if (conv->features & GAIM_CONNECTION_HTML) 261 if (conv->features & GAIM_CONNECTION_HTML)
262 { 262 {
317 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); 317 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE);
318 } 318 }
319 } 319 }
320 320
321 static void 321 static void
322 clear_formatting_cb(GtkIMHtml *imhtml, GaimGtkConversation *gtkconv) 322 clear_formatting_cb(GtkIMHtml *imhtml, PidginConversation *gtkconv)
323 { 323 {
324 default_formatize(gtkconv); 324 default_formatize(gtkconv);
325 } 325 }
326 326
327 static const char * 327 static const char *
328 gaim_gtk_get_cmd_prefix(void) 328 pidgin_get_cmd_prefix(void)
329 { 329 {
330 return "/"; 330 return "/";
331 } 331 }
332 332
333 static GaimCmdRet 333 static GaimCmdRet
384 384
385 static GaimCmdRet 385 static GaimCmdRet
386 clear_command_cb(GaimConversation *conv, 386 clear_command_cb(GaimConversation *conv,
387 const char *cmd, char **args, char **error, void *data) 387 const char *cmd, char **args, char **error, void *data)
388 { 388 {
389 GaimGtkConversation *gtkconv = NULL; 389 PidginConversation *gtkconv = NULL;
390 390
391 gtkconv = GAIM_GTK_CONVERSATION(conv); 391 gtkconv = PIDGIN_CONVERSATION(conv);
392 392
393 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); 393 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml));
394 return GAIM_CMD_STATUS_OK; 394 return GAIM_CMD_STATUS_OK;
395 } 395 }
396 396
432 432
433 return GAIM_CMD_STATUS_OK; 433 return GAIM_CMD_STATUS_OK;
434 } 434 }
435 435
436 static void 436 static void
437 send_history_add(GaimGtkConversation *gtkconv, const char *message) 437 send_history_add(PidginConversation *gtkconv, const char *message)
438 { 438 {
439 GList *first; 439 GList *first;
440 440
441 first = g_list_first(gtkconv->send_history); 441 first = g_list_first(gtkconv->send_history);
442 g_free(first->data); 442 g_free(first->data);
443 first->data = g_strdup(message); 443 first->data = g_strdup(message);
444 gtkconv->send_history = g_list_prepend(first, NULL); 444 gtkconv->send_history = g_list_prepend(first, NULL);
445 } 445 }
446 446
447 static void 447 static void
448 reset_default_size(GaimGtkConversation *gtkconv) 448 reset_default_size(PidginConversation *gtkconv)
449 { 449 {
450 GaimConversation *conv = gtkconv->active_conv; 450 GaimConversation *conv = gtkconv->active_conv;
451 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) 451 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
452 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, 452 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
453 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); 453 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"));
457 } 457 }
458 458
459 static gboolean 459 static gboolean
460 check_for_and_do_command(GaimConversation *conv) 460 check_for_and_do_command(GaimConversation *conv)
461 { 461 {
462 GaimGtkConversation *gtkconv; 462 PidginConversation *gtkconv;
463 char *cmd; 463 char *cmd;
464 const char *prefix; 464 const char *prefix;
465 GtkTextIter start; 465 GtkTextIter start;
466 466
467 gtkconv = GAIM_GTK_CONVERSATION(conv); 467 gtkconv = PIDGIN_CONVERSATION(conv);
468 prefix = gaim_gtk_get_cmd_prefix(); 468 prefix = pidgin_get_cmd_prefix();
469 469
470 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); 470 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL);
471 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); 471 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start);
472 472
473 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0) 473 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)
522 g_free(cmd); 522 g_free(cmd);
523 return FALSE; 523 return FALSE;
524 } 524 }
525 525
526 static void 526 static void
527 send_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 527 send_cb(GtkWidget *widget, PidginConversation *gtkconv)
528 { 528 {
529 GaimConversation *conv = gtkconv->active_conv; 529 GaimConversation *conv = gtkconv->active_conv;
530 GaimAccount *account; 530 GaimAccount *account;
531 GaimConnection *gc; 531 GaimConnection *gc;
532 GaimMessageFlags flags = 0; 532 GaimMessageFlags flags = 0;
601 } 601 }
602 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE); 602 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE);
603 } 603 }
604 604
605 static void 605 static void
606 add_remove_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 606 add_remove_cb(GtkWidget *widget, PidginConversation *gtkconv)
607 { 607 {
608 GaimAccount *account; 608 GaimAccount *account;
609 const char *name; 609 const char *name;
610 GaimConversation *conv = gtkconv->active_conv; 610 GaimConversation *conv = gtkconv->active_conv;
611 611
615 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { 615 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
616 GaimBuddy *b; 616 GaimBuddy *b;
617 617
618 b = gaim_find_buddy(account, name); 618 b = gaim_find_buddy(account, name);
619 if (b != NULL) 619 if (b != NULL)
620 gaim_gtkdialogs_remove_buddy(b); 620 pidgindialogs_remove_buddy(b);
621 else if (account != NULL && gaim_account_is_connected(account)) 621 else if (account != NULL && gaim_account_is_connected(account))
622 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); 622 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL);
623 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { 623 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
624 GaimChat *c; 624 GaimChat *c;
625 625
626 c = gaim_blist_find_chat(account, name); 626 c = gaim_blist_find_chat(account, name);
627 if (c != NULL) 627 if (c != NULL)
628 gaim_gtkdialogs_remove_chat(c); 628 pidgindialogs_remove_chat(c);
629 else if (account != NULL && gaim_account_is_connected(account)) 629 else if (account != NULL && gaim_account_is_connected(account))
630 gaim_blist_request_add_chat(account, NULL, NULL, name); 630 gaim_blist_request_add_chat(account, NULL, NULL, name);
631 } 631 }
632 632
633 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); 633 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
634 } 634 }
635 635
636 static void chat_do_info(GaimGtkConversation *gtkconv, const char *who) 636 static void chat_do_info(PidginConversation *gtkconv, const char *who)
637 { 637 {
638 GaimConversation *conv = gtkconv->active_conv; 638 GaimConversation *conv = gtkconv->active_conv;
639 GaimPluginProtocolInfo *prpl_info = NULL; 639 GaimPluginProtocolInfo *prpl_info = NULL;
640 GaimConnection *gc; 640 GaimConnection *gc;
641 641
656 } 656 }
657 } 657 }
658 658
659 659
660 static void 660 static void
661 info_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 661 info_cb(GtkWidget *widget, PidginConversation *gtkconv)
662 { 662 {
663 GaimConversation *conv = gtkconv->active_conv; 663 GaimConversation *conv = gtkconv->active_conv;
664 664
665 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { 665 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
666 serv_get_info(gaim_conversation_get_gc(conv), 666 serv_get_info(gaim_conversation_get_gc(conv),
667 gaim_conversation_get_name(conv)); 667 gaim_conversation_get_name(conv));
668 668
669 gtk_widget_grab_focus(gtkconv->entry); 669 gtk_widget_grab_focus(gtkconv->entry);
670 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { 670 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
671 /* Get info of the person currently selected in the GtkTreeView */ 671 /* Get info of the person currently selected in the GtkTreeView */
672 GaimGtkChatPane *gtkchat; 672 PidginChatPane *gtkchat;
673 GtkTreeIter iter; 673 GtkTreeIter iter;
674 GtkTreeModel *model; 674 GtkTreeModel *model;
675 GtkTreeSelection *sel; 675 GtkTreeSelection *sel;
676 char *name; 676 char *name;
677 677
689 g_free(name); 689 g_free(name);
690 } 690 }
691 } 691 }
692 692
693 static void 693 static void
694 block_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 694 block_cb(GtkWidget *widget, PidginConversation *gtkconv)
695 { 695 {
696 GaimConversation *conv = gtkconv->active_conv; 696 GaimConversation *conv = gtkconv->active_conv;
697 GaimAccount *account; 697 GaimAccount *account;
698 698
699 account = gaim_conversation_get_account(conv); 699 account = gaim_conversation_get_account(conv);
700 700
701 if (account != NULL && gaim_account_is_connected(account)) 701 if (account != NULL && gaim_account_is_connected(account))
702 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); 702 pidgin_request_add_block(account, gaim_conversation_get_name(conv));
703 703
704 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); 704 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
705 } 705 }
706 706
707 static void 707 static void
708 unblock_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 708 unblock_cb(GtkWidget *widget, PidginConversation *gtkconv)
709 { 709 {
710 GaimConversation *conv = gtkconv->active_conv; 710 GaimConversation *conv = gtkconv->active_conv;
711 GaimAccount *account; 711 GaimAccount *account;
712 712
713 account = gaim_conversation_get_account(conv); 713 account = gaim_conversation_get_account(conv);
714 714
715 if (account != NULL && gaim_account_is_connected(account)) 715 if (account != NULL && gaim_account_is_connected(account))
716 gaim_gtk_request_add_permit(account, gaim_conversation_get_name(conv)); 716 pidgin_request_add_permit(account, gaim_conversation_get_name(conv));
717 717
718 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); 718 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
719 } 719 }
720 720
721 static void 721 static void
722 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) 722 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info)
723 { 723 {
724 const char *buddy, *message; 724 const char *buddy, *message;
725 GaimGtkConversation *gtkconv; 725 PidginConversation *gtkconv;
726 726
727 gtkconv = GAIM_GTK_CONVERSATION(info->conv); 727 gtkconv = PIDGIN_CONVERSATION(info->conv);
728 728
729 if (resp == GTK_RESPONSE_OK) { 729 if (resp == GTK_RESPONSE_OK) {
730 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); 730 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry));
731 message = gtk_entry_get_text(GTK_ENTRY(info->message)); 731 message = gtk_entry_get_text(GTK_ENTRY(info->message));
732 732
767 else 767 else
768 return; 768 return;
769 769
770 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account))) 770 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account)))
771 { 771 {
772 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL, 772 gaim_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
773 _("That buddy is not on the same protocol as this " 773 _("That buddy is not on the same protocol as this "
774 "chat."), NULL); 774 "chat."), NULL);
775 } 775 }
776 else 776 else
777 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); 777 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name);
782 { 782 {
783 char *protocol = NULL; 783 char *protocol = NULL;
784 char *username = NULL; 784 char *username = NULL;
785 GaimAccount *account; 785 GaimAccount *account;
786 786
787 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, 787 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account,
788 &protocol, &username, NULL)) 788 &protocol, &username, NULL))
789 { 789 {
790 if (account == NULL) 790 if (account == NULL)
791 { 791 {
792 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL, 792 gaim_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
793 _("You are not currently signed on with an account that " 793 _("You are not currently signed on with an account that "
794 "can invite that buddy."), NULL); 794 "can invite that buddy."), NULL);
795 } 795 }
796 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account))) 796 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account)))
797 { 797 {
798 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL, 798 gaim_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
799 _("That buddy is not on the same protocol as this " 799 _("That buddy is not on the same protocol as this "
800 "chat."), NULL); 800 "chat."), NULL);
801 } 801 }
802 else 802 else
803 { 803 {
817 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, 817 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0},
818 {"application/x-im-contact", 0, 1} 818 {"application/x-im-contact", 0, 1}
819 }; 819 };
820 820
821 static void 821 static void
822 invite_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 822 invite_cb(GtkWidget *widget, PidginConversation *gtkconv)
823 { 823 {
824 GaimConversation *conv = gtkconv->active_conv; 824 GaimConversation *conv = gtkconv->active_conv;
825 InviteBuddyInfo *info = NULL; 825 InviteBuddyInfo *info = NULL;
826 826
827 if (invite_dialog == NULL) { 827 if (invite_dialog == NULL) {
828 GaimConnection *gc; 828 GaimConnection *gc;
829 GaimGtkWindow *gtkwin; 829 PidginWindow *gtkwin;
830 GtkWidget *label; 830 GtkWidget *label;
831 GtkWidget *vbox, *hbox; 831 GtkWidget *vbox, *hbox;
832 GtkWidget *table; 832 GtkWidget *table;
833 GtkWidget *img; 833 GtkWidget *img;
834 834
837 837
838 info = g_new0(InviteBuddyInfo, 1); 838 info = g_new0(InviteBuddyInfo, 1);
839 info->conv = conv; 839 info->conv = conv;
840 840
841 gc = gaim_conversation_get_gc(conv); 841 gc = gaim_conversation_get_gc(conv);
842 gtkwin = gaim_gtkconv_get_window(gtkconv); 842 gtkwin = pidginconv_get_window(gtkconv);
843 843
844 /* Create the new dialog. */ 844 /* Create the new dialog. */
845 invite_dialog = gtk_dialog_new_with_buttons( 845 invite_dialog = gtk_dialog_new_with_buttons(
846 _("Invite Buddy Into Chat Room"), 846 _("Invite Buddy Into Chat Room"),
847 GTK_WINDOW(gtkwin->window), 0, 847 GTK_WINDOW(gtkwin->window), 0,
957 } 957 }
958 958
959 static void 959 static void
960 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) 960 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget)
961 { 961 {
962 gaim_gtkdialogs_im(); 962 pidgindialogs_im();
963 } 963 }
964 964
965 static void 965 static void
966 savelog_writefile_cb(void *user_data, const char *filename) 966 savelog_writefile_cb(void *user_data, const char *filename)
967 { 967 {
969 FILE *fp; 969 FILE *fp;
970 const char *name; 970 const char *name;
971 gchar *text; 971 gchar *text;
972 972
973 if ((fp = g_fopen(filename, "w+")) == NULL) { 973 if ((fp = g_fopen(filename, "w+")) == NULL) {
974 gaim_notify_error(GAIM_GTK_CONVERSATION(conv), NULL, _("Unable to open file."), NULL); 974 gaim_notify_error(PIDGIN_CONVERSATION(conv), NULL, _("Unable to open file."), NULL);
975 return; 975 return;
976 } 976 }
977 977
978 name = gaim_conversation_get_name(conv); 978 name = gaim_conversation_get_name(conv);
979 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name); 979 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name);
980 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); 980 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name);
981 981
982 text = gtk_imhtml_get_markup( 982 text = gtk_imhtml_get_markup(
983 GTK_IMHTML(GAIM_GTK_CONVERSATION(conv)->imhtml)); 983 GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml));
984 fprintf(fp, "%s", text); 984 fprintf(fp, "%s", text);
985 g_free(text); 985 g_free(text);
986 986
987 fprintf(fp, "\n</body>\n</html>\n"); 987 fprintf(fp, "\n</body>\n</html>\n");
988 fclose(fp); 988 fclose(fp);
993 * plaintext v. HTML file. 993 * plaintext v. HTML file.
994 */ 994 */
995 static void 995 static void
996 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) 996 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget)
997 { 997 {
998 GaimGtkWindow *win = data; 998 PidginWindow *win = data;
999 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); 999 GaimConversation *conv = pidgin_conv_window_get_active_conversation(win);
1000 gchar *buf; 1000 gchar *buf;
1001 1001
1002 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); 1002 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name));
1003 1003
1004 gaim_request_file(GAIM_GTK_CONVERSATION(conv), _("Save Conversation"), 1004 gaim_request_file(PIDGIN_CONVERSATION(conv), _("Save Conversation"),
1005 gaim_escape_filename(buf), 1005 gaim_escape_filename(buf),
1006 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, conv); 1006 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, conv);
1007 1007
1008 g_free(buf); 1008 g_free(buf);
1009 } 1009 }
1010 1010
1011 static void 1011 static void
1012 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) 1012 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget)
1013 { 1013 {
1014 GaimGtkWindow *win = data; 1014 PidginWindow *win = data;
1015 GaimConversation *conv; 1015 GaimConversation *conv;
1016 GaimLogType type; 1016 GaimLogType type;
1017 GaimGtkBuddyList *gtkblist; 1017 PidginBuddyList *gtkblist;
1018 GdkCursor *cursor; 1018 GdkCursor *cursor;
1019 const char *name; 1019 const char *name;
1020 GaimAccount *account; 1020 GaimAccount *account;
1021 GSList *buddies; 1021 GSList *buddies;
1022 GSList *cur; 1022 GSList *cur;
1023 1023
1024 conv = gaim_gtk_conv_window_get_active_conversation(win); 1024 conv = pidgin_conv_window_get_active_conversation(win);
1025 1025
1026 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) 1026 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
1027 type = GAIM_LOG_IM; 1027 type = GAIM_LOG_IM;
1028 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) 1028 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
1029 type = GAIM_LOG_CHAT; 1029 type = GAIM_LOG_CHAT;
1030 else 1030 else
1031 return; 1031 return;
1032 1032
1033 gtkblist = gaim_gtk_blist_get_default_gtk_blist(); 1033 gtkblist = pidgin_blist_get_default_gtk_blist();
1034 1034
1035 cursor = gdk_cursor_new(GDK_WATCH); 1035 cursor = gdk_cursor_new(GDK_WATCH);
1036 gdk_window_set_cursor(gtkblist->window->window, cursor); 1036 gdk_window_set_cursor(gtkblist->window->window, cursor);
1037 gdk_window_set_cursor(win->window->window, cursor); 1037 gdk_window_set_cursor(win->window->window, cursor);
1038 gdk_cursor_unref(cursor); 1038 gdk_cursor_unref(cursor);
1049 for (cur = buddies; cur != NULL; cur = cur->next) 1049 for (cur = buddies; cur != NULL; cur = cur->next)
1050 { 1050 {
1051 GaimBlistNode *node = cur->data; 1051 GaimBlistNode *node = cur->data;
1052 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) 1052 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL)))
1053 { 1053 {
1054 gaim_gtk_log_show_contact((GaimContact *)node->parent); 1054 pidgin_log_show_contact((GaimContact *)node->parent);
1055 g_slist_free(buddies); 1055 g_slist_free(buddies);
1056 gdk_window_set_cursor(gtkblist->window->window, NULL); 1056 gdk_window_set_cursor(gtkblist->window->window, NULL);
1057 gdk_window_set_cursor(win->window->window, NULL); 1057 gdk_window_set_cursor(win->window->window, NULL);
1058 return; 1058 return;
1059 } 1059 }
1060 } 1060 }
1061 g_slist_free(buddies); 1061 g_slist_free(buddies);
1062 1062
1063 gaim_gtk_log_show(type, name, account); 1063 pidgin_log_show(type, name, account);
1064 1064
1065 gdk_window_set_cursor(gtkblist->window->window, NULL); 1065 gdk_window_set_cursor(gtkblist->window->window, NULL);
1066 gdk_window_set_cursor(win->window->window, NULL); 1066 gdk_window_set_cursor(win->window->window, NULL);
1067 } 1067 }
1068 1068
1069 static void 1069 static void
1070 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) 1070 menu_clear_cb(gpointer data, guint action, GtkWidget *widget)
1071 { 1071 {
1072 GaimGtkWindow *win = data; 1072 PidginWindow *win = data;
1073 GaimConversation *conv; 1073 GaimConversation *conv;
1074 GaimGtkConversation *gtkconv; 1074 PidginConversation *gtkconv;
1075 1075
1076 conv = gaim_gtk_conv_window_get_active_conversation(win); 1076 conv = pidgin_conv_window_get_active_conversation(win);
1077 gtkconv = GAIM_GTK_CONVERSATION(conv); 1077 gtkconv = PIDGIN_CONVERSATION(conv);
1078 1078
1079 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); 1079 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml));
1080 } 1080 }
1081 1081
1082 struct _search { 1082 struct _search {
1083 GaimGtkWindow *gtkwin; 1083 PidginWindow *gtkwin;
1084 GtkWidget *entry; 1084 GtkWidget *entry;
1085 }; 1085 };
1086 1086
1087 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) 1087 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s)
1088 { 1088 {
1089 GaimConversation *conv; 1089 GaimConversation *conv;
1090 GaimGtkConversation *gtk_active_conv; 1090 PidginConversation *gtk_active_conv;
1091 GList *iter; 1091 GList *iter;
1092 1092
1093 conv = gaim_gtk_conv_window_get_active_conversation(s->gtkwin); 1093 conv = pidgin_conv_window_get_active_conversation(s->gtkwin);
1094 gtk_active_conv = GAIM_GTK_CONVERSATION(conv); 1094 gtk_active_conv = PIDGIN_CONVERSATION(conv);
1095 1095
1096 switch (resp) 1096 switch (resp)
1097 { 1097 {
1098 case GTK_RESPONSE_OK: 1098 case GTK_RESPONSE_OK:
1099 /* clear highlighting except the active conversation window 1099 /* clear highlighting except the active conversation window
1100 * highlight the keywords in the active conversation window */ 1100 * highlight the keywords in the active conversation window */
1101 for (iter = gaim_gtk_conv_window_get_gtkconvs(s->gtkwin) ; iter ; iter = iter->next) 1101 for (iter = pidgin_conv_window_get_gtkconvs(s->gtkwin) ; iter ; iter = iter->next)
1102 { 1102 {
1103 GaimGtkConversation *gtkconv = iter->data; 1103 PidginConversation *gtkconv = iter->data;
1104 1104
1105 if (gtkconv != gtk_active_conv) 1105 if (gtkconv != gtk_active_conv)
1106 { 1106 {
1107 gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml)); 1107 gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml));
1108 } 1108 }
1115 break; 1115 break;
1116 1116
1117 case GTK_RESPONSE_DELETE_EVENT: 1117 case GTK_RESPONSE_DELETE_EVENT:
1118 case GTK_RESPONSE_CLOSE: 1118 case GTK_RESPONSE_CLOSE:
1119 /* clear the keyword highlighting in all the conversation windows */ 1119 /* clear the keyword highlighting in all the conversation windows */
1120 for (iter = gaim_gtk_conv_window_get_gtkconvs(s->gtkwin); iter; iter=iter->next) 1120 for (iter = pidgin_conv_window_get_gtkconvs(s->gtkwin); iter; iter=iter->next)
1121 { 1121 {
1122 GaimGtkConversation *gconv = iter->data; 1122 PidginConversation *gconv = iter->data;
1123 gtk_imhtml_search_clear(GTK_IMHTML(gconv->imhtml)); 1123 gtk_imhtml_search_clear(GTK_IMHTML(gconv->imhtml));
1124 } 1124 }
1125 1125
1126 gtk_widget_destroy(s->gtkwin->dialogs.search); 1126 gtk_widget_destroy(s->gtkwin->dialogs.search);
1127 s->gtkwin->dialogs.search = NULL; 1127 s->gtkwin->dialogs.search = NULL;
1131 } 1131 }
1132 1132
1133 static void 1133 static void
1134 menu_find_cb(gpointer data, guint action, GtkWidget *widget) 1134 menu_find_cb(gpointer data, guint action, GtkWidget *widget)
1135 { 1135 {
1136 GaimGtkWindow *gtkwin = data; 1136 PidginWindow *gtkwin = data;
1137 GtkWidget *hbox; 1137 GtkWidget *hbox;
1138 GtkWidget *img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, 1138 GtkWidget *img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
1139 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); 1139 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
1140 GtkWidget *label; 1140 GtkWidget *label;
1141 struct _search *s; 1141 struct _search *s;
1179 1179
1180 s->entry = gtk_entry_new(); 1180 s->entry = gtk_entry_new();
1181 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); 1181 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE);
1182 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); 1182 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry));
1183 g_signal_connect(G_OBJECT(s->entry), "changed", 1183 g_signal_connect(G_OBJECT(s->entry), "changed",
1184 G_CALLBACK(gaim_gtk_set_sensitive_if_input), 1184 G_CALLBACK(pidgin_set_sensitive_if_input),
1185 gtkwin->dialogs.search); 1185 gtkwin->dialogs.search);
1186 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0); 1186 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0);
1187 1187
1188 gtk_widget_show_all(gtkwin->dialogs.search); 1188 gtk_widget_show_all(gtkwin->dialogs.search);
1189 gtk_widget_grab_focus(s->entry); 1189 gtk_widget_grab_focus(s->entry);
1190 } 1190 }
1191 1191
1192 static void 1192 static void
1193 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) 1193 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget)
1194 { 1194 {
1195 GaimGtkWindow *win = data; 1195 PidginWindow *win = data;
1196 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); 1196 GaimConversation *conv = pidgin_conv_window_get_active_conversation(win);
1197 1197
1198 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { 1198 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
1199 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); 1199 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL);
1200 } 1200 }
1201 1201
1202 } 1202 }
1203 1203
1204 static void 1204 static void
1205 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) 1205 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget)
1206 { 1206 {
1207 GaimGtkWindow *win = data; 1207 PidginWindow *win = data;
1208 GaimConversation *conv; 1208 GaimConversation *conv;
1209 1209
1210 conv = gaim_gtk_conv_window_get_active_gtkconv(win)->active_conv; 1210 conv = pidgin_conv_window_get_active_gtkconv(win)->active_conv;
1211 1211
1212 gaim_gtk_pounce_editor_show(gaim_conversation_get_account(conv), 1212 pidgin_pounce_editor_show(gaim_conversation_get_account(conv),
1213 gaim_conversation_get_name(conv), NULL); 1213 gaim_conversation_get_name(conv), NULL);
1214 } 1214 }
1215 1215
1216 static void 1216 static void
1217 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) 1217 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget)
1218 { 1218 {
1219 GaimGtkWindow *win = data; 1219 PidginWindow *win = data;
1220 GaimGtkConversation *gtkconv; 1220 PidginConversation *gtkconv;
1221 GtkIMHtmlToolbar *toolbar; 1221 GtkIMHtmlToolbar *toolbar;
1222 1222
1223 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); 1223 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
1224 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); 1224 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
1225 1225
1226 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), 1226 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link),
1227 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); 1227 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link)));
1228 } 1228 }
1229 1229
1230 static void 1230 static void
1231 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) 1231 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget)
1232 { 1232 {
1233 GaimGtkWindow *win = data; 1233 PidginWindow *win = data;
1234 GaimConversation *conv; 1234 GaimConversation *conv;
1235 GaimGtkConversation *gtkconv; 1235 PidginConversation *gtkconv;
1236 GtkIMHtmlToolbar *toolbar; 1236 GtkIMHtmlToolbar *toolbar;
1237 1237
1238 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); 1238 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
1239 conv = gtkconv->active_conv; 1239 conv = gtkconv->active_conv;
1240 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); 1240 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
1241 1241
1242 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), 1242 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image),
1243 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); 1243 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image)));
1244 } 1244 }
1245 1245
1246 static void 1246 static void
1247 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) 1247 menu_alias_cb(gpointer data, guint action, GtkWidget *widget)
1248 { 1248 {
1249 GaimGtkWindow *win = data; 1249 PidginWindow *win = data;
1250 GaimConversation *conv; 1250 GaimConversation *conv;
1251 GaimAccount *account; 1251 GaimAccount *account;
1252 const char *name; 1252 const char *name;
1253 1253
1254 conv = gaim_gtk_conv_window_get_active_conversation(win); 1254 conv = pidgin_conv_window_get_active_conversation(win);
1255 account = gaim_conversation_get_account(conv); 1255 account = gaim_conversation_get_account(conv);
1256 name = gaim_conversation_get_name(conv); 1256 name = gaim_conversation_get_name(conv);
1257 1257
1258 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { 1258 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
1259 GaimBuddy *b; 1259 GaimBuddy *b;
1260 1260
1261 b = gaim_find_buddy(account, name); 1261 b = gaim_find_buddy(account, name);
1262 if (b != NULL) 1262 if (b != NULL)
1263 gaim_gtkdialogs_alias_buddy(b); 1263 pidgindialogs_alias_buddy(b);
1264 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { 1264 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
1265 GaimChat *c; 1265 GaimChat *c;
1266 1266
1267 c = gaim_blist_find_chat(account, name); 1267 c = gaim_blist_find_chat(account, name);
1268 if (c != NULL) 1268 if (c != NULL)
1269 gaim_gtkdialogs_alias_chat(c); 1269 pidgindialogs_alias_chat(c);
1270 } 1270 }
1271 } 1271 }
1272 1272
1273 static void 1273 static void
1274 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) 1274 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget)
1275 { 1275 {
1276 GaimGtkWindow *win = data; 1276 PidginWindow *win = data;
1277 GaimConversation *conv; 1277 GaimConversation *conv;
1278 1278
1279 conv = gaim_gtk_conv_window_get_active_conversation(win); 1279 conv = pidgin_conv_window_get_active_conversation(win);
1280 1280
1281 info_cb(NULL, GAIM_GTK_CONVERSATION(conv)); 1281 info_cb(NULL, PIDGIN_CONVERSATION(conv));
1282 } 1282 }
1283 1283
1284 static void 1284 static void
1285 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) 1285 menu_invite_cb(gpointer data, guint action, GtkWidget *widget)
1286 { 1286 {
1287 GaimGtkWindow *win = data; 1287 PidginWindow *win = data;
1288 GaimConversation *conv; 1288 GaimConversation *conv;
1289 1289
1290 conv = gaim_gtk_conv_window_get_active_conversation(win); 1290 conv = pidgin_conv_window_get_active_conversation(win);
1291 1291
1292 invite_cb(NULL, GAIM_GTK_CONVERSATION(conv)); 1292 invite_cb(NULL, PIDGIN_CONVERSATION(conv));
1293 } 1293 }
1294 1294
1295 static void 1295 static void
1296 menu_block_cb(gpointer data, guint action, GtkWidget *widget) 1296 menu_block_cb(gpointer data, guint action, GtkWidget *widget)
1297 { 1297 {
1298 GaimGtkWindow *win = data; 1298 PidginWindow *win = data;
1299 GaimConversation *conv; 1299 GaimConversation *conv;
1300 1300
1301 conv = gaim_gtk_conv_window_get_active_conversation(win); 1301 conv = pidgin_conv_window_get_active_conversation(win);
1302 1302
1303 block_cb(NULL, GAIM_GTK_CONVERSATION(conv)); 1303 block_cb(NULL, PIDGIN_CONVERSATION(conv));
1304 } 1304 }
1305 1305
1306 static void 1306 static void
1307 menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) 1307 menu_unblock_cb(gpointer data, guint action, GtkWidget *widget)
1308 { 1308 {
1309 GaimGtkWindow *win = data; 1309 PidginWindow *win = data;
1310 GaimConversation *conv; 1310 GaimConversation *conv;
1311 1311
1312 conv = gaim_gtk_conv_window_get_active_conversation(win); 1312 conv = pidgin_conv_window_get_active_conversation(win);
1313 1313
1314 unblock_cb(NULL, GAIM_GTK_CONVERSATION(conv)); 1314 unblock_cb(NULL, PIDGIN_CONVERSATION(conv));
1315 } 1315 }
1316 1316
1317 static void 1317 static void
1318 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) 1318 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget)
1319 { 1319 {
1320 GaimGtkWindow *win = data; 1320 PidginWindow *win = data;
1321 GaimConversation *conv; 1321 GaimConversation *conv;
1322 1322
1323 conv = gaim_gtk_conv_window_get_active_conversation(win); 1323 conv = pidgin_conv_window_get_active_conversation(win);
1324 1324
1325 add_remove_cb(NULL, GAIM_GTK_CONVERSATION(conv)); 1325 add_remove_cb(NULL, PIDGIN_CONVERSATION(conv));
1326 } 1326 }
1327 1327
1328 static void 1328 static void
1329 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) 1329 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget)
1330 { 1330 {
1331 GaimGtkWindow *win = data; 1331 PidginWindow *win = data;
1332 1332
1333 close_conv_cb(NULL, GAIM_GTK_CONVERSATION(gaim_gtk_conv_window_get_active_conversation(win))); 1333 close_conv_cb(NULL, PIDGIN_CONVERSATION(pidgin_conv_window_get_active_conversation(win)));
1334 } 1334 }
1335 1335
1336 static void 1336 static void
1337 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) 1337 menu_logging_cb(gpointer data, guint action, GtkWidget *widget)
1338 { 1338 {
1339 GaimGtkWindow *win = data; 1339 PidginWindow *win = data;
1340 GaimConversation *conv; 1340 GaimConversation *conv;
1341 gboolean logging; 1341 gboolean logging;
1342 1342
1343 conv = gaim_gtk_conv_window_get_active_conversation(win); 1343 conv = pidgin_conv_window_get_active_conversation(win);
1344 1344
1345 if (conv == NULL) 1345 if (conv == NULL)
1346 return; 1346 return;
1347 1347
1348 logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); 1348 logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
1382 } 1382 }
1383 1383
1384 static void 1384 static void
1385 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) 1385 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget)
1386 { 1386 {
1387 GaimGtkWindow *win = data; 1387 PidginWindow *win = data;
1388 GaimConversation *conv; 1388 GaimConversation *conv;
1389 GaimGtkConversation *gtkconv; 1389 PidginConversation *gtkconv;
1390 1390
1391 conv = gaim_gtk_conv_window_get_active_conversation(win); 1391 conv = pidgin_conv_window_get_active_conversation(win);
1392 1392
1393 if (!conv) 1393 if (!conv)
1394 return; 1394 return;
1395 1395
1396 gtkconv = GAIM_GTK_CONVERSATION(conv); 1396 gtkconv = PIDGIN_CONVERSATION(conv);
1397 1397
1398 gtkconv->make_sound = 1398 gtkconv->make_sound =
1399 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); 1399 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
1400 } 1400 }
1401 1401
1405 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", 1405 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps",
1406 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); 1406 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
1407 } 1407 }
1408 1408
1409 static void 1409 static void
1410 chat_do_im(GaimGtkConversation *gtkconv, const char *who) 1410 chat_do_im(PidginConversation *gtkconv, const char *who)
1411 { 1411 {
1412 GaimConversation *conv = gtkconv->active_conv; 1412 GaimConversation *conv = gtkconv->active_conv;
1413 GaimAccount *account; 1413 GaimAccount *account;
1414 GaimConnection *gc; 1414 GaimConnection *gc;
1415 GaimPluginProtocolInfo *prpl_info = NULL; 1415 GaimPluginProtocolInfo *prpl_info = NULL;
1430 real_who = g_strdup(who); 1430 real_who = g_strdup(who);
1431 1431
1432 if(!real_who) 1432 if(!real_who)
1433 return; 1433 return;
1434 1434
1435 gaim_gtkdialogs_im_with_user(account, real_who); 1435 pidgindialogs_im_with_user(account, real_who);
1436 1436
1437 g_free(real_who); 1437 g_free(real_who);
1438 } 1438 }
1439 1439
1440 static void 1440 static void
1441 ignore_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 1441 ignore_cb(GtkWidget *w, PidginConversation *gtkconv)
1442 { 1442 {
1443 GaimConversation *conv = gtkconv->active_conv; 1443 GaimConversation *conv = gtkconv->active_conv;
1444 GaimGtkChatPane *gtkchat; 1444 PidginChatPane *gtkchat;
1445 GaimConvChatBuddy *cbuddy; 1445 GaimConvChatBuddy *cbuddy;
1446 GaimConvChat *chat; 1446 GaimConvChat *chat;
1447 GaimConvChatBuddyFlags flags; 1447 GaimConvChatBuddyFlags flags;
1448 GtkTreeIter iter; 1448 GtkTreeIter iter;
1449 GtkTreeModel *model; 1449 GtkTreeModel *model;
1479 g_free(name); 1479 g_free(name);
1480 g_free(alias); 1480 g_free(alias);
1481 } 1481 }
1482 1482
1483 static void 1483 static void
1484 menu_chat_im_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 1484 menu_chat_im_cb(GtkWidget *w, PidginConversation *gtkconv)
1485 { 1485 {
1486 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); 1486 const char *who = g_object_get_data(G_OBJECT(w), "user_data");
1487 1487
1488 chat_do_im(gtkconv, who); 1488 chat_do_im(gtkconv, who);
1489 } 1489 }
1490 1490
1491 static void 1491 static void
1492 menu_chat_send_file_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 1492 menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv)
1493 { 1493 {
1494 GaimConversation *conv = gtkconv->active_conv; 1494 GaimConversation *conv = gtkconv->active_conv;
1495 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); 1495 const char *who = g_object_get_data(G_OBJECT(w), "user_data");
1496 GaimConnection *gc = gaim_conversation_get_gc(conv); 1496 GaimConnection *gc = gaim_conversation_get_gc(conv);
1497 1497
1498 serv_send_file(gc, who, NULL); 1498 serv_send_file(gc, who, NULL);
1499 } 1499 }
1500 1500
1501 static void 1501 static void
1502 menu_chat_info_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 1502 menu_chat_info_cb(GtkWidget *w, PidginConversation *gtkconv)
1503 { 1503 {
1504 char *who; 1504 char *who;
1505 1505
1506 who = g_object_get_data(G_OBJECT(w), "user_data"); 1506 who = g_object_get_data(G_OBJECT(w), "user_data");
1507 1507
1508 chat_do_info(gtkconv, who); 1508 chat_do_info(gtkconv, who);
1509 } 1509 }
1510 1510
1511 static void 1511 static void
1512 menu_chat_get_away_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 1512 menu_chat_get_away_cb(GtkWidget *w, PidginConversation *gtkconv)
1513 { 1513 {
1514 GaimConversation *conv = gtkconv->active_conv; 1514 GaimConversation *conv = gtkconv->active_conv;
1515 GaimPluginProtocolInfo *prpl_info = NULL; 1515 GaimPluginProtocolInfo *prpl_info = NULL;
1516 GaimConnection *gc; 1516 GaimConnection *gc;
1517 char *who; 1517 char *who;
1533 } 1533 }
1534 } 1534 }
1535 } 1535 }
1536 1536
1537 static void 1537 static void
1538 menu_chat_add_remove_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 1538 menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv)
1539 { 1539 {
1540 GaimConversation *conv = gtkconv->active_conv; 1540 GaimConversation *conv = gtkconv->active_conv;
1541 GaimAccount *account; 1541 GaimAccount *account;
1542 GaimBuddy *b; 1542 GaimBuddy *b;
1543 char *name; 1543 char *name;
1545 account = gaim_conversation_get_account(conv); 1545 account = gaim_conversation_get_account(conv);
1546 name = g_object_get_data(G_OBJECT(w), "user_data"); 1546 name = g_object_get_data(G_OBJECT(w), "user_data");
1547 b = gaim_find_buddy(account, name); 1547 b = gaim_find_buddy(account, name);
1548 1548
1549 if (b != NULL) 1549 if (b != NULL)
1550 gaim_gtkdialogs_remove_buddy(b); 1550 pidgindialogs_remove_buddy(b);
1551 else if (account != NULL && gaim_account_is_connected(account)) 1551 else if (account != NULL && gaim_account_is_connected(account))
1552 gaim_blist_request_add_buddy(account, name, NULL, NULL); 1552 gaim_blist_request_add_buddy(account, name, NULL, NULL);
1553 1553
1554 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); 1554 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
1555 } 1555 }
1556 1556
1557 static GtkTextMark * 1557 static GtkTextMark *
1558 get_mark_for_user(GaimGtkConversation *gtkconv, const char *who) 1558 get_mark_for_user(PidginConversation *gtkconv, const char *who)
1559 { 1559 {
1560 GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); 1560 GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
1561 char *tmp = g_strconcat("user:", who, NULL); 1561 char *tmp = g_strconcat("user:", who, NULL);
1562 GtkTextMark *mark = gtk_text_buffer_get_mark(buf, tmp); 1562 GtkTextMark *mark = gtk_text_buffer_get_mark(buf, tmp);
1563 1563
1564 g_free(tmp); 1564 g_free(tmp);
1565 return mark; 1565 return mark;
1566 } 1566 }
1567 1567
1568 static void 1568 static void
1569 menu_last_said_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 1569 menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv)
1570 { 1570 {
1571 GtkTextMark *mark; 1571 GtkTextMark *mark;
1572 const char *who; 1572 const char *who;
1573 1573
1574 who = g_object_get_data(G_OBJECT(w), "user_data"); 1574 who = g_object_get_data(G_OBJECT(w), "user_data");
1605 1605
1606 menu = gtk_menu_new(); 1606 menu = gtk_menu_new();
1607 1607
1608 if (!is_me) { 1608 if (!is_me) {
1609 button = gaim_new_item_from_stock(menu, _("IM"), GAIM_STOCK_IM, 1609 button = gaim_new_item_from_stock(menu, _("IM"), GAIM_STOCK_IM,
1610 G_CALLBACK(menu_chat_im_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1610 G_CALLBACK(menu_chat_im_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1611 1611
1612 if (gc == NULL) 1612 if (gc == NULL)
1613 gtk_widget_set_sensitive(button, FALSE); 1613 gtk_widget_set_sensitive(button, FALSE);
1614 1614
1615 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1615 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1617 1617
1618 if (prpl_info && prpl_info->send_file) 1618 if (prpl_info && prpl_info->send_file)
1619 { 1619 {
1620 button = gaim_new_item_from_stock(menu, _("Send File"), 1620 button = gaim_new_item_from_stock(menu, _("Send File"),
1621 GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(menu_chat_send_file_cb), 1621 GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(menu_chat_send_file_cb),
1622 GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1622 PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1623 1623
1624 if (gc == NULL || prpl_info == NULL || 1624 if (gc == NULL || prpl_info == NULL ||
1625 !(!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) 1625 !(!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)))
1626 { 1626 {
1627 gtk_widget_set_sensitive(button, FALSE); 1627 gtk_widget_set_sensitive(button, FALSE);
1631 } 1631 }
1632 1632
1633 1633
1634 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) 1634 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who))
1635 button = gaim_new_item_from_stock(menu, _("Un-Ignore"), GAIM_STOCK_IGNORE, 1635 button = gaim_new_item_from_stock(menu, _("Un-Ignore"), GAIM_STOCK_IGNORE,
1636 G_CALLBACK(ignore_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1636 G_CALLBACK(ignore_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1637 else 1637 else
1638 button = gaim_new_item_from_stock(menu, _("Ignore"), GAIM_STOCK_IGNORE, 1638 button = gaim_new_item_from_stock(menu, _("Ignore"), GAIM_STOCK_IGNORE,
1639 G_CALLBACK(ignore_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1639 G_CALLBACK(ignore_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1640 1640
1641 if (gc == NULL) 1641 if (gc == NULL)
1642 gtk_widget_set_sensitive(button, FALSE); 1642 gtk_widget_set_sensitive(button, FALSE);
1643 1643
1644 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1644 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1645 } 1645 }
1646 1646
1647 if (prpl_info && (prpl_info->get_info || prpl_info->get_cb_info)) { 1647 if (prpl_info && (prpl_info->get_info || prpl_info->get_cb_info)) {
1648 button = gaim_new_item_from_stock(menu, _("Info"), GAIM_STOCK_INFO, 1648 button = gaim_new_item_from_stock(menu, _("Info"), GAIM_STOCK_INFO,
1649 G_CALLBACK(menu_chat_info_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1649 G_CALLBACK(menu_chat_info_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1650 1650
1651 if (gc == NULL) 1651 if (gc == NULL)
1652 gtk_widget_set_sensitive(button, FALSE); 1652 gtk_widget_set_sensitive(button, FALSE);
1653 1653
1654 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1654 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1655 } 1655 }
1656 1656
1657 if (prpl_info && prpl_info->get_cb_away) { 1657 if (prpl_info && prpl_info->get_cb_away) {
1658 button = gaim_new_item_from_stock(menu, _("Get Away Message"), GAIM_STOCK_AWAY, 1658 button = gaim_new_item_from_stock(menu, _("Get Away Message"), GAIM_STOCK_AWAY,
1659 G_CALLBACK(menu_chat_get_away_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1659 G_CALLBACK(menu_chat_get_away_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1660 1660
1661 if (gc == NULL) 1661 if (gc == NULL)
1662 gtk_widget_set_sensitive(button, FALSE); 1662 gtk_widget_set_sensitive(button, FALSE);
1663 1663
1664 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1664 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1665 } 1665 }
1666 1666
1667 if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { 1667 if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
1668 if ((buddy = gaim_find_buddy(conv->account, who)) != NULL) 1668 if ((buddy = gaim_find_buddy(conv->account, who)) != NULL)
1669 button = gaim_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, 1669 button = gaim_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE,
1670 G_CALLBACK(menu_chat_add_remove_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1670 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1671 else 1671 else
1672 button = gaim_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD, 1672 button = gaim_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD,
1673 G_CALLBACK(menu_chat_add_remove_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1673 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1674 1674
1675 if (gc == NULL) 1675 if (gc == NULL)
1676 gtk_widget_set_sensitive(button, FALSE); 1676 gtk_widget_set_sensitive(button, FALSE);
1677 1677
1678 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1678 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1679 } 1679 }
1680 1680
1681 button = gaim_new_item_from_stock(menu, _("Last said"), GTK_STOCK_INDEX, 1681 button = gaim_new_item_from_stock(menu, _("Last said"), GTK_STOCK_INDEX,
1682 G_CALLBACK(menu_last_said_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL); 1682 G_CALLBACK(menu_last_said_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1683 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1683 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1684 if (!get_mark_for_user(GAIM_GTK_CONVERSATION(conv), who)) 1684 if (!get_mark_for_user(PIDGIN_CONVERSATION(conv), who))
1685 gtk_widget_set_sensitive(button, FALSE); 1685 gtk_widget_set_sensitive(button, FALSE);
1686 1686
1687 if (buddy != NULL) 1687 if (buddy != NULL)
1688 { 1688 {
1689 if (gaim_account_is_connected(conv->account)) 1689 if (gaim_account_is_connected(conv->account))
1690 gaim_gtk_append_blist_node_proto_menu(menu, conv->account->gc, 1690 pidgin_append_blist_node_proto_menu(menu, conv->account->gc,
1691 (GaimBlistNode *)buddy); 1691 (GaimBlistNode *)buddy);
1692 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy); 1692 pidgin_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
1693 gtk_widget_show_all(menu); 1693 gtk_widget_show_all(menu);
1694 } 1694 }
1695 1695
1696 return menu; 1696 return menu;
1697 } 1697 }
1698 1698
1699 1699
1700 static gint 1700 static gint
1701 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 1701 gtkconv_chat_popup_menu_cb(GtkWidget *widget, PidginConversation *gtkconv)
1702 { 1702 {
1703 GaimConversation *conv = gtkconv->active_conv; 1703 GaimConversation *conv = gtkconv->active_conv;
1704 GaimGtkChatPane *gtkchat; 1704 PidginChatPane *gtkchat;
1705 GaimConnection *gc; 1705 GaimConnection *gc;
1706 GaimAccount *account; 1706 GaimAccount *account;
1707 GtkTreeSelection *sel; 1707 GtkTreeSelection *sel;
1708 GtkTreeIter iter; 1708 GtkTreeIter iter;
1709 GtkTreeModel *model; 1709 GtkTreeModel *model;
1710 GtkWidget *menu; 1710 GtkWidget *menu;
1711 gchar *who; 1711 gchar *who;
1712 1712
1713 gtkconv = GAIM_GTK_CONVERSATION(conv); 1713 gtkconv = PIDGIN_CONVERSATION(conv);
1714 gtkchat = gtkconv->u.chat; 1714 gtkchat = gtkconv->u.chat;
1715 account = gaim_conversation_get_account(conv); 1715 account = gaim_conversation_get_account(conv);
1716 gc = account->gc; 1716 gc = account->gc;
1717 1717
1718 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); 1718 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
1722 return FALSE; 1722 return FALSE;
1723 1723
1724 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); 1724 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
1725 menu = create_chat_menu (conv, who, gc); 1725 menu = create_chat_menu (conv, who, gc);
1726 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, 1726 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
1727 gaim_gtk_treeview_popup_menu_position_func, widget, 1727 pidgin_treeview_popup_menu_position_func, widget,
1728 0, GDK_CURRENT_TIME); 1728 0, GDK_CURRENT_TIME);
1729 g_free(who); 1729 g_free(who);
1730 1730
1731 return TRUE; 1731 return TRUE;
1732 } 1732 }
1733 1733
1734 1734
1735 static gint 1735 static gint
1736 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, 1736 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event,
1737 GaimGtkConversation *gtkconv) 1737 PidginConversation *gtkconv)
1738 { 1738 {
1739 GaimConversation *conv = gtkconv->active_conv; 1739 GaimConversation *conv = gtkconv->active_conv;
1740 GaimGtkChatPane *gtkchat; 1740 PidginChatPane *gtkchat;
1741 GaimConnection *gc; 1741 GaimConnection *gc;
1742 GaimAccount *account; 1742 GaimAccount *account;
1743 GtkTreePath *path; 1743 GtkTreePath *path;
1744 GtkTreeIter iter; 1744 GtkTreeIter iter;
1745 GtkTreeModel *model; 1745 GtkTreeModel *model;
1784 1784
1785 return TRUE; 1785 return TRUE;
1786 } 1786 }
1787 1787
1788 static void 1788 static void
1789 move_to_next_unread_tab(GaimGtkConversation *gtkconv, gboolean forward) 1789 move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward)
1790 { 1790 {
1791 GaimGtkConversation *next_gtkconv = NULL; 1791 PidginConversation *next_gtkconv = NULL;
1792 GaimGtkWindow *win; 1792 PidginWindow *win;
1793 int initial, i, total, diff; 1793 int initial, i, total, diff;
1794 1794
1795 win = gtkconv->win; 1795 win = gtkconv->win;
1796 initial = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), 1796 initial = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook),
1797 gtkconv->tab_cont); 1797 gtkconv->tab_cont);
1798 total = gaim_gtk_conv_window_get_gtkconv_count(win); 1798 total = pidgin_conv_window_get_gtkconv_count(win);
1799 /* By adding total here, the moduli calculated later will always have two 1799 /* By adding total here, the moduli calculated later will always have two
1800 * positive arguments. x % y where x < 0 is not guaranteed to return a 1800 * positive arguments. x % y where x < 0 is not guaranteed to return a
1801 * positive number. 1801 * positive number.
1802 */ 1802 */
1803 diff = (forward ? 1 : -1) + total; 1803 diff = (forward ? 1 : -1) + total;
1804 1804
1805 for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) { 1805 for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) {
1806 next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, i); 1806 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i);
1807 if (next_gtkconv->unseen_state > 0) 1807 if (next_gtkconv->unseen_state > 0)
1808 break; 1808 break;
1809 } 1809 }
1810 1810
1811 if (i == initial) { /* no new messages */ 1811 if (i == initial) { /* no new messages */
1812 i = (i + diff) % total; 1812 i = (i + diff) % total;
1813 next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, i); 1813 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i);
1814 } 1814 }
1815 1815
1816 if (next_gtkconv != NULL && next_gtkconv != gtkconv) 1816 if (next_gtkconv != NULL && next_gtkconv != gtkconv)
1817 gaim_gtk_conv_window_switch_gtkconv(win, next_gtkconv); 1817 pidgin_conv_window_switch_gtkconv(win, next_gtkconv);
1818 } 1818 }
1819 1819
1820 static gboolean 1820 static gboolean
1821 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) 1821 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data)
1822 { 1822 {
1823 GaimGtkWindow *win; 1823 PidginWindow *win;
1824 GaimConversation *conv; 1824 GaimConversation *conv;
1825 GaimGtkConversation *gtkconv; 1825 PidginConversation *gtkconv;
1826 int curconv; 1826 int curconv;
1827 1827
1828 gtkconv = (GaimGtkConversation *)data; 1828 gtkconv = (PidginConversation *)data;
1829 conv = gtkconv->active_conv; 1829 conv = gtkconv->active_conv;
1830 win = gtkconv->win; 1830 win = gtkconv->win;
1831 curconv = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)); 1831 curconv = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook));
1832 1832
1833 /* If CTRL was held down... */ 1833 /* If CTRL was held down... */
1921 return TRUE; 1921 return TRUE;
1922 break; 1922 break;
1923 1923
1924 case GDK_Page_Down: 1924 case GDK_Page_Down:
1925 case ']': 1925 case ']':
1926 if (!gaim_gtk_conv_window_get_gtkconv_at_index(win, curconv + 1)) 1926 if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv + 1))
1927 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); 1927 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
1928 else 1928 else
1929 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv + 1); 1929 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv + 1);
1930 return TRUE; 1930 return TRUE;
1931 break; 1931 break;
1932 1932
1933 case GDK_Page_Up: 1933 case GDK_Page_Up:
1934 case '[': 1934 case '[':
1935 if (!gaim_gtk_conv_window_get_gtkconv_at_index(win, curconv - 1)) 1935 if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv - 1))
1936 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), -1); 1936 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), -1);
1937 else 1937 else
1938 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv - 1); 1938 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv - 1);
1939 return TRUE; 1939 return TRUE;
1940 break; 1940 break;
1973 else if (event->state & GDK_MOD1_MASK) 1973 else if (event->state & GDK_MOD1_MASK)
1974 { 1974 {
1975 if (event->keyval > '0' && event->keyval <= '9') 1975 if (event->keyval > '0' && event->keyval <= '9')
1976 { 1976 {
1977 guint switchto = event->keyval - '1'; 1977 guint switchto = event->keyval - '1';
1978 if (switchto < gaim_gtk_conv_window_get_gtkconv_count(win)) 1978 if (switchto < pidgin_conv_window_get_gtkconv_count(win))
1979 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), switchto); 1979 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), switchto);
1980 1980
1981 return TRUE; 1981 return TRUE;
1982 } 1982 }
1983 } 1983 }
2034 * all the live long day and it will get entered into the entry box. 2034 * all the live long day and it will get entered into the entry box.
2035 */ 2035 */
2036 static gboolean 2036 static gboolean
2037 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) 2037 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
2038 { 2038 {
2039 GaimGtkConversation *gtkconv = data; 2039 PidginConversation *gtkconv = data;
2040 2040
2041 /* If we have a valid key for the conversation display, then exit */ 2041 /* If we have a valid key for the conversation display, then exit */
2042 if ((event->state & GDK_CONTROL_MASK) || 2042 if ((event->state & GDK_CONTROL_MASK) ||
2043 (event->keyval == GDK_F10) || 2043 (event->keyval == GDK_F10) ||
2044 (event->keyval == GDK_Shift_L) || 2044 (event->keyval == GDK_Shift_L) ||
2061 2061
2062 return TRUE; 2062 return TRUE;
2063 } 2063 }
2064 2064
2065 void 2065 void
2066 gaim_gtkconv_switch_active_conversation(GaimConversation *conv) 2066 pidginconv_switch_active_conversation(GaimConversation *conv)
2067 { 2067 {
2068 GaimGtkConversation *gtkconv; 2068 PidginConversation *gtkconv;
2069 GaimConversation *old_conv; 2069 GaimConversation *old_conv;
2070 GtkIMHtml *entry; 2070 GtkIMHtml *entry;
2071 const char *protocol_name; 2071 const char *protocol_name;
2072 2072
2073 g_return_if_fail(conv != NULL); 2073 g_return_if_fail(conv != NULL);
2074 2074
2075 gtkconv = GAIM_GTK_CONVERSATION(conv); 2075 gtkconv = PIDGIN_CONVERSATION(conv);
2076 old_conv = gtkconv->active_conv; 2076 old_conv = gtkconv->active_conv;
2077 2077
2078 if (old_conv == conv) 2078 if (old_conv == conv)
2079 return; 2079 return;
2080 2080
2156 * preserve the formatting exactly as it is), so we have to do this now. */ 2156 * preserve the formatting exactly as it is), so we have to do this now. */
2157 gtk_imhtml_set_whole_buffer_formatting_only(entry, 2157 gtk_imhtml_set_whole_buffer_formatting_only(entry,
2158 (conv->features & GAIM_CONNECTION_FORMATTING_WBFO)); 2158 (conv->features & GAIM_CONNECTION_FORMATTING_WBFO));
2159 } 2159 }
2160 2160
2161 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-switched", conv); 2161 gaim_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv);
2162 2162
2163 gray_stuff_out(gtkconv); 2163 gray_stuff_out(gtkconv);
2164 update_typing_icon(gtkconv); 2164 update_typing_icon(gtkconv);
2165 2165
2166 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window), 2166 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window),
2176 2176
2177 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE) 2177 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE)
2178 return; 2178 return;
2179 2179
2180 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); 2180 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name);
2181 gaim_gtkconv_switch_active_conversation(conv); 2181 pidginconv_switch_active_conversation(conv);
2182 } 2182 }
2183 2183
2184 static void 2184 static void
2185 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, 2185 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
2186 gchar *new_text, gint new_text_length, gpointer user_data) 2186 gchar *new_text, gint new_text_length, gpointer user_data)
2187 { 2187 {
2188 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data; 2188 PidginConversation *gtkconv = (PidginConversation *)user_data;
2189 GaimConversation *conv; 2189 GaimConversation *conv;
2190 2190
2191 g_return_if_fail(gtkconv != NULL); 2191 g_return_if_fail(gtkconv != NULL);
2192 2192
2193 conv = gtkconv->active_conv; 2193 conv = gtkconv->active_conv;
2201 2201
2202 static void 2202 static void
2203 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, 2203 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos,
2204 GtkTextIter *end_pos, gpointer user_data) 2204 GtkTextIter *end_pos, gpointer user_data)
2205 { 2205 {
2206 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data; 2206 PidginConversation *gtkconv = (PidginConversation *)user_data;
2207 GaimConversation *conv; 2207 GaimConversation *conv;
2208 GaimConvIm *im; 2208 GaimConvIm *im;
2209 2209
2210 g_return_if_fail(gtkconv != NULL); 2210 g_return_if_fail(gtkconv != NULL);
2211 2211
2233 2233
2234 /************************************************************************** 2234 /**************************************************************************
2235 * A bunch of buddy icon functions 2235 * A bunch of buddy icon functions
2236 **************************************************************************/ 2236 **************************************************************************/
2237 GdkPixbuf * 2237 GdkPixbuf *
2238 gaim_gtkconv_get_tab_icon(GaimConversation *conv, gboolean small_icon) 2238 pidginconv_get_tab_icon(GaimConversation *conv, gboolean small_icon)
2239 { 2239 {
2240 GaimAccount *account = NULL; 2240 GaimAccount *account = NULL;
2241 const char *name = NULL; 2241 const char *name = NULL;
2242 GdkPixbuf *status = NULL; 2242 GdkPixbuf *status = NULL;
2243 GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); 2243 GaimBlistUiOps *ops = gaim_blist_get_ui_ops();
2258 * displays in the conv tab even though it shouldn't. 2258 * displays in the conv tab even though it shouldn't.
2259 * A better solution would be great. */ 2259 * A better solution would be great. */
2260 if (ops && ops->update) 2260 if (ops && ops->update)
2261 ops->update(NULL, (GaimBlistNode*)b); 2261 ops->update(NULL, (GaimBlistNode*)b);
2262 2262
2263 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, 2263 status = pidgin_blist_get_status_icon((GaimBlistNode*)b,
2264 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); 2264 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE));
2265 } 2265 }
2266 } 2266 }
2267 2267
2268 /* If they don't have a buddy icon, then use the PRPL icon */ 2268 /* If they don't have a buddy icon, then use the PRPL icon */
2269 if (status == NULL) 2269 if (status == NULL)
2270 status = gaim_gtk_create_prpl_icon(account, small_icon ? PIDGIN_PRPL_ICON_SMALL : PIDGIN_PRPL_ICON_LARGE); 2270 status = pidgin_create_prpl_icon(account, small_icon ? PIDGIN_PRPL_ICON_SMALL : PIDGIN_PRPL_ICON_LARGE);
2271 2271
2272 return status; 2272 return status;
2273 } 2273 }
2274 2274
2275 static void 2275 static void
2276 update_tab_icon(GaimConversation *conv) 2276 update_tab_icon(GaimConversation *conv)
2277 { 2277 {
2278 GaimGtkConversation *gtkconv; 2278 PidginConversation *gtkconv;
2279 GaimGtkWindow *win; 2279 PidginWindow *win;
2280 GdkPixbuf *status = NULL; 2280 GdkPixbuf *status = NULL;
2281 2281
2282 g_return_if_fail(conv != NULL); 2282 g_return_if_fail(conv != NULL);
2283 2283
2284 gtkconv = GAIM_GTK_CONVERSATION(conv); 2284 gtkconv = PIDGIN_CONVERSATION(conv);
2285 win = gtkconv->win; 2285 win = gtkconv->win;
2286 if (conv != gtkconv->active_conv) 2286 if (conv != gtkconv->active_conv)
2287 return; 2287 return;
2288 2288
2289 status = gaim_gtkconv_get_tab_icon(conv, TRUE); 2289 status = pidginconv_get_tab_icon(conv, TRUE);
2290 2290
2291 g_return_if_fail(status != NULL); 2291 g_return_if_fail(status != NULL);
2292 2292
2293 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); 2293 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status);
2294 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); 2294 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status);
2295 2295
2296 if (status != NULL) 2296 if (status != NULL)
2297 g_object_unref(status); 2297 g_object_unref(status);
2298 2298
2299 if (gaim_gtk_conv_window_is_active_conversation(conv) && 2299 if (pidgin_conv_window_is_active_conversation(conv) &&
2300 (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM || 2300 (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM ||
2301 gtkconv->u.im->anim == NULL)) 2301 gtkconv->u.im->anim == NULL))
2302 { 2302 {
2303 status = gaim_gtkconv_get_tab_icon(conv, FALSE); 2303 status = pidginconv_get_tab_icon(conv, FALSE);
2304 2304
2305 gtk_window_set_icon(GTK_WINDOW(win->window), status); 2305 gtk_window_set_icon(GTK_WINDOW(win->window), status);
2306 2306
2307 if (status != NULL) 2307 if (status != NULL)
2308 g_object_unref(status); 2308 g_object_unref(status);
2315 * that this is an autoresize, and after the main loop iterates, it 2315 * that this is an autoresize, and after the main loop iterates, it
2316 * gets set back to FALSE 2316 * gets set back to FALSE
2317 */ 2317 */
2318 static gboolean reset_auto_resize_cb(gpointer data) 2318 static gboolean reset_auto_resize_cb(gpointer data)
2319 { 2319 {
2320 GaimGtkConversation *gtkconv = (GaimGtkConversation *)data; 2320 PidginConversation *gtkconv = (PidginConversation *)data;
2321 gtkconv->auto_resize = FALSE; 2321 gtkconv->auto_resize = FALSE;
2322 return FALSE; 2322 return FALSE;
2323 } 2323 }
2324 2324
2325 static gboolean 2325 static gboolean
2326 redraw_icon(gpointer data) 2326 redraw_icon(gpointer data)
2327 { 2327 {
2328 GaimGtkConversation *gtkconv = (GaimGtkConversation *)data; 2328 PidginConversation *gtkconv = (PidginConversation *)data;
2329 GaimConversation *conv = gtkconv->active_conv; 2329 GaimConversation *conv = gtkconv->active_conv;
2330 GaimAccount *account; 2330 GaimAccount *account;
2331 GaimPluginProtocolInfo *prpl_info = NULL; 2331 GaimPluginProtocolInfo *prpl_info = NULL;
2332 2332
2333 GdkPixbuf *buf; 2333 GdkPixbuf *buf;
2334 GdkPixbuf *scale; 2334 GdkPixbuf *scale;
2335 gint delay; 2335 gint delay;
2336 int scale_width, scale_height; 2336 int scale_width, scale_height;
2337 2337
2338 gtkconv = GAIM_GTK_CONVERSATION(conv); 2338 gtkconv = PIDGIN_CONVERSATION(conv);
2339 account = gaim_conversation_get_account(conv); 2339 account = gaim_conversation_get_account(conv);
2340 if(account && account->gc) 2340 if(account && account->gc)
2341 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); 2341 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
2342 2342
2343 gtkconv->auto_resize = TRUE; 2343 gtkconv->auto_resize = TRUE;
2344 g_idle_add(reset_auto_resize_cb, gtkconv); 2344 g_idle_add(reset_auto_resize_cb, gtkconv);
2345 2345
2346 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); 2346 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL);
2347 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); 2347 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter);
2348 2348
2349 gaim_gtk_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, 2349 pidgin_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec,
2350 GAIM_ICON_SCALE_DISPLAY, &scale_width, &scale_height); 2350 GAIM_ICON_SCALE_DISPLAY, &scale_width, &scale_height);
2351 2351
2352 /* this code is ugly, and scares me */ 2352 /* this code is ugly, and scares me */
2353 scale = gdk_pixbuf_scale_simple(buf, 2353 scale = gdk_pixbuf_scale_simple(buf,
2354 MAX(gdk_pixbuf_get_width(buf) * scale_width / 2354 MAX(gdk_pixbuf_get_width(buf) * scale_width /
2370 2370
2371 return FALSE; 2371 return FALSE;
2372 } 2372 }
2373 2373
2374 static void 2374 static void
2375 start_anim(GtkObject *obj, GaimGtkConversation *gtkconv) 2375 start_anim(GtkObject *obj, PidginConversation *gtkconv)
2376 { 2376 {
2377 int delay; 2377 int delay;
2378 2378
2379 if (gtkconv->u.im->anim == NULL) 2379 if (gtkconv->u.im->anim == NULL)
2380 return; 2380 return;
2392 2392
2393 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv); 2393 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv);
2394 } 2394 }
2395 2395
2396 static void 2396 static void
2397 remove_icon(GtkWidget *widget, GaimGtkConversation *gtkconv) 2397 remove_icon(GtkWidget *widget, PidginConversation *gtkconv)
2398 { 2398 {
2399 GaimConversation *conv = gtkconv->active_conv; 2399 GaimConversation *conv = gtkconv->active_conv;
2400 GaimGtkWindow *gtkwin; 2400 PidginWindow *gtkwin;
2401 2401
2402 g_return_if_fail(conv != NULL); 2402 g_return_if_fail(conv != NULL);
2403 2403
2404 if (gtkconv->u.im->icon_container != NULL) 2404 if (gtkconv->u.im->icon_container != NULL)
2405 gtk_widget_destroy(gtkconv->u.im->icon_container); 2405 gtk_widget_destroy(gtkconv->u.im->icon_container);
2425 } 2425 }
2426 2426
2427 static void 2427 static void
2428 saveicon_writefile_cb(void *user_data, const char *filename) 2428 saveicon_writefile_cb(void *user_data, const char *filename)
2429 { 2429 {
2430 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data; 2430 PidginConversation *gtkconv = (PidginConversation *)user_data;
2431 GaimConversation *conv = gtkconv->active_conv; 2431 GaimConversation *conv = gtkconv->active_conv;
2432 FILE *fp; 2432 FILE *fp;
2433 GaimBuddyIcon *icon; 2433 GaimBuddyIcon *icon;
2434 const void *data; 2434 const void *data;
2435 size_t len; 2435 size_t len;
2450 } 2450 }
2451 fclose(fp); 2451 fclose(fp);
2452 } 2452 }
2453 2453
2454 static const char * 2454 static const char *
2455 custom_icon_pref_name(GaimGtkConversation *gtkconv) 2455 custom_icon_pref_name(PidginConversation *gtkconv)
2456 { 2456 {
2457 GaimConversation *conv; 2457 GaimConversation *conv;
2458 GaimAccount *account; 2458 GaimAccount *account;
2459 GaimBuddy *buddy; 2459 GaimBuddy *buddy;
2460 2460
2470 2470
2471 static void 2471 static void
2472 custom_icon_sel_cb(const char *filename, gpointer data) 2472 custom_icon_sel_cb(const char *filename, gpointer data)
2473 { 2473 {
2474 if (filename) { 2474 if (filename) {
2475 GaimGtkConversation *gtkconv = data; 2475 PidginConversation *gtkconv = data;
2476 GaimConversation *conv = gtkconv->active_conv; 2476 GaimConversation *conv = gtkconv->active_conv;
2477 GaimAccount *account = gaim_conversation_get_account(conv); 2477 GaimAccount *account = gaim_conversation_get_account(conv);
2478 gaim_gtk_set_custom_buddy_icon(account, gaim_conversation_get_name(conv), filename); 2478 pidgin_set_custom_buddy_icon(account, gaim_conversation_get_name(conv), filename);
2479 } 2479 }
2480 } 2480 }
2481 2481
2482 static void 2482 static void
2483 set_custom_icon_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 2483 set_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
2484 { 2484 {
2485 GtkWidget *win = gaim_gtk_buddy_icon_chooser_new(GTK_WINDOW(gtkconv->win->window), 2485 GtkWidget *win = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtkconv->win->window),
2486 custom_icon_sel_cb, gtkconv); 2486 custom_icon_sel_cb, gtkconv);
2487 gtk_widget_show_all(win); 2487 gtk_widget_show_all(win);
2488 } 2488 }
2489 2489
2490 static void 2490 static void
2491 remove_custom_icon_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 2491 remove_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
2492 { 2492 {
2493 GaimConversation *conv; 2493 GaimConversation *conv;
2494 GaimAccount *account; 2494 GaimAccount *account;
2495 2495
2496 conv = gtkconv->active_conv; 2496 conv = gtkconv->active_conv;
2497 account = gaim_conversation_get_account(conv); 2497 account = gaim_conversation_get_account(conv);
2498 gaim_gtk_set_custom_buddy_icon(account, gaim_conversation_get_name(conv), NULL); 2498 pidgin_set_custom_buddy_icon(account, gaim_conversation_get_name(conv), NULL);
2499 } 2499 }
2500 2500
2501 static void 2501 static void
2502 icon_menu_save_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 2502 icon_menu_save_cb(GtkWidget *widget, PidginConversation *gtkconv)
2503 { 2503 {
2504 GaimConversation *conv = gtkconv->active_conv; 2504 GaimConversation *conv = gtkconv->active_conv;
2505 const gchar *ext; 2505 const gchar *ext;
2506 gchar *buf; 2506 gchar *buf;
2507 2507
2518 2518
2519 g_free(buf); 2519 g_free(buf);
2520 } 2520 }
2521 2521
2522 static void 2522 static void
2523 stop_anim(GtkObject *obj, GaimGtkConversation *gtkconv) 2523 stop_anim(GtkObject *obj, PidginConversation *gtkconv)
2524 { 2524 {
2525 if (gtkconv->u.im->icon_timer != 0) 2525 if (gtkconv->u.im->icon_timer != 0)
2526 g_source_remove(gtkconv->u.im->icon_timer); 2526 g_source_remove(gtkconv->u.im->icon_timer);
2527 2527
2528 gtkconv->u.im->icon_timer = 0; 2528 gtkconv->u.im->icon_timer = 0;
2529 } 2529 }
2530 2530
2531 2531
2532 static void 2532 static void
2533 toggle_icon_animate_cb(GtkWidget *w, GaimGtkConversation *gtkconv) 2533 toggle_icon_animate_cb(GtkWidget *w, PidginConversation *gtkconv)
2534 { 2534 {
2535 gtkconv->u.im->animate = 2535 gtkconv->u.im->animate =
2536 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); 2536 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
2537 2537
2538 if (gtkconv->u.im->animate) 2538 if (gtkconv->u.im->animate)
2540 else 2540 else
2541 stop_anim(NULL, gtkconv); 2541 stop_anim(NULL, gtkconv);
2542 } 2542 }
2543 2543
2544 static gboolean 2544 static gboolean
2545 icon_menu(GtkObject *obj, GdkEventButton *e, GaimGtkConversation *gtkconv) 2545 icon_menu(GtkObject *obj, GdkEventButton *e, PidginConversation *gtkconv)
2546 { 2546 {
2547 static GtkWidget *menu = NULL; 2547 static GtkWidget *menu = NULL;
2548 const char *pref; 2548 const char *pref;
2549 2549
2550 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) 2550 if (e->button != 3 || e->type != GDK_BUTTON_PRESS)
2592 } 2592 }
2593 2593
2594 static void 2594 static void
2595 menu_buddyicon_cb(gpointer data, guint action, GtkWidget *widget) 2595 menu_buddyicon_cb(gpointer data, guint action, GtkWidget *widget)
2596 { 2596 {
2597 GaimGtkWindow *win = data; 2597 PidginWindow *win = data;
2598 GaimConversation *conv; 2598 GaimConversation *conv;
2599 GaimGtkConversation *gtkconv; 2599 PidginConversation *gtkconv;
2600 gboolean active; 2600 gboolean active;
2601 2601
2602 conv = gaim_gtk_conv_window_get_active_conversation(win); 2602 conv = pidgin_conv_window_get_active_conversation(win);
2603 2603
2604 if (!conv) 2604 if (!conv)
2605 return; 2605 return;
2606 2606
2607 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM); 2607 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM);
2608 2608
2609 gtkconv = GAIM_GTK_CONVERSATION(conv); 2609 gtkconv = PIDGIN_CONVERSATION(conv);
2610 2610
2611 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); 2611 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
2612 gtkconv->u.im->show_icon = active; 2612 gtkconv->u.im->show_icon = active;
2613 if (active) 2613 if (active)
2614 gaim_gtkconv_update_buddy_icon(conv); 2614 pidginconv_update_buddy_icon(conv);
2615 else 2615 else
2616 remove_icon(NULL, gtkconv); 2616 remove_icon(NULL, gtkconv);
2617 } 2617 }
2618 2618
2619 /************************************************************************** 2619 /**************************************************************************
2620 * End of the bunch of buddy icon functions 2620 * End of the bunch of buddy icon functions
2621 **************************************************************************/ 2621 **************************************************************************/
2622 void 2622 void
2623 gaim_gtkconv_present_conversation(GaimConversation *conv) 2623 pidginconv_present_conversation(GaimConversation *conv)
2624 { 2624 {
2625 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); 2625 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
2626 2626
2627 if(gtkconv->win==hidden_convwin) { 2627 if(gtkconv->win==hidden_convwin) {
2628 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv); 2628 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
2629 gaim_gtkconv_placement_place(gtkconv); 2629 pidginconv_placement_place(gtkconv);
2630 } 2630 }
2631 2631
2632 gaim_gtkconv_switch_active_conversation(conv); 2632 pidginconv_switch_active_conversation(conv);
2633 gaim_gtk_conv_window_switch_gtkconv(gtkconv->win, gtkconv); 2633 pidgin_conv_window_switch_gtkconv(gtkconv->win, gtkconv);
2634 gtk_window_present(GTK_WINDOW(gtkconv->win->window)); 2634 gtk_window_present(GTK_WINDOW(gtkconv->win->window));
2635 } 2635 }
2636 2636
2637 GList * 2637 GList *
2638 gaim_gtk_conversations_find_unseen_list(GaimConversationType type, 2638 pidgin_conversations_find_unseen_list(GaimConversationType type,
2639 GaimUnseenState min_state, 2639 GaimUnseenState min_state,
2640 gboolean hidden_only, 2640 gboolean hidden_only,
2641 guint max_count) 2641 guint max_count)
2642 { 2642 {
2643 GList *l; 2643 GList *l;
2652 l = gaim_get_conversations(); 2652 l = gaim_get_conversations();
2653 } 2653 }
2654 2654
2655 for (; l != NULL && (max_count == 0 || c < max_count); l = l->next) { 2655 for (; l != NULL && (max_count == 0 || c < max_count); l = l->next) {
2656 GaimConversation *conv = (GaimConversation*)l->data; 2656 GaimConversation *conv = (GaimConversation*)l->data;
2657 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); 2657 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
2658 2658
2659 if(gtkconv->active_conv != conv) 2659 if(gtkconv->active_conv != conv)
2660 continue; 2660 continue;
2661 2661
2662 if (gtkconv->unseen_state >= min_state 2662 if (gtkconv->unseen_state >= min_state
2673 2673
2674 static void 2674 static void
2675 unseen_conv_menu_cb(GtkMenuItem *item, GaimConversation *conv) 2675 unseen_conv_menu_cb(GtkMenuItem *item, GaimConversation *conv)
2676 { 2676 {
2677 g_return_if_fail(conv != NULL); 2677 g_return_if_fail(conv != NULL);
2678 gaim_gtkconv_present_conversation(conv); 2678 pidginconv_present_conversation(conv);
2679 } 2679 }
2680 2680
2681 guint 2681 guint
2682 gaim_gtk_conversations_fill_menu(GtkWidget *menu, GList *convs) 2682 pidgin_conversations_fill_menu(GtkWidget *menu, GList *convs)
2683 { 2683 {
2684 GList *l; 2684 GList *l;
2685 guint ret=0; 2685 guint ret=0;
2686 2686
2687 g_return_val_if_fail(menu != NULL, 0); 2687 g_return_val_if_fail(menu != NULL, 0);
2688 g_return_val_if_fail(convs != NULL, 0); 2688 g_return_val_if_fail(convs != NULL, 0);
2689 2689
2690 for (l = convs; l != NULL ; l = l->next) { 2690 for (l = convs; l != NULL ; l = l->next) {
2691 GaimConversation *conv = (GaimConversation*)l->data; 2691 GaimConversation *conv = (GaimConversation*)l->data;
2692 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); 2692 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
2693 2693
2694 GtkWidget *icon = gtk_image_new(); 2694 GtkWidget *icon = gtk_image_new();
2695 GdkPixbuf *pbuf = gaim_gtkconv_get_tab_icon(conv, TRUE); 2695 GdkPixbuf *pbuf = pidginconv_get_tab_icon(conv, TRUE);
2696 GtkWidget *item; 2696 GtkWidget *item;
2697 gchar *text = g_strdup_printf("%s (%d)", 2697 gchar *text = g_strdup_printf("%s (%d)",
2698 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)), 2698 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)),
2699 gtkconv->unseen_count); 2699 gtkconv->unseen_count);
2700 2700
2710 } 2710 }
2711 2711
2712 return ret; 2712 return ret;
2713 } 2713 }
2714 2714
2715 GaimGtkWindow * 2715 PidginWindow *
2716 gaim_gtkconv_get_window(GaimGtkConversation *gtkconv) 2716 pidginconv_get_window(PidginConversation *gtkconv)
2717 { 2717 {
2718 g_return_val_if_fail(gtkconv != NULL, NULL); 2718 g_return_val_if_fail(gtkconv != NULL, NULL);
2719 return gtkconv->win; 2719 return gtkconv->win;
2720 } 2720 }
2721 2721
2793 2793
2794 static void 2794 static void
2795 sound_method_pref_changed_cb(const char *name, GaimPrefType type, 2795 sound_method_pref_changed_cb(const char *name, GaimPrefType type,
2796 gconstpointer value, gpointer data) 2796 gconstpointer value, gpointer data)
2797 { 2797 {
2798 GaimGtkWindow *win = data; 2798 PidginWindow *win = data;
2799 const char *method = value; 2799 const char *method = value;
2800 2800
2801 if (!strcmp(method, "none")) 2801 if (!strcmp(method, "none"))
2802 { 2802 {
2803 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), 2803 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
2804 FALSE); 2804 FALSE);
2805 gtk_widget_set_sensitive(win->menu.sounds, FALSE); 2805 gtk_widget_set_sensitive(win->menu.sounds, FALSE);
2806 } 2806 }
2807 else 2807 else
2808 { 2808 {
2809 GaimGtkConversation *gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); 2809 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
2810 2810
2811 if (gtkconv != NULL) 2811 if (gtkconv != NULL)
2812 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), 2812 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
2813 TRUE); 2813 TRUE);
2814 gtk_widget_set_sensitive(win->menu.sounds, TRUE); 2814 gtk_widget_set_sensitive(win->menu.sounds, TRUE);
2818 2818
2819 static void 2819 static void
2820 show_buddy_icons_pref_changed_cb(const char *name, GaimPrefType type, 2820 show_buddy_icons_pref_changed_cb(const char *name, GaimPrefType type,
2821 gconstpointer value, gpointer data) 2821 gconstpointer value, gpointer data)
2822 { 2822 {
2823 GaimGtkWindow *win = data; 2823 PidginWindow *win = data;
2824 gboolean show_icons = GPOINTER_TO_INT(value); 2824 gboolean show_icons = GPOINTER_TO_INT(value);
2825 2825
2826 if (!show_icons) 2826 if (!show_icons)
2827 { 2827 {
2828 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon), 2828 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon),
2829 FALSE); 2829 FALSE);
2830 gtk_widget_set_sensitive(win->menu.show_icon, FALSE); 2830 gtk_widget_set_sensitive(win->menu.show_icon, FALSE);
2831 } 2831 }
2832 else 2832 else
2833 { 2833 {
2834 GaimGtkConversation *gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); 2834 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
2835 2835
2836 if (gtkconv != NULL) 2836 if (gtkconv != NULL)
2837 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon), 2837 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon),
2838 TRUE); 2838 TRUE);
2839 gtk_widget_set_sensitive(win->menu.show_icon, TRUE); 2839 gtk_widget_set_sensitive(win->menu.show_icon, TRUE);
2840 2840
2841 } 2841 }
2842 } 2842 }
2843 2843
2844 static void 2844 static void
2845 regenerate_options_items(GaimGtkWindow *win) 2845 regenerate_options_items(PidginWindow *win)
2846 { 2846 {
2847 GtkWidget *menu; 2847 GtkWidget *menu;
2848 GList *list; 2848 GList *list;
2849 GaimGtkConversation *gtkconv; 2849 PidginConversation *gtkconv;
2850 GaimConversation *conv; 2850 GaimConversation *conv;
2851 GaimBuddy *buddy; 2851 GaimBuddy *buddy;
2852 2852
2853 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); 2853 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
2854 conv = gtkconv->active_conv; 2854 conv = gtkconv->active_conv;
2855 buddy = gaim_find_buddy(conv->account, conv->name); 2855 buddy = gaim_find_buddy(conv->account, conv->name);
2856 2856
2857 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); 2857 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More"));
2858 2858
2866 2866
2867 /* Now add the stuff */ 2867 /* Now add the stuff */
2868 if (buddy) 2868 if (buddy)
2869 { 2869 {
2870 if (gaim_account_is_connected(conv->account)) 2870 if (gaim_account_is_connected(conv->account))
2871 gaim_gtk_append_blist_node_proto_menu(menu, conv->account->gc, 2871 pidgin_append_blist_node_proto_menu(menu, conv->account->gc,
2872 (GaimBlistNode *)buddy); 2872 (GaimBlistNode *)buddy);
2873 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy); 2873 pidgin_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
2874 } 2874 }
2875 2875
2876 if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL) 2876 if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL)
2877 { 2877 {
2878 GtkWidget *item = gtk_menu_item_new_with_label(_("No actions available")); 2878 GtkWidget *item = gtk_menu_item_new_with_label(_("No actions available"));
2883 gtk_widget_show_all(menu); 2883 gtk_widget_show_all(menu);
2884 } 2884 }
2885 2885
2886 static void menubar_activated(GtkWidget *item, gpointer data) 2886 static void menubar_activated(GtkWidget *item, gpointer data)
2887 { 2887 {
2888 GaimGtkWindow *win = data; 2888 PidginWindow *win = data;
2889 regenerate_options_items(win); 2889 regenerate_options_items(win);
2890 2890
2891 /* The following are to make sure the 'More' submenu is not regenerated every time 2891 /* The following are to make sure the 'More' submenu is not regenerated every time
2892 * the focus shifts from 'Conversations' to some other menu and back. */ 2892 * the focus shifts from 'Conversations' to some other menu and back. */
2893 g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(menubar_activated), data); 2893 g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(menubar_activated), data);
2894 g_signal_connect(G_OBJECT(win->menu.menubar), "deactivate", G_CALLBACK(focus_out_from_menubar), data); 2894 g_signal_connect(G_OBJECT(win->menu.menubar), "deactivate", G_CALLBACK(focus_out_from_menubar), data);
2895 } 2895 }
2896 2896
2897 static void 2897 static void
2898 focus_out_from_menubar(GtkWidget *wid, GaimGtkWindow *win) 2898 focus_out_from_menubar(GtkWidget *wid, PidginWindow *win)
2899 { 2899 {
2900 /* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time 2900 /* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time
2901 * the 'Conversation' menu pops up. */ 2901 * the 'Conversation' menu pops up. */
2902 GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); 2902 GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation"));
2903 g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win); 2903 g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win);
2904 g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar), 2904 g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar),
2905 G_CALLBACK(focus_out_from_menubar), win); 2905 G_CALLBACK(focus_out_from_menubar), win);
2906 } 2906 }
2907 2907
2908 static GtkWidget * 2908 static GtkWidget *
2909 setup_menubar(GaimGtkWindow *win) 2909 setup_menubar(PidginWindow *win)
2910 { 2910 {
2911 GtkAccelGroup *accel_group; 2911 GtkAccelGroup *accel_group;
2912 const char *method; 2912 const char *method;
2913 GtkWidget *menuitem; 2913 GtkWidget *menuitem;
2914 2914
2924 NULL, NULL); 2924 NULL, NULL);
2925 2925
2926 gtk_item_factory_create_items(win->menu.item_factory, menu_item_count, 2926 gtk_item_factory_create_items(win->menu.item_factory, menu_item_count,
2927 menu_items, win); 2927 menu_items, win);
2928 g_signal_connect(G_OBJECT(accel_group), "accel-changed", 2928 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
2929 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); 2929 G_CALLBACK(pidgin_save_accels_cb), NULL);
2930 2930
2931 /* Make sure the 'Conversation -> More' menuitems are regenerated whenever 2931 /* Make sure the 'Conversation -> More' menuitems are regenerated whenever
2932 * the 'Conversation' menu pops up because the entries can change after the 2932 * the 'Conversation' menu pops up because the entries can change after the
2933 * conversation is created. */ 2933 * conversation is created. */
2934 menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); 2934 menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation"));
3027 gtk_widget_set_sensitive(win->menu.show_icon, FALSE); 3027 gtk_widget_set_sensitive(win->menu.show_icon, FALSE);
3028 } 3028 }
3029 gaim_prefs_connect_callback(win, "/gaim/gtk/conversations/im/show_buddy_icons", 3029 gaim_prefs_connect_callback(win, "/gaim/gtk/conversations/im/show_buddy_icons",
3030 show_buddy_icons_pref_changed_cb, win); 3030 show_buddy_icons_pref_changed_cb, win);
3031 3031
3032 win->menu.tray = gaim_gtk_menu_tray_new(); 3032 win->menu.tray = pidgin_menu_tray_new();
3033 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), 3033 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar),
3034 win->menu.tray); 3034 win->menu.tray);
3035 gtk_widget_show(win->menu.tray); 3035 gtk_widget_show(win->menu.tray);
3036 3036
3037 gtk_widget_show(win->menu.menubar); 3037 gtk_widget_show(win->menu.menubar);
3043 /************************************************************************** 3043 /**************************************************************************
3044 * Utility functions 3044 * Utility functions
3045 **************************************************************************/ 3045 **************************************************************************/
3046 3046
3047 static void 3047 static void
3048 got_typing_keypress(GaimGtkConversation *gtkconv, gboolean first) 3048 got_typing_keypress(PidginConversation *gtkconv, gboolean first)
3049 { 3049 {
3050 GaimConversation *conv = gtkconv->active_conv; 3050 GaimConversation *conv = gtkconv->active_conv;
3051 GaimConvIm *im; 3051 GaimConvIm *im;
3052 3052
3053 /* 3053 /*
3071 gaim_conv_im_set_type_again(im, timeout); 3071 gaim_conv_im_set_type_again(im, timeout);
3072 } 3072 }
3073 } 3073 }
3074 3074
3075 static void 3075 static void
3076 update_typing_icon(GaimGtkConversation *gtkconv) 3076 update_typing_icon(PidginConversation *gtkconv)
3077 { 3077 {
3078 GaimGtkWindow *gtkwin; 3078 PidginWindow *gtkwin;
3079 GaimConvIm *im = NULL; 3079 GaimConvIm *im = NULL;
3080 GaimConversation *conv = gtkconv->active_conv; 3080 GaimConversation *conv = gtkconv->active_conv;
3081 char *stock_id; 3081 char *stock_id;
3082 const char *tooltip; 3082 const char *tooltip;
3083 3083
3102 } 3102 }
3103 3103
3104 if (gtkwin->menu.typing_icon == NULL) 3104 if (gtkwin->menu.typing_icon == NULL)
3105 { 3105 {
3106 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); 3106 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU);
3107 gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkwin->menu.tray), 3107 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
3108 gtkwin->menu.typing_icon, 3108 gtkwin->menu.typing_icon,
3109 tooltip); 3109 tooltip);
3110 } 3110 }
3111 else 3111 else
3112 { 3112 {
3113 gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU); 3113 gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU);
3114 gaim_gtk_menu_tray_set_tooltip(GAIM_GTK_MENU_TRAY(gtkwin->menu.tray), 3114 pidgin_menu_tray_set_tooltip(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
3115 gtkwin->menu.typing_icon, 3115 gtkwin->menu.typing_icon,
3116 tooltip); 3116 tooltip);
3117 } 3117 }
3118 3118
3119 gtk_widget_show(gtkwin->menu.typing_icon); 3119 gtk_widget_show(gtkwin->menu.typing_icon);
3120 } 3120 }
3121 3121
3122 static gboolean 3122 static gboolean
3123 update_send_to_selection(GaimGtkWindow *win) 3123 update_send_to_selection(PidginWindow *win)
3124 { 3124 {
3125 GaimAccount *account; 3125 GaimAccount *account;
3126 GaimConversation *conv; 3126 GaimConversation *conv;
3127 GtkWidget *menu; 3127 GtkWidget *menu;
3128 GList *child; 3128 GList *child;
3129 GaimBuddy *b; 3129 GaimBuddy *b;
3130 3130
3131 conv = gaim_gtk_conv_window_get_active_conversation(win); 3131 conv = pidgin_conv_window_get_active_conversation(win);
3132 3132
3133 if (conv == NULL) 3133 if (conv == NULL)
3134 return FALSE; 3134 return FALSE;
3135 3135
3136 account = gaim_conversation_get_account(conv); 3136 account = gaim_conversation_get_account(conv);
3194 GdkPixbuf *pixbuf; 3194 GdkPixbuf *pixbuf;
3195 gchar *text; 3195 gchar *text;
3196 3196
3197 /* Create a pixmap for the protocol icon. */ 3197 /* Create a pixmap for the protocol icon. */
3198 if (buddy != NULL) 3198 if (buddy != NULL)
3199 pixbuf = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy, GAIM_STATUS_ICON_SMALL); 3199 pixbuf = pidgin_blist_get_status_icon((GaimBlistNode*)buddy, GAIM_STATUS_ICON_SMALL);
3200 else 3200 else
3201 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5); 3201 pixbuf = pidgin_create_prpl_icon(account, 0.5);
3202 3202
3203 /* Now convert it to GtkImage */ 3203 /* Now convert it to GtkImage */
3204 if (pixbuf == NULL) 3204 if (pixbuf == NULL)
3205 image = gtk_image_new(); 3205 image = gtk_image_new();
3206 else 3206 else
3261 gtk_widget_show(menuitem); 3261 gtk_widget_show(menuitem);
3262 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 3262 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
3263 } 3263 }
3264 3264
3265 static void 3265 static void
3266 generate_send_to_items(GaimGtkWindow *win) 3266 generate_send_to_items(PidginWindow *win)
3267 { 3267 {
3268 GtkWidget *menu; 3268 GtkWidget *menu;
3269 GSList *group = NULL; 3269 GSList *group = NULL;
3270 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); 3270 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
3271 GaimGtkConversation *gtkconv; 3271 PidginConversation *gtkconv;
3272 GSList *l, *buds; 3272 GSList *l, *buds;
3273 3273
3274 g_return_if_fail(win != NULL); 3274 g_return_if_fail(win != NULL);
3275 3275
3276 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); 3276 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
3277 3277
3278 g_return_if_fail(gtkconv != NULL); 3278 g_return_if_fail(gtkconv != NULL);
3279 3279
3280 if (win->menu.send_to != NULL) 3280 if (win->menu.send_to != NULL)
3281 gtk_widget_destroy(win->menu.send_to); 3281 gtk_widget_destroy(win->menu.send_to);
3432 } 3432 }
3433 3433
3434 static void 3434 static void
3435 add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name) 3435 add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name)
3436 { 3436 {
3437 GaimGtkConversation *gtkconv; 3437 PidginConversation *gtkconv;
3438 GaimGtkChatPane *gtkchat; 3438 PidginChatPane *gtkchat;
3439 GaimConvChat *chat; 3439 GaimConvChat *chat;
3440 GaimConnection *gc; 3440 GaimConnection *gc;
3441 GaimPluginProtocolInfo *prpl_info; 3441 GaimPluginProtocolInfo *prpl_info;
3442 GtkListStore *ls; 3442 GtkListStore *ls;
3443 GdkPixbuf *pixbuf; 3443 GdkPixbuf *pixbuf;
3450 alias = cb->alias; 3450 alias = cb->alias;
3451 name = cb->name; 3451 name = cb->name;
3452 flags = GPOINTER_TO_INT(cb->flags); 3452 flags = GPOINTER_TO_INT(cb->flags);
3453 3453
3454 chat = GAIM_CONV_CHAT(conv); 3454 chat = GAIM_CONV_CHAT(conv);
3455 gtkconv = GAIM_GTK_CONVERSATION(conv); 3455 gtkconv = PIDGIN_CONVERSATION(conv);
3456 gtkchat = gtkconv->u.chat; 3456 gtkchat = gtkconv->u.chat;
3457 gc = gaim_conversation_get_gc(conv); 3457 gc = gaim_conversation_get_gc(conv);
3458 3458
3459 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) 3459 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
3460 return; 3460 return;
3578 } 3578 }
3579 3579
3580 static gboolean 3580 static gboolean
3581 tab_complete(GaimConversation *conv) 3581 tab_complete(GaimConversation *conv)
3582 { 3582 {
3583 GaimGtkConversation *gtkconv; 3583 PidginConversation *gtkconv;
3584 GtkTextIter cursor, word_start, start_buffer; 3584 GtkTextIter cursor, word_start, start_buffer;
3585 int start; 3585 int start;
3586 int most_matched = -1; 3586 int most_matched = -1;
3587 char *entered, *partial = NULL; 3587 char *entered, *partial = NULL;
3588 char *text; 3588 char *text;
3589 char *nick_partial; 3589 char *nick_partial;
3590 const char *prefix; 3590 const char *prefix;
3591 GList *matches = NULL; 3591 GList *matches = NULL;
3592 gboolean command = FALSE; 3592 gboolean command = FALSE;
3593 3593
3594 gtkconv = GAIM_GTK_CONVERSATION(conv); 3594 gtkconv = PIDGIN_CONVERSATION(conv);
3595 3595
3596 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); 3596 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer);
3597 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, 3597 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor,
3598 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); 3598 gtk_text_buffer_get_insert(gtkconv->entry_buffer));
3599 3599
3618 while (start >= 0 && text[start] != ' ') { 3618 while (start >= 0 && text[start] != ' ') {
3619 gtk_text_iter_backward_char(&word_start); 3619 gtk_text_iter_backward_char(&word_start);
3620 start--; 3620 start--;
3621 } 3621 }
3622 3622
3623 prefix = gaim_gtk_get_cmd_prefix(); 3623 prefix = pidgin_get_cmd_prefix();
3624 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) { 3624 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) {
3625 command = TRUE; 3625 command = TRUE;
3626 gtk_text_iter_forward_chars(&word_start, strlen(prefix)); 3626 gtk_text_iter_forward_chars(&word_start, strlen(prefix));
3627 } 3627 }
3628 3628
3649 } 3649 }
3650 g_list_free(list); 3650 g_list_free(list);
3651 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { 3651 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
3652 GaimConvChat *chat = GAIM_CONV_CHAT(conv); 3652 GaimConvChat *chat = GAIM_CONV_CHAT(conv);
3653 GList *l = gaim_conv_chat_get_users(chat); 3653 GList *l = gaim_conv_chat_get_users(chat);
3654 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(GAIM_GTK_CONVERSATION(conv)->u.chat->list)); 3654 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(PIDGIN_CONVERSATION(conv)->u.chat->list));
3655 GtkTreeIter iter; 3655 GtkTreeIter iter;
3656 int f; 3656 int f;
3657 3657
3658 /* Users */ 3658 /* Users */
3659 for (; l != NULL; l = l->next) { 3659 for (; l != NULL; l = l->next) {
3745 g_free(partial); 3745 g_free(partial);
3746 3746
3747 return TRUE; 3747 return TRUE;
3748 } 3748 }
3749 3749
3750 static void topic_callback(GtkWidget *w, GaimGtkConversation *gtkconv) 3750 static void topic_callback(GtkWidget *w, PidginConversation *gtkconv)
3751 { 3751 {
3752 GaimPluginProtocolInfo *prpl_info = NULL; 3752 GaimPluginProtocolInfo *prpl_info = NULL;
3753 GaimConnection *gc; 3753 GaimConnection *gc;
3754 GaimConversation *conv = gtkconv->active_conv; 3754 GaimConversation *conv = gtkconv->active_conv;
3755 GaimGtkChatPane *gtkchat; 3755 PidginChatPane *gtkchat;
3756 char *new_topic; 3756 char *new_topic;
3757 const char *current_topic; 3757 const char *current_topic;
3758 3758
3759 gc = gaim_conversation_get_gc(conv); 3759 gc = gaim_conversation_get_gc(conv);
3760 3760
3762 return; 3762 return;
3763 3763
3764 if(prpl_info->set_chat_topic == NULL) 3764 if(prpl_info->set_chat_topic == NULL)
3765 return; 3765 return;
3766 3766
3767 gtkconv = GAIM_GTK_CONVERSATION(conv); 3767 gtkconv = PIDGIN_CONVERSATION(conv);
3768 gtkchat = gtkconv->u.chat; 3768 gtkchat = gtkconv->u.chat;
3769 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text))); 3769 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)));
3770 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); 3770 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv));
3771 3771
3772 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ 3772 if(current_topic && !g_utf8_collate(new_topic, current_topic)){
3820 } 3820 }
3821 3821
3822 static void 3822 static void
3823 update_chat_alias(GaimBuddy *buddy, GaimConversation *conv, GaimConnection *gc, GaimPluginProtocolInfo *prpl_info) 3823 update_chat_alias(GaimBuddy *buddy, GaimConversation *conv, GaimConnection *gc, GaimPluginProtocolInfo *prpl_info)
3824 { 3824 {
3825 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); 3825 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
3826 GaimConvChat *chat = GAIM_CONV_CHAT(conv); 3826 GaimConvChat *chat = GAIM_CONV_CHAT(conv);
3827 GtkTreeModel *model; 3827 GtkTreeModel *model;
3828 char *normalized_name; 3828 char *normalized_name;
3829 GtkTreeIter iter; 3829 GtkTreeIter iter;
3830 int f; 3830 int f;
3927 /* Do nothing if the buddy does not belong to the conv's account */ 3927 /* Do nothing if the buddy does not belong to the conv's account */
3928 if (gaim_buddy_get_account(buddy) != gaim_conversation_get_account(conv)) 3928 if (gaim_buddy_get_account(buddy) != gaim_conversation_get_account(conv))
3929 return; 3929 return;
3930 3930
3931 /* This is safe because this callback is only used in chats, not IMs. */ 3931 /* This is safe because this callback is only used in chats, not IMs. */
3932 model = gtk_tree_view_get_model(GTK_TREE_VIEW(GAIM_GTK_CONVERSATION(conv)->u.chat->list)); 3932 model = gtk_tree_view_get_model(GTK_TREE_VIEW(PIDGIN_CONVERSATION(conv)->u.chat->list));
3933 3933
3934 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) 3934 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
3935 return; 3935 return;
3936 3936
3937 normalized_name = g_strdup(gaim_normalize(conv->account, buddy->name)); 3937 normalized_name = g_strdup(gaim_normalize(conv->account, buddy->name));
3972 return; 3972 return;
3973 3973
3974 buddy_cb_common(buddy, conv, FALSE); 3974 buddy_cb_common(buddy, conv, FALSE);
3975 } 3975 }
3976 3976
3977 static void send_menu_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) 3977 static void send_menu_cb(GtkWidget *widget, PidginConversation *gtkconv)
3978 { 3978 {
3979 g_signal_emit_by_name(gtkconv->entry, "message_send"); 3979 g_signal_emit_by_name(gtkconv->entry, "message_send");
3980 } 3980 }
3981 3981
3982 static void 3982 static void
3983 entry_popup_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data) 3983 entry_popup_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data)
3984 { 3984 {
3985 GtkWidget *menuitem; 3985 GtkWidget *menuitem;
3986 GaimGtkConversation *gtkconv = data; 3986 PidginConversation *gtkconv = data;
3987 3987
3988 g_return_if_fail(menu != NULL); 3988 g_return_if_fail(menu != NULL);
3989 g_return_if_fail(gtkconv != NULL); 3989 g_return_if_fail(gtkconv != NULL);
3990 3990
3991 menuitem = gaim_new_item_from_stock(NULL, _("_Send"), GAIM_STOCK_SEND, 3991 menuitem = gaim_new_item_from_stock(NULL, _("_Send"), GAIM_STOCK_SEND,
3999 gtk_widget_show(menuitem); 3999 gtk_widget_show(menuitem);
4000 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 1); 4000 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 1);
4001 } 4001 }
4002 4002
4003 4003
4004 static void resize_imhtml_cb(GaimGtkConversation *gtkconv) 4004 static void resize_imhtml_cb(PidginConversation *gtkconv)
4005 { 4005 {
4006 GtkTextBuffer *buffer; 4006 GtkTextBuffer *buffer;
4007 GtkTextIter iter; 4007 GtkTextIter iter;
4008 int wrapped_lines; 4008 int wrapped_lines;
4009 int lines; 4009 int lines;
4041 g_idle_add(reset_auto_resize_cb, gtkconv); 4041 g_idle_add(reset_auto_resize_cb, gtkconv);
4042 } 4042 }
4043 } 4043 }
4044 4044
4045 static GtkWidget * 4045 static GtkWidget *
4046 setup_chat_pane(GaimGtkConversation *gtkconv) 4046 setup_chat_pane(PidginConversation *gtkconv)
4047 { 4047 {
4048 GaimPluginProtocolInfo *prpl_info; 4048 GaimPluginProtocolInfo *prpl_info;
4049 GaimConversation *conv = gtkconv->active_conv; 4049 GaimConversation *conv = gtkconv->active_conv;
4050 GaimGtkChatPane *gtkchat; 4050 PidginChatPane *gtkchat;
4051 GaimConnection *gc; 4051 GaimConnection *gc;
4052 GtkWidget *vpaned, *hpaned; 4052 GtkWidget *vpaned, *hpaned;
4053 GtkWidget *vbox, *hbox, *frame; 4053 GtkWidget *vbox, *hbox, *frame;
4054 GtkWidget *imhtml_sw; 4054 GtkWidget *imhtml_sw;
4055 GtkPolicyType imhtml_sw_hscroll; 4055 GtkPolicyType imhtml_sw_hscroll;
4105 hpaned = gtk_hpaned_new(); 4105 hpaned = gtk_hpaned_new();
4106 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); 4106 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0);
4107 gtk_widget_show(hpaned); 4107 gtk_widget_show(hpaned);
4108 4108
4109 /* Setup gtkihmtml. */ 4109 /* Setup gtkihmtml. */
4110 frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw); 4110 frame = pidgin_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
4111 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); 4111 gtk_widget_set_name(gtkconv->imhtml, "pidginconv_imhtml");
4112 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), TRUE); 4112 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), TRUE);
4113 gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE); 4113 gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE);
4114 gtk_widget_show(frame); 4114 gtk_widget_show(frame);
4115 gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw), 4115 gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
4116 &imhtml_sw_hscroll, NULL); 4116 &imhtml_sw_hscroll, NULL);
4217 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); 4217 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
4218 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); 4218 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0);
4219 gtk_widget_show(vbox); 4219 gtk_widget_show(vbox);
4220 4220
4221 /* Setup the toolbar, entry widget and all signals */ 4221 /* Setup the toolbar, entry widget and all signals */
4222 frame = gaim_gtk_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL); 4222 frame = pidgin_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
4223 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); 4223 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
4224 gtk_widget_show(frame); 4224 gtk_widget_show(frame);
4225 4225
4226 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", 4226 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup",
4227 G_CALLBACK(entry_popup_menu_cb), gtkconv); 4227 G_CALLBACK(entry_popup_menu_cb), gtkconv);
4228 4228
4229 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); 4229 gtk_widget_set_name(gtkconv->entry, "pidginconv_entry");
4230 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), 4230 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
4231 gaim_account_get_protocol_name(conv->account)); 4231 gaim_account_get_protocol_name(conv->account));
4232 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, 4232 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
4233 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); 4233 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"));
4234 gtkconv->entry_buffer = 4234 gtkconv->entry_buffer =
4258 4258
4259 return vpaned; 4259 return vpaned;
4260 } 4260 }
4261 4261
4262 static GtkWidget * 4262 static GtkWidget *
4263 setup_im_pane(GaimGtkConversation *gtkconv) 4263 setup_im_pane(PidginConversation *gtkconv)
4264 { 4264 {
4265 GaimConversation *conv = gtkconv->active_conv; 4265 GaimConversation *conv = gtkconv->active_conv;
4266 GtkWidget *frame; 4266 GtkWidget *frame;
4267 GtkWidget *imhtml_sw; 4267 GtkWidget *imhtml_sw;
4268 GtkPolicyType imhtml_sw_hscroll; 4268 GtkPolicyType imhtml_sw_hscroll;
4279 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); 4279 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
4280 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); 4280 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE);
4281 gtk_widget_show(vbox); 4281 gtk_widget_show(vbox);
4282 4282
4283 /* Setup the gtkimhtml widget */ 4283 /* Setup the gtkimhtml widget */
4284 frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw); 4284 frame = pidgin_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
4285 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); 4285 gtk_widget_set_name(gtkconv->imhtml, "pidginconv_imhtml");
4286 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE); 4286 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE);
4287 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); 4287 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
4288 gtk_widget_show(frame); 4288 gtk_widget_show(frame);
4289 gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw), 4289 gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
4290 &imhtml_sw_hscroll, NULL); 4290 &imhtml_sw_hscroll, NULL);
4316 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); 4316 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
4317 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); 4317 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0);
4318 gtk_widget_show(vbox2); 4318 gtk_widget_show(vbox2);
4319 4319
4320 /* Setup the toolbar, entry widget and all signals */ 4320 /* Setup the toolbar, entry widget and all signals */
4321 frame = gaim_gtk_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL); 4321 frame = pidgin_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
4322 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); 4322 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0);
4323 gtk_widget_show(frame); 4323 gtk_widget_show(frame);
4324 4324
4325 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", 4325 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup",
4326 G_CALLBACK(entry_popup_menu_cb), gtkconv); 4326 G_CALLBACK(entry_popup_menu_cb), gtkconv);
4327 4327
4328 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); 4328 gtk_widget_set_name(gtkconv->entry, "pidginconv_entry");
4329 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), 4329 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
4330 gaim_account_get_protocol_name(conv->account)); 4330 gaim_account_get_protocol_name(conv->account));
4331 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, 4331 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
4332 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); 4332 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"));
4333 gtkconv->entry_buffer = 4333 gtkconv->entry_buffer =
4372 } 4372 }
4373 4373
4374 static void 4374 static void
4375 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, 4375 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
4376 GtkSelectionData *sd, guint info, guint t, 4376 GtkSelectionData *sd, guint info, guint t,
4377 GaimGtkConversation *gtkconv) 4377 PidginConversation *gtkconv)
4378 { 4378 {
4379 GaimConversation *conv = gtkconv->active_conv; 4379 GaimConversation *conv = gtkconv->active_conv;
4380 GaimGtkWindow *win = gtkconv->win; 4380 PidginWindow *win = gtkconv->win;
4381 GaimConversation *c; 4381 GaimConversation *c;
4382 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) 4382 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
4383 { 4383 {
4384 GaimBlistNode *n = NULL; 4384 GaimBlistNode *n = NULL;
4385 GaimBuddy *b; 4385 GaimBuddy *b;
4386 GaimGtkConversation *gtkconv = NULL; 4386 PidginConversation *gtkconv = NULL;
4387 4387
4388 n = *(GaimBlistNode **)sd->data; 4388 n = *(GaimBlistNode **)sd->data;
4389 4389
4390 if (GAIM_BLIST_NODE_IS_CONTACT(n)) 4390 if (GAIM_BLIST_NODE_IS_CONTACT(n))
4391 b = gaim_contact_get_priority_buddy((GaimContact*)n); 4391 b = gaim_contact_get_priority_buddy((GaimContact*)n);
4399 * just move the conv to this window. Otherwise, create a new 4399 * just move the conv to this window. Otherwise, create a new
4400 * conv and add it to this window. 4400 * conv and add it to this window.
4401 */ 4401 */
4402 c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, b->account); 4402 c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, b->account);
4403 if (c != NULL) { 4403 if (c != NULL) {
4404 GaimGtkWindow *oldwin; 4404 PidginWindow *oldwin;
4405 gtkconv = GAIM_GTK_CONVERSATION(c); 4405 gtkconv = PIDGIN_CONVERSATION(c);
4406 oldwin = gtkconv->win; 4406 oldwin = gtkconv->win;
4407 if (oldwin != win) { 4407 if (oldwin != win) {
4408 gaim_gtk_conv_window_remove_gtkconv(oldwin, gtkconv); 4408 pidgin_conv_window_remove_gtkconv(oldwin, gtkconv);
4409 gaim_gtk_conv_window_add_gtkconv(win, gtkconv); 4409 pidgin_conv_window_add_gtkconv(win, gtkconv);
4410 } 4410 }
4411 } else { 4411 } else {
4412 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, b->account, b->name); 4412 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, b->account, b->name);
4413 gtkconv = GAIM_GTK_CONVERSATION(c); 4413 gtkconv = PIDGIN_CONVERSATION(c);
4414 if (gtkconv->win != win) 4414 if (gtkconv->win != win)
4415 { 4415 {
4416 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv); 4416 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
4417 gaim_gtk_conv_window_add_gtkconv(win, gtkconv); 4417 pidgin_conv_window_add_gtkconv(win, gtkconv);
4418 } 4418 }
4419 } 4419 }
4420 4420
4421 /* Make this conversation the active conversation */ 4421 /* Make this conversation the active conversation */
4422 gaim_gtk_conv_window_switch_gtkconv(win, gtkconv); 4422 pidgin_conv_window_switch_gtkconv(win, gtkconv);
4423 4423
4424 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); 4424 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
4425 } 4425 }
4426 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) 4426 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
4427 { 4427 {
4428 char *protocol = NULL; 4428 char *protocol = NULL;
4429 char *username = NULL; 4429 char *username = NULL;
4430 GaimAccount *account; 4430 GaimAccount *account;
4431 GaimGtkConversation *gtkconv; 4431 PidginConversation *gtkconv;
4432 4432
4433 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account, 4433 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account,
4434 &protocol, &username, NULL)) 4434 &protocol, &username, NULL))
4435 { 4435 {
4436 if (account == NULL) 4436 if (account == NULL)
4437 { 4437 {
4438 gaim_notify_error(win, NULL, 4438 gaim_notify_error(win, NULL,
4440 "can add that buddy."), NULL); 4440 "can add that buddy."), NULL);
4441 } 4441 }
4442 else 4442 else
4443 { 4443 {
4444 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, username); 4444 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, username);
4445 gtkconv = GAIM_GTK_CONVERSATION(c); 4445 gtkconv = PIDGIN_CONVERSATION(c);
4446 if (gtkconv->win != win) 4446 if (gtkconv->win != win)
4447 { 4447 {
4448 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv); 4448 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
4449 gaim_gtk_conv_window_add_gtkconv(win, gtkconv); 4449 pidgin_conv_window_add_gtkconv(win, gtkconv);
4450 } 4450 }
4451 } 4451 }
4452 } 4452 }
4453 4453
4454 g_free(username); 4454 g_free(username);
4471 GTK_IMHTML_DND_TARGETS, 4471 GTK_IMHTML_DND_TARGETS,
4472 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, GTK_IMHTML_DRAG_NUM}, 4472 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, GTK_IMHTML_DRAG_NUM},
4473 {"application/x-im-contact", 0, GTK_IMHTML_DRAG_NUM + 1} 4473 {"application/x-im-contact", 0, GTK_IMHTML_DRAG_NUM + 1}
4474 }; 4474 };
4475 4475
4476 static GaimGtkConversation * 4476 static PidginConversation *
4477 gaim_gtk_conv_find_gtkconv(GaimConversation * conv) 4477 pidgin_conv_find_gtkconv(GaimConversation * conv)
4478 { 4478 {
4479 GaimBuddy *bud = gaim_find_buddy(conv->account, conv->name), *b; 4479 GaimBuddy *bud = gaim_find_buddy(conv->account, conv->name), *b;
4480 GaimContact *c; 4480 GaimContact *c;
4481 GaimBlistNode *cn; 4481 GaimBlistNode *cn;
4482 4482
4504 GList *list; 4504 GList *list;
4505 4505
4506 g_return_if_fail(bnode); 4506 g_return_if_fail(bnode);
4507 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(bnode)); 4507 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(bnode));
4508 4508
4509 for (list = gaim_gtk_conv_windows_get_list(); list; list = list->next) 4509 for (list = pidgin_conv_windows_get_list(); list; list = list->next)
4510 { 4510 {
4511 GaimGtkWindow *win = list->data; 4511 PidginWindow *win = list->data;
4512 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win); 4512 GaimConversation *conv = pidgin_conv_window_get_active_conversation(win);
4513 4513
4514 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) 4514 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM)
4515 continue; 4515 continue;
4516 4516
4517 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_MENU); 4517 pidginconv_update_fields(conv, PIDGINCONV_MENU);
4518 } 4518 }
4519 } 4519 }
4520 4520
4521 /************************************************************************** 4521 /**************************************************************************
4522 * Conversation UI operations 4522 * Conversation UI operations
4523 **************************************************************************/ 4523 **************************************************************************/
4524 static void 4524 static void
4525 private_gtkconv_new(GaimConversation *conv, gboolean hidden) 4525 private_gtkconv_new(GaimConversation *conv, gboolean hidden)
4526 { 4526 {
4527 GaimGtkConversation *gtkconv; 4527 PidginConversation *gtkconv;
4528 GaimConversationType conv_type = gaim_conversation_get_type(conv); 4528 GaimConversationType conv_type = gaim_conversation_get_type(conv);
4529 GtkWidget *pane = NULL; 4529 GtkWidget *pane = NULL;
4530 GtkWidget *tab_cont; 4530 GtkWidget *tab_cont;
4531 4531
4532 if (conv_type == GAIM_CONV_TYPE_IM && (gtkconv = gaim_gtk_conv_find_gtkconv(conv))) { 4532 if (conv_type == GAIM_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) {
4533 conv->ui_data = gtkconv; 4533 conv->ui_data = gtkconv;
4534 if (!g_list_find(gtkconv->convs, conv)) 4534 if (!g_list_find(gtkconv->convs, conv))
4535 gtkconv->convs = g_list_prepend(gtkconv->convs, conv); 4535 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
4536 gaim_gtkconv_switch_active_conversation(conv); 4536 pidginconv_switch_active_conversation(conv);
4537 return; 4537 return;
4538 } 4538 }
4539 4539
4540 gtkconv = g_new0(GaimGtkConversation, 1); 4540 gtkconv = g_new0(PidginConversation, 1);
4541 conv->ui_data = gtkconv; 4541 conv->ui_data = gtkconv;
4542 gtkconv->active_conv = conv; 4542 gtkconv->active_conv = conv;
4543 gtkconv->convs = g_list_prepend(gtkconv->convs, conv); 4543 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
4544 gtkconv->send_history = g_list_append(NULL, NULL); 4544 gtkconv->send_history = g_list_append(NULL, NULL);
4545 4545
4548 gtkconv->tooltips = gtk_tooltips_new(); 4548 gtkconv->tooltips = gtk_tooltips_new();
4549 gtkconv->unseen_state = GAIM_UNSEEN_NONE; 4549 gtkconv->unseen_state = GAIM_UNSEEN_NONE;
4550 gtkconv->unseen_count = 0; 4550 gtkconv->unseen_count = 0;
4551 4551
4552 if (conv_type == GAIM_CONV_TYPE_IM) { 4552 if (conv_type == GAIM_CONV_TYPE_IM) {
4553 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); 4553 gtkconv->u.im = g_malloc0(sizeof(PidginImPane));
4554 4554
4555 pane = setup_im_pane(gtkconv); 4555 pane = setup_im_pane(gtkconv);
4556 } else if (conv_type == GAIM_CONV_TYPE_CHAT) { 4556 } else if (conv_type == GAIM_CONV_TYPE_CHAT) {
4557 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); 4557 gtkconv->u.chat = g_malloc0(sizeof(PidginChatPane));
4558 pane = setup_chat_pane(gtkconv); 4558 pane = setup_chat_pane(gtkconv);
4559 } 4559 }
4560 4560
4561 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml), 4561 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml),
4562 gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE); 4562 gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE);
4598 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", 4598 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received",
4599 G_CALLBACK(conv_dnd_recv), gtkconv); 4599 G_CALLBACK(conv_dnd_recv), gtkconv);
4600 4600
4601 /* Setup the container for the tab. */ 4601 /* Setup the container for the tab. */
4602 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); 4602 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
4603 g_object_set_data(G_OBJECT(tab_cont), "GaimGtkConversation", gtkconv); 4603 g_object_set_data(G_OBJECT(tab_cont), "PidginConversation", gtkconv);
4604 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), GAIM_HIG_BOX_SPACE); 4604 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), GAIM_HIG_BOX_SPACE);
4605 gtk_container_add(GTK_CONTAINER(tab_cont), pane); 4605 gtk_container_add(GTK_CONTAINER(tab_cont), pane);
4606 gtk_widget_show(pane); 4606 gtk_widget_show(pane);
4607 4607
4608 gtkconv->make_sound = TRUE; 4608 gtkconv->make_sound = TRUE;
4620 g_signal_connect_swapped(G_OBJECT(pane), "focus", 4620 g_signal_connect_swapped(G_OBJECT(pane), "focus",
4621 G_CALLBACK(gtk_widget_grab_focus), 4621 G_CALLBACK(gtk_widget_grab_focus),
4622 gtkconv->entry); 4622 gtkconv->entry);
4623 4623
4624 if (hidden) 4624 if (hidden)
4625 gaim_gtk_conv_window_add_gtkconv(hidden_convwin, gtkconv); 4625 pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
4626 else 4626 else
4627 gaim_gtkconv_placement_place(gtkconv); 4627 pidginconv_placement_place(gtkconv);
4628 4628
4629 if (nick_colors == NULL) { 4629 if (nick_colors == NULL) {
4630 nbr_nick_colors = NUM_NICK_COLORS; 4630 nbr_nick_colors = NUM_NICK_COLORS;
4631 nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]); 4631 nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]);
4632 } 4632 }
4633 } 4633 }
4634 4634
4635 static void 4635 static void
4636 gaim_gtkconv_new_hidden(GaimConversation *conv) 4636 pidginconv_new_hidden(GaimConversation *conv)
4637 { 4637 {
4638 private_gtkconv_new(conv, TRUE); 4638 private_gtkconv_new(conv, TRUE);
4639 } 4639 }
4640 4640
4641 void 4641 void
4642 gaim_gtkconv_new(GaimConversation *conv) 4642 pidginconv_new(GaimConversation *conv)
4643 { 4643 {
4644 private_gtkconv_new(conv, FALSE); 4644 private_gtkconv_new(conv, FALSE);
4645 } 4645 }
4646 4646
4647 static void 4647 static void
4648 received_im_msg_cb(GaimAccount *account, char *sender, char *message, 4648 received_im_msg_cb(GaimAccount *account, char *sender, char *message,
4649 GaimConversation *conv, GaimMessageFlags flags) 4649 GaimConversation *conv, GaimMessageFlags flags)
4650 { 4650 {
4651 GaimConversationUiOps *ui_ops = gaim_gtk_conversations_get_conv_ui_ops(); 4651 GaimConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops();
4652 if (conv != NULL) 4652 if (conv != NULL)
4653 return; 4653 return;
4654 4654
4655 /* create hidden conv if hide_new pref is always */ 4655 /* create hidden conv if hide_new pref is always */
4656 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always") == 0) 4656 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always") == 0)
4657 { 4657 {
4658 ui_ops->create_conversation = gaim_gtkconv_new_hidden; 4658 ui_ops->create_conversation = pidginconv_new_hidden;
4659 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender); 4659 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender);
4660 ui_ops->create_conversation = gaim_gtkconv_new; 4660 ui_ops->create_conversation = pidginconv_new;
4661 return; 4661 return;
4662 } 4662 }
4663 4663
4664 /* create hidden conv if hide_new pref is away and account is away */ 4664 /* create hidden conv if hide_new pref is away and account is away */
4665 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away") == 0 && 4665 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away") == 0 &&
4666 !gaim_status_is_available(gaim_account_get_active_status(account))) 4666 !gaim_status_is_available(gaim_account_get_active_status(account)))
4667 { 4667 {
4668 ui_ops->create_conversation = gaim_gtkconv_new_hidden; 4668 ui_ops->create_conversation = pidginconv_new_hidden;
4669 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender); 4669 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender);
4670 ui_ops->create_conversation = gaim_gtkconv_new; 4670 ui_ops->create_conversation = pidginconv_new;
4671 return; 4671 return;
4672 } 4672 }
4673 } 4673 }
4674 4674
4675 static void 4675 static void
4676 gaim_gtkconv_destroy(GaimConversation *conv) 4676 pidginconv_destroy(GaimConversation *conv)
4677 { 4677 {
4678 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); 4678 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
4679 4679
4680 gtkconv->convs = g_list_remove(gtkconv->convs, conv); 4680 gtkconv->convs = g_list_remove(gtkconv->convs, conv);
4681 /* Don't destroy ourselves until all our convos are gone */ 4681 /* Don't destroy ourselves until all our convos are gone */
4682 if (gtkconv->convs) 4682 if (gtkconv->convs)
4683 return; 4683 return;
4684 4684
4685 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv); 4685 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
4686 4686
4687 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ 4687 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */
4688 gaim_request_close_with_handle(gtkconv); 4688 gaim_request_close_with_handle(gtkconv);
4689 gaim_notify_close_with_handle(gtkconv); 4689 gaim_notify_close_with_handle(gtkconv);
4690 4690
4713 g_free(gtkconv); 4713 g_free(gtkconv);
4714 } 4714 }
4715 4715
4716 4716
4717 static void 4717 static void
4718 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, 4718 pidginconv_write_im(GaimConversation *conv, const char *who,
4719 const char *message, GaimMessageFlags flags, 4719 const char *message, GaimMessageFlags flags,
4720 time_t mtime) 4720 time_t mtime)
4721 { 4721 {
4722 GaimGtkConversation *gtkconv; 4722 PidginConversation *gtkconv;
4723 4723
4724 gtkconv = GAIM_GTK_CONVERSATION(conv); 4724 gtkconv = PIDGIN_CONVERSATION(conv);
4725 4725
4726 if (conv != gtkconv->active_conv && 4726 if (conv != gtkconv->active_conv &&
4727 flags & GAIM_MESSAGE_ACTIVE_ONLY) 4727 flags & GAIM_MESSAGE_ACTIVE_ONLY)
4728 { 4728 {
4729 /* Plugins that want these messages suppressed should be 4729 /* Plugins that want these messages suppressed should be
4730 * calling gaim_conv_im_write(), so they get suppressed here, 4730 * calling gaim_conv_im_write(), so they get suppressed here,
4731 * before being written to the log. */ 4731 * before being written to the log. */
4732 gaim_debug_info("gtkconv", 4732 gaim_debug_info("gtkconv",
4733 "Suppressing message for an inactive conversation in gaim_gtkconv_write_im()\n"); 4733 "Suppressing message for an inactive conversation in pidginconv_write_im()\n");
4734 return; 4734 return;
4735 } 4735 }
4736 4736
4737 gaim_conversation_write(conv, who, message, flags, mtime); 4737 gaim_conversation_write(conv, who, message, flags, mtime);
4738 } 4738 }
4752 4752
4753 buddyname = (tag->name) + 6; 4753 buddyname = (tag->name) + 6;
4754 4754
4755 if (btn_event->button == 2 4755 if (btn_event->button == 2
4756 && event->type == GDK_2BUTTON_PRESS) { 4756 && event->type == GDK_2BUTTON_PRESS) {
4757 chat_do_info(GAIM_GTK_CONVERSATION(conv), buddyname); 4757 chat_do_info(PIDGIN_CONVERSATION(conv), buddyname);
4758 4758
4759 return TRUE; 4759 return TRUE;
4760 } else if (btn_event->button == 3 4760 } else if (btn_event->button == 3
4761 && event->type == GDK_BUTTON_PRESS) { 4761 && event->type == GDK_BUTTON_PRESS) {
4762 GtkTextIter start, end; 4762 GtkTextIter start, end;
4785 4785
4786 return FALSE; 4786 return FALSE;
4787 } 4787 }
4788 4788
4789 static GtkTextTag *get_buddy_tag(GaimConversation *conv, const char *who) { 4789 static GtkTextTag *get_buddy_tag(GaimConversation *conv, const char *who) {
4790 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); 4790 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
4791 GtkTextTag *buddytag; 4791 GtkTextTag *buddytag;
4792 gchar *str; 4792 gchar *str;
4793 4793
4794 str = g_strdup_printf("BUDDY %s", who); 4794 str = g_strdup_printf("BUDDY %s", who);
4795 4795
4809 4809
4810 return buddytag; 4810 return buddytag;
4811 } 4811 }
4812 4812
4813 static void 4813 static void
4814 gaim_gtkconv_write_conv(GaimConversation *conv, const char *name, const char *alias, 4814 pidginconv_write_conv(GaimConversation *conv, const char *name, const char *alias,
4815 const char *message, GaimMessageFlags flags, 4815 const char *message, GaimMessageFlags flags,
4816 time_t mtime) 4816 time_t mtime)
4817 { 4817 {
4818 GaimGtkConversation *gtkconv; 4818 PidginConversation *gtkconv;
4819 GaimGtkWindow *win; 4819 PidginWindow *win;
4820 GaimConnection *gc; 4820 GaimConnection *gc;
4821 GaimAccount *account; 4821 GaimAccount *account;
4822 GaimPluginProtocolInfo *prpl_info; 4822 GaimPluginProtocolInfo *prpl_info;
4823 int gtk_font_options = 0; 4823 int gtk_font_options = 0;
4824 int gtk_font_options_all = 0; 4824 int gtk_font_options_all = 0;
4836 gboolean plugin_return; 4836 gboolean plugin_return;
4837 char *bracket; 4837 char *bracket;
4838 int tag_count = 0; 4838 int tag_count = 0;
4839 4839
4840 g_return_if_fail(conv != NULL); 4840 g_return_if_fail(conv != NULL);
4841 gtkconv = GAIM_GTK_CONVERSATION(conv); 4841 gtkconv = PIDGIN_CONVERSATION(conv);
4842 g_return_if_fail(gtkconv != NULL); 4842 g_return_if_fail(gtkconv != NULL);
4843 4843
4844 if (conv != gtkconv->active_conv) 4844 if (conv != gtkconv->active_conv)
4845 { 4845 {
4846 if (flags & GAIM_MESSAGE_ACTIVE_ONLY) 4846 if (flags & GAIM_MESSAGE_ACTIVE_ONLY)
4848 /* Unless this had GAIM_MESSAGE_NO_LOG, this message 4848 /* Unless this had GAIM_MESSAGE_NO_LOG, this message
4849 * was logged. Plugin writers: if this isn't what 4849 * was logged. Plugin writers: if this isn't what
4850 * you wanted, call gaim_conv_im_write() instead of 4850 * you wanted, call gaim_conv_im_write() instead of
4851 * gaim_conversation_write(). */ 4851 * gaim_conversation_write(). */
4852 gaim_debug_info("gtkconv", 4852 gaim_debug_info("gtkconv",
4853 "Suppressing message for an inactive conversation in gaim_gtkconv_write_conv()\n"); 4853 "Suppressing message for an inactive conversation in pidginconv_write_conv()\n");
4854 return; 4854 return;
4855 } 4855 }
4856 4856
4857 /* Set the active conversation to the one that just messaged us. */ 4857 /* Set the active conversation to the one that just messaged us. */
4858 /* TODO: consider not doing this if the account is offline or something */ 4858 /* TODO: consider not doing this if the account is offline or something */
4859 if (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV)) 4859 if (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))
4860 gaim_gtkconv_switch_active_conversation(conv); 4860 pidginconv_switch_active_conversation(conv);
4861 } 4861 }
4862 4862
4863 type = gaim_conversation_get_type(conv); 4863 type = gaim_conversation_get_type(conv);
4864 account = gaim_conversation_get_account(conv); 4864 account = gaim_conversation_get_account(conv);
4865 g_return_if_fail(account != NULL); 4865 g_return_if_fail(account != NULL);
4866 gc = gaim_account_get_connection(account); 4866 gc = gaim_account_get_connection(account);
4867 g_return_if_fail(gc != NULL); 4867 g_return_if_fail(gc != NULL);
4868 4868
4869 displaying = g_strdup(message); 4869 displaying = g_strdup(message);
4870 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1( 4870 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1(
4871 gaim_gtk_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ? 4871 pidgin_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ?
4872 "displaying-im-msg" : "displaying-chat-msg"), 4872 "displaying-im-msg" : "displaying-chat-msg"),
4873 account, name, &displaying, conv, flags)); 4873 account, name, &displaying, conv, flags));
4874 if (plugin_return) 4874 if (plugin_return)
4875 { 4875 {
4876 g_free(displaying); 4876 g_free(displaying);
4930 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; 4930 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING;
4931 4931
4932 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) 4932 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml))))
4933 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all); 4933 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all);
4934 4934
4935 mdate = gaim_signal_emit_return_1(gaim_gtk_conversations_get_handle(), 4935 mdate = gaim_signal_emit_return_1(pidgin_conversations_get_handle(),
4936 "conversation-timestamp", 4936 "conversation-timestamp",
4937 conv, mtime); 4937 conv, mtime);
4938 if (mdate == NULL) 4938 if (mdate == NULL)
4939 { 4939 {
4940 struct tm *tm = localtime(&mtime); 4940 struct tm *tm = localtime(&mtime);
5158 5158
5159 g_free(mdate); 5159 g_free(mdate);
5160 g_free(sml_attrib); 5160 g_free(sml_attrib);
5161 5161
5162 /* Tab highlighting stuff */ 5162 /* Tab highlighting stuff */
5163 if (!(flags & GAIM_MESSAGE_SEND) && !gaim_gtkconv_has_focus(conv)) 5163 if (!(flags & GAIM_MESSAGE_SEND) && !pidginconv_has_focus(conv))
5164 { 5164 {
5165 GaimUnseenState unseen = GAIM_UNSEEN_NONE; 5165 GaimUnseenState unseen = GAIM_UNSEEN_NONE;
5166 5166
5167 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK) 5167 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK)
5168 unseen = GAIM_UNSEEN_NICK; 5168 unseen = GAIM_UNSEEN_NICK;
5175 unseen = GAIM_UNSEEN_TEXT; 5175 unseen = GAIM_UNSEEN_TEXT;
5176 5176
5177 gtkconv_set_unseen(gtkconv, unseen); 5177 gtkconv_set_unseen(gtkconv, unseen);
5178 } 5178 }
5179 5179
5180 gaim_signal_emit(gaim_gtk_conversations_get_handle(), 5180 gaim_signal_emit(pidgin_conversations_get_handle(),
5181 (type == GAIM_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"), 5181 (type == GAIM_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"),
5182 account, name, displaying, conv, flags); 5182 account, name, displaying, conv, flags);
5183 g_free(displaying); 5183 g_free(displaying);
5184 } 5184 }
5185 static void 5185 static void
5186 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *cbuddies, gboolean new_arrivals) 5186 pidginconv_chat_add_users(GaimConversation *conv, GList *cbuddies, gboolean new_arrivals)
5187 { 5187 {
5188 GaimConvChat *chat; 5188 GaimConvChat *chat;
5189 GaimGtkConversation *gtkconv; 5189 PidginConversation *gtkconv;
5190 GaimGtkChatPane *gtkchat; 5190 PidginChatPane *gtkchat;
5191 GtkListStore *ls; 5191 GtkListStore *ls;
5192 GList *l; 5192 GList *l;
5193 5193
5194 char tmp[BUF_LONG]; 5194 char tmp[BUF_LONG];
5195 int num_users; 5195 int num_users;
5196 5196
5197 chat = GAIM_CONV_CHAT(conv); 5197 chat = GAIM_CONV_CHAT(conv);
5198 gtkconv = GAIM_GTK_CONVERSATION(conv); 5198 gtkconv = PIDGIN_CONVERSATION(conv);
5199 gtkchat = gtkconv->u.chat; 5199 gtkchat = gtkconv->u.chat;
5200 5200
5201 num_users = g_list_length(gaim_conv_chat_get_users(chat)); 5201 num_users = g_list_length(gaim_conv_chat_get_users(chat));
5202 5202
5203 g_snprintf(tmp, sizeof(tmp), 5203 g_snprintf(tmp, sizeof(tmp),
5226 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN, 5226 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN,
5227 GTK_SORT_ASCENDING); 5227 GTK_SORT_ASCENDING);
5228 } 5228 }
5229 5229
5230 static void 5230 static void
5231 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, 5231 pidginconv_chat_rename_user(GaimConversation *conv, const char *old_name,
5232 const char *new_name, const char *new_alias) 5232 const char *new_name, const char *new_alias)
5233 { 5233 {
5234 GaimConvChat *chat; 5234 GaimConvChat *chat;
5235 GaimGtkConversation *gtkconv; 5235 PidginConversation *gtkconv;
5236 GaimGtkChatPane *gtkchat; 5236 PidginChatPane *gtkchat;
5237 GaimConvChatBuddyFlags flags; 5237 GaimConvChatBuddyFlags flags;
5238 GaimConvChatBuddy *cbuddy; 5238 GaimConvChatBuddy *cbuddy;
5239 GtkTreeIter iter; 5239 GtkTreeIter iter;
5240 GtkTreeModel *model; 5240 GtkTreeModel *model;
5241 int f = 1; 5241 int f = 1;
5242 5242
5243 chat = GAIM_CONV_CHAT(conv); 5243 chat = GAIM_CONV_CHAT(conv);
5244 gtkconv = GAIM_GTK_CONVERSATION(conv); 5244 gtkconv = PIDGIN_CONVERSATION(conv);
5245 gtkchat = gtkconv->u.chat; 5245 gtkchat = gtkconv->u.chat;
5246 5246
5247 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); 5247 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
5248 5248
5249 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) 5249 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
5274 5274
5275 add_chat_buddy_common(conv, cbuddy, old_name); 5275 add_chat_buddy_common(conv, cbuddy, old_name);
5276 } 5276 }
5277 5277
5278 static void 5278 static void
5279 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) 5279 pidginconv_chat_remove_users(GaimConversation *conv, GList *users)
5280 { 5280 {
5281 GaimConvChat *chat; 5281 GaimConvChat *chat;
5282 GaimGtkConversation *gtkconv; 5282 PidginConversation *gtkconv;
5283 GaimGtkChatPane *gtkchat; 5283 PidginChatPane *gtkchat;
5284 GtkTreeIter iter; 5284 GtkTreeIter iter;
5285 GtkTreeModel *model; 5285 GtkTreeModel *model;
5286 GList *l; 5286 GList *l;
5287 char tmp[BUF_LONG]; 5287 char tmp[BUF_LONG];
5288 int num_users; 5288 int num_users;
5289 gboolean f; 5289 gboolean f;
5290 5290
5291 chat = GAIM_CONV_CHAT(conv); 5291 chat = GAIM_CONV_CHAT(conv);
5292 gtkconv = GAIM_GTK_CONVERSATION(conv); 5292 gtkconv = PIDGIN_CONVERSATION(conv);
5293 gtkchat = gtkconv->u.chat; 5293 gtkchat = gtkconv->u.chat;
5294 5294
5295 num_users = g_list_length(gaim_conv_chat_get_users(chat)); 5295 num_users = g_list_length(gaim_conv_chat_get_users(chat));
5296 5296
5297 for (l = users; l != NULL; l = l->next) { 5297 for (l = users; l != NULL; l = l->next) {
5327 5327
5328 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); 5328 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp);
5329 } 5329 }
5330 5330
5331 static void 5331 static void
5332 gaim_gtkconv_chat_update_user(GaimConversation *conv, const char *user) 5332 pidginconv_chat_update_user(GaimConversation *conv, const char *user)
5333 { 5333 {
5334 GaimConvChat *chat; 5334 GaimConvChat *chat;
5335 GaimConvChatBuddyFlags flags; 5335 GaimConvChatBuddyFlags flags;
5336 GaimConvChatBuddy *cbuddy; 5336 GaimConvChatBuddy *cbuddy;
5337 GaimGtkConversation *gtkconv; 5337 PidginConversation *gtkconv;
5338 GaimGtkChatPane *gtkchat; 5338 PidginChatPane *gtkchat;
5339 GtkTreeIter iter; 5339 GtkTreeIter iter;
5340 GtkTreeModel *model; 5340 GtkTreeModel *model;
5341 int f = 1; 5341 int f = 1;
5342 char *alias = NULL; 5342 char *alias = NULL;
5343 5343
5344 chat = GAIM_CONV_CHAT(conv); 5344 chat = GAIM_CONV_CHAT(conv);
5345 gtkconv = GAIM_GTK_CONVERSATION(conv); 5345 gtkconv = PIDGIN_CONVERSATION(conv);
5346 gtkchat = gtkconv->u.chat; 5346 gtkchat = gtkconv->u.chat;
5347 5347
5348 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); 5348 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
5349 5349
5350 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) 5350 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
5382 add_chat_buddy_common(conv, cbuddy, NULL); 5382 add_chat_buddy_common(conv, cbuddy, NULL);
5383 g_free(alias); 5383 g_free(alias);
5384 } 5384 }
5385 5385
5386 gboolean 5386 gboolean
5387 gaim_gtkconv_has_focus(GaimConversation *conv) 5387 pidginconv_has_focus(GaimConversation *conv)
5388 { 5388 {
5389 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); 5389 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
5390 GaimGtkWindow *win; 5390 PidginWindow *win;
5391 gboolean has_focus; 5391 gboolean has_focus;
5392 5392
5393 win = gtkconv->win; 5393 win = gtkconv->win;
5394 5394
5395 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL); 5395 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL);
5396 5396
5397 if (has_focus && gaim_gtk_conv_window_is_active_conversation(conv)) 5397 if (has_focus && pidgin_conv_window_is_active_conversation(conv))
5398 return TRUE; 5398 return TRUE;
5399 5399
5400 return FALSE; 5400 return FALSE;
5401 } 5401 }
5402 5402
5403 static void gaim_gtkconv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data) 5403 static void pidginconv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data)
5404 { 5404 {
5405 GtkIMHtmlSmiley *smiley; 5405 GtkIMHtmlSmiley *smiley;
5406 5406
5407 smiley = (GtkIMHtmlSmiley *)user_data; 5407 smiley = (GtkIMHtmlSmiley *)user_data;
5408 smiley->icon = gdk_pixbuf_loader_get_animation(loader); 5408 smiley->icon = gdk_pixbuf_loader_get_animation(loader);
5409 5409
5410 if (smiley->icon) 5410 if (smiley->icon)
5411 g_object_ref(G_OBJECT(smiley->icon)); 5411 g_object_ref(G_OBJECT(smiley->icon));
5412 #ifdef DEBUG_CUSTOM_SMILEY 5412 #ifdef DEBUG_CUSTOM_SMILEY
5413 gaim_debug_info("custom-smiley", "gaim_gtkconv_custom_smiley_allocated(): got GdkPixbufAnimation %p for smiley '%s'\n", smiley->icon, smiley->smile); 5413 gaim_debug_info("custom-smiley", "pidginconv_custom_smiley_allocated(): got GdkPixbufAnimation %p for smiley '%s'\n", smiley->icon, smiley->smile);
5414 #endif 5414 #endif
5415 } 5415 }
5416 5416
5417 static void gaim_gtkconv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data) 5417 static void pidginconv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data)
5418 { 5418 {
5419 GtkIMHtmlSmiley *smiley; 5419 GtkIMHtmlSmiley *smiley;
5420 GtkWidget *icon = NULL; 5420 GtkWidget *icon = NULL;
5421 GtkTextChildAnchor *anchor = NULL; 5421 GtkTextChildAnchor *anchor = NULL;
5422 GSList *current = NULL; 5422 GSList *current = NULL;
5423 5423
5424 smiley = (GtkIMHtmlSmiley *)user_data; 5424 smiley = (GtkIMHtmlSmiley *)user_data;
5425 if (!smiley->imhtml) { 5425 if (!smiley->imhtml) {
5426 #ifdef DEBUG_CUSTOM_SMILEY 5426 #ifdef DEBUG_CUSTOM_SMILEY
5427 gaim_debug_error("custom-smiley", "gaim_gtkconv_custom_smiley_closed(): orphan smiley found: %p\n", smiley); 5427 gaim_debug_error("custom-smiley", "pidginconv_custom_smiley_closed(): orphan smiley found: %p\n", smiley);
5428 #endif 5428 #endif
5429 g_object_unref(G_OBJECT(loader)); 5429 g_object_unref(G_OBJECT(loader));
5430 smiley->loader = NULL; 5430 smiley->loader = NULL;
5431 return; 5431 return;
5432 } 5432 }
5434 for (current = smiley->anchors; current; current = g_slist_next(current)) { 5434 for (current = smiley->anchors; current; current = g_slist_next(current)) {
5435 5435
5436 icon = gtk_image_new_from_animation(smiley->icon); 5436 icon = gtk_image_new_from_animation(smiley->icon);
5437 5437
5438 #ifdef DEBUG_CUSTOM_SMILEY 5438 #ifdef DEBUG_CUSTOM_SMILEY
5439 gaim_debug_info("custom-smiley", "gaim_gtkconv_custom_smiley_closed(): got GtkImage %p from GtkPixbufAnimation %p for smiley '%s'\n", 5439 gaim_debug_info("custom-smiley", "pidginconv_custom_smiley_closed(): got GtkImage %p from GtkPixbufAnimation %p for smiley '%s'\n",
5440 icon, smiley->icon, smiley->smile); 5440 icon, smiley->icon, smiley->smile);
5441 #endif 5441 #endif
5442 if (icon) { 5442 if (icon) {
5443 gtk_widget_show(icon); 5443 gtk_widget_show(icon);
5444 5444
5480 5480
5481 /* XXX: Is it necessary to _unref the loader first? */ 5481 /* XXX: Is it necessary to _unref the loader first? */
5482 smiley->loader = gdk_pixbuf_loader_new(); 5482 smiley->loader = gdk_pixbuf_loader_new();
5483 smiley->icon = NULL; 5483 smiley->icon = NULL;
5484 5484
5485 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(gaim_gtkconv_custom_smiley_allocated), smiley); 5485 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(pidginconv_custom_smiley_allocated), smiley);
5486 g_signal_connect(smiley->loader, "closed", G_CALLBACK(gaim_gtkconv_custom_smiley_closed), smiley); 5486 g_signal_connect(smiley->loader, "closed", G_CALLBACK(pidginconv_custom_smiley_closed), smiley);
5487 5487
5488 return TRUE; 5488 return TRUE;
5489 } 5489 }
5490 5490
5491 loader = gdk_pixbuf_loader_new(); 5491 loader = gdk_pixbuf_loader_new();
5497 smiley->file = NULL; 5497 smiley->file = NULL;
5498 smiley->smile = g_strdup(smile); 5498 smiley->smile = g_strdup(smile);
5499 smiley->loader = loader; 5499 smiley->loader = loader;
5500 smiley->flags = smiley->flags | GTK_IMHTML_SMILEY_CUSTOM; 5500 smiley->flags = smiley->flags | GTK_IMHTML_SMILEY_CUSTOM;
5501 5501
5502 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(gaim_gtkconv_custom_smiley_allocated), smiley); 5502 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(pidginconv_custom_smiley_allocated), smiley);
5503 g_signal_connect(smiley->loader, "closed", G_CALLBACK(gaim_gtkconv_custom_smiley_closed), smiley); 5503 g_signal_connect(smiley->loader, "closed", G_CALLBACK(pidginconv_custom_smiley_closed), smiley);
5504 5504
5505 gtk_imhtml_associate_smiley(imhtml, sml, smiley); 5505 gtk_imhtml_associate_smiley(imhtml, sml, smiley);
5506 5506
5507 return TRUE; 5507 return TRUE;
5508 } 5508 }
5509 5509
5510 static gboolean 5510 static gboolean
5511 gaim_gtkconv_custom_smiley_add(GaimConversation *conv, const char *smile, gboolean remote) 5511 pidginconv_custom_smiley_add(GaimConversation *conv, const char *smile, gboolean remote)
5512 { 5512 {
5513 GaimGtkConversation *gtkconv; 5513 PidginConversation *gtkconv;
5514 struct smiley_list *list; 5514 struct smiley_list *list;
5515 const char *sml = NULL, *conv_sml; 5515 const char *sml = NULL, *conv_sml;
5516 5516
5517 if (!conv || !smile || !*smile) { 5517 if (!conv || !smile || !*smile) {
5518 return FALSE; 5518 return FALSE;
5519 } 5519 }
5520 5520
5521 /* If smileys are off, return false */ 5521 /* If smileys are off, return false */
5522 if (gaim_gtkthemes_smileys_disabled()) 5522 if (pidginthemes_smileys_disabled())
5523 return FALSE; 5523 return FALSE;
5524 5524
5525 /* If possible add this smiley to the current theme. 5525 /* If possible add this smiley to the current theme.
5526 * The addition is only temporary: custom smilies aren't saved to disk. */ 5526 * The addition is only temporary: custom smilies aren't saved to disk. */
5527 conv_sml = gaim_account_get_protocol_name(conv->account); 5527 conv_sml = gaim_account_get_protocol_name(conv->account);
5528 gtkconv = GAIM_GTK_CONVERSATION(conv); 5528 gtkconv = PIDGIN_CONVERSATION(conv);
5529 5529
5530 for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) { 5530 for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) {
5531 if (!strcmp(list->sml, conv_sml)) { 5531 if (!strcmp(list->sml, conv_sml)) {
5532 sml = list->sml; 5532 sml = list->sml;
5533 break; 5533 break;
5543 5543
5544 return TRUE; 5544 return TRUE;
5545 } 5545 }
5546 5546
5547 static void 5547 static void
5548 gaim_gtkconv_custom_smiley_write(GaimConversation *conv, const char *smile, 5548 pidginconv_custom_smiley_write(GaimConversation *conv, const char *smile,
5549 const guchar *data, gsize size) 5549 const guchar *data, gsize size)
5550 { 5550 {
5551 GaimGtkConversation *gtkconv; 5551 PidginConversation *gtkconv;
5552 GtkIMHtmlSmiley *smiley; 5552 GtkIMHtmlSmiley *smiley;
5553 GdkPixbufLoader *loader; 5553 GdkPixbufLoader *loader;
5554 const char *sml; 5554 const char *sml;
5555 5555
5556 sml = gaim_account_get_protocol_name(conv->account); 5556 sml = gaim_account_get_protocol_name(conv->account);
5557 gtkconv = GAIM_GTK_CONVERSATION(conv); 5557 gtkconv = PIDGIN_CONVERSATION(conv);
5558 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); 5558 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile);
5559 5559
5560 if (!smiley) 5560 if (!smiley)
5561 return; 5561 return;
5562 5562
5566 5566
5567 gdk_pixbuf_loader_write(loader, data, size, NULL); 5567 gdk_pixbuf_loader_write(loader, data, size, NULL);
5568 } 5568 }
5569 5569
5570 static void 5570 static void
5571 gaim_gtkconv_custom_smiley_close(GaimConversation *conv, const char *smile) 5571 pidginconv_custom_smiley_close(GaimConversation *conv, const char *smile)
5572 { 5572 {
5573 GaimGtkConversation *gtkconv; 5573 PidginConversation *gtkconv;
5574 GtkIMHtmlSmiley *smiley; 5574 GtkIMHtmlSmiley *smiley;
5575 GdkPixbufLoader *loader; 5575 GdkPixbufLoader *loader;
5576 const char *sml; 5576 const char *sml;
5577 5577
5578 g_return_if_fail(conv != NULL); 5578 g_return_if_fail(conv != NULL);
5579 g_return_if_fail(smile != NULL); 5579 g_return_if_fail(smile != NULL);
5580 5580
5581 sml = gaim_account_get_protocol_name(conv->account); 5581 sml = gaim_account_get_protocol_name(conv->account);
5582 gtkconv = GAIM_GTK_CONVERSATION(conv); 5582 gtkconv = PIDGIN_CONVERSATION(conv);
5583 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); 5583 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile);
5584 5584
5585 if (!smiley) 5585 if (!smiley)
5586 return; 5586 return;
5587 5587
5597 gdk_pixbuf_loader_close(loader, NULL); 5597 gdk_pixbuf_loader_close(loader, NULL);
5598 5598
5599 } 5599 }
5600 5600
5601 static void 5601 static void
5602 gaim_gtkconv_send_confirm(GaimConversation *conv, const char *message) 5602 pidginconv_send_confirm(GaimConversation *conv, const char *message)
5603 { 5603 {
5604 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); 5604 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
5605 5605
5606 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0); 5606 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0);
5607 } 5607 }
5608 5608
5609 /* 5609 /*
5610 * Makes sure all the menu items and all the buttons are hidden/shown and 5610 * Makes sure all the menu items and all the buttons are hidden/shown and
5611 * sensitive/insensitive. This is called after changing tabs and when an 5611 * sensitive/insensitive. This is called after changing tabs and when an
5612 * account signs on or off. 5612 * account signs on or off.
5613 */ 5613 */
5614 static void 5614 static void
5615 gray_stuff_out(GaimGtkConversation *gtkconv) 5615 gray_stuff_out(PidginConversation *gtkconv)
5616 { 5616 {
5617 GaimGtkWindow *win; 5617 PidginWindow *win;
5618 GaimConversation *conv = gtkconv->active_conv; 5618 GaimConversation *conv = gtkconv->active_conv;
5619 GaimConnection *gc; 5619 GaimConnection *gc;
5620 GaimPluginProtocolInfo *prpl_info = NULL; 5620 GaimPluginProtocolInfo *prpl_info = NULL;
5621 GdkPixbuf *window_icon = NULL; 5621 GdkPixbuf *window_icon = NULL;
5622 GtkIMHtmlButtons buttons; 5622 GtkIMHtmlButtons buttons;
5623 GaimAccount *account; 5623 GaimAccount *account;
5624 5624
5625 win = gaim_gtkconv_get_window(gtkconv); 5625 win = pidginconv_get_window(gtkconv);
5626 gc = gaim_conversation_get_gc(conv); 5626 gc = gaim_conversation_get_gc(conv);
5627 account = gaim_conversation_get_account(conv); 5627 account = gaim_conversation_get_account(conv);
5628 5628
5629 if (gc != NULL) 5629 if (gc != NULL)
5630 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 5630 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
5776 } 5776 }
5777 5777
5778 /* 5778 /*
5779 * Update the window's icon 5779 * Update the window's icon
5780 */ 5780 */
5781 if (gaim_gtk_conv_window_is_active_conversation(conv)) 5781 if (pidgin_conv_window_is_active_conversation(conv))
5782 { 5782 {
5783 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && 5783 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) &&
5784 (gtkconv->u.im->anim)) 5784 (gtkconv->u.im->anim))
5785 { 5785 {
5786 window_icon = 5786 window_icon =
5787 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); 5787 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
5788 g_object_ref(window_icon); 5788 g_object_ref(window_icon);
5789 } else { 5789 } else {
5790 window_icon = gaim_gtkconv_get_tab_icon(conv, FALSE); 5790 window_icon = pidginconv_get_tab_icon(conv, FALSE);
5791 } 5791 }
5792 gtk_window_set_icon(GTK_WINDOW(win->window), window_icon); 5792 gtk_window_set_icon(GTK_WINDOW(win->window), window_icon);
5793 if (window_icon != NULL) 5793 if (window_icon != NULL)
5794 g_object_unref(G_OBJECT(window_icon)); 5794 g_object_unref(G_OBJECT(window_icon));
5795 } 5795 }
5796 } 5796 }
5797 5797
5798 static void 5798 static void
5799 gaim_gtkconv_update_fields(GaimConversation *conv, GaimGtkConvFields fields) 5799 pidginconv_update_fields(GaimConversation *conv, PidginConvFields fields)
5800 { 5800 {
5801 GaimGtkConversation *gtkconv; 5801 PidginConversation *gtkconv;
5802 GaimGtkWindow *win; 5802 PidginWindow *win;
5803 5803
5804 gtkconv = GAIM_GTK_CONVERSATION(conv); 5804 gtkconv = PIDGIN_CONVERSATION(conv);
5805 if (!gtkconv) 5805 if (!gtkconv)
5806 return; 5806 return;
5807 win = gaim_gtkconv_get_window(gtkconv); 5807 win = pidginconv_get_window(gtkconv);
5808 if (!win) 5808 if (!win)
5809 return; 5809 return;
5810 5810
5811 if (fields & GAIM_GTKCONV_SET_TITLE) 5811 if (fields & PIDGINCONV_SET_TITLE)
5812 { 5812 {
5813 gaim_conversation_autoset_title(conv); 5813 gaim_conversation_autoset_title(conv);
5814 } 5814 }
5815 5815
5816 if (fields & GAIM_GTKCONV_BUDDY_ICON) 5816 if (fields & PIDGINCONV_BUDDY_ICON)
5817 { 5817 {
5818 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) 5818 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
5819 gaim_gtkconv_update_buddy_icon(conv); 5819 pidginconv_update_buddy_icon(conv);
5820 } 5820 }
5821 5821
5822 if (fields & GAIM_GTKCONV_MENU) 5822 if (fields & PIDGINCONV_MENU)
5823 { 5823 {
5824 gray_stuff_out(GAIM_GTK_CONVERSATION(conv)); 5824 gray_stuff_out(PIDGIN_CONVERSATION(conv));
5825 generate_send_to_items(win); 5825 generate_send_to_items(win);
5826 } 5826 }
5827 5827
5828 if (fields & GAIM_GTKCONV_TAB_ICON) 5828 if (fields & PIDGINCONV_TAB_ICON)
5829 { 5829 {
5830 update_tab_icon(conv); 5830 update_tab_icon(conv);
5831 generate_send_to_items(win); /* To update the icons in SendTo menu */ 5831 generate_send_to_items(win); /* To update the icons in SendTo menu */
5832 } 5832 }
5833 5833
5834 if ((fields & GAIM_GTKCONV_TOPIC) && 5834 if ((fields & PIDGINCONV_TOPIC) &&
5835 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) 5835 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
5836 { 5836 {
5837 const char *topic; 5837 const char *topic;
5838 GaimConvChat *chat = GAIM_CONV_CHAT(conv); 5838 GaimConvChat *chat = GAIM_CONV_CHAT(conv);
5839 GaimGtkChatPane *gtkchat = gtkconv->u.chat; 5839 PidginChatPane *gtkchat = gtkconv->u.chat;
5840 5840
5841 if (gtkchat->topic_text != NULL) 5841 if (gtkchat->topic_text != NULL)
5842 { 5842 {
5843 topic = gaim_conv_chat_get_topic(chat); 5843 topic = gaim_conv_chat_get_topic(chat);
5844 5844
5846 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, 5846 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text,
5847 topic ? topic : "", NULL); 5847 topic ? topic : "", NULL);
5848 } 5848 }
5849 } 5849 }
5850 5850
5851 if (fields & GAIM_GTKCONV_SMILEY_THEME) 5851 if (fields & PIDGINCONV_SMILEY_THEME)
5852 gaim_gtkthemes_smiley_themeize(GAIM_GTK_CONVERSATION(conv)->imhtml); 5852 pidginthemes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml);
5853 5853
5854 if ((fields & GAIM_GTKCONV_COLORIZE_TITLE) || 5854 if ((fields & PIDGINCONV_COLORIZE_TITLE) ||
5855 (fields & GAIM_GTKCONV_SET_TITLE)) 5855 (fields & PIDGINCONV_SET_TITLE))
5856 { 5856 {
5857 char *title; 5857 char *title;
5858 GaimConvIm *im = NULL; 5858 GaimConvIm *im = NULL;
5859 GaimAccount *account = gaim_conversation_get_account(conv); 5859 GaimAccount *account = gaim_conversation_get_account(conv);
5860 AtkObject *accessibility_obj; 5860 AtkObject *accessibility_obj;
5919 g_free(label); 5919 g_free(label);
5920 } 5920 }
5921 else 5921 else
5922 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); 5922 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title);
5923 5923
5924 if (gaim_gtk_conv_window_is_active_conversation(conv)) 5924 if (pidgin_conv_window_is_active_conversation(conv))
5925 update_typing_icon(gtkconv); 5925 update_typing_icon(gtkconv);
5926 5926
5927 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); 5927 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title);
5928 if (gaim_gtk_conv_window_is_active_conversation(conv)) 5928 if (pidgin_conv_window_is_active_conversation(conv))
5929 gtk_window_set_title(GTK_WINDOW(win->window), title); 5929 gtk_window_set_title(GTK_WINDOW(win->window), title);
5930 5930
5931 g_free(title); 5931 g_free(title);
5932 } 5932 }
5933 } 5933 }
5934 5934
5935 static void 5935 static void
5936 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) 5936 pidginconv_updated(GaimConversation *conv, GaimConvUpdateType type)
5937 { 5937 {
5938 GaimGtkConvFields flags = 0; 5938 PidginConvFields flags = 0;
5939 5939
5940 g_return_if_fail(conv != NULL); 5940 g_return_if_fail(conv != NULL);
5941 5941
5942 if (type == GAIM_CONV_UPDATE_ACCOUNT) 5942 if (type == GAIM_CONV_UPDATE_ACCOUNT)
5943 { 5943 {
5944 flags = GAIM_GTKCONV_ALL; 5944 flags = PIDGINCONV_ALL;
5945 } 5945 }
5946 else if (type == GAIM_CONV_UPDATE_TYPING || 5946 else if (type == GAIM_CONV_UPDATE_TYPING ||
5947 type == GAIM_CONV_UPDATE_UNSEEN || 5947 type == GAIM_CONV_UPDATE_UNSEEN ||
5948 type == GAIM_CONV_UPDATE_TITLE) 5948 type == GAIM_CONV_UPDATE_TITLE)
5949 { 5949 {
5950 flags = GAIM_GTKCONV_COLORIZE_TITLE; 5950 flags = PIDGINCONV_COLORIZE_TITLE;
5951 } 5951 }
5952 else if (type == GAIM_CONV_UPDATE_TOPIC) 5952 else if (type == GAIM_CONV_UPDATE_TOPIC)
5953 { 5953 {
5954 flags = GAIM_GTKCONV_TOPIC; 5954 flags = PIDGINCONV_TOPIC;
5955 } 5955 }
5956 else if (type == GAIM_CONV_ACCOUNT_ONLINE || 5956 else if (type == GAIM_CONV_ACCOUNT_ONLINE ||
5957 type == GAIM_CONV_ACCOUNT_OFFLINE) 5957 type == GAIM_CONV_ACCOUNT_OFFLINE)
5958 { 5958 {
5959 flags = GAIM_GTKCONV_MENU | GAIM_GTKCONV_TAB_ICON | GAIM_GTKCONV_SET_TITLE; 5959 flags = PIDGINCONV_MENU | PIDGINCONV_TAB_ICON | PIDGINCONV_SET_TITLE;
5960 } 5960 }
5961 else if (type == GAIM_CONV_UPDATE_AWAY) 5961 else if (type == GAIM_CONV_UPDATE_AWAY)
5962 { 5962 {
5963 flags = GAIM_GTKCONV_TAB_ICON; 5963 flags = PIDGINCONV_TAB_ICON;
5964 } 5964 }
5965 else if (type == GAIM_CONV_UPDATE_ADD || 5965 else if (type == GAIM_CONV_UPDATE_ADD ||
5966 type == GAIM_CONV_UPDATE_REMOVE || 5966 type == GAIM_CONV_UPDATE_REMOVE ||
5967 type == GAIM_CONV_UPDATE_CHATLEFT) 5967 type == GAIM_CONV_UPDATE_CHATLEFT)
5968 { 5968 {
5969 flags = GAIM_GTKCONV_SET_TITLE | GAIM_GTKCONV_MENU; 5969 flags = PIDGINCONV_SET_TITLE | PIDGINCONV_MENU;
5970 } 5970 }
5971 else if (type == GAIM_CONV_UPDATE_ICON) 5971 else if (type == GAIM_CONV_UPDATE_ICON)
5972 { 5972 {
5973 flags = GAIM_GTKCONV_BUDDY_ICON; 5973 flags = PIDGINCONV_BUDDY_ICON;
5974 } 5974 }
5975 else if (type == GAIM_CONV_UPDATE_FEATURES) 5975 else if (type == GAIM_CONV_UPDATE_FEATURES)
5976 { 5976 {
5977 flags = GAIM_GTKCONV_MENU; 5977 flags = PIDGINCONV_MENU;
5978 } 5978 }
5979 5979
5980 gaim_gtkconv_update_fields(conv, flags); 5980 pidginconv_update_fields(conv, flags);
5981 } 5981 }
5982 5982
5983 static GaimConversationUiOps conversation_ui_ops = 5983 static GaimConversationUiOps conversation_ui_ops =
5984 { 5984 {
5985 gaim_gtkconv_new, 5985 pidginconv_new,
5986 gaim_gtkconv_destroy, /* destroy_conversation */ 5986 pidginconv_destroy, /* destroy_conversation */
5987 NULL, /* write_chat */ 5987 NULL, /* write_chat */
5988 gaim_gtkconv_write_im, /* write_im */ 5988 pidginconv_write_im, /* write_im */
5989 gaim_gtkconv_write_conv, /* write_conv */ 5989 pidginconv_write_conv, /* write_conv */
5990 gaim_gtkconv_chat_add_users, /* chat_add_users */ 5990 pidginconv_chat_add_users, /* chat_add_users */
5991 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ 5991 pidginconv_chat_rename_user, /* chat_rename_user */
5992 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ 5992 pidginconv_chat_remove_users, /* chat_remove_users */
5993 gaim_gtkconv_chat_update_user, /* chat_update_user */ 5993 pidginconv_chat_update_user, /* chat_update_user */
5994 gaim_gtkconv_present_conversation, /* present */ 5994 pidginconv_present_conversation, /* present */
5995 gaim_gtkconv_has_focus, /* has_focus */ 5995 pidginconv_has_focus, /* has_focus */
5996 gaim_gtkconv_custom_smiley_add, /* custom_smiley_add */ 5996 pidginconv_custom_smiley_add, /* custom_smiley_add */
5997 gaim_gtkconv_custom_smiley_write, /* custom_smiley_write */ 5997 pidginconv_custom_smiley_write, /* custom_smiley_write */
5998 gaim_gtkconv_custom_smiley_close, /* custom_smiley_close */ 5998 pidginconv_custom_smiley_close, /* custom_smiley_close */
5999 gaim_gtkconv_send_confirm, /* send_confirm */ 5999 pidginconv_send_confirm, /* send_confirm */
6000 }; 6000 };
6001 6001
6002 GaimConversationUiOps * 6002 GaimConversationUiOps *
6003 gaim_gtk_conversations_get_conv_ui_ops(void) 6003 pidgin_conversations_get_conv_ui_ops(void)
6004 { 6004 {
6005 return &conversation_ui_ops; 6005 return &conversation_ui_ops;
6006 } 6006 }
6007 6007
6008 /************************************************************************** 6008 /**************************************************************************
6009 * Public conversation utility functions 6009 * Public conversation utility functions
6010 **************************************************************************/ 6010 **************************************************************************/
6011 void 6011 void
6012 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) 6012 pidginconv_update_buddy_icon(GaimConversation *conv)
6013 { 6013 {
6014 GaimGtkConversation *gtkconv; 6014 PidginConversation *gtkconv;
6015 GaimGtkWindow *win; 6015 PidginWindow *win;
6016 6016
6017 GdkPixbufLoader *loader; 6017 GdkPixbufLoader *loader;
6018 GdkPixbufAnimation *anim; 6018 GdkPixbufAnimation *anim;
6019 GError *err = NULL; 6019 GError *err = NULL;
6020 6020
6036 6036
6037 g_return_if_fail(conv != NULL); 6037 g_return_if_fail(conv != NULL);
6038 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); 6038 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv));
6039 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM); 6039 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM);
6040 6040
6041 gtkconv = GAIM_GTK_CONVERSATION(conv); 6041 gtkconv = PIDGIN_CONVERSATION(conv);
6042 win = gtkconv->win; 6042 win = gtkconv->win;
6043 if (conv != gtkconv->active_conv) 6043 if (conv != gtkconv->active_conv)
6044 return; 6044 return;
6045 6045
6046 if (!gtkconv->u.im->show_icon) 6046 if (!gtkconv->u.im->show_icon)
6132 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); 6132 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter);
6133 if (gtkconv->u.im->animate) 6133 if (gtkconv->u.im->animate)
6134 start_anim(NULL, gtkconv); 6134 start_anim(NULL, gtkconv);
6135 } 6135 }
6136 6136
6137 gaim_gtk_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, 6137 pidgin_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec,
6138 GAIM_ICON_SCALE_DISPLAY, &scale_width, &scale_height); 6138 GAIM_ICON_SCALE_DISPLAY, &scale_width, &scale_height);
6139 scale = gdk_pixbuf_scale_simple(buf, 6139 scale = gdk_pixbuf_scale_simple(buf,
6140 MAX(gdk_pixbuf_get_width(buf) * scale_width / 6140 MAX(gdk_pixbuf_get_width(buf) * scale_width /
6141 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), 6141 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1),
6142 MAX(gdk_pixbuf_get_height(buf) * scale_height / 6142 MAX(gdk_pixbuf_get_height(buf) * scale_height /
6172 6172
6173 gtk_widget_show(gtkconv->u.im->icon_container); 6173 gtk_widget_show(gtkconv->u.im->icon_container);
6174 gtk_widget_show(frame); 6174 gtk_widget_show(frame);
6175 6175
6176 /* The buddy icon code needs badly to be fixed. */ 6176 /* The buddy icon code needs badly to be fixed. */
6177 if(gaim_gtk_conv_window_is_active_conversation(conv)) 6177 if(pidgin_conv_window_is_active_conversation(conv))
6178 { 6178 {
6179 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); 6179 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
6180 gtk_window_set_icon(GTK_WINDOW(win->window), buf); 6180 gtk_window_set_icon(GTK_WINDOW(win->window), buf);
6181 } 6181 }
6182 } 6182 }
6183 6183
6184 void 6184 void
6185 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) 6185 pidginconv_update_buttons_by_protocol(GaimConversation *conv)
6186 { 6186 {
6187 GaimGtkWindow *win; 6187 PidginWindow *win;
6188 6188
6189 if (!GAIM_IS_GTK_CONVERSATION(conv)) 6189 if (!GAIM_IS_GTK_CONVERSATION(conv))
6190 return; 6190 return;
6191 6191
6192 win = GAIM_GTK_CONVERSATION(conv)->win; 6192 win = PIDGIN_CONVERSATION(conv)->win;
6193 6193
6194 if (win != NULL && gaim_gtk_conv_window_is_active_conversation(conv)) 6194 if (win != NULL && pidgin_conv_window_is_active_conversation(conv))
6195 gray_stuff_out(GAIM_GTK_CONVERSATION(conv)); 6195 gray_stuff_out(PIDGIN_CONVERSATION(conv));
6196 } 6196 }
6197 6197
6198 int 6198 int
6199 gaim_gtkconv_get_tab_at_xy(GaimGtkWindow *win, int x, int y, gboolean *to_right) 6199 pidginconv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right)
6200 { 6200 {
6201 gint nb_x, nb_y, x_rel, y_rel; 6201 gint nb_x, nb_y, x_rel, y_rel;
6202 GtkNotebook *notebook; 6202 GtkNotebook *notebook;
6203 GtkWidget *page, *tab; 6203 GtkWidget *page, *tab;
6204 gint i, page_num = -1; 6204 gint i, page_num = -1;
6268 close_on_tabs_pref_cb(const char *name, GaimPrefType type, 6268 close_on_tabs_pref_cb(const char *name, GaimPrefType type,
6269 gconstpointer value, gpointer data) 6269 gconstpointer value, gpointer data)
6270 { 6270 {
6271 GList *l; 6271 GList *l;
6272 GaimConversation *conv; 6272 GaimConversation *conv;
6273 GaimGtkConversation *gtkconv; 6273 PidginConversation *gtkconv;
6274 6274
6275 for (l = gaim_get_conversations(); l != NULL; l = l->next) { 6275 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
6276 conv = (GaimConversation *)l->data; 6276 conv = (GaimConversation *)l->data;
6277 6277
6278 if (!GAIM_IS_GTK_CONVERSATION(conv)) 6278 if (!GAIM_IS_GTK_CONVERSATION(conv))
6279 continue; 6279 continue;
6280 6280
6281 gtkconv = GAIM_GTK_CONVERSATION(conv); 6281 gtkconv = PIDGIN_CONVERSATION(conv);
6282 6282
6283 if (value) 6283 if (value)
6284 gtk_widget_show(gtkconv->close); 6284 gtk_widget_show(gtkconv->close);
6285 else 6285 else
6286 gtk_widget_hide(gtkconv->close); 6286 gtk_widget_hide(gtkconv->close);
6292 gconstpointer value, gpointer data) 6292 gconstpointer value, gpointer data)
6293 { 6293 {
6294 #ifdef USE_GTKSPELL 6294 #ifdef USE_GTKSPELL
6295 GList *cl; 6295 GList *cl;
6296 GaimConversation *conv; 6296 GaimConversation *conv;
6297 GaimGtkConversation *gtkconv; 6297 PidginConversation *gtkconv;
6298 GtkSpell *spell; 6298 GtkSpell *spell;
6299 6299
6300 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { 6300 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) {
6301 6301
6302 conv = (GaimConversation *)cl->data; 6302 conv = (GaimConversation *)cl->data;
6303 6303
6304 if (!GAIM_IS_GTK_CONVERSATION(conv)) 6304 if (!GAIM_IS_GTK_CONVERSATION(conv))
6305 continue; 6305 continue;
6306 6306
6307 gtkconv = GAIM_GTK_CONVERSATION(conv); 6307 gtkconv = PIDGIN_CONVERSATION(conv);
6308 6308
6309 if (value) 6309 if (value)
6310 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); 6310 pidgin_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry));
6311 else { 6311 else {
6312 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); 6312 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry));
6313 gtkspell_detach(spell); 6313 gtkspell_detach(spell);
6314 } 6314 }
6315 } 6315 }
6320 tab_side_pref_cb(const char *name, GaimPrefType type, 6320 tab_side_pref_cb(const char *name, GaimPrefType type,
6321 gconstpointer value, gpointer data) 6321 gconstpointer value, gpointer data)
6322 { 6322 {
6323 GList *l; 6323 GList *l;
6324 GtkPositionType pos; 6324 GtkPositionType pos;
6325 GaimGtkWindow *win; 6325 PidginWindow *win;
6326 6326
6327 pos = GPOINTER_TO_INT(value); 6327 pos = GPOINTER_TO_INT(value);
6328 6328
6329 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) { 6329 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
6330 win = l->data; 6330 win = l->data;
6331 6331
6332 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos&~8); 6332 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos&~8);
6333 } 6333 }
6334 } 6334 }
6337 show_timestamps_pref_cb(const char *name, GaimPrefType type, 6337 show_timestamps_pref_cb(const char *name, GaimPrefType type,
6338 gconstpointer value, gpointer data) 6338 gconstpointer value, gpointer data)
6339 { 6339 {
6340 GList *l; 6340 GList *l;
6341 GaimConversation *conv; 6341 GaimConversation *conv;
6342 GaimGtkConversation *gtkconv; 6342 PidginConversation *gtkconv;
6343 GaimGtkWindow *win; 6343 PidginWindow *win;
6344 6344
6345 for (l = gaim_get_conversations(); l != NULL; l = l->next) 6345 for (l = gaim_get_conversations(); l != NULL; l = l->next)
6346 { 6346 {
6347 conv = (GaimConversation *)l->data; 6347 conv = (GaimConversation *)l->data;
6348 6348
6349 if (!GAIM_IS_GTK_CONVERSATION(conv)) 6349 if (!GAIM_IS_GTK_CONVERSATION(conv))
6350 continue; 6350 continue;
6351 6351
6352 gtkconv = GAIM_GTK_CONVERSATION(conv); 6352 gtkconv = PIDGIN_CONVERSATION(conv);
6353 win = gtkconv->win; 6353 win = gtkconv->win;
6354 6354
6355 gtk_check_menu_item_set_active( 6355 gtk_check_menu_item_set_active(
6356 GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), 6356 GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
6357 (gboolean)GPOINTER_TO_INT(value)); 6357 (gboolean)GPOINTER_TO_INT(value));
6365 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, 6365 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type,
6366 gconstpointer value, gpointer data) 6366 gconstpointer value, gpointer data)
6367 { 6367 {
6368 GList *l; 6368 GList *l;
6369 GaimConversation *conv; 6369 GaimConversation *conv;
6370 GaimGtkConversation *gtkconv; 6370 PidginConversation *gtkconv;
6371 GaimGtkWindow *win; 6371 PidginWindow *win;
6372 6372
6373 for (l = gaim_get_conversations(); l != NULL; l = l->next) 6373 for (l = gaim_get_conversations(); l != NULL; l = l->next)
6374 { 6374 {
6375 conv = (GaimConversation *)l->data; 6375 conv = (GaimConversation *)l->data;
6376 6376
6377 if (!GAIM_IS_GTK_CONVERSATION(conv)) 6377 if (!GAIM_IS_GTK_CONVERSATION(conv))
6378 continue; 6378 continue;
6379 6379
6380 gtkconv = GAIM_GTK_CONVERSATION(conv); 6380 gtkconv = PIDGIN_CONVERSATION(conv);
6381 win = gtkconv->win; 6381 win = gtkconv->win;
6382 6382
6383 gtk_check_menu_item_set_active( 6383 gtk_check_menu_item_set_active(
6384 GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), 6384 GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar),
6385 (gboolean)GPOINTER_TO_INT(value)); 6385 (gboolean)GPOINTER_TO_INT(value));
6395 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, 6395 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type,
6396 gconstpointer value, gpointer data) 6396 gconstpointer value, gpointer data)
6397 { 6397 {
6398 GList *l; 6398 GList *l;
6399 GaimConversation *conv; 6399 GaimConversation *conv;
6400 GaimGtkConversation *gtkconv; 6400 PidginConversation *gtkconv;
6401 GaimGtkWindow *win; 6401 PidginWindow *win;
6402 6402
6403 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) 6403 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons"))
6404 return; 6404 return;
6405 6405
6406 /* Set the "animate" flag for each icon based on the new preference */ 6406 /* Set the "animate" flag for each icon based on the new preference */
6407 for (l = gaim_get_ims(); l != NULL; l = l->next) { 6407 for (l = gaim_get_ims(); l != NULL; l = l->next) {
6408 conv = (GaimConversation *)l->data; 6408 conv = (GaimConversation *)l->data;
6409 gtkconv = GAIM_GTK_CONVERSATION(conv); 6409 gtkconv = PIDGIN_CONVERSATION(conv);
6410 gtkconv->u.im->animate = GPOINTER_TO_INT(value); 6410 gtkconv->u.im->animate = GPOINTER_TO_INT(value);
6411 } 6411 }
6412 6412
6413 /* Now either stop or start animation for the active conversation in each window */ 6413 /* Now either stop or start animation for the active conversation in each window */
6414 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) { 6414 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
6415 win = l->data; 6415 win = l->data;
6416 conv = gaim_gtk_conv_window_get_active_conversation(win); 6416 conv = pidgin_conv_window_get_active_conversation(win);
6417 gaim_gtkconv_update_buddy_icon(conv); 6417 pidginconv_update_buddy_icon(conv);
6418 } 6418 }
6419 } 6419 }
6420 6420
6421 static void 6421 static void
6422 show_buddy_icons_pref_cb(const char *name, GaimPrefType type, 6422 show_buddy_icons_pref_cb(const char *name, GaimPrefType type,
6426 6426
6427 for (l = gaim_get_conversations(); l != NULL; l = l->next) { 6427 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
6428 GaimConversation *conv = l->data; 6428 GaimConversation *conv = l->data;
6429 6429
6430 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) 6430 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
6431 gaim_gtkconv_update_buddy_icon(conv); 6431 pidginconv_update_buddy_icon(conv);
6432 } 6432 }
6433 } 6433 }
6434 6434
6435 static void 6435 static void
6436 conv_placement_usetabs_cb(const char *name, GaimPrefType type, 6436 conv_placement_usetabs_cb(const char *name, GaimPrefType type,
6443 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, 6443 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus,
6444 GaimStatus *newstatus) 6444 GaimStatus *newstatus)
6445 { 6445 {
6446 GList *l; 6446 GList *l;
6447 GaimConversation *conv = NULL; 6447 GaimConversation *conv = NULL;
6448 GaimGtkConversation *gtkconv; 6448 PidginConversation *gtkconv;
6449 6449
6450 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")!=0) 6450 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")!=0)
6451 return; 6451 return;
6452 6452
6453 if(gaim_status_is_available(oldstatus) || !gaim_status_is_available(newstatus)) 6453 if(gaim_status_is_available(oldstatus) || !gaim_status_is_available(newstatus))
6464 gaim_conversation_get_account(conv)))) 6464 gaim_conversation_get_account(conv))))
6465 l = l->next; 6465 l = l->next;
6466 if (!l) 6466 if (!l)
6467 break; 6467 break;
6468 6468
6469 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv); 6469 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
6470 gaim_gtkconv_placement_place(gtkconv); 6470 pidginconv_placement_place(gtkconv);
6471 6471
6472 /* TODO: do we need to do anything for any other conversations that are in the same gtkconv here? 6472 /* TODO: do we need to do anything for any other conversations that are in the same gtkconv here?
6473 * I'm a little concerned that not doing so will cause the "pending" indicator in the gtkblist not to be cleared. -DAA*/ 6473 * I'm a little concerned that not doing so will cause the "pending" indicator in the gtkblist not to be cleared. -DAA*/
6474 gaim_conversation_update(conv, GAIM_CONV_UPDATE_UNSEEN); 6474 gaim_conversation_update(conv, GAIM_CONV_UPDATE_UNSEEN);
6475 } 6475 }
6479 hide_new_pref_cb(const char *name, GaimPrefType type, 6479 hide_new_pref_cb(const char *name, GaimPrefType type,
6480 gconstpointer value, gpointer data) 6480 gconstpointer value, gpointer data)
6481 { 6481 {
6482 GList *l; 6482 GList *l;
6483 GaimConversation *conv = NULL; 6483 GaimConversation *conv = NULL;
6484 GaimGtkConversation *gtkconv; 6484 PidginConversation *gtkconv;
6485 gboolean when_away = FALSE; 6485 gboolean when_away = FALSE;
6486 6486
6487 if(!hidden_convwin) 6487 if(!hidden_convwin)
6488 return; 6488 return;
6489 6489
6502 if(when_away && !gaim_status_is_available( 6502 if(when_away && !gaim_status_is_available(
6503 gaim_account_get_active_status( 6503 gaim_account_get_active_status(
6504 gaim_conversation_get_account(conv)))) 6504 gaim_conversation_get_account(conv))))
6505 continue; 6505 continue;
6506 6506
6507 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv); 6507 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
6508 gaim_gtkconv_placement_place(gtkconv); 6508 pidginconv_placement_place(gtkconv);
6509 } 6509 }
6510 } 6510 }
6511 6511
6512 6512
6513 static void 6513 static void
6517 GaimConvPlacementFunc func; 6517 GaimConvPlacementFunc func;
6518 6518
6519 if (strcmp(name, "/gaim/gtk/conversations/placement")) 6519 if (strcmp(name, "/gaim/gtk/conversations/placement"))
6520 return; 6520 return;
6521 6521
6522 func = gaim_gtkconv_placement_get_fnc(value); 6522 func = pidginconv_placement_get_fnc(value);
6523 6523
6524 if (func == NULL) 6524 if (func == NULL)
6525 return; 6525 return;
6526 6526
6527 gaim_gtkconv_placement_set_current_func(func); 6527 pidginconv_placement_set_current_func(func);
6528 } 6528 }
6529 6529
6530 static GaimGtkConversation * 6530 static PidginConversation *
6531 get_gtkconv_with_contact(GaimContact *contact) 6531 get_gtkconv_with_contact(GaimContact *contact)
6532 { 6532 {
6533 GaimBlistNode *node; 6533 GaimBlistNode *node;
6534 6534
6535 node = ((GaimBlistNode*)contact)->child; 6535 node = ((GaimBlistNode*)contact)->child;
6538 { 6538 {
6539 GaimBuddy *buddy = (GaimBuddy*)node; 6539 GaimBuddy *buddy = (GaimBuddy*)node;
6540 GaimConversation *conv; 6540 GaimConversation *conv;
6541 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account); 6541 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account);
6542 if (conv) 6542 if (conv)
6543 return GAIM_GTK_CONVERSATION(conv); 6543 return PIDGIN_CONVERSATION(conv);
6544 } 6544 }
6545 return NULL; 6545 return NULL;
6546 } 6546 }
6547 6547
6548 static void 6548 static void
6557 /* This seems fine in theory, but we also need to cover the 6557 /* This seems fine in theory, but we also need to cover the
6558 * case of this account matching one of the other buddies in 6558 * case of this account matching one of the other buddies in
6559 * one of the contacts containing the buddy corresponding to 6559 * one of the contacts containing the buddy corresponding to
6560 * a conversation. It's easier to just update them all. */ 6560 * a conversation. It's easier to just update them all. */
6561 /* if (gaim_conversation_get_account(conv) == account) */ 6561 /* if (gaim_conversation_get_account(conv) == account) */
6562 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON | 6562 pidginconv_update_fields(conv, PIDGINCONV_TAB_ICON |
6563 GAIM_GTKCONV_MENU | GAIM_GTKCONV_COLORIZE_TITLE); 6563 PIDGINCONV_MENU | PIDGINCONV_COLORIZE_TITLE);
6564 } 6564 }
6565 } 6565 }
6566 6566
6567 static gboolean 6567 static gboolean
6568 update_buddy_status_timeout(GaimBuddy *buddy) 6568 update_buddy_status_timeout(GaimBuddy *buddy)
6570 /* To remove the signing-on/off door icon */ 6570 /* To remove the signing-on/off door icon */
6571 GaimConversation *conv; 6571 GaimConversation *conv;
6572 6572
6573 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account); 6573 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account);
6574 if (conv) 6574 if (conv)
6575 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON); 6575 pidginconv_update_fields(conv, PIDGINCONV_TAB_ICON);
6576 6576
6577 return FALSE; 6577 return FALSE;
6578 } 6578 }
6579 6579
6580 static void 6580 static void
6581 update_buddy_status_changed(GaimBuddy *buddy, GaimStatus *old, GaimStatus *newstatus) 6581 update_buddy_status_changed(GaimBuddy *buddy, GaimStatus *old, GaimStatus *newstatus)
6582 { 6582 {
6583 GaimGtkConversation *gtkconv; 6583 PidginConversation *gtkconv;
6584 GaimConversation *conv; 6584 GaimConversation *conv;
6585 6585
6586 gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy)); 6586 gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy));
6587 if (gtkconv) 6587 if (gtkconv)
6588 { 6588 {
6589 conv = gtkconv->active_conv; 6589 conv = gtkconv->active_conv;
6590 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON | GAIM_GTKCONV_COLORIZE_TITLE); 6590 pidginconv_update_fields(conv, PIDGINCONV_TAB_ICON | PIDGINCONV_COLORIZE_TITLE);
6591 if ((gaim_status_is_online(old) ^ gaim_status_is_online(newstatus)) != 0) 6591 if ((gaim_status_is_online(old) ^ gaim_status_is_online(newstatus)) != 0)
6592 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_MENU); 6592 pidginconv_update_fields(conv, PIDGINCONV_MENU);
6593 } 6593 }
6594 6594
6595 /* In case a conversation is started after the buddy has signed-on/off */ 6595 /* In case a conversation is started after the buddy has signed-on/off */
6596 g_timeout_add(11000, (GSourceFunc)update_buddy_status_timeout, buddy); 6596 g_timeout_add(11000, (GSourceFunc)update_buddy_status_timeout, buddy);
6597 } 6597 }
6598 6598
6599 static void 6599 static void
6600 update_buddy_privacy_changed(GaimBuddy *buddy) 6600 update_buddy_privacy_changed(GaimBuddy *buddy)
6601 { 6601 {
6602 GaimGtkConversation *gtkconv; 6602 PidginConversation *gtkconv;
6603 GaimConversation *conv; 6603 GaimConversation *conv;
6604 6604
6605 gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy)); 6605 gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy));
6606 if (gtkconv) { 6606 if (gtkconv) {
6607 conv = gtkconv->active_conv; 6607 conv = gtkconv->active_conv;
6608 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON | GAIM_GTKCONV_MENU); 6608 pidginconv_update_fields(conv, PIDGINCONV_TAB_ICON | PIDGINCONV_MENU);
6609 } 6609 }
6610 } 6610 }
6611 6611
6612 static void 6612 static void
6613 update_buddy_idle_changed(GaimBuddy *buddy, gboolean old, gboolean newidle) 6613 update_buddy_idle_changed(GaimBuddy *buddy, gboolean old, gboolean newidle)
6614 { 6614 {
6615 GaimConversation *conv; 6615 GaimConversation *conv;
6616 6616
6617 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account); 6617 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account);
6618 if (conv) 6618 if (conv)
6619 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON); 6619 pidginconv_update_fields(conv, PIDGINCONV_TAB_ICON);
6620 } 6620 }
6621 6621
6622 static void 6622 static void
6623 update_buddy_icon(GaimBuddy *buddy) 6623 update_buddy_icon(GaimBuddy *buddy)
6624 { 6624 {
6625 GaimConversation *conv; 6625 GaimConversation *conv;
6626 6626
6627 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account); 6627 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account);
6628 if (conv) 6628 if (conv)
6629 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_BUDDY_ICON); 6629 pidginconv_update_fields(conv, PIDGINCONV_BUDDY_ICON);
6630 } 6630 }
6631 6631
6632 static void 6632 static void
6633 update_buddy_sign(GaimBuddy *buddy, const char *which) 6633 update_buddy_sign(GaimBuddy *buddy, const char *which)
6634 { 6634 {
6648 } 6648 }
6649 6649
6650 static void 6650 static void
6651 update_conversation_switched(GaimConversation *conv) 6651 update_conversation_switched(GaimConversation *conv)
6652 { 6652 {
6653 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON | GAIM_GTKCONV_SET_TITLE | 6653 pidginconv_update_fields(conv, PIDGINCONV_TAB_ICON | PIDGINCONV_SET_TITLE |
6654 GAIM_GTKCONV_MENU | GAIM_GTKCONV_BUDDY_ICON); 6654 PIDGINCONV_MENU | PIDGINCONV_BUDDY_ICON);
6655 } 6655 }
6656 6656
6657 static void 6657 static void
6658 update_buddy_typing(GaimAccount *account, const char *who) 6658 update_buddy_typing(GaimAccount *account, const char *who)
6659 { 6659 {
6660 GaimConversation *conv; 6660 GaimConversation *conv;
6661 GaimGtkConversation *gtkconv; 6661 PidginConversation *gtkconv;
6662 6662
6663 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, account); 6663 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, account);
6664 if (!conv) 6664 if (!conv)
6665 return; 6665 return;
6666 6666
6667 gtkconv = GAIM_GTK_CONVERSATION(conv); 6667 gtkconv = PIDGIN_CONVERSATION(conv);
6668 if (gtkconv && gtkconv->active_conv == conv) 6668 if (gtkconv && gtkconv->active_conv == conv)
6669 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_COLORIZE_TITLE); 6669 pidginconv_update_fields(conv, PIDGINCONV_COLORIZE_TITLE);
6670 } 6670 }
6671 6671
6672 static void 6672 static void
6673 update_chat(GaimConversation *conv) 6673 update_chat(GaimConversation *conv)
6674 { 6674 {
6675 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TOPIC | 6675 pidginconv_update_fields(conv, PIDGINCONV_TOPIC |
6676 GAIM_GTKCONV_MENU | GAIM_GTKCONV_SET_TITLE); 6676 PIDGINCONV_MENU | PIDGINCONV_SET_TITLE);
6677 } 6677 }
6678 6678
6679 static void 6679 static void
6680 update_chat_topic(GaimConversation *conv, const char *old, const char *new) 6680 update_chat_topic(GaimConversation *conv, const char *old, const char *new)
6681 { 6681 {
6682 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TOPIC); 6682 pidginconv_update_fields(conv, PIDGINCONV_TOPIC);
6683 } 6683 }
6684 6684
6685 void * 6685 void *
6686 gaim_gtk_conversations_get_handle(void) 6686 pidgin_conversations_get_handle(void)
6687 { 6687 {
6688 static int handle; 6688 static int handle;
6689 6689
6690 return &handle; 6690 return &handle;
6691 } 6691 }
6692 6692
6693 void 6693 void
6694 gaim_gtk_conversations_init(void) 6694 pidgin_conversations_init(void)
6695 { 6695 {
6696 void *handle = gaim_gtk_conversations_get_handle(); 6696 void *handle = pidgin_conversations_get_handle();
6697 void *blist_handle = gaim_blist_get_handle(); 6697 void *blist_handle = gaim_blist_get_handle();
6698 6698
6699 /* Conversations */ 6699 /* Conversations */
6700 gaim_prefs_add_none("/gaim/gtk/conversations"); 6700 gaim_prefs_add_none("/gaim/gtk/conversations");
6701 gaim_prefs_add_bool("/gaim/gtk/conversations/use_smooth_scrolling", TRUE); 6701 gaim_prefs_add_bool("/gaim/gtk/conversations/use_smooth_scrolling", TRUE);
6770 * Register signals 6770 * Register signals
6771 **********************************************************************/ 6771 **********************************************************************/
6772 gaim_signal_register(handle, "conversation-dragging", 6772 gaim_signal_register(handle, "conversation-dragging",
6773 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, 6773 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
6774 gaim_value_new(GAIM_TYPE_BOXED, 6774 gaim_value_new(GAIM_TYPE_BOXED,
6775 "GaimGtkWindow *"), 6775 "PidginWindow *"),
6776 gaim_value_new(GAIM_TYPE_BOXED, 6776 gaim_value_new(GAIM_TYPE_BOXED,
6777 "GaimGtkWindow *")); 6777 "PidginWindow *"));
6778 6778
6779 gaim_signal_register(handle, "conversation-timestamp", 6779 gaim_signal_register(handle, "conversation-timestamp",
6780 #if SIZEOF_TIME_T == 4 6780 #if SIZEOF_TIME_T == 4
6781 gaim_marshal_POINTER__POINTER_INT, 6781 gaim_marshal_POINTER__POINTER_INT,
6782 #elif SIZEOF_TIME_T == 8 6782 #elif SIZEOF_TIME_T == 8
6877 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", 6877 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg",
6878 handle, G_CALLBACK(received_im_msg_cb), NULL); 6878 handle, G_CALLBACK(received_im_msg_cb), NULL);
6879 6879
6880 gaim_conversations_set_ui_ops(&conversation_ui_ops); 6880 gaim_conversations_set_ui_ops(&conversation_ui_ops);
6881 6881
6882 hidden_convwin = gaim_gtk_conv_window_new(); 6882 hidden_convwin = pidgin_conv_window_new();
6883 window_list = g_list_remove(window_list, hidden_convwin); 6883 window_list = g_list_remove(window_list, hidden_convwin);
6884 6884
6885 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", 6885 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
6886 handle, GAIM_CALLBACK(account_status_changed_cb), NULL); 6886 handle, GAIM_CALLBACK(account_status_changed_cb), NULL);
6887 6887
6904 handle, GAIM_CALLBACK(update_buddy_icon), NULL); 6904 handle, GAIM_CALLBACK(update_buddy_icon), NULL);
6905 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing", 6905 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing",
6906 handle, GAIM_CALLBACK(update_buddy_typing), NULL); 6906 handle, GAIM_CALLBACK(update_buddy_typing), NULL);
6907 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing-stopped", 6907 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing-stopped",
6908 handle, GAIM_CALLBACK(update_buddy_typing), NULL); 6908 handle, GAIM_CALLBACK(update_buddy_typing), NULL);
6909 gaim_signal_connect(gaim_gtk_conversations_get_handle(), "conversation-switched", 6909 gaim_signal_connect(pidgin_conversations_get_handle(), "conversation-switched",
6910 handle, GAIM_CALLBACK(update_conversation_switched), NULL); 6910 handle, GAIM_CALLBACK(update_conversation_switched), NULL);
6911 gaim_signal_connect(gaim_conversations_get_handle(), "chat-left", handle, 6911 gaim_signal_connect(gaim_conversations_get_handle(), "chat-left", handle,
6912 GAIM_CALLBACK(update_chat), NULL); 6912 GAIM_CALLBACK(update_chat), NULL);
6913 gaim_signal_connect(gaim_conversations_get_handle(), "chat-joined", handle, 6913 gaim_signal_connect(gaim_conversations_get_handle(), "chat-joined", handle,
6914 GAIM_CALLBACK(update_chat), NULL); 6914 GAIM_CALLBACK(update_chat), NULL);
6915 gaim_signal_connect(gaim_conversations_get_handle(), "chat-topic-changed", handle, 6915 gaim_signal_connect(gaim_conversations_get_handle(), "chat-topic-changed", handle,
6916 GAIM_CALLBACK(update_chat_topic), NULL); 6916 GAIM_CALLBACK(update_chat_topic), NULL);
6917 gaim_signal_connect_priority(gaim_conversations_get_handle(), "conversation-updated", handle, 6917 gaim_signal_connect_priority(gaim_conversations_get_handle(), "conversation-updated", handle,
6918 GAIM_CALLBACK(gaim_gtkconv_updated), NULL, 6918 GAIM_CALLBACK(pidginconv_updated), NULL,
6919 GAIM_SIGNAL_PRIORITY_LOWEST); 6919 GAIM_SIGNAL_PRIORITY_LOWEST);
6920 } 6920 }
6921 6921
6922 void 6922 void
6923 gaim_gtk_conversations_uninit(void) 6923 pidgin_conversations_uninit(void)
6924 { 6924 {
6925 gaim_prefs_disconnect_by_handle(gaim_gtk_conversations_get_handle()); 6925 gaim_prefs_disconnect_by_handle(pidgin_conversations_get_handle());
6926 gaim_signals_disconnect_by_handle(gaim_gtk_conversations_get_handle()); 6926 gaim_signals_disconnect_by_handle(pidgin_conversations_get_handle());
6927 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); 6927 gaim_signals_unregister_by_instance(pidgin_conversations_get_handle());
6928 gaim_gtk_conv_window_destroy(hidden_convwin); 6928 pidgin_conv_window_destroy(hidden_convwin);
6929 hidden_convwin=NULL; 6929 hidden_convwin=NULL;
6930 } 6930 }
6931 6931
6932 6932
6933 6933
7000 #include "gaimstock.h" 7000 #include "gaimstock.h"
7001 #include "gtkimhtml.h" 7001 #include "gtkimhtml.h"
7002 #include "gtkimhtmltoolbar.h" 7002 #include "gtkimhtmltoolbar.h"
7003 7003
7004 static void 7004 static void
7005 do_close(GtkWidget *w, int resp, GaimGtkWindow *win) 7005 do_close(GtkWidget *w, int resp, PidginWindow *win)
7006 { 7006 {
7007 gtk_widget_destroy(warn_close_dialog); 7007 gtk_widget_destroy(warn_close_dialog);
7008 warn_close_dialog = NULL; 7008 warn_close_dialog = NULL;
7009 7009
7010 if (resp == GTK_RESPONSE_OK) 7010 if (resp == GTK_RESPONSE_OK)
7011 gaim_gtk_conv_window_destroy(win); 7011 pidgin_conv_window_destroy(win);
7012 } 7012 }
7013 7013
7014 static void 7014 static void
7015 build_warn_close_dialog(GaimGtkWindow *gtkwin) 7015 build_warn_close_dialog(PidginWindow *gtkwin)
7016 { 7016 {
7017 GtkWidget *label; 7017 GtkWidget *label;
7018 GtkWidget *vbox, *hbox; 7018 GtkWidget *vbox, *hbox;
7019 GtkWidget *img; 7019 GtkWidget *img;
7020 7020
7071 **************************************************************************/ 7071 **************************************************************************/
7072 7072
7073 static gboolean 7073 static gboolean
7074 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) 7074 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d)
7075 { 7075 {
7076 GaimGtkWindow *win = d; 7076 PidginWindow *win = d;
7077 GList *l; 7077 GList *l;
7078 7078
7079 /* If there are unread messages then show a warning dialog */ 7079 /* If there are unread messages then show a warning dialog */
7080 for (l = gaim_gtk_conv_window_get_gtkconvs(win); 7080 for (l = pidgin_conv_window_get_gtkconvs(win);
7081 l != NULL; l = l->next) 7081 l != NULL; l = l->next)
7082 { 7082 {
7083 GaimGtkConversation *gtkconv = l->data; 7083 PidginConversation *gtkconv = l->data;
7084 if (gaim_conversation_get_type(gtkconv->active_conv) == GAIM_CONV_TYPE_IM && 7084 if (gaim_conversation_get_type(gtkconv->active_conv) == GAIM_CONV_TYPE_IM &&
7085 gtkconv->unseen_state >= GAIM_UNSEEN_TEXT) 7085 gtkconv->unseen_state >= GAIM_UNSEEN_TEXT)
7086 { 7086 {
7087 build_warn_close_dialog(win); 7087 build_warn_close_dialog(win);
7088 gtk_widget_show_all(warn_close_dialog); 7088 gtk_widget_show_all(warn_close_dialog);
7089 7089
7090 return TRUE; 7090 return TRUE;
7091 } 7091 }
7092 } 7092 }
7093 7093
7094 gaim_gtk_conv_window_destroy(win); 7094 pidgin_conv_window_destroy(win);
7095 7095
7096 return TRUE; 7096 return TRUE;
7097 } 7097 }
7098 7098
7099 static void 7099 static void
7100 gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state) 7100 gtkconv_set_unseen(PidginConversation *gtkconv, GaimUnseenState state)
7101 { 7101 {
7102 if (state == GAIM_UNSEEN_NONE) 7102 if (state == GAIM_UNSEEN_NONE)
7103 { 7103 {
7104 gtkconv->unseen_count = 0; 7104 gtkconv->unseen_count = 0;
7105 gtkconv->unseen_state = GAIM_UNSEEN_NONE; 7105 gtkconv->unseen_state = GAIM_UNSEEN_NONE;
7122 * messages. 7122 * messages.
7123 */ 7123 */
7124 static gint 7124 static gint
7125 focus_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d) 7125 focus_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d)
7126 { 7126 {
7127 GaimGtkWindow *win = d; 7127 PidginWindow *win = d;
7128 GaimGtkConversation *gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); 7128 PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
7129 7129
7130 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE); 7130 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE);
7131 7131
7132 return FALSE; 7132 return FALSE;
7133 } 7133 }
7141 gtk_widget_set_state(widget, GTK_STATE_NORMAL); 7141 gtk_widget_set_state(widget, GTK_STATE_NORMAL);
7142 } 7142 }
7143 #endif 7143 #endif
7144 7144
7145 static void 7145 static void
7146 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) 7146 notebook_init_grab(PidginWindow *gtkwin, GtkWidget *widget)
7147 { 7147 {
7148 static GdkCursor *cursor = NULL; 7148 static GdkCursor *cursor = NULL;
7149 7149
7150 gtkwin->in_drag = TRUE; 7150 gtkwin->in_drag = TRUE;
7151 7151
7169 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, 7169 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
7170 NULL, cursor, GDK_CURRENT_TIME); 7170 NULL, cursor, GDK_CURRENT_TIME);
7171 } 7171 }
7172 7172
7173 static gboolean 7173 static gboolean
7174 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win) 7174 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
7175 { 7175 {
7176 7176
7177 /* 7177 /*
7178 * Make sure the user moved the mouse far enough for the 7178 * Make sure the user moved the mouse far enough for the
7179 * drag to be initiated. 7179 * drag to be initiated.
7187 win->in_predrag = FALSE; 7187 win->in_predrag = FALSE;
7188 notebook_init_grab(win, widget); 7188 notebook_init_grab(win, widget);
7189 } 7189 }
7190 } 7190 }
7191 else { /* Otherwise, draw the arrows. */ 7191 else { /* Otherwise, draw the arrows. */
7192 GaimGtkWindow *dest_win; 7192 PidginWindow *dest_win;
7193 GtkNotebook *dest_notebook; 7193 GtkNotebook *dest_notebook;
7194 GtkWidget *tab; 7194 GtkWidget *tab;
7195 gint nb_x, nb_y, page_num; 7195 gint nb_x, nb_y, page_num;
7196 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; 7196 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y;
7197 gboolean horiz_tabs = FALSE; 7197 gboolean horiz_tabs = FALSE;
7198 GaimGtkConversation *gtkconv; 7198 PidginConversation *gtkconv;
7199 gboolean to_right = FALSE; 7199 gboolean to_right = FALSE;
7200 7200
7201 /* Get the window that the cursor is over. */ 7201 /* Get the window that the cursor is over. */
7202 dest_win = gaim_gtk_conv_window_get_at_xy(e->x_root, e->y_root); 7202 dest_win = pidgin_conv_window_get_at_xy(e->x_root, e->y_root);
7203 7203
7204 if (dest_win == NULL) { 7204 if (dest_win == NULL) {
7205 dnd_hints_hide_all(); 7205 dnd_hints_hide_all();
7206 7206
7207 return TRUE; 7207 return TRUE;
7212 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); 7212 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y);
7213 7213
7214 arrow1_x = arrow2_x = nb_x; 7214 arrow1_x = arrow2_x = nb_x;
7215 arrow1_y = arrow2_y = nb_y; 7215 arrow1_y = arrow2_y = nb_y;
7216 7216
7217 page_num = gaim_gtkconv_get_tab_at_xy(dest_win, 7217 page_num = pidginconv_get_tab_at_xy(dest_win,
7218 e->x_root, e->y_root, &to_right); 7218 e->x_root, e->y_root, &to_right);
7219 to_right = to_right && (win != dest_win); 7219 to_right = to_right && (win != dest_win);
7220 7220
7221 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || 7221 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP ||
7222 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { 7222 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) {
7223 7223
7224 horiz_tabs = TRUE; 7224 horiz_tabs = TRUE;
7225 } 7225 }
7226 7226
7227 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(dest_win, page_num); 7227 gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num);
7228 tab = gtkconv->tabby; 7228 tab = gtkconv->tabby;
7229 7229
7230 if (horiz_tabs) { 7230 if (horiz_tabs) {
7231 arrow1_x = arrow2_x = nb_x + tab->allocation.x; 7231 arrow1_x = arrow2_x = nb_x + tab->allocation.x;
7232 7232
7259 7259
7260 return TRUE; 7260 return TRUE;
7261 } 7261 }
7262 7262
7263 static gboolean 7263 static gboolean
7264 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimGtkWindow *win) 7264 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, PidginWindow *win)
7265 { 7265 {
7266 if (win->in_drag) 7266 if (win->in_drag)
7267 return FALSE; 7267 return FALSE;
7268 7268
7269 if (e->x_root < win->drag_min_x || 7269 if (e->x_root < win->drag_min_x ||
7280 7280
7281 /* 7281 /*
7282 * THANK YOU GALEON! 7282 * THANK YOU GALEON!
7283 */ 7283 */
7284 static gboolean 7284 static gboolean
7285 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win) 7285 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
7286 { 7286 {
7287 gint nb_x, nb_y, x_rel, y_rel; 7287 gint nb_x, nb_y, x_rel, y_rel;
7288 int tab_clicked; 7288 int tab_clicked;
7289 GtkWidget *page; 7289 GtkWidget *page;
7290 GtkWidget *tab; 7290 GtkWidget *tab;
7291 7291
7292 if (e->button == 2) { 7292 if (e->button == 2) {
7293 GaimGtkConversation *gtkconv; 7293 PidginConversation *gtkconv;
7294 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root, NULL); 7294 tab_clicked = pidginconv_get_tab_at_xy(win, e->x_root, e->y_root, NULL);
7295 7295
7296 if (tab_clicked == -1) 7296 if (tab_clicked == -1)
7297 return FALSE; 7297 return FALSE;
7298 7298
7299 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, tab_clicked); 7299 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, tab_clicked);
7300 close_conv_cb(NULL, gtkconv); 7300 close_conv_cb(NULL, gtkconv);
7301 return TRUE; 7301 return TRUE;
7302 } 7302 }
7303 7303
7304 7304
7314 7314
7315 /* 7315 /*
7316 * Make sure a tab was actually clicked. The arrow buttons 7316 * Make sure a tab was actually clicked. The arrow buttons
7317 * mess things up. 7317 * mess things up.
7318 */ 7318 */
7319 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root, NULL); 7319 tab_clicked = pidginconv_get_tab_at_xy(win, e->x_root, e->y_root, NULL);
7320 7320
7321 if (tab_clicked == -1) 7321 if (tab_clicked == -1)
7322 return FALSE; 7322 return FALSE;
7323 7323
7324 /* 7324 /*
7368 7368
7369 return FALSE; 7369 return FALSE;
7370 } 7370 }
7371 7371
7372 static gboolean 7372 static gboolean
7373 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win) 7373 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
7374 { 7374 {
7375 GaimGtkWindow *dest_win; 7375 PidginWindow *dest_win;
7376 GaimConversation *conv; 7376 GaimConversation *conv;
7377 GaimGtkConversation *gtkconv; 7377 PidginConversation *gtkconv;
7378 gint dest_page_num = 0; 7378 gint dest_page_num = 0;
7379 gboolean new_window = FALSE; 7379 gboolean new_window = FALSE;
7380 gboolean to_right = FALSE; 7380 gboolean to_right = FALSE;
7381 7381
7382 /* 7382 /*
7425 7425
7426 win->in_drag = FALSE; 7426 win->in_drag = FALSE;
7427 7427
7428 dnd_hints_hide_all(); 7428 dnd_hints_hide_all();
7429 7429
7430 dest_win = gaim_gtk_conv_window_get_at_xy(e->x_root, e->y_root); 7430 dest_win = pidgin_conv_window_get_at_xy(e->x_root, e->y_root);
7431 7431
7432 conv = gaim_gtk_conv_window_get_active_conversation(win); 7432 conv = pidgin_conv_window_get_active_conversation(win);
7433 7433
7434 if (dest_win == NULL) { 7434 if (dest_win == NULL) {
7435 /* If the current window doesn't have any other conversations, 7435 /* If the current window doesn't have any other conversations,
7436 * there isn't much point transferring the conv to a new window. */ 7436 * there isn't much point transferring the conv to a new window. */
7437 if (gaim_gtk_conv_window_get_gtkconv_count(win) > 1) { 7437 if (pidgin_conv_window_get_gtkconv_count(win) > 1) {
7438 /* Make a new window to stick this to. */ 7438 /* Make a new window to stick this to. */
7439 dest_win = gaim_gtk_conv_window_new(); 7439 dest_win = pidgin_conv_window_new();
7440 new_window = TRUE; 7440 new_window = TRUE;
7441 } 7441 }
7442 } 7442 }
7443 7443
7444 if (dest_win == NULL) 7444 if (dest_win == NULL)
7445 return FALSE; 7445 return FALSE;
7446 7446
7447 gaim_signal_emit(gaim_gtk_conversations_get_handle(), 7447 gaim_signal_emit(pidgin_conversations_get_handle(),
7448 "conversation-dragging", win, dest_win); 7448 "conversation-dragging", win, dest_win);
7449 7449
7450 /* Get the destination page number. */ 7450 /* Get the destination page number. */
7451 if (!new_window) 7451 if (!new_window)
7452 dest_page_num = gaim_gtkconv_get_tab_at_xy(dest_win, 7452 dest_page_num = pidginconv_get_tab_at_xy(dest_win,
7453 e->x_root, e->y_root, &to_right); 7453 e->x_root, e->y_root, &to_right);
7454 7454
7455 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, win->drag_tab); 7455 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, win->drag_tab);
7456 7456
7457 if (win == dest_win) { 7457 if (win == dest_win) {
7458 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, dest_page_num); 7458 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, dest_page_num);
7459 } else { 7459 } else {
7460 gaim_gtk_conv_window_remove_gtkconv(win, gtkconv); 7460 pidgin_conv_window_remove_gtkconv(win, gtkconv);
7461 gaim_gtk_conv_window_add_gtkconv(dest_win, gtkconv); 7461 pidgin_conv_window_add_gtkconv(dest_win, gtkconv);
7462 gtk_notebook_reorder_child(GTK_NOTEBOOK(dest_win->notebook), gtkconv->tab_cont, dest_page_num + to_right); 7462 gtk_notebook_reorder_child(GTK_NOTEBOOK(dest_win->notebook), gtkconv->tab_cont, dest_page_num + to_right);
7463 gaim_gtk_conv_window_switch_gtkconv(dest_win, gtkconv); 7463 pidgin_conv_window_switch_gtkconv(dest_win, gtkconv);
7464 if (new_window) { 7464 if (new_window) {
7465 gint win_width, win_height; 7465 gint win_width, win_height;
7466 7466
7467 gtk_window_get_size(GTK_WINDOW(dest_win->window), 7467 gtk_window_get_size(GTK_WINDOW(dest_win->window),
7468 &win_width, &win_height); 7468 &win_width, &win_height);
7469 7469
7470 gtk_window_move(GTK_WINDOW(dest_win->window), 7470 gtk_window_move(GTK_WINDOW(dest_win->window),
7471 e->x_root - (win_width / 2), 7471 e->x_root - (win_width / 2),
7472 e->y_root - (win_height / 2)); 7472 e->y_root - (win_height / 2));
7473 7473
7474 gaim_gtk_conv_window_show(dest_win); 7474 pidgin_conv_window_show(dest_win);
7475 } 7475 }
7476 } 7476 }
7477 7477
7478 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); 7478 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
7479 7479
7480 return TRUE; 7480 return TRUE;
7481 } 7481 }
7482 7482
7483 7483
7484 static void 7484 static void
7485 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, 7485 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num,
7486 gpointer user_data) 7486 gpointer user_data)
7487 { 7487 {
7488 GaimGtkWindow *win; 7488 PidginWindow *win;
7489 GaimConversation *conv; 7489 GaimConversation *conv;
7490 GaimGtkConversation *gtkconv; 7490 PidginConversation *gtkconv;
7491 7491
7492 win = user_data; 7492 win = user_data;
7493 conv = gaim_gtk_conv_window_get_active_conversation(win); 7493 conv = pidgin_conv_window_get_active_conversation(win);
7494 7494
7495 g_return_if_fail(conv != NULL); 7495 g_return_if_fail(conv != NULL);
7496 7496
7497 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) 7497 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM)
7498 return; 7498 return;
7499 7499
7500 gtkconv = GAIM_GTK_CONVERSATION(conv); 7500 gtkconv = PIDGIN_CONVERSATION(conv);
7501 7501
7502 stop_anim(NULL, gtkconv); 7502 stop_anim(NULL, gtkconv);
7503 } 7503 }
7504 static void 7504 static void
7505 close_window(GtkWidget *w, GaimGtkWindow *win) 7505 close_window(GtkWidget *w, PidginWindow *win)
7506 { 7506 {
7507 close_win_cb(w, NULL, win); 7507 close_win_cb(w, NULL, win);
7508 } 7508 }
7509 7509
7510 static void 7510 static void
7511 detach_tab_cb(GtkWidget *w, GObject *menu) 7511 detach_tab_cb(GtkWidget *w, GObject *menu)
7512 { 7512 {
7513 GaimGtkWindow *win, *new_window; 7513 PidginWindow *win, *new_window;
7514 GaimGtkConversation *gtkconv; 7514 PidginConversation *gtkconv;
7515 7515
7516 gtkconv = g_object_get_data(menu, "clicked_tab"); 7516 gtkconv = g_object_get_data(menu, "clicked_tab");
7517 7517
7518 if (!gtkconv) 7518 if (!gtkconv)
7519 return; 7519 return;
7520 7520
7521 win = gaim_gtkconv_get_window(gtkconv); 7521 win = pidginconv_get_window(gtkconv);
7522 /* Nothing to do if there's only one tab in the window */ 7522 /* Nothing to do if there's only one tab in the window */
7523 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) 7523 if (pidgin_conv_window_get_gtkconv_count(win) == 1)
7524 return; 7524 return;
7525 7525
7526 gaim_gtk_conv_window_remove_gtkconv(win, gtkconv); 7526 pidgin_conv_window_remove_gtkconv(win, gtkconv);
7527 7527
7528 new_window = gaim_gtk_conv_window_new(); 7528 new_window = pidgin_conv_window_new();
7529 gaim_gtk_conv_window_add_gtkconv(new_window, gtkconv); 7529 pidgin_conv_window_add_gtkconv(new_window, gtkconv);
7530 gaim_gtk_conv_window_show(new_window); 7530 pidgin_conv_window_show(new_window);
7531 } 7531 }
7532 7532
7533 static void 7533 static void
7534 close_others_cb(GtkWidget *w, GObject *menu) 7534 close_others_cb(GtkWidget *w, GObject *menu)
7535 { 7535 {
7536 GList *iter; 7536 GList *iter;
7537 GaimGtkConversation *gtkconv; 7537 PidginConversation *gtkconv;
7538 GaimGtkWindow *win; 7538 PidginWindow *win;
7539 7539
7540 gtkconv = g_object_get_data(menu, "clicked_tab"); 7540 gtkconv = g_object_get_data(menu, "clicked_tab");
7541 7541
7542 if (!gtkconv) 7542 if (!gtkconv)
7543 return; 7543 return;
7544 7544
7545 win = gaim_gtkconv_get_window(gtkconv); 7545 win = pidginconv_get_window(gtkconv);
7546 7546
7547 for (iter = gaim_gtk_conv_window_get_gtkconvs(win); iter; ) 7547 for (iter = pidgin_conv_window_get_gtkconvs(win); iter; )
7548 { 7548 {
7549 GaimGtkConversation *gconv = iter->data; 7549 PidginConversation *gconv = iter->data;
7550 iter = iter->next; 7550 iter = iter->next;
7551 7551
7552 if (gconv != gtkconv) 7552 if (gconv != gtkconv)
7553 { 7553 {
7554 close_conv_cb(NULL, gconv); 7554 close_conv_cb(NULL, gconv);
7556 } 7556 }
7557 } 7557 }
7558 7558
7559 static void close_tab_cb(GtkWidget *w, GObject *menu) 7559 static void close_tab_cb(GtkWidget *w, GObject *menu)
7560 { 7560 {
7561 GaimGtkConversation *gtkconv; 7561 PidginConversation *gtkconv;
7562 7562
7563 gtkconv = g_object_get_data(menu, "clicked_tab"); 7563 gtkconv = g_object_get_data(menu, "clicked_tab");
7564 7564
7565 if (gtkconv) 7565 if (gtkconv)
7566 close_conv_cb(NULL, gtkconv); 7566 close_conv_cb(NULL, gtkconv);
7567 } 7567 }
7568 7568
7569 static gboolean 7569 static gboolean
7570 right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, GaimGtkWindow *win) 7570 right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow *win)
7571 { 7571 {
7572 GtkWidget *item, *menu; 7572 GtkWidget *item, *menu;
7573 GaimGtkConversation *gtkconv; 7573 PidginConversation *gtkconv;
7574 7574
7575 if (event->type != GDK_BUTTON_PRESS || event->button != 3) 7575 if (event->type != GDK_BUTTON_PRESS || event->button != 3)
7576 return FALSE; 7576 return FALSE;
7577 7577
7578 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, 7578 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win,
7579 gaim_gtkconv_get_tab_at_xy(win, event->x_root, event->y_root, NULL)); 7579 pidginconv_get_tab_at_xy(win, event->x_root, event->y_root, NULL));
7580 7580
7581 if (g_object_get_data(G_OBJECT(notebook->menu), "clicked_tab")) 7581 if (g_object_get_data(G_OBJECT(notebook->menu), "clicked_tab"))
7582 { 7582 {
7583 g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv); 7583 g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv);
7584 return FALSE; 7584 return FALSE;
7620 7620
7621 static void 7621 static void
7622 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, 7622 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num,
7623 gpointer user_data) 7623 gpointer user_data)
7624 { 7624 {
7625 GaimGtkWindow *win; 7625 PidginWindow *win;
7626 GaimConversation *conv; 7626 GaimConversation *conv;
7627 GaimGtkConversation *gtkconv; 7627 PidginConversation *gtkconv;
7628 const char *sound_method; 7628 const char *sound_method;
7629 7629
7630 win = user_data; 7630 win = user_data;
7631 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, page_num); 7631 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, page_num);
7632 conv = gtkconv->active_conv; 7632 conv = gtkconv->active_conv;
7633 7633
7634 g_return_if_fail(conv != NULL); 7634 g_return_if_fail(conv != NULL);
7635 7635
7636 /* clear unseen flag if conversation is not hidden */ 7636 /* clear unseen flag if conversation is not hidden */
7637 if(!gaim_gtkconv_is_hidden(gtkconv)) { 7637 if(!pidginconv_is_hidden(gtkconv)) {
7638 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE); 7638 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE);
7639 } 7639 }
7640 7640
7641 /* Update the menubar */ 7641 /* Update the menubar */
7642 7642
7644 gaim_conversation_is_logging(conv)); 7644 gaim_conversation_is_logging(conv));
7645 7645
7646 generate_send_to_items(win); 7646 generate_send_to_items(win);
7647 regenerate_options_items(win); 7647 regenerate_options_items(win);
7648 7648
7649 gaim_gtkconv_switch_active_conversation(conv); 7649 pidginconv_switch_active_conversation(conv);
7650 7650
7651 sound_method = gaim_prefs_get_string("/gaim/gtk/sound/method"); 7651 sound_method = gaim_prefs_get_string("/gaim/gtk/sound/method");
7652 if (strcmp(sound_method, "none") != 0) 7652 if (strcmp(sound_method, "none") != 0)
7653 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), 7653 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
7654 gtkconv->make_sound); 7654 gtkconv->make_sound);
7672 */ 7672 */
7673 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && 7673 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) &&
7674 (gtkconv->u.im->animate)) 7674 (gtkconv->u.im->animate))
7675 start_anim(NULL, gtkconv); 7675 start_anim(NULL, gtkconv);
7676 7676
7677 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-switched", conv); 7677 gaim_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv);
7678 } 7678 }
7679 7679
7680 /************************************************************************** 7680 /**************************************************************************
7681 * GTK+ window ops 7681 * GTK+ window ops
7682 **************************************************************************/ 7682 **************************************************************************/
7683 7683
7684 GList * 7684 GList *
7685 gaim_gtk_conv_windows_get_list() 7685 pidgin_conv_windows_get_list()
7686 { 7686 {
7687 return window_list; 7687 return window_list;
7688 } 7688 }
7689 7689
7690 GaimGtkWindow * 7690 PidginWindow *
7691 gaim_gtk_conv_window_new() 7691 pidgin_conv_window_new()
7692 { 7692 {
7693 GaimGtkWindow *win; 7693 PidginWindow *win;
7694 GtkPositionType pos; 7694 GtkPositionType pos;
7695 GtkWidget *testidea; 7695 GtkWidget *testidea;
7696 GtkWidget *menubar; 7696 GtkWidget *menubar;
7697 7697
7698 win = g_malloc0(sizeof(GaimGtkWindow)); 7698 win = g_malloc0(sizeof(PidginWindow));
7699 7699
7700 window_list = g_list_append(window_list, win); 7700 window_list = g_list_append(window_list, win);
7701 7701
7702 /* Create the window. */ 7702 /* Create the window. */
7703 win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 7703 win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
7764 7764
7765 return win; 7765 return win;
7766 } 7766 }
7767 7767
7768 void 7768 void
7769 gaim_gtk_conv_window_destroy(GaimGtkWindow *win) 7769 pidgin_conv_window_destroy(PidginWindow *win)
7770 { 7770 {
7771 gaim_prefs_disconnect_by_handle(win); 7771 gaim_prefs_disconnect_by_handle(win);
7772 window_list = g_list_remove(window_list, win); 7772 window_list = g_list_remove(window_list, win);
7773 7773
7774 /* Close the "Find" dialog if it's open */ 7774 /* Close the "Find" dialog if it's open */
7778 gtk_widget_hide_all(win->window); 7778 gtk_widget_hide_all(win->window);
7779 7779
7780 if (win->gtkconvs) { 7780 if (win->gtkconvs) {
7781 while (win->gtkconvs) { 7781 while (win->gtkconvs) {
7782 GList *nextgtk = win->gtkconvs->next; 7782 GList *nextgtk = win->gtkconvs->next;
7783 GaimGtkConversation *gtkconv = win->gtkconvs->data; 7783 PidginConversation *gtkconv = win->gtkconvs->data;
7784 GList *nextcore = gtkconv->convs->next; 7784 GList *nextcore = gtkconv->convs->next;
7785 GaimConversation *conv = gtkconv->convs->data; 7785 GaimConversation *conv = gtkconv->convs->data;
7786 gaim_conversation_destroy(conv); 7786 gaim_conversation_destroy(conv);
7787 if (!nextgtk && !nextcore) 7787 if (!nextgtk && !nextcore)
7788 /* we'll end up invoking ourselves when we destroy our last child */ 7788 /* we'll end up invoking ourselves when we destroy our last child */
7799 7799
7800 g_free(win); 7800 g_free(win);
7801 } 7801 }
7802 7802
7803 void 7803 void
7804 gaim_gtk_conv_window_show(GaimGtkWindow *win) 7804 pidgin_conv_window_show(PidginWindow *win)
7805 { 7805 {
7806 gtk_widget_show(win->window); 7806 gtk_widget_show(win->window);
7807 } 7807 }
7808 7808
7809 void 7809 void
7810 gaim_gtk_conv_window_hide(GaimGtkWindow *win) 7810 pidgin_conv_window_hide(PidginWindow *win)
7811 { 7811 {
7812 gtk_widget_hide(win->window); 7812 gtk_widget_hide(win->window);
7813 } 7813 }
7814 7814
7815 void 7815 void
7816 gaim_gtk_conv_window_raise(GaimGtkWindow *win) 7816 pidgin_conv_window_raise(PidginWindow *win)
7817 { 7817 {
7818 gdk_window_raise(GDK_WINDOW(win->window->window)); 7818 gdk_window_raise(GDK_WINDOW(win->window->window));
7819 } 7819 }
7820 7820
7821 void 7821 void
7822 gaim_gtk_conv_window_switch_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv) 7822 pidgin_conv_window_switch_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
7823 { 7823 {
7824 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 7824 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook),
7825 gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), 7825 gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook),
7826 gtkconv->tab_cont)); 7826 gtkconv->tab_cont));
7827 } 7827 }
7828 7828
7829 void 7829 void
7830 gaim_gtk_conv_window_add_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv) 7830 pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
7831 { 7831 {
7832 GaimConversation *conv = gtkconv->active_conv; 7832 GaimConversation *conv = gtkconv->active_conv;
7833 GaimGtkConversation *focus_gtkconv; 7833 PidginConversation *focus_gtkconv;
7834 GtkWidget *tabby, *menu_tabby; 7834 GtkWidget *tabby, *menu_tabby;
7835 GtkWidget *tab_cont = gtkconv->tab_cont; 7835 GtkWidget *tab_cont = gtkconv->tab_cont;
7836 GtkWidget *close_image; 7836 GtkWidget *close_image;
7837 GaimConversationType conv_type; 7837 GaimConversationType conv_type;
7838 const gchar *tmp_lab; 7838 const gchar *tmp_lab;
7945 7945
7946 gtk_widget_show(tabby); 7946 gtk_widget_show(tabby);
7947 gtk_widget_show(menu_tabby); 7947 gtk_widget_show(menu_tabby);
7948 7948
7949 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) 7949 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
7950 gaim_gtkconv_update_buddy_icon(conv); 7950 pidginconv_update_buddy_icon(conv);
7951 7951
7952 /* Add this pane to the conversation's notebook. */ 7952 /* Add this pane to the conversation's notebook. */
7953 gtk_notebook_append_page_menu(GTK_NOTEBOOK(win->notebook), tab_cont, tabby, menu_tabby); 7953 gtk_notebook_append_page_menu(GTK_NOTEBOOK(win->notebook), tab_cont, tabby, menu_tabby);
7954 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START); 7954 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START);
7955 7955
7956 7956
7957 gtk_widget_show(tab_cont); 7957 gtk_widget_show(tab_cont);
7958 7958
7959 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) { 7959 if (pidgin_conv_window_get_gtkconv_count(win) == 1) {
7960 /* Er, bug in notebooks? Switch to the page manually. */ 7960 /* Er, bug in notebooks? Switch to the page manually. */
7961 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); 7961 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
7962 7962
7963 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), 7963 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
7964 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); 7964 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs"));
7965 } else 7965 } else
7966 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE); 7966 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE);
7967 7967
7968 focus_gtkconv = g_list_nth_data(gaim_gtk_conv_window_get_gtkconvs(win), 7968 focus_gtkconv = g_list_nth_data(pidgin_conv_window_get_gtkconvs(win),
7969 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook))); 7969 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)));
7970 gtk_widget_grab_focus(focus_gtkconv->entry); 7970 gtk_widget_grab_focus(focus_gtkconv->entry);
7971 7971
7972 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) 7972 if (pidgin_conv_window_get_gtkconv_count(win) == 1)
7973 update_send_to_selection(win); 7973 update_send_to_selection(win);
7974 } 7974 }
7975 7975
7976 void 7976 void
7977 gaim_gtk_conv_window_remove_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv) 7977 pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
7978 { 7978 {
7979 unsigned int index; 7979 unsigned int index;
7980 GaimConversationType conv_type; 7980 GaimConversationType conv_type;
7981 7981
7982 conv_type = gaim_conversation_get_type(gtkconv->active_conv); 7982 conv_type = gaim_conversation_get_type(gtkconv->active_conv);
7986 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); 7986 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont));
7987 7987
7988 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); 7988 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index);
7989 7989
7990 /* go back to tabless if need be */ 7990 /* go back to tabless if need be */
7991 if (gaim_gtk_conv_window_get_gtkconv_count(win) <= 2) { 7991 if (pidgin_conv_window_get_gtkconv_count(win) <= 2) {
7992 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), 7992 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
7993 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); 7993 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs"));
7994 } 7994 }
7995 7995
7996 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv); 7996 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv);
7997 7997
7998 if (!win->gtkconvs && win != hidden_convwin) 7998 if (!win->gtkconvs && win != hidden_convwin)
7999 gaim_gtk_conv_window_destroy(win); 7999 pidgin_conv_window_destroy(win);
8000 } 8000 }
8001 8001
8002 GaimGtkConversation * 8002 PidginConversation *
8003 gaim_gtk_conv_window_get_gtkconv_at_index(const GaimGtkWindow *win, int index) 8003 pidgin_conv_window_get_gtkconv_at_index(const PidginWindow *win, int index)
8004 { 8004 {
8005 GtkWidget *tab_cont; 8005 GtkWidget *tab_cont;
8006 8006
8007 if (index == -1) 8007 if (index == -1)
8008 index = 0; 8008 index = 0;
8009 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index); 8009 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index);
8010 return tab_cont ? g_object_get_data(G_OBJECT(tab_cont), "GaimGtkConversation") : NULL; 8010 return tab_cont ? g_object_get_data(G_OBJECT(tab_cont), "PidginConversation") : NULL;
8011 } 8011 }
8012 8012
8013 GaimGtkConversation * 8013 PidginConversation *
8014 gaim_gtk_conv_window_get_active_gtkconv(const GaimGtkWindow *win) 8014 pidgin_conv_window_get_active_gtkconv(const PidginWindow *win)
8015 { 8015 {
8016 int index; 8016 int index;
8017 GtkWidget *tab_cont; 8017 GtkWidget *tab_cont;
8018 8018
8019 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)); 8019 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook));
8020 if (index == -1) 8020 if (index == -1)
8021 index = 0; 8021 index = 0;
8022 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index); 8022 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index);
8023 if (!tab_cont) 8023 if (!tab_cont)
8024 return NULL; 8024 return NULL;
8025 return g_object_get_data(G_OBJECT(tab_cont), "GaimGtkConversation"); 8025 return g_object_get_data(G_OBJECT(tab_cont), "PidginConversation");
8026 } 8026 }
8027 8027
8028 8028
8029 GaimConversation * 8029 GaimConversation *
8030 gaim_gtk_conv_window_get_active_conversation(const GaimGtkWindow *win) 8030 pidgin_conv_window_get_active_conversation(const PidginWindow *win)
8031 { 8031 {
8032 GaimGtkConversation *gtkconv; 8032 PidginConversation *gtkconv;
8033 8033
8034 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win); 8034 gtkconv = pidgin_conv_window_get_active_gtkconv(win);
8035 return gtkconv ? gtkconv->active_conv : NULL; 8035 return gtkconv ? gtkconv->active_conv : NULL;
8036 } 8036 }
8037 8037
8038 gboolean 8038 gboolean
8039 gaim_gtk_conv_window_is_active_conversation(const GaimConversation *conv) 8039 pidgin_conv_window_is_active_conversation(const GaimConversation *conv)
8040 { 8040 {
8041 return conv == gaim_gtk_conv_window_get_active_conversation(GAIM_GTK_CONVERSATION(conv)->win); 8041 return conv == pidgin_conv_window_get_active_conversation(PIDGIN_CONVERSATION(conv)->win);
8042 } 8042 }
8043 8043
8044 gboolean 8044 gboolean
8045 gaim_gtk_conv_window_has_focus(GaimGtkWindow *win) 8045 pidgin_conv_window_has_focus(PidginWindow *win)
8046 { 8046 {
8047 gboolean has_focus = FALSE; 8047 gboolean has_focus = FALSE;
8048 8048
8049 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL); 8049 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL);
8050 8050
8051 return has_focus; 8051 return has_focus;
8052 } 8052 }
8053 8053
8054 GaimGtkWindow * 8054 PidginWindow *
8055 gaim_gtk_conv_window_get_at_xy(int x, int y) 8055 pidgin_conv_window_get_at_xy(int x, int y)
8056 { 8056 {
8057 GaimGtkWindow *win; 8057 PidginWindow *win;
8058 GdkWindow *gdkwin; 8058 GdkWindow *gdkwin;
8059 GList *l; 8059 GList *l;
8060 8060
8061 gdkwin = gdk_window_at_pointer(&x, &y); 8061 gdkwin = gdk_window_at_pointer(&x, &y);
8062 8062
8063 if (gdkwin) 8063 if (gdkwin)
8064 gdkwin = gdk_window_get_toplevel(gdkwin); 8064 gdkwin = gdk_window_get_toplevel(gdkwin);
8065 8065
8066 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) { 8066 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
8067 win = l->data; 8067 win = l->data;
8068 8068
8069 if (gdkwin == win->window->window) 8069 if (gdkwin == win->window->window)
8070 return win; 8070 return win;
8071 } 8071 }
8072 8072
8073 return NULL; 8073 return NULL;
8074 } 8074 }
8075 8075
8076 GList * 8076 GList *
8077 gaim_gtk_conv_window_get_gtkconvs(GaimGtkWindow *win) 8077 pidgin_conv_window_get_gtkconvs(PidginWindow *win)
8078 { 8078 {
8079 return win->gtkconvs; 8079 return win->gtkconvs;
8080 } 8080 }
8081 8081
8082 guint 8082 guint
8083 gaim_gtk_conv_window_get_gtkconv_count(GaimGtkWindow *win) 8083 pidgin_conv_window_get_gtkconv_count(PidginWindow *win)
8084 { 8084 {
8085 return g_list_length(win->gtkconvs); 8085 return g_list_length(win->gtkconvs);
8086 } 8086 }
8087 8087
8088 GaimGtkWindow * 8088 PidginWindow *
8089 gaim_gtk_conv_window_first_with_type(GaimConversationType type) 8089 pidgin_conv_window_first_with_type(GaimConversationType type)
8090 { 8090 {
8091 GList *wins, *convs; 8091 GList *wins, *convs;
8092 GaimGtkWindow *win; 8092 PidginWindow *win;
8093 GaimGtkConversation *conv; 8093 PidginConversation *conv;
8094 8094
8095 if (type == GAIM_CONV_TYPE_UNKNOWN) 8095 if (type == GAIM_CONV_TYPE_UNKNOWN)
8096 return NULL; 8096 return NULL;
8097 8097
8098 for (wins = gaim_gtk_conv_windows_get_list(); wins != NULL; wins = wins->next) { 8098 for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) {
8099 win = wins->data; 8099 win = wins->data;
8100 8100
8101 for (convs = win->gtkconvs; 8101 for (convs = win->gtkconvs;
8102 convs != NULL; 8102 convs != NULL;
8103 convs = convs->next) { 8103 convs = convs->next) {
8110 } 8110 }
8111 8111
8112 return NULL; 8112 return NULL;
8113 } 8113 }
8114 8114
8115 GaimGtkWindow * 8115 PidginWindow *
8116 gaim_gtk_conv_window_last_with_type(GaimConversationType type) 8116 pidgin_conv_window_last_with_type(GaimConversationType type)
8117 { 8117 {
8118 GList *wins, *convs; 8118 GList *wins, *convs;
8119 GaimGtkWindow *win; 8119 PidginWindow *win;
8120 GaimGtkConversation *conv; 8120 PidginConversation *conv;
8121 8121
8122 if (type == GAIM_CONV_TYPE_UNKNOWN) 8122 if (type == GAIM_CONV_TYPE_UNKNOWN)
8123 return NULL; 8123 return NULL;
8124 8124
8125 for (wins = g_list_last(gaim_gtk_conv_windows_get_list()); 8125 for (wins = g_list_last(pidgin_conv_windows_get_list());
8126 wins != NULL; 8126 wins != NULL;
8127 wins = wins->prev) { 8127 wins = wins->prev) {
8128 8128
8129 win = wins->data; 8129 win = wins->data;
8130 8130
8157 static GList *conv_placement_fncs = NULL; 8157 static GList *conv_placement_fncs = NULL;
8158 static GaimConvPlacementFunc place_conv = NULL; 8158 static GaimConvPlacementFunc place_conv = NULL;
8159 8159
8160 /* This one places conversations in the last made window. */ 8160 /* This one places conversations in the last made window. */
8161 static void 8161 static void
8162 conv_placement_last_created_win(GaimGtkConversation *conv) 8162 conv_placement_last_created_win(PidginConversation *conv)
8163 { 8163 {
8164 GaimGtkWindow *win; 8164 PidginWindow *win;
8165 8165
8166 GList *l = g_list_last(gaim_gtk_conv_windows_get_list()); 8166 GList *l = g_list_last(pidgin_conv_windows_get_list());
8167 win = l ? l->data : NULL;; 8167 win = l ? l->data : NULL;;
8168 8168
8169 if (win == NULL) { 8169 if (win == NULL) {
8170 win = gaim_gtk_conv_window_new(); 8170 win = pidgin_conv_window_new();
8171 8171
8172 gaim_gtk_conv_window_add_gtkconv(win, conv); 8172 pidgin_conv_window_add_gtkconv(win, conv);
8173 gaim_gtk_conv_window_show(win); 8173 pidgin_conv_window_show(win);
8174 } else { 8174 } else {
8175 gaim_gtk_conv_window_add_gtkconv(win, conv); 8175 pidgin_conv_window_add_gtkconv(win, conv);
8176 } 8176 }
8177 } 8177 }
8178 8178
8179 /* This one places conversations in the last made window of the same type. */ 8179 /* This one places conversations in the last made window of the same type. */
8180 static void 8180 static void
8181 conv_placement_last_created_win_type(GaimGtkConversation *conv) 8181 conv_placement_last_created_win_type(PidginConversation *conv)
8182 { 8182 {
8183 GaimGtkWindow *win; 8183 PidginWindow *win;
8184 8184
8185 win = gaim_gtk_conv_window_last_with_type(gaim_conversation_get_type(conv->active_conv)); 8185 win = pidgin_conv_window_last_with_type(gaim_conversation_get_type(conv->active_conv));
8186 8186
8187 if (win == NULL) { 8187 if (win == NULL) {
8188 win = gaim_gtk_conv_window_new(); 8188 win = pidgin_conv_window_new();
8189 8189
8190 gaim_gtk_conv_window_add_gtkconv(win, conv); 8190 pidgin_conv_window_add_gtkconv(win, conv);
8191 gaim_gtk_conv_window_show(win); 8191 pidgin_conv_window_show(win);
8192 } else 8192 } else
8193 gaim_gtk_conv_window_add_gtkconv(win, conv); 8193 pidgin_conv_window_add_gtkconv(win, conv);
8194 } 8194 }
8195 8195
8196 /* This one places each conversation in its own window. */ 8196 /* This one places each conversation in its own window. */
8197 static void 8197 static void
8198 conv_placement_new_window(GaimGtkConversation *conv) 8198 conv_placement_new_window(PidginConversation *conv)
8199 { 8199 {
8200 GaimGtkWindow *win; 8200 PidginWindow *win;
8201 8201
8202 win = gaim_gtk_conv_window_new(); 8202 win = pidgin_conv_window_new();
8203 8203
8204 gaim_gtk_conv_window_add_gtkconv(win, conv); 8204 pidgin_conv_window_add_gtkconv(win, conv);
8205 8205
8206 gaim_gtk_conv_window_show(win); 8206 pidgin_conv_window_show(win);
8207 } 8207 }
8208 8208
8209 static GaimGroup * 8209 static GaimGroup *
8210 conv_get_group(GaimGtkConversation *conv) 8210 conv_get_group(PidginConversation *conv)
8211 { 8211 {
8212 GaimGroup *group = NULL; 8212 GaimGroup *group = NULL;
8213 8213
8214 if (gaim_conversation_get_type(conv->active_conv) == GAIM_CONV_TYPE_IM) { 8214 if (gaim_conversation_get_type(conv->active_conv) == GAIM_CONV_TYPE_IM) {
8215 GaimBuddy *buddy; 8215 GaimBuddy *buddy;
8237 * This groups things by, well, group. Buddies from groups will always be 8237 * This groups things by, well, group. Buddies from groups will always be
8238 * grouped together, and a buddy from a group not belonging to any currently 8238 * grouped together, and a buddy from a group not belonging to any currently
8239 * open windows will get a new window. 8239 * open windows will get a new window.
8240 */ 8240 */
8241 static void 8241 static void
8242 conv_placement_by_group(GaimGtkConversation *conv) 8242 conv_placement_by_group(PidginConversation *conv)
8243 { 8243 {
8244 GaimConversationType type; 8244 GaimConversationType type;
8245 GaimGroup *group = NULL; 8245 GaimGroup *group = NULL;
8246 GList *wl, *cl; 8246 GList *wl, *cl;
8247 8247
8248 type = gaim_conversation_get_type(conv->active_conv); 8248 type = gaim_conversation_get_type(conv->active_conv);
8249 8249
8250 group = conv_get_group(conv); 8250 group = conv_get_group(conv);
8251 8251
8252 /* Go through the list of IMs and find one with this group. */ 8252 /* Go through the list of IMs and find one with this group. */
8253 for (wl = gaim_gtk_conv_windows_get_list(); wl != NULL; wl = wl->next) { 8253 for (wl = pidgin_conv_windows_get_list(); wl != NULL; wl = wl->next) {
8254 GaimGtkWindow *win2; 8254 PidginWindow *win2;
8255 GaimGtkConversation *conv2; 8255 PidginConversation *conv2;
8256 GaimGroup *group2 = NULL; 8256 GaimGroup *group2 = NULL;
8257 8257
8258 win2 = wl->data; 8258 win2 = wl->data;
8259 8259
8260 for (cl = win2->gtkconvs; 8260 for (cl = win2->gtkconvs;
8263 conv2 = cl->data; 8263 conv2 = cl->data;
8264 8264
8265 group2 = conv_get_group(conv2); 8265 group2 = conv_get_group(conv2);
8266 8266
8267 if (group == group2) { 8267 if (group == group2) {
8268 gaim_gtk_conv_window_add_gtkconv(win2, conv); 8268 pidgin_conv_window_add_gtkconv(win2, conv);
8269 8269
8270 return; 8270 return;
8271 } 8271 }
8272 } 8272 }
8273 } 8273 }
8276 conv_placement_new_window(conv); 8276 conv_placement_new_window(conv);
8277 } 8277 }
8278 8278
8279 /* This groups things by account. Otherwise, the same semantics as above */ 8279 /* This groups things by account. Otherwise, the same semantics as above */
8280 static void 8280 static void
8281 conv_placement_by_account(GaimGtkConversation *conv) 8281 conv_placement_by_account(PidginConversation *conv)
8282 { 8282 {
8283 GaimConversationType type; 8283 GaimConversationType type;
8284 GList *wins, *convs; 8284 GList *wins, *convs;
8285 GaimAccount *account; 8285 GaimAccount *account;
8286 8286
8287 account = gaim_conversation_get_account(conv->active_conv); 8287 account = gaim_conversation_get_account(conv->active_conv);
8288 type = gaim_conversation_get_type(conv->active_conv); 8288 type = gaim_conversation_get_type(conv->active_conv);
8289 8289
8290 /* Go through the list of IMs and find one with this group. */ 8290 /* Go through the list of IMs and find one with this group. */
8291 for (wins = gaim_gtk_conv_windows_get_list(); wins != NULL; wins = wins->next) { 8291 for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) {
8292 GaimGtkWindow *win2; 8292 PidginWindow *win2;
8293 GaimGtkConversation *conv2; 8293 PidginConversation *conv2;
8294 8294
8295 win2 = wins->data; 8295 win2 = wins->data;
8296 8296
8297 for (convs = win2->gtkconvs; 8297 for (convs = win2->gtkconvs;
8298 convs != NULL; 8298 convs != NULL;
8299 convs = convs->next) { 8299 convs = convs->next) {
8300 conv2 = convs->data; 8300 conv2 = convs->data;
8301 8301
8302 if (account == gaim_conversation_get_account(conv2->active_conv)) { 8302 if (account == gaim_conversation_get_account(conv2->active_conv)) {
8303 gaim_gtk_conv_window_add_gtkconv(win2, conv); 8303 pidgin_conv_window_add_gtkconv(win2, conv);
8304 return; 8304 return;
8305 } 8305 }
8306 } 8306 }
8307 } 8307 }
8308 8308
8356 conv_placement_by_account); 8356 conv_placement_by_account);
8357 } 8357 }
8358 } 8358 }
8359 8359
8360 GList * 8360 GList *
8361 gaim_gtkconv_placement_get_options(void) 8361 pidginconv_placement_get_options(void)
8362 { 8362 {
8363 GList *n, *list = NULL; 8363 GList *n, *list = NULL;
8364 ConvPlacementData *data; 8364 ConvPlacementData *data;
8365 8365
8366 ensure_default_funcs(); 8366 ensure_default_funcs();
8374 return list; 8374 return list;
8375 } 8375 }
8376 8376
8377 8377
8378 void 8378 void
8379 gaim_gtkconv_placement_add_fnc(const char *id, const char *name, 8379 pidginconv_placement_add_fnc(const char *id, const char *name,
8380 GaimConvPlacementFunc fnc) 8380 GaimConvPlacementFunc fnc)
8381 { 8381 {
8382 g_return_if_fail(id != NULL); 8382 g_return_if_fail(id != NULL);
8383 g_return_if_fail(name != NULL); 8383 g_return_if_fail(name != NULL);
8384 g_return_if_fail(fnc != NULL); 8384 g_return_if_fail(fnc != NULL);
8387 8387
8388 add_conv_placement_fnc(id, name, fnc); 8388 add_conv_placement_fnc(id, name, fnc);
8389 } 8389 }
8390 8390
8391 void 8391 void
8392 gaim_gtkconv_placement_remove_fnc(const char *id) 8392 pidginconv_placement_remove_fnc(const char *id)
8393 { 8393 {
8394 ConvPlacementData *data = get_conv_placement_data(id); 8394 ConvPlacementData *data = get_conv_placement_data(id);
8395 8395
8396 if (data == NULL) 8396 if (data == NULL)
8397 return; 8397 return;
8402 g_free(data->name); 8402 g_free(data->name);
8403 g_free(data); 8403 g_free(data);
8404 } 8404 }
8405 8405
8406 const char * 8406 const char *
8407 gaim_gtkconv_placement_get_name(const char *id) 8407 pidginconv_placement_get_name(const char *id)
8408 { 8408 {
8409 ConvPlacementData *data; 8409 ConvPlacementData *data;
8410 8410
8411 ensure_default_funcs(); 8411 ensure_default_funcs();
8412 8412
8417 8417
8418 return data->name; 8418 return data->name;
8419 } 8419 }
8420 8420
8421 GaimConvPlacementFunc 8421 GaimConvPlacementFunc
8422 gaim_gtkconv_placement_get_fnc(const char *id) 8422 pidginconv_placement_get_fnc(const char *id)
8423 { 8423 {
8424 ConvPlacementData *data; 8424 ConvPlacementData *data;
8425 8425
8426 ensure_default_funcs(); 8426 ensure_default_funcs();
8427 8427
8432 8432
8433 return data->fnc; 8433 return data->fnc;
8434 } 8434 }
8435 8435
8436 void 8436 void
8437 gaim_gtkconv_placement_set_current_func(GaimConvPlacementFunc func) 8437 pidginconv_placement_set_current_func(GaimConvPlacementFunc func)
8438 { 8438 {
8439 g_return_if_fail(func != NULL); 8439 g_return_if_fail(func != NULL);
8440 8440
8441 /* If tabs are enabled, set the function, otherwise, NULL it out. */ 8441 /* If tabs are enabled, set the function, otherwise, NULL it out. */
8442 if (gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) 8442 if (gaim_prefs_get_bool("/gaim/gtk/conversations/tabs"))
8444 else 8444 else
8445 place_conv = NULL; 8445 place_conv = NULL;
8446 } 8446 }
8447 8447
8448 GaimConvPlacementFunc 8448 GaimConvPlacementFunc
8449 gaim_gtkconv_placement_get_current_func(void) 8449 pidginconv_placement_get_current_func(void)
8450 { 8450 {
8451 return place_conv; 8451 return place_conv;
8452 } 8452 }
8453 8453
8454 void 8454 void
8455 gaim_gtkconv_placement_place(GaimGtkConversation *gtkconv) 8455 pidginconv_placement_place(PidginConversation *gtkconv)
8456 { 8456 {
8457 if (place_conv) 8457 if (place_conv)
8458 place_conv(gtkconv); 8458 place_conv(gtkconv);
8459 else 8459 else
8460 conv_placement_new_window(gtkconv); 8460 conv_placement_new_window(gtkconv);
8461 } 8461 }
8462 8462
8463 gboolean 8463 gboolean
8464 gaim_gtkconv_is_hidden(GaimGtkConversation *gtkconv) 8464 pidginconv_is_hidden(PidginConversation *gtkconv)
8465 { 8465 {
8466 g_return_val_if_fail(gtkconv != NULL, FALSE); 8466 g_return_val_if_fail(gtkconv != NULL, FALSE);
8467 8467
8468 return (gtkconv->win == hidden_convwin); 8468 return (gtkconv->win == hidden_convwin);
8469 } 8469 }