comparison src/gtkimhtml.c @ 5091:04ded2f7253c

[gaim-migrate @ 5453] Ari Pollak (sourceo) writes: "If you hover over a link, a tooltip will generally pop up with the URL that is linked. If you then right-click on the link, the tooltip is still there, and can possibly cover over the right-click context menu. This patch simply closes the tooltip when right-clicking on a link." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 09 Apr 2003 23:35:53 +0000
parents 44945824ba60
children 89c0c811befa
comparison
equal deleted inserted replaced
5090:4596276f5b12 5091:04ded2f7253c
295 clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); 295 clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
296 gtk_clipboard_set_text(clipboard, url, -1); 296 gtk_clipboard_set_text(clipboard, url, -1);
297 } 297 }
298 298
299 /* The callback for an event on a link tag. */ 299 /* The callback for an event on a link tag. */
300 gboolean tag_event(GtkTextTag *tag, GObject *arg1, GdkEvent *event, GtkTextIter *arg2, char *url) { 300 gboolean tag_event(GtkTextTag *tag, GObject *imhtml, GdkEvent *event, GtkTextIter *arg2, char *url) {
301 GdkEventButton *event_button = (GdkEventButton *) event; 301 GdkEventButton *event_button = (GdkEventButton *) event;
302 302
303 if (event->type == GDK_BUTTON_RELEASE) { 303 if (event->type == GDK_BUTTON_RELEASE) {
304 if (event_button->button == 1) { 304 if (event_button->button == 1) {
305 GtkTextIter start, end; 305 GtkTextIter start, end;
310 gtk_text_iter_get_offset(&end)) 310 gtk_text_iter_get_offset(&end))
311 return FALSE; 311 return FALSE;
312 312
313 /* A link was clicked--we emit the "url_clicked" signal 313 /* A link was clicked--we emit the "url_clicked" signal
314 * with the URL as the argument */ 314 * with the URL as the argument */
315 g_signal_emit(arg1, signals[URL_CLICKED], 0, url); 315 g_signal_emit(imhtml, signals[URL_CLICKED], 0, url);
316 return FALSE; 316 return FALSE;
317 } else if(event_button->button == 3) { 317 } else if(event_button->button == 3) {
318 GtkWidget *img, *item, *menu; 318 GtkWidget *img, *item, *menu;
319 struct url_data *tempdata = g_new(struct url_data, 1); 319 struct url_data *tempdata = g_new(struct url_data, 1);
320 tempdata->object = g_object_ref(arg1); 320 tempdata->object = g_object_ref(imhtml);
321 tempdata->url = g_strdup(url); 321 tempdata->url = g_strdup(url);
322 322
323 /* Don't want the tooltip around if user right-clicked on link */
324 if (GTK_IMHTML(imhtml)->tip_window) {
325 gtk_widget_destroy(GTK_IMHTML(imhtml)->tip_window);
326 GTK_IMHTML(imhtml)->tip_window = NULL;
327 }
328 if (GTK_IMHTML(imhtml)->tip_timer) {
329 g_source_remove(GTK_IMHTML(imhtml)->tip_timer);
330 GTK_IMHTML(imhtml)->tip_timer = 0;
331 }
332 gdk_window_set_cursor(event_button->window, GTK_IMHTML(imhtml)->arrow_cursor);
323 menu = gtk_menu_new(); 333 menu = gtk_menu_new();
324 334
325 /* buttons and such */ 335 /* buttons and such */
326 img = gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU); 336 img = gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU);
327 item = gtk_image_menu_item_new_with_mnemonic(_("_Copy Link Location")); 337 item = gtk_image_menu_item_new_with_mnemonic(_("_Copy Link Location"));