Mercurial > pidgin.yaz
changeset 22738:01e0ddc7e040
merge of '5f1a220f63d8e85758a94a2ed57381dc91b07eda'
and 'd367c4b51bfd3fefedc0d0256bbcde2792770344'
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Mon, 28 Apr 2008 20:10:41 +0000 |
parents | 8c3f6126759c (diff) 97ecc85b6c18 (current diff) |
children | 17cda378a2dd 99cd68788bc0 |
files | |
diffstat | 5 files changed, 113 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Apr 28 20:03:40 2008 +0000 +++ b/ChangeLog Mon Apr 28 20:10:41 2008 +0000 @@ -14,6 +14,8 @@ * Added a plugin (not built by default) which adds a Send button back to the conversation window. People without physical keyboards have a hard time with the lack of the button. + * Clicking on the buddyicon in the conversation window toggles the size of + the icon between small and large. General: * The configure script now dies on more absent dependencies. The
--- a/autogen.sh Mon Apr 28 20:03:40 2008 +0000 +++ b/autogen.sh Mon Apr 28 20:10:41 2008 +0000 @@ -111,7 +111,7 @@ if [ -f ${ARGS_FILE} ] ; then echo "found." printf "%s" "sourcing ${ARGS_FILE}: " - . autogen.args + . ${ARGS_FILE} echo "done." else echo "not found."
--- a/libpurple/protocols/jabber/chat.c Mon Apr 28 20:03:40 2008 +0000 +++ b/libpurple/protocols/jabber/chat.c Mon Apr 28 20:10:41 2008 +0000 @@ -238,6 +238,8 @@ char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); purple_notify_error(gc, _("Invalid Room Handle"), _("Invalid Room Handle"), buf); + g_free(buf); + return; } if(jabber_chat_find(js, room, server))
--- a/libpurple/protocols/oscar/util.c Mon Apr 28 20:03:40 2008 +0000 +++ b/libpurple/protocols/oscar/util.c Mon Apr 28 20:10:41 2008 +0000 @@ -156,7 +156,7 @@ return FALSE; for (i = 0; sn[i] != '\0'; i++) { - if (!isalnum(sn[i]) && (sn[i] != ' ') && (sn[i] != '.')) + if (!isalnum(sn[i]) && (sn[i] != ' ')) return FALSE; }
--- a/pidgin/gtkconv.c Mon Apr 28 20:03:40 2008 +0000 +++ b/pidgin/gtkconv.c Mon Apr 28 20:10:41 2008 +0000 @@ -101,6 +101,9 @@ #define DEFAULT_HIGHLIGHT_COLOR "#AF7F00" #define DEFAULT_ACTION_COLOR "#062585" +#define BUDDYICON_SIZE_MIN 32 +#define BUDDYICON_SIZE_MAX 96 + /* Undef this to turn off "custom-smiley" debug messages */ #define DEBUG_CUSTOM_SMILEY @@ -2561,6 +2564,7 @@ GdkPixbuf *scale; gint delay; int scale_width, scale_height; + int size; gtkconv = PIDGIN_CONVERSATION(conv); account = purple_conversation_get_account(conv); @@ -2575,17 +2579,22 @@ gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); - scale_width = gdk_pixbuf_get_width(buf); - scale_height = gdk_pixbuf_get_height(buf); - if (scale_width == scale_height) { - scale_width = scale_height = 32; + scale_width = gdk_pixbuf_get_width(buf); + scale_height = gdk_pixbuf_get_height(buf); + + gtk_widget_get_size_request(gtkconv->infopane_hbox, NULL, &size); + size = MIN(size, MIN(scale_width, scale_height)); + size = CLAMP(size, BUDDYICON_SIZE_MIN, BUDDYICON_SIZE_MAX); + + if (scale_width == scale_height) { + scale_width = scale_height = size; } else if (scale_height > scale_width) { - scale_width = 32 * scale_width / scale_height; - scale_height = 32; - } else { - scale_height = 32 * scale_height / scale_width; - scale_width = 32; - } + scale_width = size * scale_width / scale_height; + scale_height = size; + } else { + scale_height = size * scale_height / scale_width; + scale_width = size; + } scale = gdk_pixbuf_scale_simple(buf, scale_width, scale_height, GDK_INTERP_BILINEAR); @@ -2705,6 +2714,33 @@ } static void +change_size_cb(GtkWidget *widget, PidginConversation *gtkconv) +{ + int size = 0; + PurpleConversation *conv = gtkconv->active_conv; + GSList *buddies; + + gtk_widget_get_size_request(gtkconv->infopane_hbox, NULL, &size); + + if (size == BUDDYICON_SIZE_MAX) { + size = BUDDYICON_SIZE_MIN; + } else { + size = BUDDYICON_SIZE_MAX; + } + + gtk_widget_set_size_request(gtkconv->infopane_hbox, -1, size); + pidgin_conv_update_buddy_icon(conv); + + buddies = purple_find_buddies(purple_conversation_get_account(conv), + purple_conversation_get_name(conv)); + for (; buddies; buddies = g_slist_delete_link(buddies, buddies)) { + PurpleBuddy *buddy = buddies->data; + PurpleContact *contact = purple_buddy_get_contact(buddy); + purple_blist_node_set_int((PurpleBlistNode*)contact, "pidgin-infopane-iconsize", size); + } +} + +static void remove_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv) { PurpleConversation *conv; @@ -2765,8 +2801,14 @@ PurpleConversation *conv; PurpleBuddy *buddy; - if (e->button != 3 || e->type != GDK_BUTTON_PRESS) + if (e->button == 1 && e->type == GDK_BUTTON_PRESS) { + change_size_cb(NULL, gtkconv); + return TRUE; + } + + if (e->button != 3 || e->type != GDK_BUTTON_PRESS) { return FALSE; + } /* * If a menu already exists, destroy it before creating a new one, @@ -2796,6 +2838,10 @@ G_CALLBACK(set_custom_icon_cb), gtkconv, 0, 0, NULL); + pidgin_new_item_from_stock(menu, _("Change Size"), NULL, + G_CALLBACK(change_size_cb), gtkconv, + 0, 0, NULL); + /* Is there a custom icon for this person? */ conv = gtkconv->active_conv; buddy = purple_find_buddy(purple_conversation_get_account(conv), @@ -3640,6 +3686,20 @@ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); } +static gboolean +compare_buddy_presence(PurplePresence *p1, PurplePresence *p2) +{ + /* This is necessary because multiple PurpleBuddy's don't share the same + * PurplePresence anymore. + */ + PurpleBuddy *b1 = purple_presence_get_buddy(p1); + PurpleBuddy *b2 = purple_presence_get_buddy(p2); + if (purple_buddy_get_account(b1) == purple_buddy_get_account(b2) && + strcmp(purple_buddy_get_name(b1), purple_buddy_get_name(b2)) == 0) + return FALSE; + return TRUE; +} + static void generate_send_to_items(PidginWindow *win) { @@ -3674,8 +3734,7 @@ if (buds == NULL) { - /* The user isn't on the buddy list. */ - create_sendto_item(menu, sg, &group, NULL, gtkconv->active_conv->account, gtkconv->active_conv->name); + /* The user isn't on the buddy list. So we don't create any sendto menu. */ } else { @@ -3699,20 +3758,22 @@ { /* Use the PurplePresence to get unique buddies. */ PurplePresence *presence = purple_buddy_get_presence(buddy); - if (!g_list_find(list, presence)) + if (!g_list_find_custom(list, presence, (GCompareFunc)compare_buddy_presence)) list = g_list_prepend(list, presence); } } } - /* Loop over the list backwards so we get the items in the right order, - * since we did a g_list_prepend() earlier. */ - for (iter = g_list_last(list); iter != NULL; iter = iter->prev) - { - PurplePresence *pre = iter->data; - PurpleBuddy *buddy = purple_presence_get_buddy(pre); - create_sendto_item(menu, sg, &group, buddy, + /* Create the sendto menu only if it has more than one item to show */ + if (list && list->next) { + /* Loop over the list backwards so we get the items in the right order, + * since we did a g_list_prepend() earlier. */ + for (iter = g_list_last(list); iter != NULL; iter = iter->prev) { + PurplePresence *pre = iter->data; + PurpleBuddy *buddy = purple_presence_get_buddy(pre); + create_sendto_item(menu, sg, &group, buddy, purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); + } } g_list_free(list); g_slist_free(buds); @@ -4622,8 +4683,10 @@ GtkCellRenderer *rend; GtkTreePath *path; PurpleConversation *conv = gtkconv->active_conv; + PurpleBuddy *buddy; gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); GtkPolicyType imhtml_sw_hscroll; + int buddyicon_size = 0; /* Setup the top part of the pane */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -4657,7 +4720,16 @@ path = gtk_tree_path_new_from_string("0"); gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(gtkconv->infopane), path); gtk_tree_path_free(path); - gtk_widget_set_size_request(gtkconv->infopane_hbox, -1, 32); + + if ((buddy = purple_find_buddy(purple_conversation_get_account(conv), + purple_conversation_get_name(conv))) != NULL) { + PurpleContact *contact = purple_buddy_get_contact(buddy); + if (contact) { + buddyicon_size = purple_blist_node_get_int((PurpleBlistNode*)contact, "pidgin-infopane-iconsize"); + } + } + buddyicon_size = CLAMP(buddyicon_size, BUDDYICON_SIZE_MIN, BUDDYICON_SIZE_MAX); + gtk_widget_set_size_request(gtkconv->infopane_hbox, -1, buddyicon_size); gtk_widget_show(gtkconv->infopane); rend = gtk_cell_renderer_pixbuf_new(); @@ -6768,6 +6840,7 @@ GtkWidget *event; GdkPixbuf *scale; int scale_width, scale_height; + int size = 0; PurpleAccount *account; PurplePluginProtocolInfo *prpl_info = NULL; @@ -6880,14 +6953,20 @@ scale_width = gdk_pixbuf_get_width(buf); scale_height = gdk_pixbuf_get_height(buf); + + gtk_widget_get_size_request(gtkconv->infopane_hbox, NULL, &size); + size = MIN(size, MIN(scale_width, scale_height)); + + /* Some sanity checks */ + size = CLAMP(size, BUDDYICON_SIZE_MIN, BUDDYICON_SIZE_MAX); if (scale_width == scale_height) { - scale_width = scale_height = 32; + scale_width = scale_height = size; } else if (scale_height > scale_width) { - scale_width = 32 * scale_width / scale_height; - scale_height = 32; + scale_width = size * scale_width / scale_height; + scale_height = size; } else { - scale_height = 32 * scale_height / scale_width; - scale_width = 32; + scale_height = size * scale_height / scale_width; + scale_width = size; } scale = gdk_pixbuf_scale_simple(buf, scale_width, scale_height, GDK_INTERP_BILINEAR); @@ -8270,7 +8349,7 @@ } else { page_num = 0; to_right = pidgin_conv_xy_to_right_infopane(dest_win, e->x_root, e->y_root); - tab = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num)->infopane; + tab = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num)->infopane_hbox; } if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP ||