comparison src/buddy.c @ 4929:8a20332821b6

[gaim-migrate @ 5263] And now you can keep offline buddies shown all the time. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 31 Mar 2003 22:55:51 +0000
parents 36c06909823e
children d090282c42f7
comparison
equal deleted inserted replaced
4928:36c06909823e 4929:8a20332821b6
389 static void edit_mode_cb() { 389 static void edit_mode_cb() {
390 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH); 390 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
391 gdk_window_set_cursor(gtkblist->window->window, cursor); 391 gdk_window_set_cursor(gtkblist->window->window, cursor);
392 while (gtk_events_pending()) 392 while (gtk_events_pending())
393 gtk_main_iteration(); 393 gtk_main_iteration();
394 gtkblist->editmode = !gtkblist->editmode; 394 blist_options ^= OPT_BLIST_SHOW_OFFLINE;
395 save_prefs();
395 gdk_cursor_unref(cursor); 396 gdk_cursor_unref(cursor);
396 cursor = gdk_cursor_new(GDK_LEFT_PTR); 397 cursor = gdk_cursor_new(GDK_LEFT_PTR);
397 gdk_window_set_cursor(gtkblist->window->window, cursor); 398 gdk_window_set_cursor(gtkblist->window->window, cursor);
398 gdk_cursor_unref(cursor); 399 gdk_cursor_unref(cursor);
399 gaim_gtk_blist_refresh(gaim_get_blist()); 400 gaim_gtk_blist_refresh(gaim_get_blist());
897 } 898 }
898 } 899 }
899 900
900 901
901 /* Idle grey buddies affects the whole row. This converts the status icon to greyscale. */ 902 /* Idle grey buddies affects the whole row. This converts the status icon to greyscale. */
902 if (!b->present && gtkblist->editmode) 903 if (!b->present && blist_options & OPT_BLIST_SHOW_OFFLINE)
903 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); 904 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
904 else if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) 905 else if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
905 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE); 906 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
906 return scale; 907 return scale;
907 } 908 }
921 buf = gdk_pixbuf_new_from_file(file, NULL); 922 buf = gdk_pixbuf_new_from_file(file, NULL);
922 g_free(file); 923 g_free(file);
923 924
924 925
925 if (buf) { 926 if (buf) {
926 if (!b->present && gtkblist->editmode) 927 if (!b->present && blist_options & OPT_BLIST_SHOW_OFFLINE)
927 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE); 928 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
928 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) 929 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
929 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE); 930 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
930 931
931 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR); 932 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR);
946 int ihrs, imin; 947 int ihrs, imin;
947 char *idletime = NULL, *warning = NULL, *statustext = NULL; 948 char *idletime = NULL, *warning = NULL, *statustext = NULL;
948 time_t t; 949 time_t t;
949 950
950 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) { 951 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) {
951 if ((b->idle > 0 && blist_options & OPT_BLIST_GREY_IDLERS && !selected) || gtkblist->editmode) { 952 if ((b->idle > 0 && blist_options & OPT_BLIST_GREY_IDLERS && !selected) || blist_options & OPT_BLIST_SHOW_OFFLINE) {
952 text = g_strdup_printf("<span color='dim grey'>%s</span>", 953 text = g_strdup_printf("<span color='dim grey'>%s</span>",
953 esc); 954 esc);
954 g_free(esc); 955 g_free(esc);
955 return text; 956 return text;
956 } else { 957 } else {
1339 gtkblist->selected_node = NULL; 1340 gtkblist->selected_node = NULL;
1340 1341
1341 if (get_iter_from_node(node, &iter)) { 1342 if (get_iter_from_node(node, &iter)) {
1342 gtk_tree_store_remove(gtkblist->treemodel, &iter); 1343 gtk_tree_store_remove(gtkblist->treemodel, &iter);
1343 if(GAIM_BLIST_NODE_IS_BUDDY(node) && 1344 if(GAIM_BLIST_NODE_IS_BUDDY(node) &&
1344 !gtkblist->editmode && 1345 !blist_options & OPT_BLIST_SHOW_OFFLINE &&
1345 gaim_blist_get_group_online_count((struct group *)node->parent) == 0) { 1346 gaim_blist_get_group_online_count((struct group *)node->parent) == 0) {
1346 GtkTreeIter groupiter; 1347 GtkTreeIter groupiter;
1347 if(get_iter_from_node(node->parent, &groupiter)) 1348 if(get_iter_from_node(node->parent, &groupiter))
1348 gtk_tree_store_remove(gtkblist->treemodel, &groupiter); 1349 gtk_tree_store_remove(gtkblist->treemodel, &groupiter);
1349 } 1350 }
1393 1394
1394 1395
1395 if (!get_iter_from_node(node, &iter)) { /* This is a newly added node */ 1396 if (!get_iter_from_node(node, &iter)) { /* This is a newly added node */
1396 new_entry = TRUE; 1397 new_entry = TRUE;
1397 if (GAIM_BLIST_NODE_IS_BUDDY(node)) { 1398 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
1398 if (((struct buddy*)node)->present || (gtkblist->editmode && ((struct buddy*)node)->account->gc)) { 1399 if (((struct buddy*)node)->present || (blist_options & OPT_BLIST_SHOW_OFFLINE && ((struct buddy*)node)->account->gc)) {
1399 GtkTreeIter groupiter; 1400 GtkTreeIter groupiter;
1400 GaimBlistNode *oldersibling; 1401 GaimBlistNode *oldersibling;
1401 GtkTreeIter oldersiblingiter; 1402 GtkTreeIter oldersiblingiter;
1402 1403
1403 if(node->parent && !get_iter_from_node(node->parent, &groupiter)) { 1404 if(node->parent && !get_iter_from_node(node->parent, &groupiter)) {
1443 gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), path, TRUE); 1444 gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), path, TRUE);
1444 gtk_tree_path_free(path); 1445 gtk_tree_path_free(path);
1445 } 1446 }
1446 } 1447 }
1447 } 1448 }
1448 else if (GAIM_BLIST_NODE_IS_GROUP(node) && gtkblist->editmode) { 1449 else if (GAIM_BLIST_NODE_IS_GROUP(node) && blist_options & OPT_BLIST_SHOW_OFFLINE) {
1449 GaimBlistNode *oldersibling; 1450 GaimBlistNode *oldersibling;
1450 GtkTreeIter oldersiblingiter; 1451 GtkTreeIter oldersiblingiter;
1451 GdkPixbuf *groupicon = gtk_widget_render_icon(gtkblist->treeview, 1452 GdkPixbuf *groupicon = gtk_widget_render_icon(gtkblist->treeview,
1452 GTK_STOCK_OPEN, GTK_ICON_SIZE_SMALL_TOOLBAR, NULL); 1453 GTK_STOCK_OPEN, GTK_ICON_SIZE_SMALL_TOOLBAR, NULL);
1453 char *esc = g_markup_escape_text(((struct group*)node)->name, -1); 1454 char *esc = g_markup_escape_text(((struct group*)node)->name, -1);
1467 g_free(mark); 1468 g_free(mark);
1468 g_object_unref(groupicon); 1469 g_object_unref(groupicon);
1469 } 1470 }
1470 1471
1471 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { 1472 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1472 if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter) == FALSE && gtkblist->editmode == FALSE) 1473 if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter) == FALSE && blist_options & OPT_BLIST_SHOW_OFFLINE == FALSE)
1473 gtk_tree_store_remove(gtkblist->treemodel, &iter); 1474 gtk_tree_store_remove(gtkblist->treemodel, &iter);
1474 else { 1475 else {
1475 char *esc = g_markup_escape_text(((struct group*)node)->name, -1); 1476 char *esc = g_markup_escape_text(((struct group*)node)->name, -1);
1476 char *mark = g_strdup_printf("<span weight='bold'>%s</span>", esc); 1477 char *mark = g_strdup_printf("<span weight='bold'>%s</span>", esc);
1477 g_free(esc); 1478 g_free(esc);
1480 -1); 1481 -1);
1481 g_free(mark); 1482 g_free(mark);
1482 } 1483 }
1483 } 1484 }
1484 1485
1485 if (GAIM_BLIST_NODE_IS_BUDDY(node) && (((struct buddy*)node)->present || (gtkblist->editmode && ((struct buddy*)node)->account->gc))) { 1486 if (GAIM_BLIST_NODE_IS_BUDDY(node) && (((struct buddy*)node)->present || (blist_options & OPT_BLIST_SHOW_OFFLINE && ((struct buddy*)node)->account->gc))) {
1486 GdkPixbuf *status, *avatar; 1487 GdkPixbuf *status, *avatar;
1487 char *mark; 1488 char *mark;
1488 char *warning = NULL, *idle = NULL; 1489 char *warning = NULL, *idle = NULL;
1489 1490
1490 gboolean selected = (gtkblist->selected_node == node); 1491 gboolean selected = (gtkblist->selected_node == node);