comparison src/gtkimhtml.c @ 8456:5f8d4ab6d375

[gaim-migrate @ 9186] "his patch fixes an issue where the gtkimhtml and the gtkimtoolbar did not know what protocol the conversation was for so they we're either displaying core smileys or white boxes with an x through them. this also make gtkimthml honor the ctrl-{b/u/i} and ctrl-number prefs." --Gary Kramlich who continues: "in the first patch i forgot to adjust the protocol name in the conversation when an item in the send as menu was selected. This fixes that." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 16 Mar 2004 19:35:17 +0000
parents b08d8874d933
children daeeb96cdf8f
comparison
equal deleted inserted replaced
8455:622fd4e800b4 8456:5f8d4ab6d375
386 break; 386 break;
387 387
388 case 'b': /* ctrl-b is GDK_Left, which moves backwards. */ 388 case 'b': /* ctrl-b is GDK_Left, which moves backwards. */
389 case 'B': 389 case 'B':
390 if (imhtml->format_functions & GTK_IMHTML_BOLD) { 390 if (imhtml->format_functions & GTK_IMHTML_BOLD) {
391 gtk_imhtml_toggle_bold(imhtml); 391 if(imhtml->html_shortcuts) {
392 object = g_object_ref(G_OBJECT(imhtml)); 392 gtk_imhtml_toggle_bold(imhtml);
393 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_BOLD); 393 object = g_object_ref(G_OBJECT(imhtml));
394 g_object_unref(object); 394 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_BOLD);
395 g_object_unref(object);
396 }
395 } 397 }
396 return TRUE; 398 return TRUE;
397 break; 399 break;
398 400
399 case 'f': 401 case 'f':
406 break; 408 break;
407 409
408 case 'i': 410 case 'i':
409 case 'I': 411 case 'I':
410 if (imhtml->format_functions & GTK_IMHTML_ITALIC) 412 if (imhtml->format_functions & GTK_IMHTML_ITALIC)
411 gtk_imhtml_toggle_italic(imhtml); 413 if(imhtml->html_shortcuts)
414 gtk_imhtml_toggle_italic(imhtml);
412 return TRUE; 415 return TRUE;
413 break; 416 break;
414 417
415 case 'u': /* ctrl-u is GDK_Clear, which clears the line. */ 418 case 'u': /* ctrl-u is GDK_Clear, which clears the line. */
416 case 'U': 419 case 'U':
417 if (imhtml->format_functions & GTK_IMHTML_UNDERLINE) 420 if (imhtml->format_functions & GTK_IMHTML_UNDERLINE)
418 gtk_imhtml_toggle_underline(imhtml); 421 if(imhtml->html_shortcuts)
422 gtk_imhtml_toggle_underline(imhtml);
419 return TRUE; 423 return TRUE;
420 break; 424 break;
421 425
422 case '-': 426 case '-':
423 if (imhtml->format_functions & GTK_IMHTML_SHRINK) 427 if (imhtml->format_functions & GTK_IMHTML_SHRINK)
447 case '%': strcpy(buf, ":-/"); break; 451 case '%': strcpy(buf, ":-/"); break;
448 case '^': strcpy(buf, ":'("); break; 452 case '^': strcpy(buf, ":'("); break;
449 case '&': strcpy(buf, ":-X"); break; 453 case '&': strcpy(buf, ":-X"); break;
450 case '*': strcpy(buf, ":-D"); break; 454 case '*': strcpy(buf, ":-D"); break;
451 } 455 }
452 if (*buf) { 456 if (*buf && imhtml->smiley_shortcuts) {
453 gtk_imhtml_insert_smiley(imhtml, NULL, buf);//->account->protocol_id, buf); 457 gtk_imhtml_insert_smiley(imhtml, imhtml->protocol_name, buf);
454 return TRUE; 458 return TRUE;
455 } 459 }
456 return FALSE; 460 return FALSE;
457 } 461 }
458 462
582 g_hash_table_destroy(imhtml->smiley_data); 586 g_hash_table_destroy(imhtml->smiley_data);
583 gtk_smiley_tree_destroy(imhtml->default_smilies); 587 gtk_smiley_tree_destroy(imhtml->default_smilies);
584 gdk_cursor_unref(imhtml->hand_cursor); 588 gdk_cursor_unref(imhtml->hand_cursor);
585 gdk_cursor_unref(imhtml->arrow_cursor); 589 gdk_cursor_unref(imhtml->arrow_cursor);
586 gdk_cursor_unref(imhtml->text_cursor); 590 gdk_cursor_unref(imhtml->text_cursor);
591
587 if(imhtml->tip_window){ 592 if(imhtml->tip_window){
588 gtk_widget_destroy(imhtml->tip_window); 593 gtk_widget_destroy(imhtml->tip_window);
589 } 594 }
590 if(imhtml->tip_timer) 595 if(imhtml->tip_timer)
591 gtk_timeout_remove(imhtml->tip_timer); 596 gtk_timeout_remove(imhtml->tip_timer);
2054 gboolean show) 2059 gboolean show)
2055 { 2060 {
2056 imhtml->show_comments = show; 2061 imhtml->show_comments = show;
2057 } 2062 }
2058 2063
2064 void gtk_imhtml_html_shortcuts (GtkIMHtml *imhtml,
2065 gboolean allow)
2066 {
2067 imhtml->html_shortcuts = allow;
2068 }
2069
2070 void gtk_imhtml_smiley_shortcuts (GtkIMHtml *imhtml,
2071 gboolean allow)
2072 {
2073 imhtml->smiley_shortcuts = allow;
2074 }
2075
2076 void
2077 gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, gchar *protocol_name) {
2078 imhtml->protocol_name = protocol_name;
2079 }
2080
2059 void 2081 void
2060 gtk_imhtml_clear (GtkIMHtml *imhtml) 2082 gtk_imhtml_clear (GtkIMHtml *imhtml)
2061 { 2083 {
2062 GList *del; 2084 GList *del;
2063 GtkTextIter start, end; 2085 GtkTextIter start, end;
3016 gtk_text_buffer_get_start_iter(imhtml->text_buffer, &start_iter); 3038 gtk_text_buffer_get_start_iter(imhtml->text_buffer, &start_iter);
3017 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end_iter); 3039 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end_iter);
3018 return gtk_text_buffer_get_text(imhtml->text_buffer, &start_iter, &end_iter, FALSE); 3040 return gtk_text_buffer_get_text(imhtml->text_buffer, &start_iter, &end_iter, FALSE);
3019 3041
3020 } 3042 }
3021