changeset 29378:fdb61f7e8576

Change the cursor and act on double click on usernames in chat history. Use the hand-cursor when hovering over usernames in the chat history, and pop up an IM on double click. Closes #11295. On the news tonight: The bird is still the word.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 06 Feb 2010 23:45:03 +0000
parents 57ae03fdb86f
children 5f00c19d462f
files pidgin/gtkconv.c pidgin/gtkimhtml.c
diffstat 2 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Sat Feb 06 06:53:31 2010 +0000
+++ b/pidgin/gtkconv.c	Sat Feb 06 23:45:03 2010 +0000
@@ -5621,7 +5621,11 @@
 
 		buddyname = (tag->name) + 6;
 
-		if (btn_event->button == 2
+		if (btn_event->button == 1 &&
+				event->type == GDK_2BUTTON_PRESS) {
+			chat_do_im(PIDGIN_CONVERSATION(conv), buddyname);
+			return TRUE;
+		} else if (btn_event->button == 2
 				&& event->type == GDK_2BUTTON_PRESS) {
 			chat_do_info(PIDGIN_CONVERSATION(conv), buddyname);
 
@@ -5683,6 +5687,7 @@
 					"weight", purple_find_buddy(purple_conversation_get_account(conv), who) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
 					NULL);
 
+		g_object_set_data(G_OBJECT(buddytag), "cursor", "");
 		g_signal_connect(G_OBJECT(buddytag), "event",
 				G_CALLBACK(buddytag_event), conv);
 	}
--- a/pidgin/gtkimhtml.c	Sat Feb 06 06:53:31 2010 +0000
+++ b/pidgin/gtkimhtml.c	Sat Feb 06 23:45:03 2010 +0000
@@ -628,6 +628,7 @@
 	GtkTextTag *tag = NULL, *oldprelit_tag;
 	GtkTextChildAnchor* anchor;
 	gboolean hand = TRUE;
+	GdkCursor *cursor = NULL;
 
 	oldprelit_tag = GTK_IMHTML(imhtml)->prelit_tag;
 
@@ -676,9 +677,9 @@
 			GTK_IMHTML(imhtml)->tip_window = NULL;
 		}
 		if (GTK_IMHTML(imhtml)->editable)
-			gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->text_cursor);
+			cursor = GTK_IMHTML(imhtml)->text_cursor;
 		else
-			gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->arrow_cursor);
+			cursor = GTK_IMHTML(imhtml)->arrow_cursor;
 		if (GTK_IMHTML(imhtml)->tip_timer)
 			g_source_remove(GTK_IMHTML(imhtml)->tip_timer);
 		GTK_IMHTML(imhtml)->tip_timer = 0;
@@ -692,12 +693,25 @@
 	}
 
 	if (tip && *tip) {
-		if (!GTK_IMHTML(imhtml)->editable && hand)
-			gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->hand_cursor);
 		GTK_IMHTML(imhtml)->tip_timer = g_timeout_add (TOOLTIP_TIMEOUT,
 							       gtk_imhtml_tip, imhtml);
+	} else if (!tip) {
+		hand = FALSE;
+		for (templist = tags; templist; templist = templist->next) {
+			tag = templist->data;
+			if ((tip = g_object_get_data(G_OBJECT(tag), "cursor"))) {
+				hand = TRUE;
+				break;
+			}
+		}
 	}
 
+	if (hand && !(GTK_IMHTML(imhtml)->editable))
+		cursor = GTK_IMHTML(imhtml)->hand_cursor;
+
+	if (cursor)
+		gdk_window_set_cursor(win, cursor);
+
 	GTK_IMHTML(imhtml)->tip = tip;
 	g_slist_free(tags);
 	return FALSE;