comparison src/gtkblist.c @ 9944:e4a27c9aec4c

[gaim-migrate @ 10838] with much rejoicing, and massive thanks to the efforts of Christian, and all who have helped him, I present to you the incomplete status rewrite! committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 03 Sep 2004 21:35:52 +0000
parents 4e7590473515
children ced29c7b396c
comparison
equal deleted inserted replaced
9943:f8e395a054e2 9944:e4a27c9aec4c
891 gaim_gtk_blist_joinchat_show(); 891 gaim_gtk_blist_joinchat_show();
892 } 892 }
893 893
894 static void gtk_blist_button_away_cb(GtkWidget *w, gpointer data) 894 static void gtk_blist_button_away_cb(GtkWidget *w, gpointer data)
895 { 895 {
896 gtk_menu_popup(GTK_MENU(awaymenu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); 896 /* FIXME: Status */
897 gtk_menu_popup(GTK_MENU(awaymenu), NULL, NULL, NULL, NULL,
898 1, GDK_CURRENT_TIME);
897 } 899 }
898 900
899 static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) { 901 static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
900 GaimBlistNode *node; 902 GaimBlistNode *node;
901 GValue val = {0,}; 903 GValue val = {0,};
2475 g_string_free(parts_text, TRUE); 2477 g_string_free(parts_text, TRUE);
2476 g_free(name); 2478 g_free(name);
2477 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) || 2479 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
2478 GAIM_BLIST_NODE_IS_BUDDY(node)) { 2480 GAIM_BLIST_NODE_IS_BUDDY(node)) {
2479 GaimBuddy *b; 2481 GaimBuddy *b;
2482 GaimPresence *presence;
2483 gboolean idle;
2484 time_t idle_secs;
2485 unsigned int warning_level;
2480 char *statustext = NULL; 2486 char *statustext = NULL;
2481 char *contactaliastext = NULL; 2487 char *contactaliastext = NULL;
2482 char *aliastext = NULL, *nicktext = NULL; 2488 char *aliastext = NULL, *nicktext = NULL;
2483 char *loggedin = NULL, *idletime = NULL; 2489 char *loggedin = NULL, *idletime = NULL;
2484 char *warning = NULL; 2490 char *warning = NULL;
2521 aliastext = g_markup_escape_text(b->alias, -1); 2527 aliastext = g_markup_escape_text(b->alias, -1);
2522 2528
2523 if(b->server_alias) 2529 if(b->server_alias)
2524 nicktext = g_markup_escape_text(b->server_alias, -1); 2530 nicktext = g_markup_escape_text(b->server_alias, -1);
2525 2531
2526 if (b->evil > 0) 2532 if (warning_level > 0)
2527 warning = g_strdup_printf(_("%d%%"), b->evil); 2533 warning = g_strdup_printf(_("%d%%"), warning_level);
2528 2534
2529 if(g_list_length(gaim_connections_get_all()) > 1) 2535 if(g_list_length(gaim_connections_get_all()) > 1)
2530 accounttext = g_markup_escape_text(b->account->username, -1); 2536 accounttext = g_markup_escape_text(b->account->username, -1);
2531 2537
2532 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>" 2538 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>"
2576 char *filename; 2582 char *filename;
2577 int x; 2583 int x;
2578 int y; 2584 int y;
2579 }; 2585 };
2580 2586
2581 GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size) 2587 GdkPixbuf *
2588 gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size)
2582 { 2589 {
2583 GdkPixbuf *scale, *status = NULL; 2590 GdkPixbuf *scale, *status = NULL;
2584 int i, scalesize = 30; 2591 int i, scalesize = 30;
2585 char *filename; 2592 char *filename;
2586 const char *protoname = NULL; 2593 const char *protoname = NULL;
2587 struct _gaim_gtk_blist_node *gtknode = node->ui_data; 2594 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
2588 struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15}, 2595 struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15},
2589 {NULL, 0, 0}, {NULL, 15, 0}}; 2596 {NULL, 0, 0}, {NULL, 15, 0}};
2590 2597 GaimPresence *presence = NULL;
2591 GaimBuddy *buddy = NULL; 2598 GaimBuddy *buddy = NULL;
2592 GaimChat *chat = NULL; 2599 GaimChat *chat = NULL;
2593 2600
2594 if(GAIM_BLIST_NODE_IS_CONTACT(node)) { 2601 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
2595 if(!gtknode->contact_expanded) 2602 if(!gtknode->contact_expanded)
2688 } 2695 }
2689 } 2696 }
2690 } 2697 }
2691 2698
2692 if(buddy) { 2699 if(buddy) {
2693 if(buddy->present == GAIM_BUDDY_OFFLINE) 2700 presence = gaim_buddy_get_presence(buddy);
2701
2702 if (!GAIM_BUDDY_IS_ONLINE(buddy))
2694 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); 2703 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
2695 else if(buddy->idle && 2704 else if (gaim_presence_is_idle(presence) &&
2696 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) 2705 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies"))
2706 {
2697 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE); 2707 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
2708 }
2698 } 2709 }
2699 2710
2700 return scale; 2711 return scale;
2701 } 2712 }
2702 2713
2723 if (buf) 2734 if (buf)
2724 g_object_ref(G_OBJECT(buf)); 2735 g_object_ref(G_OBJECT(buf));
2725 gdk_pixbuf_loader_close(loader, NULL); 2736 gdk_pixbuf_loader_close(loader, NULL);
2726 g_object_unref(G_OBJECT(loader)); 2737 g_object_unref(G_OBJECT(loader));
2727 2738
2728 if (buf) { 2739 if (buf)
2740 {
2741 GaimPresence *presence = gaim_buddy_get_presence(b);
2742
2729 if (!GAIM_BUDDY_IS_ONLINE(b)) 2743 if (!GAIM_BUDDY_IS_ONLINE(b))
2730 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE); 2744 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
2731 if (b->idle && gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) 2745
2746 if (gaim_presence_is_idle(presence) &&
2747 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies"))
2748 {
2732 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE); 2749 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
2750 }
2733 2751
2734 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR); 2752 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR);
2735 g_object_unref(G_OBJECT(buf)); 2753 g_object_unref(G_OBJECT(buf));
2736 return ret; 2754 return ret;
2737 } 2755 }
2743 const char *name; 2761 const char *name;
2744 char *esc, *text = NULL; 2762 char *esc, *text = NULL;
2745 GaimPlugin *prpl; 2763 GaimPlugin *prpl;
2746 GaimPluginProtocolInfo *prpl_info = NULL; 2764 GaimPluginProtocolInfo *prpl_info = NULL;
2747 GaimContact *contact; 2765 GaimContact *contact;
2766 GaimPresence *presence;
2748 struct _gaim_gtk_blist_node *gtkcontactnode = NULL; 2767 struct _gaim_gtk_blist_node *gtkcontactnode = NULL;
2749 int ihrs, imin;
2750 char *idletime = NULL, *warning = NULL, *statustext = NULL; 2768 char *idletime = NULL, *warning = NULL, *statustext = NULL;
2769 unsigned int warning_level;
2751 time_t t; 2770 time_t t;
2752 /* XXX Clean up this crap */ 2771 /* XXX Clean up this crap */
2753 2772
2754 contact = (GaimContact*)((GaimBlistNode*)b)->parent; 2773 contact = (GaimContact*)((GaimBlistNode*)b)->parent;
2755 if(contact) 2774 if(contact)
2764 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account)); 2783 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
2765 2784
2766 if (prpl != NULL) 2785 if (prpl != NULL)
2767 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); 2786 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
2768 2787
2788 presence = gaim_buddy_get_presence(b);
2789
2769 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) { 2790 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
2770 if ((b->idle && !selected && 2791
2792 if ((gaim_presence_is_idle(presence) && !selected &&
2771 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) || 2793 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) ||
2772 !GAIM_BUDDY_IS_ONLINE(b)) { 2794 !GAIM_BUDDY_IS_ONLINE(b))
2795 {
2773 if (selected) 2796 if (selected)
2774 text = g_strdup(esc); 2797 text = g_strdup(esc);
2775 else 2798 else
2776 text = g_strdup_printf("<span color='dim grey'>%s</span>", 2799 text = g_strdup_printf("<span color='dim grey'>%s</span>",
2777 esc); 2800 esc);
2778 g_free(esc); 2801 g_free(esc);
2779 return text; 2802 return text;
2780 } 2803 }
2781 else { 2804 else
2782 return esc; 2805 return esc;
2783 } 2806 }
2784 }
2785
2786 time(&t);
2787 ihrs = (t - b->idle) / 3600;
2788 imin = ((t - b->idle) / 60) % 60;
2789 2807
2790 if (prpl_info && prpl_info->status_text && b->account->gc) { 2808 if (prpl_info && prpl_info->status_text && b->account->gc) {
2791 char *tmp = prpl_info->status_text(b); 2809 char *tmp = prpl_info->status_text(b);
2792 const char *end; 2810 const char *end;
2793 2811
2827 2845
2828 g_free(tmp); 2846 g_free(tmp);
2829 } 2847 }
2830 } 2848 }
2831 2849
2832 if (b->idle > 0 && 2850 if (gaim_presence_is_idle(presence) &&
2833 gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time")) { 2851 gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time"))
2834 if (ihrs) 2852 {
2835 idletime = g_strdup_printf(_("Idle (%dh%02dm) "), ihrs, imin); 2853 time_t idle_secs = gaim_presence_get_idle_time(presence);
2854
2855 if (idle_secs > 0)
2856 {
2857 int ihrs, imin;
2858
2859 time(&t);
2860 ihrs = (t - idle_secs) / 3600;
2861 imin = ((t - idle_secs) / 60) % 60;
2862
2863 if (ihrs)
2864 idletime = g_strdup_printf(_("Idle (%dh%02dm) "), ihrs, imin);
2865 else
2866 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
2867 }
2836 else 2868 else
2837 idletime = g_strdup_printf(_("Idle (%dm) "), imin); 2869 idletime = g_strdup(_("Idle "));
2838 } 2870 }
2839 2871
2840 if (b->evil > 0 && 2872 warning_level = gaim_presence_get_warning_level(presence);
2841 gaim_prefs_get_bool("/gaim/gtk/blist/show_warning_level")) 2873
2842 warning = g_strdup_printf(_("Warned (%d%%) "), b->evil); 2874 if (warning_level > 0 &&
2875 gaim_prefs_get_bool("/gaim/gtk/blist/show_warning_level"))
2876 {
2877 warning = g_strdup_printf(_("Warned (%d%%) "), warning_level);
2878 }
2843 2879
2844 if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext) 2880 if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext)
2845 statustext = g_strdup(_("Offline ")); 2881 statustext = g_strdup(_("Offline "));
2846 2882
2847 if (b->idle && !selected && 2883 if (gaim_presence_is_idle(presence) && !selected &&
2848 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) { 2884 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) {
2849 2885
2850 text = g_strdup_printf("<span color='dim grey'>%s</span>\n" 2886 text = g_strdup_printf("<span color='dim grey'>%s</span>\n"
2851 "<span color='dim grey' size='smaller'>%s%s%s</span>", 2887 "<span color='dim grey' size='smaller'>%s%s%s</span>",
2852 esc, 2888 esc,
2915 for(gnode = list->root; gnode; gnode = gnode->next) { 2951 for(gnode = list->root; gnode; gnode = gnode->next) {
2916 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) 2952 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
2917 continue; 2953 continue;
2918 for(cnode = gnode->child; cnode; cnode = cnode->next) { 2954 for(cnode = gnode->child; cnode; cnode = cnode->next) {
2919 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) { 2955 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
2920 GaimBuddy *buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode); 2956 GaimBuddy *buddy;
2921 if(buddy && buddy->idle) 2957 GaimPresence *presence;
2922 gaim_gtk_blist_update(list, cnode); 2958
2959 buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode);
2960 presence = gaim_buddy_get_presence(buddy);
2961
2962 if (buddy && gaim_presence_is_idle(presence))
2963 gaim_gtk_blist_update(list, cnode);
2923 } 2964 }
2924 } 2965 }
2925 } 2966 }
2926 2967
2927 /* keep on going */ 2968 /* keep on going */
3115 g_signal_connect(G_OBJECT(accel_group), "accel-changed", 3156 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
3116 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); 3157 G_CALLBACK(gaim_gtk_save_accels_cb), NULL);
3117 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtk_item_factory_get_widget(gtkblist->ift, "<GaimMain>"), FALSE, FALSE, 0); 3158 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtk_item_factory_get_widget(gtkblist->ift, "<GaimMain>"), FALSE, FALSE, 0);
3118 3159
3119 awaymenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Away")); 3160 awaymenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Away"));
3161
3162 /* FIXME: Status */
3163 #if 0
3120 do_away_menu(); 3164 do_away_menu();
3165 #endif
3121 3166
3122 gtkblist->bpmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Buddy Pounce")); 3167 gtkblist->bpmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Buddy Pounce"));
3123 gaim_gtkpounce_menu_build(gtkblist->bpmenu); 3168 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
3124 3169
3125 protomenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Account Actions")); 3170 protomenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Account Actions"));
3616 } 3661 }
3617 } 3662 }
3618 3663
3619 static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node) 3664 static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node)
3620 { 3665 {
3666 GaimPresence *presence;
3621 GdkPixbuf *status, *avatar; 3667 GdkPixbuf *status, *avatar;
3622 char *mark; 3668 char *mark;
3623 char *warning = NULL, *idle = NULL; 3669 char *warning = NULL, *idle = NULL;
3624 3670 unsigned int warning_level;
3625 gboolean selected = (gtkblist->selected_node == node); 3671 gboolean selected = (gtkblist->selected_node == node);
3672
3673 presence = gaim_buddy_get_presence(buddy);
3626 3674
3627 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy, 3675 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy,
3628 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") 3676 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")
3629 ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL)); 3677 ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
3630 3678
3631 avatar = gaim_gtk_blist_get_buddy_icon(buddy); 3679 avatar = gaim_gtk_blist_get_buddy_icon(buddy);
3632 mark = gaim_gtk_blist_get_name_markup(buddy, selected); 3680 mark = gaim_gtk_blist_get_name_markup(buddy, selected);
3633 3681
3634 if (buddy->idle > 0) { 3682 if (gaim_presence_is_idle(presence))
3635 time_t t; 3683 {
3636 int ihrs, imin; 3684 time_t idle_secs = gaim_presence_get_idle_time(presence);
3637 time(&t); 3685
3638 ihrs = (t - buddy->idle) / 3600; 3686 if (idle_secs > 0)
3639 imin = ((t - buddy->idle) / 60) % 60; 3687 {
3640 if(ihrs > 0) 3688 time_t t;
3641 idle = g_strdup_printf("(%d:%02d)", ihrs, imin); 3689 int ihrs, imin;
3642 else 3690 time(&t);
3643 idle = g_strdup_printf("(%d)", imin); 3691 ihrs = (t - idle_secs) / 3600;
3644 } 3692 imin = ((t - idle_secs) / 60) % 60;
3645 3693
3646 if (buddy->evil > 0) 3694 if (ihrs > 0)
3647 warning = g_strdup_printf("%d%%", buddy->evil); 3695 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
3696 else
3697 idle = g_strdup_printf("(%d)", imin);
3698 }
3699 }
3700
3701 warning_level = gaim_presence_get_warning_level(presence);
3702
3703 if (warning_level > 0)
3704 warning = g_strdup_printf("%d%%", warning_level);
3648 3705
3649 if (gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies") && 3706 if (gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies") &&
3650 buddy->idle) { 3707 gaim_presence_is_idle(presence))
3651 3708 {
3652 if(warning && !selected) { 3709 if (warning && !selected) {
3653 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>", 3710 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>",
3654 warning); 3711 warning);
3655 g_free(warning); 3712 g_free(warning);
3656 warning = w2; 3713 warning = w2;
3657 } 3714 }
3658 3715
3659 if(idle && !selected) { 3716 if (idle && !selected) {
3660 char *i2 = g_strdup_printf("<span color='dim grey'>%s</span>", 3717 char *i2 = g_strdup_printf("<span color='dim grey'>%s</span>",
3661 idle); 3718 idle);
3662 g_free(idle); 3719 g_free(idle);
3663 idle = i2; 3720 idle = i2;
3664 } 3721 }
3665 } 3722 }
3666 3723
4838 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0); 4895 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
4839 return iter; 4896 return iter;
4840 } 4897 }
4841 4898
4842 do { 4899 do {
4843 int cmp; 4900 gint name_cmp;
4901 gint presence_cmp;
4844 4902
4845 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val); 4903 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val);
4846 n = g_value_get_pointer(&val); 4904 n = g_value_get_pointer(&val);
4847 4905
4848 if(GAIM_BLIST_NODE_IS_CONTACT(n)) { 4906 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4849 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n); 4907 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n);
4850 } else { 4908 } else {
4851 this_buddy = NULL; 4909 this_buddy = NULL;
4852 } 4910 }
4853 4911
4854 cmp = gaim_utf8_strcasecmp(my_buddy ? 4912 name_cmp = gaim_utf8_strcasecmp(
4855 gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy)) 4913 (my_buddy
4856 : NULL, this_buddy ? 4914 ? gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy))
4857 gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy)) 4915 : NULL),
4858 : NULL); 4916 (this_buddy
4859 4917 ? gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy))
4860 /* Hideous */ 4918 : NULL));
4861 if(!this_buddy || 4919
4862 ((my_buddy->present > this_buddy->present) || 4920 presence_cmp = gaim_presence_compare(
4863 (my_buddy->present == this_buddy->present && 4921 gaim_buddy_get_presence(my_buddy),
4864 (((my_buddy->uc & UC_UNAVAILABLE) < (this_buddy->uc & UC_UNAVAILABLE)) || 4922 gaim_buddy_get_presence(this_buddy));
4865 (((my_buddy->uc & UC_UNAVAILABLE) == (this_buddy->uc & UC_UNAVAILABLE)) && 4923
4866 (((my_buddy->idle == 0) && (this_buddy->idle != 0)) || 4924 if (this_buddy == NULL ||
4867 (this_buddy->idle && (my_buddy->idle > this_buddy->idle)) || 4925 (presence_cmp > 0 ||
4868 ((my_buddy->idle == this_buddy->idle) && 4926 (presence_cmp == 0 &&
4869 (cmp < 0 || (cmp == 0 && node < n))))))))) { 4927 (name_cmp < 0 || (name_cmp == 0 && node < n)))))
4870 if(cur) { 4928 {
4929 if (cur != NULL)
4930 {
4871 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z); 4931 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4872 return *cur; 4932 return *cur;
4873 } else { 4933 }
4934 else
4935 {
4874 gtk_tree_store_insert_before(gtkblist->treemodel, &iter, 4936 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4875 &groupiter, &more_z); 4937 &groupiter, &more_z);
4876 return iter; 4938 return iter;
4877 } 4939 }
4878 } 4940 }
4941
4879 g_value_unset(&val); 4942 g_value_unset(&val);
4880 } while (gtk_tree_model_iter_next (GTK_TREE_MODEL(gtkblist->treemodel), &more_z)); 4943 }
4944 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(gtkblist->treemodel),
4945 &more_z));
4881 4946
4882 if(cur) { 4947 if(cur) {
4883 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL); 4948 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4884 return *cur; 4949 return *cur;
4885 } else { 4950 } else {