Mercurial > pidgin.yaz
comparison src/conversation.c @ 2231:8c4ff1a368bd
[gaim-migrate @ 2241]
blue:~/gaim/app/src/protocols $ ./gtk
icq: 0
irc: 0
jabber: 52
msn: 0
napster: 0
oscar: 7
toc: 17
yahoo: 0
zephyr: 1
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 07 Sep 2001 08:09:22 +0000 |
parents | a93a6fe22330 |
children | b7ff2ca1d653 |
comparison
equal
deleted
inserted
replaced
2230:cfc9abe45db2 | 2231:8c4ff1a368bd |
---|---|
76 gboolean keypress_callback(GtkWidget *entry, GdkEventKey * event, struct conversation *c); | 76 gboolean keypress_callback(GtkWidget *entry, GdkEventKey * event, struct conversation *c); |
77 | 77 |
78 static void update_icon(struct conversation *); | 78 static void update_icon(struct conversation *); |
79 static void remove_icon(struct conversation *); | 79 static void remove_icon(struct conversation *); |
80 | 80 |
81 static void update_checkbox(struct conversation *); | |
82 static void remove_checkbox(struct conversation *); | |
83 | |
81 /*------------------------------------------------------------------------*/ | 84 /*------------------------------------------------------------------------*/ |
82 /* Helpers */ | 85 /* Helpers */ |
83 /*------------------------------------------------------------------------*/ | 86 /*------------------------------------------------------------------------*/ |
84 | 87 |
85 | 88 |
155 if (connections) | 158 if (connections) |
156 c->gc = (struct gaim_connection *)connections->data; | 159 c->gc = (struct gaim_connection *)connections->data; |
157 c->history = g_string_new(""); | 160 c->history = g_string_new(""); |
158 conversations = g_list_append(conversations, c); | 161 conversations = g_list_append(conversations, c); |
159 show_conv(c); | 162 show_conv(c); |
160 if (c->gc && c->gc->prpl && c->gc->prpl->insert_convo) | |
161 (*c->gc->prpl->insert_convo)(c->gc, c); | |
162 update_icon(c); | 163 update_icon(c); |
164 update_checkbox(c); | |
163 plugin_event(event_new_conversation, name, 0, 0, 0); | 165 plugin_event(event_new_conversation, name, 0, 0, 0); |
164 return c; | 166 return c; |
165 } | 167 } |
166 | 168 |
167 | 169 |
411 | 413 |
412 if (general_options & OPT_GEN_CHECK_SPELLING) | 414 if (general_options & OPT_GEN_CHECK_SPELLING) |
413 gtkspell_detach(GTK_TEXT(c->entry)); | 415 gtkspell_detach(GTK_TEXT(c->entry)); |
414 | 416 |
415 if (!c->is_chat) { | 417 if (!c->is_chat) { |
416 if (c->gc && c->gc->prpl && c->gc->prpl->remove_convo) | |
417 (*c->gc->prpl->remove_convo)(c->gc, c); | |
418 remove_icon(c); | 418 remove_icon(c); |
419 remove_checkbox(c); | |
419 if (display_options & OPT_DISP_ONE_WINDOW) { | 420 if (display_options & OPT_DISP_ONE_WINDOW) { |
420 if (g_list_length(conversations) > 1) { | 421 if (g_list_length(conversations) > 1) { |
421 gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook), | 422 gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook), |
422 g_list_index(conversations, c)); | 423 g_list_index(conversations, c)); |
423 } else { | 424 } else { |
856 char *buffy; | 857 char *buffy; |
857 | 858 |
858 buffy = g_strdup(buf); | 859 buffy = g_strdup(buf); |
859 plugin_event(event_im_displayed_sent, c->gc, c->name, &buffy, 0); | 860 plugin_event(event_im_displayed_sent, c->gc, c->name, &buffy, 0); |
860 if (buffy) { | 861 if (buffy) { |
861 err = serv_send_im(c->gc, c->name, buffy, 0); | 862 int imflags = 0; |
863 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->check))) | |
864 imflags = IM_FLAG_CHECKBOX; | |
865 err = serv_send_im(c->gc, c->name, buffy, imflags); | |
862 g_free(buffy); | 866 g_free(buffy); |
863 } | 867 } |
864 | 868 |
865 | 869 |
866 if (err >= 0) { | 870 if (err >= 0) { |
1781 struct conversation *cnv = gtk_object_get_user_data(m); | 1785 struct conversation *cnv = gtk_object_get_user_data(m); |
1782 | 1786 |
1783 if (cnv->gc == c) | 1787 if (cnv->gc == c) |
1784 return; | 1788 return; |
1785 | 1789 |
1786 if (cnv->gc && cnv->gc->prpl && cnv->gc->prpl->remove_convo) | |
1787 (*cnv->gc->prpl->remove_convo)(cnv->gc, cnv); | |
1788 | |
1789 cnv->gc = c; | 1790 cnv->gc = c; |
1790 | 1791 |
1791 update_buttons_by_protocol(cnv); | 1792 update_buttons_by_protocol(cnv); |
1792 | 1793 |
1793 if (cnv->gc && cnv->gc->prpl && cnv->gc->prpl->insert_convo) | |
1794 (*cnv->gc->prpl->insert_convo)(cnv->gc, cnv); | |
1795 update_icon(cnv); | 1794 update_icon(cnv); |
1795 update_checkbox(cnv); | |
1796 } | 1796 } |
1797 | 1797 |
1798 void update_convo_add_button(struct conversation *c) | 1798 void update_convo_add_button(struct conversation *c) |
1799 { | 1799 { |
1800 int dispstyle = set_dispstyle(0); | 1800 int dispstyle = set_dispstyle(0); |
1896 | 1896 |
1897 while (c) { | 1897 while (c) { |
1898 C = (struct conversation *)c->data; | 1898 C = (struct conversation *)c->data; |
1899 c = c->next; | 1899 c = c->next; |
1900 | 1900 |
1901 if (C->gc && C->gc->prpl && C->gc->prpl->remove_convo) | |
1902 (*C->gc->prpl->remove_convo)(C->gc, C); | |
1903 remove_icon(C); | 1901 remove_icon(C); |
1902 remove_checkbox(C); | |
1904 } | 1903 } |
1905 } | 1904 } |
1906 | 1905 |
1907 void set_convo_gc(struct conversation *c, struct gaim_connection *gc) | 1906 void set_convo_gc(struct conversation *c, struct gaim_connection *gc) |
1908 { | 1907 { |
1909 if (c->gc == gc) | 1908 if (c->gc == gc) |
1910 return; | 1909 return; |
1911 | |
1912 if (c->gc && g_slist_find(connections, c->gc) && c->gc->prpl && c->gc->prpl->remove_convo) | |
1913 (*c->gc->prpl->remove_convo)(c->gc, c); | |
1914 | 1910 |
1915 c->gc = gc; | 1911 c->gc = gc; |
1916 | 1912 |
1917 if (gc) | 1913 if (gc) |
1918 gtk_option_menu_set_history(GTK_OPTION_MENU(c->menu), g_slist_index(connections, gc)); | 1914 gtk_option_menu_set_history(GTK_OPTION_MENU(c->menu), g_slist_index(connections, gc)); |
1919 | 1915 |
1920 update_buttons_by_protocol(c); | 1916 update_buttons_by_protocol(c); |
1921 | 1917 |
1922 if (c->gc && c->gc->prpl && c->gc->prpl->insert_convo) | |
1923 (*c->gc->prpl->insert_convo)(c->gc, c); | |
1924 update_icon(c); | 1918 update_icon(c); |
1919 update_checkbox(c); | |
1925 } | 1920 } |
1926 | 1921 |
1927 void update_buttons_by_protocol(struct conversation *c) | 1922 void update_buttons_by_protocol(struct conversation *c) |
1928 { | 1923 { |
1929 if (!c->gc) | 1924 if (!c->gc) |
2342 struct conversation *c = x->data; | 2337 struct conversation *c = x->data; |
2343 GtkWidget *imhtml, *win; | 2338 GtkWidget *imhtml, *win; |
2344 | 2339 |
2345 imhtml = c->text; | 2340 imhtml = c->text; |
2346 win = c->window; | 2341 win = c->window; |
2347 if (c->gc && c->gc->prpl->remove_convo) | |
2348 (*c->gc->prpl->remove_convo)(c->gc, c); | |
2349 remove_icon(c); | 2342 remove_icon(c); |
2343 remove_checkbox(c); | |
2350 show_conv(c); | 2344 show_conv(c); |
2351 gtk_widget_destroy(c->text); | 2345 gtk_widget_destroy(c->text); |
2352 gtk_widget_reparent(imhtml, c->sw); | 2346 gtk_widget_reparent(imhtml, c->sw); |
2353 c->text = imhtml; | 2347 c->text = imhtml; |
2354 gtk_widget_destroy(win); | 2348 gtk_widget_destroy(win); |
2355 if (c->gc && c->gc->prpl->insert_convo) | |
2356 (*c->gc->prpl->insert_convo)(c->gc, c); | |
2357 update_icon(c); | 2349 update_icon(c); |
2350 update_checkbox(c); | |
2358 | 2351 |
2359 x = x->next; | 2352 x = x->next; |
2360 } | 2353 } |
2361 } else { | 2354 } else { |
2362 GList *x, *m; | 2355 GList *x, *m; |
2365 while (x) { | 2358 while (x) { |
2366 struct conversation *c = x->data; | 2359 struct conversation *c = x->data; |
2367 GtkWidget *imhtml; | 2360 GtkWidget *imhtml; |
2368 | 2361 |
2369 imhtml = c->text; | 2362 imhtml = c->text; |
2370 if (c->gc && c->gc->prpl->remove_convo) | |
2371 (*c->gc->prpl->remove_convo)(c->gc, c); | |
2372 remove_icon(c); | 2363 remove_icon(c); |
2364 remove_checkbox(c); | |
2373 show_conv(c); | 2365 show_conv(c); |
2374 gtk_widget_destroy(c->text); | 2366 gtk_widget_destroy(c->text); |
2375 gtk_widget_reparent(imhtml, c->sw); | 2367 gtk_widget_reparent(imhtml, c->sw); |
2376 c->text = imhtml; | 2368 c->text = imhtml; |
2377 if (c->gc && c->gc->prpl->insert_convo) | |
2378 (*c->gc->prpl->insert_convo)(c->gc, c); | |
2379 update_icon(c); | 2369 update_icon(c); |
2370 update_checkbox(c); | |
2380 | 2371 |
2381 x = x->next; | 2372 x = x->next; |
2382 } | 2373 } |
2383 if (all_convos) | 2374 if (all_convos) |
2384 gtk_widget_destroy(all_convos); | 2375 gtk_widget_destroy(all_convos); |
2600 GdkBitmap *bm; | 2591 GdkBitmap *bm; |
2601 | 2592 |
2602 if (!c) | 2593 if (!c) |
2603 return; | 2594 return; |
2604 | 2595 |
2596 remove_icon(c); | |
2597 | |
2605 if (!c->gc) | 2598 if (!c->gc) |
2606 return; | 2599 return; |
2607 | |
2608 remove_icon(c); | |
2609 | 2600 |
2610 data = get_icon_data(c->gc, normalize(c->name), &len); | 2601 data = get_icon_data(c->gc, normalize(c->name), &len); |
2611 if (!data) | 2602 if (!data) |
2612 return; | 2603 return; |
2613 | 2604 |
2659 { | 2650 { |
2660 struct conversation *c = find_conversation(who); | 2651 struct conversation *c = find_conversation(who); |
2661 if (c->gc == gc) | 2652 if (c->gc == gc) |
2662 update_icon(c); | 2653 update_icon(c); |
2663 } | 2654 } |
2655 | |
2656 static void remove_checkbox(struct conversation *c) | |
2657 { | |
2658 if (c->check) | |
2659 gtk_container_remove(GTK_CONTAINER(c->lbox), c->check); | |
2660 c->check = NULL; | |
2661 } | |
2662 | |
2663 static void update_checkbox(struct conversation *c) | |
2664 { | |
2665 if (!c) | |
2666 return; | |
2667 | |
2668 remove_checkbox(c); | |
2669 | |
2670 if (!c->gc) | |
2671 return; | |
2672 | |
2673 if (!c->gc->prpl->checkbox) | |
2674 return; | |
2675 | |
2676 c->check = gtk_check_button_new_with_label(c->gc->prpl->checkbox); | |
2677 gtk_box_pack_start(GTK_BOX(c->lbox), c->check, FALSE, FALSE, 5); | |
2678 gtk_widget_show(c->check); | |
2679 } |