From: <aar...@us...> - 2006-06-12 04:43:57
|
Revision: 16262 Author: aaronsheldon Date: 2006-06-11 21:43:43 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16262&view=rev Log Message: ----------- Calls update contact with a buddy instead of a contact (faster), switches a check order for to be better in average case, removes the possibility of a double-gtk-blist-update, greatly improves the performance of group-update, and corrects a bunch of style issues. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/gtkblist.c Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-06-12 04:23:04 UTC (rev 16261) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-06-12 04:43:43 UTC (rev 16262) @@ -121,6 +121,7 @@ static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node); static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data); static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node); +static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node); static char *gaim_get_tooltip_text(GaimBlistNode *node, gboolean full); static const char *item_factory_translate_func (const char *path, gpointer func_data); static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter); @@ -877,8 +878,7 @@ gtk_main_iteration(); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0); - - gaim_gtk_blist_update(NULL, node); + gaim_gtk_blist_update_contact(NULL, node->child); gtk_tree_path_free(path); } @@ -3063,7 +3063,7 @@ if (buddy && gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) - gaim_gtk_blist_update(list, cnode); + gaim_gtk_blist_update_contact(list, (GaimBlistNode*)buddy); } } } @@ -3903,7 +3903,7 @@ while (node) { - if (!GAIM_BLIST_NODE_IS_GROUP(node) && remove) + if (remove && !GAIM_BLIST_NODE_IS_GROUP(node)) gaim_gtk_blist_hide_node(list, node); gaim_gtk_blist_update(list, node); @@ -3995,7 +3995,7 @@ gtkblist->selected_node = new_selection; if(new_selection) gaim_gtk_blist_update(NULL, new_selection); - if(old_selection) + else if(old_selection) gaim_gtk_blist_update(NULL, old_selection); } @@ -4088,7 +4088,9 @@ if (GAIM_BLIST_NODE_IS_GROUP(node)) gnode = node; - else if (GAIM_BLIST_NODE_IS_BUDDY(node)) + else if (GAIM_BLIST_NODE_IS_CONTACT(node)) + gnode = node->parent; + else if (GAIM_BLIST_NODE_IS_BUDDY(node)) //maybe OR'ed with IS_CHAT? gnode = node->parent->parent; g_return_if_fail(GAIM_BLIST_NODE_IS_GROUP(gnode)); @@ -4101,23 +4103,9 @@ if (count > 0 || gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups")) show = TRUE; - else if (GAIM_BLIST_NODE_IS_BUDDY(node)){ + else if (GAIM_BLIST_NODE_IS_BUDDY(node)){ /* Or chat? */ if (buddy_is_displayable((GaimBuddy*)node)) - show = TRUE; - /* Fallback loop */ - } else { - GaimBlistNode *n; - n = gnode->child; - while (n && !GAIM_BLIST_NODE_IS_GROUP(n)) { - if (GAIM_BLIST_NODE_IS_BUDDY(n)) { - if (buddy_is_displayable((GaimBuddy*)n)) { - show = TRUE; - break; - } - } - n = gaim_blist_node_next(n, FALSE); - } - } + show = TRUE;} if (show) { char *mark, *esc; @@ -4162,7 +4150,8 @@ mark = gaim_gtk_blist_get_name_markup(buddy, selected); if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time") && - gaim_presence_is_idle(presence)) + gaim_presence_is_idle(presence) && + !gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) { time_t idle_secs = gaim_presence_get_idle_time(presence); @@ -4173,7 +4162,6 @@ time(&t); ihrs = (t - idle_secs) / 3600; imin = ((t - idle_secs) / 60) % 60; - if (ihrs > 0) idle = g_strdup_printf("%d:%02d", ihrs, imin); else @@ -4211,41 +4199,41 @@ can know in advance which buddy has changed so we can just update that */ static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node) { - GaimBlistNode *bnode; + GaimBlistNode *cnode; GaimContact *contact; GaimBuddy *buddy; struct _gaim_gtk_blist_node *gtknode; if (GAIM_BLIST_NODE_IS_BUDDY(node)) - bnode = node->parent; + cnode = node->parent; else - bnode = node; + cnode = node; - g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(bnode)); + g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(cnode)); /* First things first, update the group */ if (GAIM_BLIST_NODE_IS_BUDDY(node)) gaim_gtk_blist_update_group(list, node); else - gaim_gtk_blist_update_group(list, bnode->parent); + gaim_gtk_blist_update_group(list, cnode->parent); - contact = (GaimContact*)bnode; + contact = (GaimContact*)cnode; buddy = gaim_contact_get_priority_buddy(contact); if (buddy_is_displayable(buddy)) { GtkTreeIter iter; - if(!insert_node(list, bnode, &iter)) + if(!insert_node(list, cnode, &iter)) return; - gtknode = (struct _gaim_gtk_blist_node *)bnode->ui_data; + gtknode = (struct _gaim_gtk_blist_node *)cnode->ui_data; if(gtknode->contact_expanded) { GdkPixbuf *status; char *mark; - status = gaim_gtk_blist_get_status_icon(bnode, + status = gaim_gtk_blist_get_status_icon(cnode, (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL)); @@ -4262,10 +4250,10 @@ if(status) g_object_unref(status); } else { - buddy_node(buddy, &iter, bnode); + buddy_node(buddy, &iter, cnode); } } else { - gaim_gtk_blist_hide_node(list, bnode); + gaim_gtk_blist_hide_node(list, cnode); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |