Mercurial > pidgin
comparison src/dialogs.c @ 8061:ea073d234191
[gaim-migrate @ 8749]
<b><i><u>what you see is what you get</u></i></b>
committer: Tailor Script <tailor@pidgin.im>
| author | Nathan Walp <nwalp@pidgin.im> |
|---|---|
| date | Sat, 10 Jan 2004 06:06:02 +0000 |
| parents | fa6395637e2c |
| children | 4971193f761d |
comparison
equal
deleted
inserted
replaced
| 8060:b66733e6e6f2 | 8061:ea073d234191 |
|---|---|
| 693 } | 693 } |
| 694 | 694 |
| 695 static void do_insert_link(GtkWidget *w, int resp, struct linkdlg *a) | 695 static void do_insert_link(GtkWidget *w, int resp, struct linkdlg *a) |
| 696 { | 696 { |
| 697 GaimGtkConversation *gtkconv; | 697 GaimGtkConversation *gtkconv; |
| 698 char *open_tag; | |
| 699 const char *urltext, *showtext; | 698 const char *urltext, *showtext; |
| 700 | 699 |
| 701 gtkconv = GAIM_GTK_CONVERSATION(a->c); | 700 gtkconv = GAIM_GTK_CONVERSATION(a->c); |
| 702 | 701 |
| 703 if (resp == GTK_RESPONSE_OK) { | 702 if (resp == GTK_RESPONSE_OK) { |
| 705 showtext = gtk_entry_get_text(GTK_ENTRY(a->text)); | 704 showtext = gtk_entry_get_text(GTK_ENTRY(a->text)); |
| 706 | 705 |
| 707 if (!strlen(showtext)) | 706 if (!strlen(showtext)) |
| 708 showtext = urltext; | 707 showtext = urltext; |
| 709 | 708 |
| 710 open_tag = g_strdup_printf("<A HREF=\"%s\">%s", urltext, showtext); | 709 gtk_imhtml_insert_link(GTK_IMHTML(gtkconv->entry), urltext, showtext); |
| 711 gaim_gtk_surround(gtkconv, open_tag, "</A>"); | 710 gaim_gtk_advance_past(gtkconv, "<A HREF>", "</A>"); |
| 712 g_free(open_tag); | |
| 713 } | 711 } |
| 714 | 712 |
| 715 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), FALSE); | 713 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), FALSE); |
| 716 } | 714 } |
| 717 | 715 |
| 861 /* GTK_IS_EDITABLE(c->entry); huh? */ | 859 /* GTK_IS_EDITABLE(c->entry); huh? */ |
| 862 | 860 |
| 863 gtkconv = GAIM_GTK_CONVERSATION(c); | 861 gtkconv = GAIM_GTK_CONVERSATION(c); |
| 864 | 862 |
| 865 gtkconv->fg_color = text_color; | 863 gtkconv->fg_color = text_color; |
| 866 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", | 864 g_snprintf(open_tag, 23, "#%02X%02X%02X", |
| 867 text_color.red / 256, | 865 text_color.red / 256, |
| 868 text_color.green / 256, | 866 text_color.green / 256, |
| 869 text_color.blue / 256); | 867 text_color.blue / 256); |
| 870 gaim_gtk_surround(gtkconv, open_tag, "</FONT>"); | 868 gtk_imhtml_toggle_forecolor(GTK_IMHTML(gtkconv->entry), open_tag); |
| 871 | 869 |
| 872 gaim_debug(GAIM_DEBUG_MISC, "fgcolor dialog", "#%02X%02X%02X\n", | |
| 873 text_color.red / 256, | |
| 874 text_color.green / 256, | |
| 875 text_color.blue / 256); | |
| 876 g_free(open_tag); | 870 g_free(open_tag); |
| 877 cancel_fgcolor(NULL, c); | 871 cancel_fgcolor(NULL, c); |
| 878 } | 872 } |
| 879 | 873 |
| 880 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) | 874 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
| 892 /* GTK_IS_EDITABLE(c->entry); huh? */ | 886 /* GTK_IS_EDITABLE(c->entry); huh? */ |
| 893 | 887 |
| 894 gtkconv = GAIM_GTK_CONVERSATION(c); | 888 gtkconv = GAIM_GTK_CONVERSATION(c); |
| 895 | 889 |
| 896 gtkconv->bg_color = text_color; | 890 gtkconv->bg_color = text_color; |
| 897 g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", | 891 g_snprintf(open_tag, 25, "#%02X%02X%02X", |
| 898 text_color.red / 256, | 892 text_color.red / 256, |
| 899 text_color.green / 256, | 893 text_color.green / 256, |
| 900 text_color.blue / 256); | 894 text_color.blue / 256); |
| 901 gaim_gtk_surround(gtkconv, open_tag, "</BODY>"); | 895 gtk_imhtml_toggle_backcolor(GTK_IMHTML(gtkconv->entry), open_tag); |
| 902 gaim_debug(GAIM_DEBUG_MISC, "bgcolor dialog", "#%02X%02X%02X\n", | 896 |
| 903 text_color.red / 256, | |
| 904 text_color.green / 256, | |
| 905 text_color.blue / 256); | |
| 906 | |
| 907 g_free(open_tag); | 897 g_free(open_tag); |
| 908 cancel_bgcolor(NULL, c); | 898 cancel_bgcolor(NULL, c); |
| 909 } | 899 } |
| 910 | 900 |
| 911 void show_fgcolor_dialog(GaimConversation *c, GtkWidget *color) | 901 void show_fgcolor_dialog(GaimConversation *c, GtkWidget *color) |
| 1349 | 1339 |
| 1350 void insert_smiley_text(GtkWidget *widget, GaimConversation *c) | 1340 void insert_smiley_text(GtkWidget *widget, GaimConversation *c) |
| 1351 { | 1341 { |
| 1352 GaimGtkConversation *gtkconv; | 1342 GaimGtkConversation *gtkconv; |
| 1353 char *smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text"); | 1343 char *smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text"); |
| 1354 GtkTextMark *select_mark, *insert_mark; | 1344 GaimPlugin *proto = gaim_find_prpl(gaim_account_get_protocol_id(gaim_conversation_get_account(c))); |
| 1355 GtkTextIter select_iter, insert_iter; | |
| 1356 | 1345 |
| 1357 gtkconv = GAIM_GTK_CONVERSATION(c); | 1346 gtkconv = GAIM_GTK_CONVERSATION(c); |
| 1358 | 1347 |
| 1359 select_mark = gtk_text_buffer_get_selection_bound(gtkconv->entry_buffer); | 1348 gtk_imhtml_insert_smiley(GTK_IMHTML(gtkconv->entry), proto->info->name, smiley_text); |
| 1360 insert_mark = gtk_text_buffer_get_insert(gtkconv->entry_buffer); | 1349 |
| 1361 | |
| 1362 if(insert_mark != select_mark) { /* there is text selected */ | |
| 1363 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &select_iter, select_mark); | |
| 1364 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &insert_iter, insert_mark); | |
| 1365 gtk_text_buffer_delete(gtkconv->entry_buffer, &select_iter, &insert_iter); | |
| 1366 } | |
| 1367 | |
| 1368 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, smiley_text, -1); | |
| 1369 close_smiley_dialog(NULL, c); | 1350 close_smiley_dialog(NULL, c); |
| 1370 } | 1351 } |
| 1371 | 1352 |
| 1372 static void add_smiley(GaimConversation *c, GtkWidget *table, int row, int col, char *filename, char *face) | 1353 static void add_smiley(GaimConversation *c, GtkWidget *table, int row, int col, char *filename, char *face) |
| 1373 { | 1354 { |
