| 2977 { |
2977 { |
| 2978 pidgin_blist_destroy_tooltip_data(); |
2978 pidgin_blist_destroy_tooltip_data(); |
| 2979 pidgin_tooltip_destroy(); |
2979 pidgin_tooltip_destroy(); |
| 2980 } |
2980 } |
| 2981 |
2981 |
| |
2982 static void |
| |
2983 pidgin_blist_align_tooltip(struct tooltip_data *td, GtkWidget *widget) |
| |
2984 { |
| |
2985 GtkTextDirection dir = gtk_widget_get_direction(widget); |
| |
2986 |
| |
2987 if (dir == GTK_TEXT_DIR_RTL) |
| |
2988 { |
| |
2989 char* layout_name = purple_markup_strip_html(pango_layout_get_text(td->name_layout)); |
| |
2990 PangoDirection dir = pango_find_base_dir(layout_name, -1); |
| |
2991 if (dir == PANGO_DIRECTION_RTL || dir == PANGO_DIRECTION_NEUTRAL) |
| |
2992 pango_layout_set_alignment(td->name_layout, PANGO_ALIGN_RIGHT); |
| |
2993 g_free(layout_name); |
| |
2994 pango_layout_set_alignment(td->layout, PANGO_ALIGN_RIGHT); |
| |
2995 } |
| |
2996 } |
| |
2997 |
| 2982 static gboolean |
2998 static gboolean |
| 2983 pidgin_blist_create_tooltip_for_node(GtkWidget *widget, gpointer data, int *w, int *h) |
2999 pidgin_blist_create_tooltip_for_node(GtkWidget *widget, gpointer data, int *w, int *h) |
| 2984 { |
3000 { |
| 2985 PurpleBlistNode *node = data; |
3001 PurpleBlistNode *node = data; |
| 2986 int width, height; |
3002 int width, height; |
| 2996 |
3012 |
| 2997 gtkblist->tipwindow = widget; |
3013 gtkblist->tipwindow = widget; |
| 2998 if (PURPLE_BLIST_NODE_IS_CHAT(node) || |
3014 if (PURPLE_BLIST_NODE_IS_CHAT(node) || |
| 2999 PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
3015 PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| 3000 struct tooltip_data *td = create_tip_for_node(node, TRUE); |
3016 struct tooltip_data *td = create_tip_for_node(node, TRUE); |
| |
3017 pidgin_blist_align_tooltip(td, gtkblist->tipwindow); |
| 3001 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td); |
3018 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td); |
| 3002 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
3019 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
| 3003 PurpleGroup *group = (PurpleGroup*)node; |
3020 PurpleGroup *group = (PurpleGroup*)node; |
| 3004 GSList *accounts; |
3021 GSList *accounts; |
| 3005 struct tooltip_data *td = create_tip_for_node(node, TRUE); |
3022 struct tooltip_data *td = create_tip_for_node(node, TRUE); |
| |
3023 pidgin_blist_align_tooltip(td, gtkblist->tipwindow); |
| 3006 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td); |
3024 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td); |
| 3007 |
3025 |
| 3008 /* Accounts with buddies in group */ |
3026 /* Accounts with buddies in group */ |
| 3009 accounts = purple_group_get_accounts(group); |
3027 accounts = purple_group_get_accounts(group); |
| 3010 for (; accounts != NULL; |
3028 for (; accounts != NULL; |
| 3020 |
3038 |
| 3021 for(child = node->child; child; child = child->next) |
3039 for(child = node->child; child; child = child->next) |
| 3022 { |
3040 { |
| 3023 if(PURPLE_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((PurpleBuddy*)child)) { |
3041 if(PURPLE_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((PurpleBuddy*)child)) { |
| 3024 struct tooltip_data *td = create_tip_for_node(child, (b == (PurpleBuddy*)child)); |
3042 struct tooltip_data *td = create_tip_for_node(child, (b == (PurpleBuddy*)child)); |
| |
3043 pidgin_blist_align_tooltip(td, gtkblist->tipwindow); |
| 3025 if (b == (PurpleBuddy *)child) { |
3044 if (b == (PurpleBuddy *)child) { |
| 3026 gtkblist->tooltipdata = g_list_prepend(gtkblist->tooltipdata, td); |
3045 gtkblist->tooltipdata = g_list_prepend(gtkblist->tooltipdata, td); |
| 3027 } else { |
3046 } else { |
| 3028 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td); |
3047 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td); |
| 3029 } |
3048 } |