Mercurial > pidgin
comparison src/buddy.c @ 4701:ac7ca2bd6d4f
[gaim-migrate @ 5012]
now groups go away when they're empty, like you would think they should.
also fixes a segfault if someone signs on and off very quickly.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 11 Mar 2003 03:59:42 +0000 |
parents | 2222cd30008a |
children | cb5b23dfd82b |
comparison
equal
deleted
inserted
replaced
4700:e52e19e33227 | 4701:ac7ca2bd6d4f |
---|---|
354 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) { | 354 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) { |
355 scalesize = 15; | 355 scalesize = 15; |
356 sw = nw = ne = NULL; /* So that only the se icon will composite */ | 356 sw = nw = ne = NULL; /* So that only the se icon will composite */ |
357 } | 357 } |
358 | 358 |
359 | 359 |
360 if (b->present == 2) { | 360 if (b->present == 2) { |
361 struct gaim_gtk_blist_node *gtknode; | |
361 /* If b->present is 2, that means this buddy has just signed on. We use the "login" icon for the | 362 /* If b->present is 2, that means this buddy has just signed on. We use the "login" icon for the |
362 * status, and we set a timeout to change it to a normal icon after 10 seconds. */ | 363 * status, and we set a timeout to change it to a normal icon after 10 seconds. */ |
363 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "login.png", NULL); | 364 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "login.png", NULL); |
364 status = gdk_pixbuf_new_from_file(filename,NULL); | 365 status = gdk_pixbuf_new_from_file(filename,NULL); |
365 g_free(filename); | 366 g_free(filename); |
366 g_timeout_add(10000, (GSourceFunc)gaim_reset_present_icon, b); | 367 |
367 | 368 gtknode = GAIM_GTK_BLIST_NODE((GaimBlistNode*)b); |
369 gtknode->timer = g_timeout_add(10000, (GSourceFunc)gaim_reset_present_icon, b); | |
370 | |
368 /* "Hey, what's all this crap?" you ask. Status icons will be themeable too, and | 371 /* "Hey, what's all this crap?" you ask. Status icons will be themeable too, and |
369 then it will look up protoname from the theme */ | 372 then it will look up protoname from the theme */ |
370 } else { | 373 } else { |
371 char *image = g_strdup_printf("%s.png", protoname); | 374 char *image = g_strdup_printf("%s.png", protoname); |
372 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); | 375 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
728 gtk_widget_hide(gtkblist->bbox); | 731 gtk_widget_hide(gtkblist->bbox); |
729 else | 732 else |
730 gtk_widget_show_all(gtkblist->bbox); | 733 gtk_widget_show_all(gtkblist->bbox); |
731 } | 734 } |
732 | 735 |
736 static void gaim_gtk_blist_remove(struct gaim_buddy_list *list, GaimBlistNode *node) | |
737 { | |
738 struct gaim_gtk_blist_node *gtknode; | |
739 GtkTreeIter iter; | |
740 | |
741 if (!node->ui_data) | |
742 return; | |
743 | |
744 gtknode = (struct gaim_gtk_blist_node *)node->ui_data; | |
745 | |
746 if (gtknode->timer > 0) { | |
747 g_source_remove(gtknode->timer); | |
748 gtknode->timer = 0; | |
749 } | |
750 | |
751 if (get_iter_from_node(node, &iter)) { | |
752 gtk_tree_store_remove(gtkblist->treemodel, &iter); | |
753 if(GAIM_BLIST_NODE_IS_BUDDY(node) && gaim_blist_get_group_online_count((struct group *)node->parent) == 0) { | |
754 GtkTreeIter groupiter; | |
755 if(get_iter_from_node(node->parent, &groupiter)) | |
756 gtk_tree_store_remove(gtkblist->treemodel, &groupiter); | |
757 } | |
758 } | |
759 } | |
760 | |
761 | |
733 static void gaim_gtk_blist_update(struct gaim_buddy_list *list, GaimBlistNode *node) | 762 static void gaim_gtk_blist_update(struct gaim_buddy_list *list, GaimBlistNode *node) |
734 { | 763 { |
735 struct gaim_gtk_blist_node *gtknode; | 764 struct gaim_gtk_blist_node *gtknode; |
736 GtkTreeIter iter; | 765 GtkTreeIter iter; |
737 gboolean expand = FALSE; | 766 gboolean expand = FALSE; |
830 g_object_unref(status); | 859 g_object_unref(status); |
831 | 860 |
832 if (avatar != NULL) | 861 if (avatar != NULL) |
833 g_object_unref(avatar); | 862 g_object_unref(avatar); |
834 | 863 |
835 } else if (GAIM_BLIST_NODE_IS_BUDDY(node) && !new_entry){ | 864 } else if (GAIM_BLIST_NODE_IS_BUDDY(node) && !new_entry) { |
836 gtk_tree_store_remove(gtkblist->treemodel, &iter); | 865 gaim_gtk_blist_remove(list, node); |
837 } | 866 } |
838 } | |
839 | |
840 static void gaim_gtk_blist_remove(struct gaim_buddy_list *list, GaimBlistNode *node) | |
841 { | |
842 struct gaim_gtk_blist_node *gtknode; | |
843 GtkTreeIter iter; | |
844 | |
845 if (!node->ui_data) | |
846 return; | |
847 | |
848 gtknode = (struct gaim_gtk_blist_node *)node->ui_data; | |
849 | |
850 if (gtknode->timer > 0) | |
851 g_source_remove(gtknode->timer); | |
852 | |
853 if (get_iter_from_node(node, &iter)) | |
854 gtk_tree_store_remove(gtkblist->treemodel, &iter); | |
855 } | 867 } |
856 | 868 |
857 static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list) | 869 static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list) |
858 { | 870 { |
859 gtk_widget_destroy(gtkblist->window); | 871 gtk_widget_destroy(gtkblist->window); |