Mercurial > pidgin
changeset 22664:5624eec4da24
merge of '8ac2f1461dd4df5ba43e8c0399b59451b3c549e6'
and 'f29197b389e99b8fcdc2b1179c0be21644a4c170'
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 13 Apr 2008 17:39:38 +0000 |
parents | 654f8386f4b3 (diff) 5cc1bb16edcd (current diff) |
children | 864c82371181 |
files | pidgin/gtkconv.c |
diffstat | 5 files changed, 45 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/conversation.c Sun Apr 13 09:51:45 2008 +0000 +++ b/libpurple/conversation.c Sun Apr 13 17:39:38 2008 +0000 @@ -862,7 +862,7 @@ gc = purple_account_get_connection(account); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && - (gc == NULL || !g_slist_find(gc->buddy_chats, conv))) + (gc != NULL && !g_slist_find(gc->buddy_chats, conv))) return; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM &&
--- a/libpurple/protocols/jabber/chat.c Sun Apr 13 09:51:45 2008 +0000 +++ b/libpurple/protocols/jabber/chat.c Sun Apr 13 17:39:38 2008 +0000 @@ -137,9 +137,12 @@ { PurpleAccount *account = purple_conversation_get_account(conv); PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js = gc->proto_data; - int id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - + JabberStream *js; + int id; + if (!gc) + return NULL; + js = gc->proto_data; + id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); return jabber_chat_find_by_id(js, id); }
--- a/pidgin/gtkblist.c Sun Apr 13 09:51:45 2008 +0000 +++ b/pidgin/gtkblist.c Sun Apr 13 17:39:38 2008 +0000 @@ -1033,6 +1033,7 @@ g_free(title); purple_blist_node_set_bool(node, "collapsed", FALSE); + pidgin_blist_tooltip_destroy(); } } @@ -1070,7 +1071,7 @@ pidgin_blist_update_contact(NULL, cnode); } } - + pidgin_blist_tooltip_destroy(); } else if(PURPLE_BLIST_NODE_IS_CONTACT(node)) { pidgin_blist_collapse_contact_cb(NULL, node); }
--- a/pidgin/gtkconv.c Sun Apr 13 09:51:45 2008 +0000 +++ b/pidgin/gtkconv.c Sun Apr 13 17:39:38 2008 +0000 @@ -5430,7 +5430,7 @@ account = purple_conversation_get_account(conv); g_return_if_fail(account != NULL); gc = purple_account_get_connection(account); - g_return_if_fail(gc != NULL); + g_return_if_fail(gc != NULL || !(flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))); /* Make sure URLs are clickable */ if(flags & PURPLE_MESSAGE_NO_LINKIFY) @@ -5463,7 +5463,7 @@ } win = gtkconv->win; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; line_count = gtk_text_buffer_get_line_count( gtk_text_view_get_buffer(GTK_TEXT_VIEW( @@ -5702,7 +5702,7 @@ g_free(alias_escaped); /* Are we in a chat where we can tell which users are buddies? */ - if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && + if (prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { /* Bold buddies to make them stand out from non-buddies. */
--- a/pidgin/gtkimhtml.c Sun Apr 13 09:51:45 2008 +0000 +++ b/pidgin/gtkimhtml.c Sun Apr 13 17:39:38 2008 +0000 @@ -359,17 +359,17 @@ GtkTextIter iter; gboolean scroll = TRUE; - gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); + gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &rect); - gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); - - if(((y + height) - (rect.y + rect.height)) > height - && gtk_text_buffer_get_char_count(imhtml->text_buffer)){ - scroll = FALSE; - } - - if(imhtml->old_rect.width != rect.width || imhtml->old_rect.height != rect.height){ + gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); + + if (((y + height) - (rect.y + rect.height)) > height && + gtk_text_buffer_get_char_count(imhtml->text_buffer)) { + scroll = FALSE; + } + + if(imhtml->old_rect.width != rect.width || imhtml->old_rect.height != rect.height) { GList *iter = GTK_IMHTML(widget)->scalables; xminus = gtk_text_view_get_left_margin(GTK_TEXT_VIEW(widget)) + @@ -386,11 +386,11 @@ imhtml->old_rect = rect; parent_size_allocate(widget, alloc); - + /* Don't scroll here if we're in the middle of a smooth scroll */ if (scroll && imhtml->scroll_time == NULL && - GTK_WIDGET_REALIZED(imhtml)) - gtk_imhtml_scroll_to_end(imhtml, FALSE); + GTK_WIDGET_REALIZED(imhtml)) + gtk_imhtml_scroll_to_end(imhtml, FALSE); } static gint @@ -576,11 +576,11 @@ /* If we don't have a tip from a URL, let's see if we have a tip from a smiley */ anchor = gtk_text_iter_get_child_anchor(&iter); if (anchor) { - tip = g_object_get_data(G_OBJECT(anchor), "gtkimhtml_plaintext"); + tip = g_object_get_data(G_OBJECT(anchor), "gtkimhtml_tiptext"); hand = FALSE; } - if (tip){ + if (tip && *tip) { if (!GTK_IMHTML(imhtml)->editable && hand) gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->hand_cursor); GTK_IMHTML(imhtml)->tip_timer = g_timeout_add (TOOLTIP_TIMEOUT, @@ -2268,8 +2268,7 @@ GSList *unused) { GtkTextIter iter, ins, sel; - GdkRectangle rect; - int y, height, ins_offset = 0, sel_offset = 0; + int ins_offset = 0, sel_offset = 0; gboolean fixins = FALSE, fixsel = FALSE; g_return_if_fail (imhtml != NULL); @@ -2290,13 +2289,17 @@ sel_offset = gtk_text_iter_get_offset(&sel); } - gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect); - gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); - - - if(((y + height) - (rect.y + rect.height)) > height - && gtk_text_buffer_get_char_count(imhtml->text_buffer)){ - options |= GTK_IMHTML_NO_SCROLL; + if (!(options & GTK_IMHTML_NO_SCROLL)) { + GdkRectangle rect; + int y, height; + + gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect); + gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); + + if (((y + height) - (rect.y + rect.height)) > height && + gtk_text_buffer_get_char_count(imhtml->text_buffer)) { + options |= GTK_IMHTML_NO_SCROLL; + } } gtk_imhtml_insert_html_at_iter(imhtml, text, options, &iter); @@ -4713,8 +4716,11 @@ } if (icon) { + char *text = g_strdup(unescaped); /* Do not g_free 'text'. + It will be destroyed when 'anchor' is destroyed. */ anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter); - g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free); + g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", text, g_free); + g_object_set_data(G_OBJECT(anchor), "gtkimhtml_tiptext", text); g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley), g_free); /* This catches the expose events generated by animated @@ -4732,9 +4738,11 @@ imhtml_smiley->anchors = g_slist_append(imhtml_smiley->anchors, anchor); if (ebox) { GtkWidget *img = gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_MENU); + char *text = g_strdup(unescaped); gtk_container_add(GTK_CONTAINER(ebox), img); gtk_widget_show(img); - g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free); + g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", text, g_free); + g_object_set_data(G_OBJECT(anchor), "gtkimhtml_tiptext", text); gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), ebox, anchor); } } else {