Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 7404:d889a99e0eb1
[gaim-migrate @ 8000]
Make gaim work with gtk2.0 again.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 31 Oct 2003 15:06:35 +0000 |
parents | 414c701ef1ff |
children | 6a9acef3b867 |
comparison
equal
deleted
inserted
replaced
7403:818350245bfc | 7404:d889a99e0eb1 |
---|---|
330 } | 330 } |
331 | 331 |
332 return FALSE; | 332 return FALSE; |
333 } | 333 } |
334 | 334 |
335 #if GTK_CHECK_VERSION(2,2,0) | |
335 static GtkIMHtmlCopyable *gtk_imhtml_copyable_new(GtkIMHtml *imhtml, GtkTextMark *mark, const gchar *text) | 336 static GtkIMHtmlCopyable *gtk_imhtml_copyable_new(GtkIMHtml *imhtml, GtkTextMark *mark, const gchar *text) |
336 { | 337 { |
337 GtkIMHtmlCopyable *copy = g_malloc(sizeof(GtkIMHtmlCopyable)); | 338 GtkIMHtmlCopyable *copy = g_malloc(sizeof(GtkIMHtmlCopyable)); |
338 copy->mark = mark; | 339 copy->mark = mark; |
339 copy->text = g_strdup(text); | 340 copy->text = g_strdup(text); |
388 static gboolean button_release_cb(GtkIMHtml *imhtml, GdkEventButton event, gpointer the_foibles_of_man) | 389 static gboolean button_release_cb(GtkIMHtml *imhtml, GdkEventButton event, gpointer the_foibles_of_man) |
389 { | 390 { |
390 copy_clipboard_cb(imhtml, gtk_widget_get_clipboard(GTK_WIDGET(imhtml), GDK_SELECTION_PRIMARY)); | 391 copy_clipboard_cb(imhtml, gtk_widget_get_clipboard(GTK_WIDGET(imhtml), GDK_SELECTION_PRIMARY)); |
391 return FALSE; | 392 return FALSE; |
392 } | 393 } |
394 #endif | |
393 | 395 |
394 | 396 |
395 static GtkTextViewClass *parent_class = NULL; | 397 static GtkTextViewClass *parent_class = NULL; |
396 | 398 |
397 /* GtkIMHtml has one signal--URL_CLICKED */ | 399 /* GtkIMHtml has one signal--URL_CLICKED */ |
404 static void | 406 static void |
405 gtk_imhtml_finalize (GObject *object) | 407 gtk_imhtml_finalize (GObject *object) |
406 { | 408 { |
407 GtkIMHtml *imhtml = GTK_IMHTML(object); | 409 GtkIMHtml *imhtml = GTK_IMHTML(object); |
408 GList *scalables; | 410 GList *scalables; |
411 #if GTK_CHECK_VERSION(2,2,0) | |
409 GSList *copyables; | 412 GSList *copyables; |
413 #endif | |
410 | 414 |
411 g_hash_table_destroy(imhtml->smiley_data); | 415 g_hash_table_destroy(imhtml->smiley_data); |
412 gtk_smiley_tree_destroy(imhtml->default_smilies); | 416 gtk_smiley_tree_destroy(imhtml->default_smilies); |
413 gdk_cursor_unref(imhtml->hand_cursor); | 417 gdk_cursor_unref(imhtml->hand_cursor); |
414 gdk_cursor_unref(imhtml->arrow_cursor); | 418 gdk_cursor_unref(imhtml->arrow_cursor); |
421 for(scalables = imhtml->scalables; scalables; scalables = scalables->next) { | 425 for(scalables = imhtml->scalables; scalables; scalables = scalables->next) { |
422 GtkIMHtmlScalable *scale = GTK_IMHTML_SCALABLE(scalables->data); | 426 GtkIMHtmlScalable *scale = GTK_IMHTML_SCALABLE(scalables->data); |
423 scale->free(scale); | 427 scale->free(scale); |
424 } | 428 } |
425 | 429 |
430 #if GTK_CHECK_VERSION(2,2,0) | |
426 for (copyables = imhtml->copyables; copyables; copyables = copyables->next) { | 431 for (copyables = imhtml->copyables; copyables; copyables = copyables->next) { |
427 GtkIMHtmlCopyable *copy = GTK_IMHTML_COPYABLE(copyables->data); | 432 GtkIMHtmlCopyable *copy = GTK_IMHTML_COPYABLE(copyables->data); |
428 g_free(copy->text); | 433 g_free(copy->text); |
429 g_free(copy); | 434 g_free(copy); |
430 } | 435 } |
431 | 436 #endif |
432 g_list_free(imhtml->scalables); | 437 g_list_free(imhtml->scalables); |
433 G_OBJECT_CLASS(parent_class)->finalize (object); | 438 G_OBJECT_CLASS(parent_class)->finalize (object); |
434 } | 439 } |
435 | 440 |
436 /* Boring GTK stuff */ | 441 /* Boring GTK stuff */ |
490 | 495 |
491 g_signal_connect(G_OBJECT(imhtml), "size-allocate", G_CALLBACK(gtk_size_allocate_cb), NULL); | 496 g_signal_connect(G_OBJECT(imhtml), "size-allocate", G_CALLBACK(gtk_size_allocate_cb), NULL); |
492 g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL); | 497 g_signal_connect(G_OBJECT(imhtml), "motion-notify-event", G_CALLBACK(gtk_motion_event_notify), NULL); |
493 g_signal_connect(G_OBJECT(imhtml), "leave-notify-event", G_CALLBACK(gtk_leave_event_notify), NULL); | 498 g_signal_connect(G_OBJECT(imhtml), "leave-notify-event", G_CALLBACK(gtk_leave_event_notify), NULL); |
494 g_signal_connect(G_OBJECT(imhtml), "key_press_event", G_CALLBACK(gtk_key_pressed_cb), NULL); | 499 g_signal_connect(G_OBJECT(imhtml), "key_press_event", G_CALLBACK(gtk_key_pressed_cb), NULL); |
500 #if GTK_CHECK_VERSION(2,2,0) | |
495 g_signal_connect(G_OBJECT(imhtml), "copy-clipboard", G_CALLBACK(copy_clipboard_cb), NULL); | 501 g_signal_connect(G_OBJECT(imhtml), "copy-clipboard", G_CALLBACK(copy_clipboard_cb), NULL); |
496 g_signal_connect(G_OBJECT(imhtml), "button-release-event", G_CALLBACK(button_release_cb), imhtml); | 502 g_signal_connect(G_OBJECT(imhtml), "button-release-event", G_CALLBACK(button_release_cb), imhtml); |
503 #endif | |
497 gtk_widget_add_events(GTK_WIDGET(imhtml), GDK_LEAVE_NOTIFY_MASK); | 504 gtk_widget_add_events(GTK_WIDGET(imhtml), GDK_LEAVE_NOTIFY_MASK); |
498 | 505 |
499 imhtml->tip = NULL; | 506 imhtml->tip = NULL; |
500 imhtml->tip_timer = 0; | 507 imhtml->tip_timer = 0; |
501 imhtml->tip_window = NULL; | 508 imhtml->tip_window = NULL; |
502 | 509 |
503 imhtml->scalables = NULL; | 510 imhtml->scalables = NULL; |
511 #if GTK_CHECK_VERSION(2,2,0) | |
504 imhtml->copyables = NULL; | 512 imhtml->copyables = NULL; |
513 #endif | |
505 } | 514 } |
506 | 515 |
507 GtkWidget *gtk_imhtml_new(void *a, void *b) | 516 GtkWidget *gtk_imhtml_new(void *a, void *b) |
508 { | 517 { |
509 return GTK_WIDGET(g_object_new(gtk_imhtml_get_type(), NULL)); | 518 return GTK_WIDGET(g_object_new(gtk_imhtml_get_type(), NULL)); |
1462 } | 1471 } |
1463 | 1472 |
1464 if (icon) { | 1473 if (icon) { |
1465 gtk_widget_show(icon); | 1474 gtk_widget_show(icon); |
1466 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), icon, anchor); | 1475 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), icon, anchor); |
1476 #if GTK_CHECK_VERSION(2,2,0) | |
1467 gtk_imhtml_copyable_new(imhtml, | 1477 gtk_imhtml_copyable_new(imhtml, |
1468 gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, TRUE), | 1478 gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, TRUE), |
1469 ws); | 1479 ws); |
1480 #endif | |
1470 } | 1481 } |
1471 | 1482 |
1472 copy = iter; | 1483 copy = iter; |
1473 gtk_text_iter_backward_char(©); | 1484 gtk_text_iter_backward_char(©); |
1474 if (bg) { | 1485 if (bg) { |