changeset 438:881f5d538f15

[gaim-migrate @ 448] Added hit detection on ticker -- clicking on a name is like double clicking in the online buddy list, and brings up an IM window. committer: Tailor Script <tailor@pidgin.im>
author Syd Logan <slogan>
date Sun, 25 Jun 2000 17:00:24 +0000
parents 9c113e5c5363
children 9e5a6c35dd64
files src/buddy.c src/ticker.c
diffstat 2 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Sun Jun 25 16:59:08 2000 +0000
+++ b/src/buddy.c	Sun Jun 25 17:00:24 2000 +0000
@@ -403,6 +403,19 @@
 	}
 }
 
+void pressed_ticker(char *buddy)
+{
+	struct conversation *c;
+
+	c = find_conversation(buddy);
+
+	if (c != NULL) {
+		gdk_window_show(c->window->window);
+	} else {
+		c = new_conversation(buddy);
+	}
+}
+
 void pressed_info(GtkWidget *widget, struct buddy *b)
 {
         serv_get_info(b->name);
--- a/src/ticker.c	Sun Jun 25 16:59:08 2000 +0000
+++ b/src/ticker.c	Sun Jun 25 17:00:24 2000 +0000
@@ -30,6 +30,7 @@
 typedef struct {
 	char buddy[ 128 ];
 	GtkWidget *hbox;
+	GtkWidget *ebox;
 	GtkWidget *label;
 	GtkWidget *pix;
 } TickerData;
@@ -98,6 +99,14 @@
 
 }
 
+gint 
+ButtonPressCallback( GtkWidget *widget, GdkEvent *event, gpointer callback_data ) 
+{
+	TickerData *p = (TickerData *) callback_data;
+
+	pressed_ticker( p->buddy );
+}
+
 void
 BuddyTickerAddUser( char *name, GdkPixmap *pm, GdkBitmap *bm )
 {
@@ -127,8 +136,20 @@
 
 	BuddyTickerSetPixmap( name, pm, bm );
 
+	p->ebox = gtk_event_box_new();
+
+	// click detection
+
+        gtk_widget_set_events (p->ebox, GDK_BUTTON_PRESS_MASK);
+        gtk_signal_connect (GTK_OBJECT (p->ebox), "button_press_event",
+                GTK_SIGNAL_FUNC(ButtonPressCallback), (gpointer) p);
+
+	gtk_box_pack_start_defaults( GTK_BOX( p->hbox ), p->ebox );
+	gtk_widget_show( p->ebox );
+
 	p->label = gtk_label_new( name );
-	gtk_box_pack_start_defaults( GTK_BOX( p->hbox ), p->label );
+	gtk_container_add( GTK_CONTAINER(p->ebox), p->label ); 
+
 	gtk_widget_show( p->label );
 
         gtk_widget_show( tickerwindow );