comparison pidgin/gtkblist.c @ 19874:0ed8a2a86a1b

explicit merge of 'fc49baf44017a8fd511c607b435668baf2a0f518' and 'b50640e3caa45410064cc403c759c1b427800a1e' to branch 'org.maemo.garage.pidgin.pidgin.dialog-transience'
author Gabriel Schulhof <nix@go-nix.ca>
date Fri, 17 Aug 2007 22:10:43 +0000
parents 94a2128d139e aafa9b36344e
children 9474223e534b
comparison
equal deleted inserted replaced
19872:dd5e6f06be8f 19874:0ed8a2a86a1b
2606 GdkScreen *screen = NULL; 2606 GdkScreen *screen = NULL;
2607 #endif 2607 #endif
2608 gboolean tooltip_top = FALSE; 2608 gboolean tooltip_top = FALSE;
2609 struct _pidgin_blist_node *gtknode; 2609 struct _pidgin_blist_node *gtknode;
2610 GdkRectangle mon_size; 2610 GdkRectangle mon_size;
2611 int sig;
2611 2612
2612 if (node == NULL) 2613 if (node == NULL)
2613 return; 2614 return;
2614 2615
2615 /* 2616 /*
2616 * Attempt to free the previous tooltip. I have a feeling 2617 * Attempt to free the previous tooltip. I have a feeling
2617 * this is never needed... but just in case. 2618 * this is never needed... but just in case.
2618 */ 2619 */
2619 pidgin_blist_tooltip_destroy(); 2620 pidgin_blist_tooltip_destroy();
2620
2621 2621
2622 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP); 2622 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
2623 2623
2624 if(PURPLE_BLIST_NODE_IS_CHAT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node)) { 2624 if(PURPLE_BLIST_NODE_IS_CHAT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node)) {
2625 struct tooltip_data *td = create_tip_for_node(node, TRUE); 2625 struct tooltip_data *td = create_tip_for_node(node, TRUE);
2671 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips"); 2671 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
2672 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event", 2672 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
2673 G_CALLBACK(pidgin_blist_paint_tip), NULL); 2673 G_CALLBACK(pidgin_blist_paint_tip), NULL);
2674 gtk_widget_ensure_style (gtkblist->tipwindow); 2674 gtk_widget_ensure_style (gtkblist->tipwindow);
2675 2675
2676
2677 #if GTK_CHECK_VERSION(2,2,0) 2676 #if GTK_CHECK_VERSION(2,2,0)
2678 gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL); 2677 gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL);
2679 mon_num = gdk_screen_get_monitor_at_point(screen, x, y); 2678 mon_num = gdk_screen_get_monitor_at_point(screen, x, y);
2680 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size); 2679 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size);
2681 2680
2719 } 2718 }
2720 2719
2721 gtk_widget_set_size_request(gtkblist->tipwindow, w, h); 2720 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
2722 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y); 2721 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
2723 gtk_widget_show(gtkblist->tipwindow); 2722 gtk_widget_show(gtkblist->tipwindow);
2723
2724 /* Hide the tooltip when the widget is destroyed */
2725 sig = g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(pidgin_blist_tooltip_destroy), NULL);
2726 g_signal_connect_swapped(G_OBJECT(gtkblist->tipwindow), "destroy", G_CALLBACK(g_source_remove), GINT_TO_POINTER(sig));
2724 2727
2725 return; 2728 return;
2726 } 2729 }
2727 2730
2728 static gboolean pidgin_blist_drag_motion_cb(GtkWidget *tv, GdkDragContext *drag_context, 2731 static gboolean pidgin_blist_drag_motion_cb(GtkWidget *tv, GdkDragContext *drag_context,
3324 hidden_conv = TRUE; 3327 hidden_conv = TRUE;
3325 } 3328 }
3326 } 3329 }
3327 3330
3328 /* XXX Good luck cleaning up this crap */ 3331 /* XXX Good luck cleaning up this crap */
3329 if (aliased) { 3332 contact = (PurpleContact*)((PurpleBlistNode*)b)->parent;
3330 contact = (PurpleContact*)((PurpleBlistNode*)b)->parent; 3333 if(contact)
3331 if(contact) 3334 gtkcontactnode = ((PurpleBlistNode*)contact)->ui_data;
3332 gtkcontactnode = ((PurpleBlistNode*)contact)->ui_data; 3335
3333 3336 if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
3334 if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias) 3337 name = contact->alias;
3335 name = contact->alias; 3338 else
3336 else 3339 name = purple_buddy_get_alias(b);
3337 name = purple_buddy_get_alias(b);
3338 } else {
3339 name = b->name;
3340 }
3341 3340
3342 esc = g_markup_escape_text(name, strlen(name)); 3341 esc = g_markup_escape_text(name, strlen(name));
3343 3342
3344 presence = purple_buddy_get_presence(b); 3343 presence = purple_buddy_get_presence(b);
3345 3344