comparison src/gtkconv.c @ 9108:6a17b7e2e3b2

[gaim-migrate @ 9885] I did some more prefslashing. Test, discuss. I'll stay up for a bit. If nobody objects, let's tag and release. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 28 May 2004 05:53:34 +0000
parents 717d0e23f5fa
children 78189aad1457
comparison
equal deleted inserted replaced
9107:f0be63d6d192 9108:6a17b7e2e3b2
3385 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); 3385 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5);
3386 3386
3387 gaim_gtkconv_update_buttons_by_protocol(conv); 3387 gaim_gtkconv_update_buttons_by_protocol(conv);
3388 3388
3389 /* Check if the buttons should be visible or not */ 3389 /* Check if the buttons should be visible or not */
3390 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/im/button_type"); 3390 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type");
3391 if (button_type == GAIM_BUTTON_NONE) 3391 if (button_type == GAIM_BUTTON_NONE)
3392 gtk_widget_hide(gtkconv->bbox); 3392 gtk_widget_hide(gtkconv->bbox);
3393 else 3393 else
3394 gtk_widget_show(gtkconv->bbox); 3394 gtk_widget_show(gtkconv->bbox);
3395 3395
3472 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); 3472 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3);
3473 3473
3474 gaim_gtkconv_update_buttons_by_protocol(conv); 3474 gaim_gtkconv_update_buttons_by_protocol(conv);
3475 3475
3476 /* Check if the buttons should be visible or not */ 3476 /* Check if the buttons should be visible or not */
3477 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/chat/button_type"); 3477 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type");
3478 if (button_type == GAIM_BUTTON_NONE) 3478 if (button_type == GAIM_BUTTON_NONE)
3479 gtk_widget_hide(gtkconv->bbox); 3479 gtk_widget_hide(gtkconv->bbox);
3480 else 3480 else
3481 gtk_widget_show(gtkconv->bbox); 3481 gtk_widget_show(gtkconv->bbox);
3482 3482
4480 gtkwin = GAIM_GTK_WINDOW(gaimwin); 4480 gtkwin = GAIM_GTK_WINDOW(gaimwin);
4481 4481
4482 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); 4482 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL);
4483 4483
4484 if (!(flags & GAIM_MESSAGE_NO_LOG) && 4484 if (!(flags & GAIM_MESSAGE_NO_LOG) &&
4485 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { 4485 gaim_prefs_get_bool("/gaim/gtk/conversations/raise_on_events")) {
4486 4486
4487 gaim_conv_window_raise(gaim_conversation_get_window(conv)); 4487 gaim_conv_window_raise(gaim_conversation_get_window(conv));
4488 } 4488 }
4489 4489
4490 /* Play a sound, if specified in prefs. */ 4490 /* Play a sound, if specified in prefs. */
4544 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) 4544 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks"))
4545 flags |= GAIM_MESSAGE_COLORIZE; 4545 flags |= GAIM_MESSAGE_COLORIZE;
4546 4546
4547 /* Raise the window, if specified in prefs. */ 4547 /* Raise the window, if specified in prefs. */
4548 if (!(flags & GAIM_MESSAGE_NO_LOG) && 4548 if (!(flags & GAIM_MESSAGE_NO_LOG) &&
4549 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { 4549 /* we may want to change this */
4550 gaim_prefs_get_bool("/gaim/gtk/conversations/raise_on_events")) {
4550 4551
4551 gaim_conv_window_raise(gaim_conversation_get_window(conv)); 4552 gaim_conv_window_raise(gaim_conversation_get_window(conv));
4552 } 4553 }
4553 4554
4554 gaim_conversation_write(conv, who, message, flags, mtime); 4555 gaim_conversation_write(conv, who, message, flags, mtime);
4575 gtkconv = GAIM_GTK_CONVERSATION(conv); 4576 gtkconv = GAIM_GTK_CONVERSATION(conv);
4576 gc = gaim_conversation_get_gc(conv); 4577 gc = gaim_conversation_get_gc(conv);
4577 4578
4578 win = gaim_conversation_get_window(conv); 4579 win = gaim_conversation_get_window(conv);
4579 4580
4580 if (!(flags & GAIM_MESSAGE_NO_LOG) && 4581 if (!(flags & GAIM_MESSAGE_NO_LOG) && gaim_prefs_get_bool("/gaim/gtk/conversations/raise_on_events")) {
4581 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT &&
4582 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) ||
4583 (gaim_conversation_get_type(conv) == GAIM_CONV_IM &&
4584 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")))) {
4585
4586 gaim_conv_window_show(win); 4582 gaim_conv_window_show(win);
4587 } 4583 }
4588 4584
4589 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) 4585 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml))))
4590 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); 4586 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0);
5295 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); 5291 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100);
5296 g_object_unref(G_OBJECT(scale)); 5292 g_object_unref(G_OBJECT(scale));
5297 5293
5298 5294
5299 vbox = gtk_vbox_new(FALSE, 0); 5295 vbox = gtk_vbox_new(FALSE, 0);
5300 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/im/button_type"); 5296 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type");
5301 if(button_type == GAIM_BUTTON_NONE) { 5297 if(button_type == GAIM_BUTTON_NONE) {
5302 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), vbox, FALSE, FALSE, 0); 5298 gtk_box_pack_start(GTK_BOX(gtkconv->entrybox), vbox, FALSE, FALSE, 0);
5303 gtk_box_reorder_child(GTK_BOX(gtkconv->entrybox), vbox, 0); 5299 gtk_box_reorder_child(GTK_BOX(gtkconv->entrybox), vbox, 0);
5304 } else { 5300 } else {
5305 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); 5301 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0);
5688 gtk_widget_hide(gtkconv->toolbar); 5684 gtk_widget_hide(gtkconv->toolbar);
5689 } 5685 }
5690 } 5686 }
5691 5687
5692 static void 5688 static void
5693 im_button_type_pref_cb(const char *name, GaimPrefType type, 5689 button_type_pref_cb(const char *name, GaimPrefType type,
5694 gpointer value, gpointer data) 5690 gpointer value, gpointer data)
5695 { 5691 {
5696 GList *l; 5692 GList *l;
5697 GaimConversation *conv; 5693 GaimConversation *conv;
5698 GaimGtkConversation *gtkconv; 5694 GaimGtkConversation *gtkconv;
5699 5695
5700 for (l = gaim_get_ims(); l != NULL; l = l->next) { 5696 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
5701 conv = (GaimConversation *)l->data; 5697 conv = (GaimConversation *)l->data;
5702 gtkconv = GAIM_GTK_CONVERSATION(conv); 5698 gtkconv = GAIM_GTK_CONVERSATION(conv);
5703 5699 switch (conv->type) {
5704 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); 5700 case GAIM_CONV_IM:
5705 gaim_gtkconv_update_buddy_icon(conv); 5701 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send));
5702 gaim_gtkconv_update_buddy_icon(conv);
5703 break;
5704 case GAIM_CONV_CHAT:
5705 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send));
5706 break;
5707 }
5706 } 5708 }
5707 } 5709 }
5708 5710
5709 static void 5711 static void
5710 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, 5712 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type,
5742 for (l = gaim_get_conversations(); l != NULL; l = l->next) { 5744 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
5743 GaimConversation *conv = l->data; 5745 GaimConversation *conv = l->data;
5744 5746
5745 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) 5747 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
5746 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); 5748 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon);
5747 }
5748 }
5749
5750 static void
5751 chat_button_type_pref_cb(const char *name, GaimPrefType type,
5752 gpointer value, gpointer data)
5753 {
5754 GList *l;
5755 GaimConversation *conv;
5756 GaimGtkConversation *gtkconv;
5757
5758 for (l = gaim_get_chats(); l != NULL; l = l->next) {
5759 conv = (GaimConversation *)l->data;
5760 gtkconv = GAIM_GTK_CONVERSATION(conv);
5761
5762 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send));
5763 } 5749 }
5764 } 5750 }
5765 5751
5766 static void 5752 static void
5767 conv_placement_pref_cb(const char *name, GaimPrefType type, 5753 conv_placement_pref_cb(const char *name, GaimPrefType type,
5821 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); 5807 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "");
5822 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); 5808 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", "");
5823 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); 5809 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3);
5824 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); 5810 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE);
5825 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); 5811 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP);
5812 gaim_prefs_add_int("/gaim/gtk/conversations/button_type",
5813 GAIM_BUTTON_TEXT_IMAGE);
5814 gaim_prefs_add_bool("/gaim/gtk/conversations/raise_on_events", FALSE);
5815 gaim_prefs_rename("/gaim/gtk/conversations/im/buton_type", "/gaim/gtk/conversations/button_type");
5816 gaim_prefs_rename("/gaim/gtk/conversations/im/raise_on_events", "/gaim/gtk/conversations/raise_on_events");
5817
5826 5818
5827 /* Conversations -> Chat */ 5819 /* Conversations -> Chat */
5828 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); 5820 gaim_prefs_add_none("/gaim/gtk/conversations/chat");
5829 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type",
5830 GAIM_BUTTON_TEXT_IMAGE);
5831 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); 5821 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE);
5832 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE);
5833 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); 5822 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410);
5834 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); 5823 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160);
5835 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); 5824 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50);
5836 5825
5837 /* Conversations -> IM */ 5826 /* Conversations -> IM */
5838 gaim_prefs_add_none("/gaim/gtk/conversations/im"); 5827 gaim_prefs_add_none("/gaim/gtk/conversations/im");
5839 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", 5828
5840 GAIM_BUTTON_TEXT_IMAGE);
5841 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); 5829 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE);
5842 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); 5830
5843 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); 5831 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE);
5844 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); 5832 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410);
5845 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); 5833 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160);
5846 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); 5834 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50);
5847 5835
5865 5853
5866 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", 5854 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement",
5867 conv_placement_pref_cb, NULL); 5855 conv_placement_pref_cb, NULL);
5868 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); 5856 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement");
5869 5857
5870 5858 gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type",
5859 button_type_pref_cb, NULL);
5871 5860
5872 /* IM callbacks */ 5861 /* IM callbacks */
5873 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type",
5874 im_button_type_pref_cb, NULL);
5875 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", 5862 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons",
5876 animate_buddy_icons_pref_cb, NULL); 5863 animate_buddy_icons_pref_cb, NULL);
5877 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", 5864 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons",
5878 show_buddy_icons_pref_cb, NULL); 5865 show_buddy_icons_pref_cb, NULL);
5879 5866
5880
5881 /* Chat callbacks */
5882 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type",
5883 chat_button_type_pref_cb, NULL);
5884 5867
5885 /********************************************************************** 5868 /**********************************************************************
5886 * Register signals 5869 * Register signals
5887 **********************************************************************/ 5870 **********************************************************************/
5888 gaim_signal_register(handle, "conversation-drag-ended", 5871 gaim_signal_register(handle, "conversation-drag-ended",