changeset 2655:c4ad36781d1b

[gaim-migrate @ 2668] it's 10:50 committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 01 Nov 2001 18:50:39 +0000
parents edd8cc296a06
children b4165d68185b
files ChangeLog HACKING configure.ac doc/gaim.1 src/gtkimhtml.c
diffstat 5 files changed, 87 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Nov 01 17:34:41 2001 +0000
+++ b/ChangeLog	Thu Nov 01 18:50:39 2001 +0000
@@ -1,5 +1,8 @@
 Gaim: The Pimpin' Penguin IM Clone thats good for the soul! 
 
+version 0.48:
+	* Right-click on links to open/copy URL
+
 version 0.47 (11/01/2001):
 	* Better font loading (pays attention to charset now)
 	  (thanks Arkadiusz Miskiewicz)
--- a/HACKING	Thu Nov 01 17:34:41 2001 +0000
+++ b/HACKING	Thu Nov 01 18:50:39 2001 +0000
@@ -34,9 +34,16 @@
 section, or email it to gaim@marko.net.
 
 This file was last modified by $Author: warmenhoven $ on
-$Date: 2001-10-16 19:37:11 -0400 (Tue, 16 Oct 2001) $. Do not expect any information contained
+$Date: 2001-11-01 13:50:39 -0500 (Thu, 01 Nov 2001) $. Do not expect any information contained
 within to be current or correct.
 
+Here's something new. Someone requested that I comment the code. No. I'm
+a lazy bastard, and I understand most of the code, so I don't need the
+comments. I understand that some of you do though. So give me the names
+of specific functions that you'd like commented and I'll see what I can
+do. It's more likely that those comments will be updated with the code
+than this file is, though even that is still unlikely.
+
 
 CODING STYLE
 ============
--- a/configure.ac	Thu Nov 01 17:34:41 2001 +0000
+++ b/configure.ac	Thu Nov 01 18:50:39 2001 +0000
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(src/aim.c)
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE([gaim], [0.47])
+AM_INIT_AUTOMAKE([gaim], [0.48])
 
 AC_PATH_PROG(sedpath, sed)
 
--- a/doc/gaim.1	Thu Nov 01 17:34:41 2001 +0000
+++ b/doc/gaim.1	Thu Nov 01 18:50:39 2001 +0000
@@ -21,7 +21,7 @@
 .\" USA.
 .TH gaim 1
 .SH NAME
-Gaim v0.47 \- Instant Messaging client
+Gaim v0.48 \- Instant Messaging client
 .SH SYNOPSIS
 .TP 5
 \fBgaim \fI[options]\fR
--- a/src/gtkimhtml.c	Thu Nov 01 17:34:41 2001 +0000
+++ b/src/gtkimhtml.c	Thu Nov 01 18:50:39 2001 +0000
@@ -296,6 +296,7 @@
 	gint y;
 	gint width;
 	gint height;
+	GtkIMHtml *imhtml;
 	GtkIMHtmlBit *bit;
 };
 
@@ -1475,6 +1476,33 @@
 	return TRUE;
 }
 
+static void
+menu_open_url (GtkObject *object,
+	       gpointer   data)
+{
+	struct url_widget *uw = data;
+
+	gtk_signal_emit (GTK_OBJECT (uw->imhtml), signals [URL_CLICKED], uw->bit->url);
+}
+
+static void
+menu_copy_link (GtkObject *object,
+		gpointer   data)
+{
+	struct url_widget *uw = data;
+	GtkIMHtml *imhtml = uw->imhtml;
+
+	if (imhtml->selected_text)
+		g_string_free (imhtml->selected_text, TRUE);
+
+	gtk_imhtml_select_none (uw->imhtml);
+
+	imhtml->selection = TRUE;
+	imhtml->selected_text = g_string_new (uw->bit->url);
+
+	gtk_selection_owner_set (GTK_WIDGET (imhtml), GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
+}
+
 static gint
 gtk_imhtml_button_press_event (GtkWidget      *widget,
 			       GdkEventButton *event)
@@ -1484,16 +1512,57 @@
 	GtkAdjustment *hadj = GTK_LAYOUT (widget)->hadjustment;
 	gint x, y;
 
+	x = event->x + hadj->value;
+	y = event->y + vadj->value;
+
 	if (event->button == 1) {
-		x = event->x + hadj->value;
-		y = event->y + vadj->value;
-
 		imhtml->sel_startx = x;
 		imhtml->sel_starty = y;
 		imhtml->selection = TRUE;
 		gtk_imhtml_select_none (imhtml);
 	}
 
+	if (event->button == 3) {
+		GList *urls = imhtml->urls;
+		struct url_widget *uw;
+
+		while (urls) {
+			uw = urls->data;
+			if ((x > uw->x) && (x < uw->x + uw->width) &&
+			    (y > uw->y) && (y < uw->y + uw->height)) {
+				GtkWidget *menu = gtk_menu_new ();
+
+				GtkWidget *button = gtk_menu_item_new_with_label ("Open URL");
+				gtk_signal_connect (GTK_OBJECT (button), "activate",
+						    GTK_SIGNAL_FUNC (menu_open_url), uw);
+				gtk_menu_append (GTK_MENU (menu), button);
+				gtk_widget_show (button);
+
+				button = gtk_menu_item_new_with_label ("Copy Link Location");
+				gtk_signal_connect (GTK_OBJECT (button), "activate",
+						    GTK_SIGNAL_FUNC (menu_copy_link), uw);
+				gtk_menu_append (GTK_MENU (menu), button);
+				gtk_widget_show (button);
+
+				gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+						3, event->time);
+
+				if (imhtml->tip_timer) {
+					gtk_timeout_remove (imhtml->tip_timer);
+					imhtml->tip_timer = 0;
+				}
+				if (imhtml->tip_window) {
+					gtk_widget_destroy (imhtml->tip_window);
+					imhtml->tip_window = NULL;
+				}
+				imhtml->tip_bit = NULL;
+
+				return TRUE;
+			}
+			urls = g_list_next (urls);
+		}
+	}
+
 	return TRUE;
 }
 
@@ -2226,6 +2295,7 @@
 		uw->y = imhtml->y;
 		uw->width = width;
 		uw->height = imhtml->llheight;
+		uw->imhtml = imhtml;
 		uw->bit = bit;
 		imhtml->urls = g_list_append (imhtml->urls, uw);
 	}
@@ -2258,6 +2328,7 @@
 		uw->y = imhtml->y;
 		uw->width = width;
 		uw->height = imhtml->llheight;
+		uw->imhtml = imhtml;
 		uw->bit = bit;
 		imhtml->urls = g_list_append (imhtml->urls, uw);
 	}