comparison src/gtkconv.c @ 9885:4d3a61dcb942

[gaim-migrate @ 10767] grim was nice enough to put the icon crash fix into faceprint-doesn't-have-to-think (patch) form for me The assorted packagers will likely want to put this patch in their next package, lest their users annoy them, with big nasty pointy teeth. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 26 Aug 2004 13:32:50 +0000
parents d6cf01e43b86
children 18a787538ad2
comparison
equal deleted inserted replaced
9884:0d0e60f5964a 9885:4d3a61dcb942
3703 gc = gaim_conversation_get_gc(conv); 3703 gc = gaim_conversation_get_gc(conv);
3704 3704
3705 /* Remove anything else in our parent */ 3705 /* Remove anything else in our parent */
3706 children = gtk_container_get_children(GTK_CONTAINER(parent)); 3706 children = gtk_container_get_children(GTK_CONTAINER(parent));
3707 while (children != NULL) { 3707 while (children != NULL) {
3708 gtk_container_remove(GTK_CONTAINER(parent), children->data); 3708 if(children->data != gtkim->icon_container)
3709 gtk_container_remove(GTK_CONTAINER(parent), children->data);
3709 children = g_list_remove(children, children->data); 3710 children = g_list_remove(children, children->data);
3710 } 3711 }
3711 3712
3712 /* The buttons, from left to right */ 3713 /* The buttons, from left to right */
3713 3714
5618 const void *data; 5619 const void *data;
5619 size_t len; 5620 size_t len;
5620 5621
5621 GdkPixbuf *buf; 5622 GdkPixbuf *buf;
5622 5623
5623 GtkWidget *vbox;
5624 GtkWidget *event; 5624 GtkWidget *event;
5625 GtkWidget *frame; 5625 GtkWidget *frame;
5626 GdkPixbuf *scale; 5626 GdkPixbuf *scale;
5627 GdkPixmap *pm; 5627 GdkPixmap *pm;
5628 GdkBitmap *bm; 5628 GdkBitmap *bm;
5648 account = gaim_conversation_get_account(conv); 5648 account = gaim_conversation_get_account(conv);
5649 if(account && account->gc) 5649 if(account && account->gc)
5650 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); 5650 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
5651 5651
5652 /* Remove the current icon stuff */ 5652 /* Remove the current icon stuff */
5653 if (gtkconv->u.im->icon != NULL) 5653 if (gtkconv->u.im->icon_container != NULL)
5654 gtk_widget_destroy(gtkconv->u.im->icon->parent->parent->parent); 5654 gtk_widget_destroy(gtkconv->u.im->icon_container);
5655 gtkconv->u.im->icon_container = NULL;
5655 5656
5656 if (gtkconv->u.im->anim != NULL) 5657 if (gtkconv->u.im->anim != NULL)
5657 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); 5658 g_object_unref(G_OBJECT(gtkconv->u.im->anim));
5658 5659
5659 if (gtkconv->u.im->icon_timer != 0) 5660 if (gtkconv->u.im->icon_timer != 0)
5667 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) 5668 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons"))
5668 return; 5669 return;
5669 5670
5670 if (gaim_conversation_get_gc(conv) == NULL) 5671 if (gaim_conversation_get_gc(conv) == NULL)
5671 return; 5672 return;
5672
5673
5674 5673
5675 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); 5674 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv));
5676 5675
5677 if (icon == NULL) 5676 if (icon == NULL)
5678 return; 5677 return;
5693 fclose(file); 5692 fclose(file);
5694 5693
5695 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); 5694 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err);
5696 /* make sure we remove the file as soon as possible */ 5695 /* make sure we remove the file as soon as possible */
5697 unlink(filename); 5696 unlink(filename);
5698
5699 5697
5700 if (err) { 5698 if (err) {
5701 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", 5699 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv",
5702 "Buddy icon error: %s\n", err->message); 5700 "Buddy icon error: %s\n", err->message);
5703 g_error_free(err); 5701 g_error_free(err);
5728 5726
5729 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); 5727 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100);
5730 g_object_unref(G_OBJECT(scale)); 5728 g_object_unref(G_OBJECT(scale));
5731 5729
5732 5730
5733 vbox = gtk_vbox_new(FALSE, 0); 5731 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0);
5734 5732
5735 frame = gtk_frame_new(NULL); 5733 frame = gtk_frame_new(NULL);
5736 gtk_frame_set_shadow_type(GTK_FRAME(frame), 5734 gtk_frame_set_shadow_type(GTK_FRAME(frame),
5737 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); 5735 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN));
5738 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); 5736 gtk_box_pack_start(GTK_BOX(gtkconv->u.im->icon_container), frame,
5737 FALSE, FALSE, 0);
5739 5738
5740 event = gtk_event_box_new(); 5739 event = gtk_event_box_new();
5741 gtk_container_add(GTK_CONTAINER(frame), event); 5740 gtk_container_add(GTK_CONTAINER(frame), event);
5742 g_signal_connect(G_OBJECT(event), "button-press-event", 5741 g_signal_connect(G_OBJECT(event), "button-press-event",
5743 G_CALLBACK(icon_menu), conv); 5742 G_CALLBACK(icon_menu), conv);
5755 5754
5756 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); 5755 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type");
5757 /* the button seems to get its size before the box, so... */ 5756 /* the button seems to get its size before the box, so... */
5758 gtk_widget_size_request(gtkconv->send, &requisition); 5757 gtk_widget_size_request(gtkconv->send, &requisition);
5759 if (button_type == GAIM_BUTTON_NONE || requisition.height * 1.5 < scale_height) { 5758 if (button_type == GAIM_BUTTON_NONE || requisition.height * 1.5 < scale_height) {
5760 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), vbox, FALSE, FALSE, 0); 5759 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox),
5760 gtkconv->u.im->icon_container, FALSE, FALSE, 0);
5761 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */ 5761 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */
5762 } else { 5762 } else {
5763 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); 5763 gtk_box_pack_start(GTK_BOX(gtkconv->bbox),
5764 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); 5764 gtkconv->u.im->icon_container, FALSE, FALSE, 0);
5765 } 5765 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox),
5766 5766 gtkconv->u.im->icon_container, 0);
5767 gtk_widget_show(vbox); 5767 }
5768
5769 gtk_widget_show(gtkconv->u.im->icon_container);
5768 gtk_widget_show(frame); 5770 gtk_widget_show(frame);
5769 5771
5770 /* The buddy icon code needs badly to be fixed. */ 5772 /* The buddy icon code needs badly to be fixed. */
5771 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); 5773 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
5772 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) 5774 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv)))