comparison src/conversation.c @ 3472:d33ec392a5e1

[gaim-migrate @ 3523] Rob McQueen went and removed all the GTK version preprocessor statements. Thanks! committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 29 Aug 2002 21:40:08 +0000
parents 2f8f4f1dac98
children 0073a014e55b
comparison
equal deleted inserted replaced
3471:7fb93ecd631c 3472:d33ec392a5e1
270 gtk_widget_destroy(c->smiley_dialog); 270 gtk_widget_destroy(c->smiley_dialog);
271 if (c->link_dialog) 271 if (c->link_dialog)
272 gtk_widget_destroy(c->link_dialog); 272 gtk_widget_destroy(c->link_dialog);
273 if (c->log_dialog) 273 if (c->log_dialog)
274 gtk_widget_destroy(c->log_dialog); 274 gtk_widget_destroy(c->log_dialog);
275 #if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0)
276 if (c->save_icon) 275 if (c->save_icon)
277 gtk_widget_destroy(c->save_icon); 276 gtk_widget_destroy(c->save_icon);
278 #endif
279 c->send_history = g_list_first(c->send_history); 277 c->send_history = g_list_first(c->send_history);
280 while (c->send_history) { 278 while (c->send_history) {
281 if (c->send_history->data) 279 if (c->send_history->data)
282 g_free(c->send_history->data); 280 g_free(c->send_history->data);
283 c->send_history = c->send_history->next; 281 c->send_history = c->send_history->next;
2640 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); 2638 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry);
2641 if (!GTK_WIDGET_REALIZED(label)) 2639 if (!GTK_WIDGET_REALIZED(label))
2642 return; 2640 return;
2643 if (c->unseen == -1) return; 2641 if (c->unseen == -1) return;
2644 style = gtk_style_new(); 2642 style = gtk_style_new();
2645 #if !GTK_CHECK_VERSION(1,3,0)
2646 gdk_font_unref(gtk_style_get_font(style));
2647 #endif
2648 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); 2643 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
2649 gtk_widget_set_style(label, style); 2644 gtk_widget_set_style(label, style);
2650 gtk_style_unref(style); 2645 gtk_style_unref(style);
2651 if (c) 2646 if (c)
2652 c->unseen = 0; 2647 c->unseen = 0;
2667 gtk_notebook_get_nth_page(notebook, 2662 gtk_notebook_get_nth_page(notebook,
2668 offs + g_list_index(ws, c))); 2663 offs + g_list_index(ws, c)));
2669 style = gtk_style_new(); 2664 style = gtk_style_new();
2670 if (!GTK_WIDGET_REALIZED(label)) 2665 if (!GTK_WIDGET_REALIZED(label))
2671 gtk_widget_realize(label); 2666 gtk_widget_realize(label);
2672 #if !GTK_CHECK_VERSION(1,3,0)
2673 gdk_font_unref(gtk_style_get_font(style));
2674 #endif
2675 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); 2667 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
2676 style->fg[0].red = 0x0000; 2668 style->fg[0].red = 0x0000;
2677 style->fg[0].green = 0x9999; 2669 style->fg[0].green = 0x9999;
2678 style->fg[0].blue = 0x0000; 2670 style->fg[0].blue = 0x0000;
2679 gtk_widget_set_style(label, style); 2671 gtk_widget_set_style(label, style);
2729 offs + g_list_index(ws, c))); 2721 offs + g_list_index(ws, c)));
2730 GtkStyle *style; 2722 GtkStyle *style;
2731 style = gtk_style_new(); 2723 style = gtk_style_new();
2732 if (!GTK_WIDGET_REALIZED(label)) 2724 if (!GTK_WIDGET_REALIZED(label))
2733 gtk_widget_realize(label); 2725 gtk_widget_realize(label);
2734 #if !GTK_CHECK_VERSION(1,3,0)
2735 gdk_font_unref(gtk_style_get_font(style));
2736 #endif
2737 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); 2726 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
2738 c->unseen = 0; 2727 c->unseen = 0;
2739 gtk_widget_set_style(label, style); 2728 gtk_widget_set_style(label, style);
2740 gtk_style_unref(style); 2729 gtk_style_unref(style);
2741 } 2730 }
2901 2890
2902 gtk_object_set_user_data(GTK_OBJECT(entry), c); 2891 gtk_object_set_user_data(GTK_OBJECT(entry), c);
2903 gtk_text_set_editable(GTK_TEXT(entry), TRUE); 2892 gtk_text_set_editable(GTK_TEXT(entry), TRUE);
2904 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE); 2893 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE);
2905 2894
2906 #if !GTK_CHECK_VERSION(1,3,0) /* This gtk bug should be fixed in gtk2 */
2907 /* I hate hackish workarounds. According to Ari Pollak, a gtk bug causes Gaim to loop
2908 * infinitely if the entry is smaller than the text height. This is a hackish workaround */
2909 gtk_widget_set_usize(entry, conv_size.width - 20,
2910 MAX(conv_size.entry_height,
2911 gdk_char_height(gtk_widget_get_default_style()->font, '0') +
2912 gtk_widget_get_default_style()->font->ascent + 1));
2913 #else
2914 gtk_widget_set_usize(entry, conv_size.width - 20, MAX(conv_size.entry_height, 25)); 2895 gtk_widget_set_usize(entry, conv_size.width - 20, MAX(conv_size.entry_height, 25));
2915 #endif
2916 2896
2917 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback), c); 2897 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback), c);
2918 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), c); 2898 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), c);
2919 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), 2899 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed),
2920 entry); 2900 entry);
3355 sprintf(b->fontface, "%s", fontface); 3335 sprintf(b->fontface, "%s", fontface);
3356 sprintf(b->fontxfld, "%s", fontxfld); 3336 sprintf(b->fontxfld, "%s", fontxfld);
3357 } 3337 }
3358 } 3338 }
3359 3339
3360 #if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0)
3361 #include <gdk-pixbuf/gdk-pixbuf.h> 3340 #include <gdk-pixbuf/gdk-pixbuf.h>
3362 3341
3363 #define SCALE(x) ((gdk_pixbuf_animation_get_width(x) <= 48 && gdk_pixbuf_animation_get_height(x) <= 48) \ 3342 #define SCALE(x) ((gdk_pixbuf_animation_get_width(x) <= 48 && gdk_pixbuf_animation_get_height(x) <= 48) \
3364 ? 48 : 50) 3343 ? 48 : 50)
3365 3344
3495 button = gtk_menu_item_new_with_label(_("Disable Animation")); 3474 button = gtk_menu_item_new_with_label(_("Disable Animation"));
3496 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(stop_anim), c); 3475 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(stop_anim), c);
3497 gtk_menu_append(GTK_MENU(menu), button); 3476 gtk_menu_append(GTK_MENU(menu), button);
3498 gtk_widget_show(button); 3477 gtk_widget_show(button);
3499 } 3478 }
3500 #if GTK_CHECK_VERSION(1,3,0)
3501 else if (c->anim && !(gdk_pixbuf_animation_is_static_image(c->anim))) 3479 else if (c->anim && !(gdk_pixbuf_animation_is_static_image(c->anim)))
3502 #else
3503 else if (c->anim && (gdk_pixbuf_animation_get_num_frames(c->anim) > 1))
3504 #endif
3505 { 3480 {
3506 button = gtk_menu_item_new_with_label(_("Enable Animation")); 3481 button = gtk_menu_item_new_with_label(_("Enable Animation"));
3507 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(start_anim), c); 3482 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(start_anim), c);
3508 gtk_menu_append(GTK_MENU(menu), button); 3483 gtk_menu_append(GTK_MENU(menu), button);
3509 gtk_widget_show(button); 3484 gtk_widget_show(button);
3522 3497
3523 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); 3498 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time);
3524 3499
3525 return TRUE; 3500 return TRUE;
3526 } 3501 }
3527 #endif
3528 3502
3529 void remove_icon(struct conversation *c) 3503 void remove_icon(struct conversation *c)
3530 { 3504 {
3531 #if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0)
3532 if (c->icon) 3505 if (c->icon)
3533 gtk_container_remove(GTK_CONTAINER(c->bbox), c->icon->parent->parent); 3506 gtk_container_remove(GTK_CONTAINER(c->bbox), c->icon->parent->parent);
3534 c->icon = NULL; 3507 c->icon = NULL;
3535 if (c->anim) 3508 if (c->anim)
3536 gdk_pixbuf_animation_unref(c->anim); 3509 gdk_pixbuf_animation_unref(c->anim);
3537 c->anim = NULL; 3510 c->anim = NULL;
3538 if (c->icon_timer) 3511 if (c->icon_timer)
3539 gtk_timeout_remove(c->icon_timer); 3512 gtk_timeout_remove(c->icon_timer);
3540 c->icon_timer = 0; 3513 c->icon_timer = 0;
3541 #if GTK_CHECK_VERSION(1,3,0)
3542 if(c->iter) 3514 if(c->iter)
3543 g_object_unref(c->iter); 3515 g_object_unref(c->iter);
3544 #else
3545 c->frame = 0;
3546 #endif
3547 #endif
3548 } 3516 }
3549 3517
3550 void update_smilies(struct conversation *c) 3518 void update_smilies(struct conversation *c)
3551 { 3519 {
3552 GSList *smilies; 3520 GSList *smilies;
3668 if(im_options & OPT_IM_NO_ANIMATION) 3636 if(im_options & OPT_IM_NO_ANIMATION)
3669 stop_anim(NULL, c); 3637 stop_anim(NULL, c);
3670 gdk_pixmap_unref(pm); 3638 gdk_pixmap_unref(pm);
3671 if (bm) 3639 if (bm)
3672 gdk_bitmap_unref(bm); 3640 gdk_bitmap_unref(bm);
3673
3674 } 3641 }
3675 3642
3676 void got_new_icon(struct gaim_connection *gc, char *who) 3643 void got_new_icon(struct gaim_connection *gc, char *who)
3677 { 3644 {
3678 struct conversation *c = find_conversation(who); 3645 struct conversation *c = find_conversation(who);
3689 } 3656 }
3690 } 3657 }
3691 3658
3692 void set_anim() 3659 void set_anim()
3693 { 3660 {
3694 #if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0)
3695 GList *c = conversations; 3661 GList *c = conversations;
3696 if (im_options & OPT_IM_HIDE_ICONS) 3662 if (im_options & OPT_IM_HIDE_ICONS)
3697 return; 3663 return;
3698 while (c) { 3664 while (c) {
3699 if(im_options & OPT_IM_NO_ANIMATION) 3665 if(im_options & OPT_IM_NO_ANIMATION)
3700 stop_anim(NULL, c->data); 3666 stop_anim(NULL, c->data);
3701 else 3667 else
3702 start_anim(NULL, c->data); 3668 start_anim(NULL, c->data);
3703 c = c->next; 3669 c = c->next;
3704 } 3670 }
3705 #endif
3706 } 3671 }
3707 3672
3708 static void remove_checkbox(struct conversation *c) 3673 static void remove_checkbox(struct conversation *c)
3709 { 3674 {
3710 if (c->check) 3675 if (c->check)