comparison src/conversation.c @ 3671:0f468c22c702

[gaim-migrate @ 3801] Starting to redo the conversation window; if things dont work right then deal with it. I'll work on it more after this... committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Mon, 14 Oct 2002 03:05:24 +0000
parents e2391338c394
children 7571943d6851
comparison
equal deleted inserted replaced
3670:773dbe57e635 3671:0f468c22c702
308 GList *cnv = conversations; 308 GList *cnv = conversations;
309 struct conversation *c; 309 struct conversation *c;
310 310
311 while (cnv) { 311 while (cnv) {
312 c = (struct conversation *)cnv->data; 312 c = (struct conversation *)cnv->data;
313
314 if (c->log_button) { 313 if (c->log_button) {
315 if (c->is_chat) 314 if (c->is_chat)
316 gtk_widget_set_sensitive(c->log_button, 315 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button),
317 ((logging_options & OPT_LOG_CHATS)) ? FALSE : TRUE); 316 ((logging_options & OPT_LOG_CHATS)) ? FALSE : TRUE);
318 else 317 else
319 gtk_widget_set_sensitive(c->log_button, 318 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button),
320 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : TRUE); 319 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : TRUE);
321 } 320 }
322 321
323 cnv = cnv->next; 322 cnv = cnv->next;
324 } 323 }
326 while (C) { 325 while (C) {
327 g = (struct gaim_connection *)C->data; 326 g = (struct gaim_connection *)C->data;
328 bcs = g->buddy_chats; 327 bcs = g->buddy_chats;
329 while (bcs) { 328 while (bcs) {
330 c = (struct conversation *)bcs->data; 329 c = (struct conversation *)bcs->data;
331
332 if (c->log_button) { 330 if (c->log_button) {
333 if (c->is_chat) 331 if (c->is_chat)
334 gtk_widget_set_sensitive(c->log_button, 332 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button),
335 ((logging_options & OPT_LOG_CHATS)) ? FALSE : 333 ((logging_options & OPT_LOG_CHATS)) ? FALSE :
336 TRUE); 334 TRUE);
337 else 335 else
338 gtk_widget_set_sensitive(c->log_button, 336 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button),
339 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : 337 ((logging_options & OPT_LOG_CONVOS)) ? FALSE :
340 TRUE); 338 TRUE);
341 } 339 }
342 340
343 bcs = bcs->next; 341 bcs = bcs->next;
364 362
365 if (c->underline) 363 if (c->underline)
366 gtk_widget_set_sensitive(c->underline, 364 gtk_widget_set_sensitive(c->underline,
367 ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); 365 ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE);
368 366
369 if (c->strike)
370 gtk_widget_set_sensitive(c->strike,
371 ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE);
372
373 cnv = cnv->next; 367 cnv = cnv->next;
374 } 368 }
375 } 369 }
376 370
377 /* 371 /*
404 if (state_lock) 398 if (state_lock)
405 return; 399 return;
406 400
407 if (find_log_info(c->name)) 401 if (find_log_info(c->name))
408 rm_log(find_log_info(c->name)); 402 rm_log(find_log_info(c->name));
409 else if (GTK_TOGGLE_BUTTON(loggle)->active) 403 else if (GTK_CHECK_MENU_ITEM(c->log_button)->active)
410 show_log_dialog(c); 404 show_log_dialog(c);
411 else 405 else
412 cancel_log(NULL, c); 406 cancel_log(NULL, c);
413 } 407 }
414 408
415 void toggle_sound(GtkWidget *widget, struct conversation *c) 409 void toggle_sound(GtkWidget *widget, struct conversation *c)
416 { 410 {
417 GdkPixmap *pm;
418 GdkBitmap *bm;
419
420 c->makesound = !c->makesound; 411 c->makesound = !c->makesound;
421
422 pm = gdk_pixmap_create_from_xpm_d(c->window->window, &bm, &c->window->style->white,
423 c->makesound ? speaker_xpm : speaker_mute_xpm);
424 gtk_pixmap_set(GTK_PIXMAP(c->speaker_p), pm, bm);
425 gdk_pixmap_unref(pm);
426 gdk_bitmap_unref(bm);
427 } 412 }
428 413
429 static void do_save_convo(GtkObject *obj, GtkWidget *wid) 414 static void do_save_convo(GtkObject *obj, GtkWidget *wid)
430 { 415 {
431 struct conversation *c = gtk_object_get_user_data(obj); 416 struct conversation *c = gtk_object_get_user_data(obj);
520 505
521 void insert_smiley(GtkWidget *smiley, struct conversation *c) 506 void insert_smiley(GtkWidget *smiley, struct conversation *c)
522 { 507 {
523 if (state_lock) 508 if (state_lock)
524 return; 509 return;
510
525 if (GTK_TOGGLE_BUTTON(smiley)->active) 511 if (GTK_TOGGLE_BUTTON(smiley)->active)
526 show_smiley_dialog(c, smiley); 512 show_smiley_dialog(c, smiley);
527 else if (c->smiley_dialog) 513 else if (c->smiley_dialog)
528 close_smiley_dialog(smiley, c); 514 close_smiley_dialog(smiley, c);
515
516 gtk_widget_grab_focus(c->entry);
529 517
530 return; 518 return;
531 } 519 }
532 520
533 int close_callback(GtkWidget *widget, struct conversation *c) 521 int close_callback(GtkWidget *widget, struct conversation *c)
952 quiet_set(c->bold, 940 quiet_set(c->bold,
953 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->bold))); 941 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->bold)));
954 do_bold(c->bold, c->entry); 942 do_bold(c->bold, c->entry);
955 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); 943 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
956 break; 944 break;
957 case 's':
958 case 'S':
959 quiet_set(c->strike,
960 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->strike)));
961 do_strike(c->strike, c->entry);
962 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
963 break;
964
965 case '-': 945 case '-':
966 do_small(NULL, c->entry); 946 do_small(NULL, c->entry);
967 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); 947 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
968 break; 948 break;
969 case '=': 949 case '=':
1215 strcpy(buf, buf2); 1195 strcpy(buf, buf2);
1216 } 1196 }
1217 } 1197 }
1218 1198
1219 quiet_set(c->bold, FALSE); 1199 quiet_set(c->bold, FALSE);
1220 quiet_set(c->strike, FALSE);
1221 quiet_set(c->italic, FALSE); 1200 quiet_set(c->italic, FALSE);
1222 quiet_set(c->underline, FALSE); 1201 quiet_set(c->underline, FALSE);
1223 quiet_set(c->font, FALSE); 1202 quiet_set(c->font, FALSE);
1224 quiet_set(c->fgcolorbtn, FALSE); 1203 quiet_set(c->fgcolorbtn, FALSE);
1225 quiet_set(c->bgcolorbtn, FALSE); 1204 quiet_set(c->bgcolorbtn, FALSE);
1648 cancel_font(font, c); 1627 cancel_font(font, c);
1649 else 1628 else
1650 advance_past(c->entry, "<FONT FACE>", "</FONT>"); 1629 advance_past(c->entry, "<FONT FACE>", "</FONT>");
1651 } 1630 }
1652 1631
1632 void insert_link_cb(GtkWidget *w, struct conversation *c)
1633 {
1634 show_add_link(c->link, c);
1635 }
1636
1653 void toggle_link(GtkWidget *linky, struct conversation *c) 1637 void toggle_link(GtkWidget *linky, struct conversation *c)
1654 { 1638 {
1655 if (state_lock) 1639 if (state_lock)
1656 return; 1640 return;
1657 if (GTK_TOGGLE_BUTTON(linky)->active) 1641
1658 show_add_link(linky, c); 1642 if (GTK_TOGGLE_BUTTON(c->link)->active)
1643 show_add_link(c->link, c);
1644
1659 else if (c->link_dialog) 1645 else if (c->link_dialog)
1660 cancel_link(linky, c); 1646 cancel_link(c->link, c);
1661 else 1647 else
1662 advance_past(c->entry, "<A HREF>", "</A>"); 1648 advance_past(c->entry, "<A HREF>", "</A>");
1649
1650 gtk_widget_grab_focus(c->entry);
1663 } 1651 }
1664 1652
1665 void do_strike(GtkWidget *strike, GtkWidget *entry) 1653 void do_strike(GtkWidget *strike, GtkWidget *entry)
1666 { 1654 {
1667 if (state_lock) 1655 if (state_lock)
1680 return; 1668 return;
1681 if (GTK_TOGGLE_BUTTON(bold)->active) 1669 if (GTK_TOGGLE_BUTTON(bold)->active)
1682 surround(entry, "<B>", "</B>"); 1670 surround(entry, "<B>", "</B>");
1683 else 1671 else
1684 advance_past(entry, "<B>", "</B>"); 1672 advance_past(entry, "<B>", "</B>");
1673
1674 gtk_widget_grab_focus(entry);
1685 } 1675 }
1686 1676
1687 void do_underline(GtkWidget *underline, GtkWidget *entry) 1677 void do_underline(GtkWidget *underline, GtkWidget *entry)
1688 { 1678 {
1689 if (state_lock) 1679 if (state_lock)
1690 return; 1680 return;
1691 if (GTK_TOGGLE_BUTTON(underline)->active) 1681 if (GTK_TOGGLE_BUTTON(underline)->active)
1692 surround(entry, "<U>", "</U>"); 1682 surround(entry, "<U>", "</U>");
1693 else 1683 else
1694 advance_past(entry, "<U>", "</U>"); 1684 advance_past(entry, "<U>", "</U>");
1685
1686 gtk_widget_grab_focus(entry);
1695 } 1687 }
1696 1688
1697 void do_italic(GtkWidget *italic, GtkWidget *entry) 1689 void do_italic(GtkWidget *italic, GtkWidget *entry)
1698 { 1690 {
1699 if (state_lock) 1691 if (state_lock)
1700 return; 1692 return;
1701 if (GTK_TOGGLE_BUTTON(italic)->active) 1693 if (GTK_TOGGLE_BUTTON(italic)->active)
1702 surround(entry, "<I>", "</I>"); 1694 surround(entry, "<I>", "</I>");
1703 else 1695 else
1704 advance_past(entry, "<I>", "</I>"); 1696 advance_past(entry, "<I>", "</I>");
1697
1698 gtk_widget_grab_focus(entry);
1705 } 1699 }
1706 1700
1707 /* html code to modify font sizes must all be the same length, */ 1701 /* html code to modify font sizes must all be the same length, */
1708 /* currently set to 15 chars */ 1702 /* currently set to 15 chars */
1709 1703
1710 void do_small(GtkWidget *small, GtkWidget *entry) 1704 void do_small(GtkWidget *small, GtkWidget *entry)
1711 { 1705 {
1712 if (state_lock) 1706 if (state_lock)
1713 return; 1707 return;
1708
1714 surround(entry, "<FONT SIZE=\"1\">", "</FONT>"); 1709 surround(entry, "<FONT SIZE=\"1\">", "</FONT>");
1710
1711 gtk_widget_grab_focus(entry);
1715 } 1712 }
1716 1713
1717 void do_normal(GtkWidget *normal, GtkWidget *entry) 1714 void do_normal(GtkWidget *normal, GtkWidget *entry)
1718 { 1715 {
1719 if (state_lock) 1716 if (state_lock)
1720 return; 1717 return;
1718
1721 surround(entry, "<FONT SIZE=\"3\">", "</FONT>"); 1719 surround(entry, "<FONT SIZE=\"3\">", "</FONT>");
1720
1721 gtk_widget_grab_focus(entry);
1722 } 1722 }
1723 1723
1724 void do_big(GtkWidget *big, GtkWidget *entry) 1724 void do_big(GtkWidget *big, GtkWidget *entry)
1725 { 1725 {
1726 if (state_lock) 1726 if (state_lock)
1727 return; 1727 return;
1728
1728 surround(entry, "<FONT SIZE=\"5\">", "</FONT>"); 1729 surround(entry, "<FONT SIZE=\"5\">", "</FONT>");
1730
1731 gtk_widget_grab_focus(entry);
1729 } 1732 }
1730 1733
1731 void check_everything(GtkWidget *entry) 1734 void check_everything(GtkWidget *entry)
1732 { 1735 {
1733 struct conversation *c; 1736 struct conversation *c;
1780 quiet_set(c->underline, TRUE); 1783 quiet_set(c->underline, TRUE);
1781 else if (count_tag(entry, "<U>", "</U>")) 1784 else if (count_tag(entry, "<U>", "</U>"))
1782 quiet_set(c->underline, TRUE); 1785 quiet_set(c->underline, TRUE);
1783 else 1786 else
1784 quiet_set(c->underline, FALSE); 1787 quiet_set(c->underline, FALSE);
1785
1786 if (invert_tags(entry, "<STRIKE>", "</STRIKE>", 0))
1787 quiet_set(c->strike, TRUE);
1788 else if (count_tag(entry, "<STRIKE>", "</STRIKE>"))
1789 quiet_set(c->strike, TRUE);
1790 else
1791 quiet_set(c->strike, FALSE);
1792 } 1788 }
1793 1789
1794 1790
1795 /*------------------------------------------------------------------------*/ 1791 /*------------------------------------------------------------------------*/
1796 /* Takin care of the window.. */ 1792 /* Takin care of the window.. */
2159 2155
2160 if (percent < 1) 2156 if (percent < 1)
2161 gtk_progress_set_percentage(GTK_PROGRESS(c->progress), percent); 2157 gtk_progress_set_percentage(GTK_PROGRESS(c->progress), percent);
2162 } 2158 }
2163 2159
2160 GtkWidget *build_conv_menubar(struct conversation *c)
2161 {
2162 GtkWidget *menubar;
2163 GtkWidget *menu;
2164 GtkWidget *menuitem;
2165
2166 menubar = gtk_menu_bar_new();
2167
2168 menu = gtk_menu_new();
2169
2170 /* The file menu */
2171 menuitem = gaim_new_item(NULL, _("File"));
2172 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
2173 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem);
2174
2175 gaim_new_item_from_stock(menu, _("_Save Conversation"), "gtk-save-as", GTK_SIGNAL_FUNC(save_convo), c, 0, 0, NULL);
2176
2177 gaim_new_item_from_stock(menu, _("View _History"), NULL, GTK_SIGNAL_FUNC(conv_show_log), GINT_TO_POINTER(c->name), 0, 0, NULL);
2178
2179 menuitem = gtk_menu_item_new();
2180 gtk_menu_append(GTK_MENU(menu), menuitem);
2181 /*
2182 c->sendfile_btn = gaim_new_item_from_pixbuf(menu, _("Send File"), "send-file-small.png", NULL, NULL, 0, 0, NULL); */
2183
2184 gaim_new_item_from_pixbuf(menu, _("Insert URL"), NULL, GTK_SIGNAL_FUNC(insert_link_cb), c, 0, 0, NULL);
2185 c->image_menubtn = gaim_new_item_from_pixbuf(menu, _("Insert Image"), "insert-image-small.png", GTK_SIGNAL_FUNC(insert_image), c, 0, 0, NULL);
2186
2187 menuitem = gtk_menu_item_new();
2188 gtk_menu_append(GTK_MENU(menu), menuitem);
2189
2190 gaim_new_item_from_stock(menu, _("_Close"), "gtk-close", GTK_SIGNAL_FUNC(close_callback), c, 0, 0, NULL);
2191
2192 /* The Options menu */
2193 menu = gtk_menu_new();
2194
2195 menuitem = gaim_new_item(NULL, _("Options"));
2196 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
2197 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem);
2198
2199 /* Logging */
2200 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Enable _Logging"));
2201 c->log_button = menuitem; /* We should save this */
2202
2203 state_lock = 1;
2204 if (find_log_info(c->name))
2205 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(menuitem), TRUE);
2206 else
2207 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(menuitem), FALSE);
2208 state_lock = 0;
2209
2210 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(toggle_loggle), c);
2211
2212 /* Sounds */
2213
2214 gtk_menu_append(GTK_MENU(menu), menuitem);
2215
2216 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Enable _Sounds"));
2217 c->makesound = 1;
2218 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(toggle_sound), c);
2219 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
2220 gtk_menu_append(GTK_MENU(menu), menuitem);
2221
2222
2223
2224 /* Now set the current values or something */
2225 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), (logging_options & OPT_LOG_CONVOS) ? FALSE : TRUE);
2226
2227 gtk_widget_show_all(menubar);
2228
2229 return menubar;
2230
2231 }
2232
2233 GtkWidget *build_conv_toolbar2(struct conversation *c)
2234 {
2235 GtkWidget *vbox;
2236 GtkWidget *hbox;
2237 GtkWidget *button;
2238 GtkWidget *sep;
2239 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
2240 /*
2241 c->toolbar = toolbar;
2242 c->bold = bold;
2243 c->strike = strike;
2244 c->italic = italic;
2245 c->underline = underline;
2246 c->log_button = wood;
2247 c->viewer_button = viewer;
2248 c->fgcolorbtn = fgcolorbtn;
2249 c->bgcolorbtn = bgcolorbtn;
2250 c->link = link;
2251 c->wood = wood;
2252 c->font = font;
2253 c->smiley = smiley;
2254 c->imagebtn = image;
2255 c->speaker = speaker;
2256 c->speaker_p = speaker_p;
2257 */
2258
2259 vbox = gtk_vbox_new(FALSE, 0);
2260 sep = gtk_hseparator_new();
2261 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
2262
2263 hbox = gtk_hbox_new(FALSE, 5);
2264 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
2265
2266 /* Bold */
2267 button = gaim_pixbuf_toolbar_button_from_stock("gtk-bold");
2268 gtk_size_group_add_widget(sg, button);
2269 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2270 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_bold), c->entry);
2271 c->bold = button; /* We should remember this */
2272
2273 /* Italic */
2274 button = gaim_pixbuf_toolbar_button_from_stock("gtk-italic");
2275 gtk_size_group_add_widget(sg, button);
2276 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2277 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_italic), c->entry);
2278 c->italic = button; /* We should remember this */
2279
2280 /* Underline */
2281 button = gaim_pixbuf_toolbar_button_from_stock("gtk-underline");
2282 gtk_size_group_add_widget(sg, button);
2283 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2284 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_underline), c->entry);
2285 c->underline = button; /* We should remember this */
2286
2287 /* Sep */
2288 sep = gtk_vseparator_new();
2289 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
2290
2291 /* Increase font size */
2292 button = gaim_pixbuf_toolbar_button_from_file("text_bigger.png");
2293 gtk_size_group_add_widget(sg, button);
2294 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2295 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_big), c->entry);
2296
2297 /* Normal Font Size */
2298 button = gaim_pixbuf_toolbar_button_from_file("text_normal.png");
2299 gtk_size_group_add_widget(sg, button);
2300 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2301 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_normal), c->entry);
2302 c->font = button; /* We should remember this */
2303
2304 /* Decrease font size */
2305 button = gaim_pixbuf_toolbar_button_from_file("text_smaller.png");
2306 gtk_size_group_add_widget(sg, button);
2307 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2308 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_small), c->entry);
2309
2310 /* Sep */
2311 sep = gtk_vseparator_new();
2312 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
2313
2314 /* Font Color */
2315 button = gaim_pixbuf_toolbar_button_from_stock("gtk-select-color");
2316 gtk_size_group_add_widget(sg, button);
2317 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2318 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_fg_color), c);
2319 c->fgcolorbtn = button; /* We should remember this */
2320
2321 /* Font Color */
2322 button = gaim_pixbuf_toolbar_button_from_stock("gtk-select-color");
2323 gtk_size_group_add_widget(sg, button);
2324 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2325 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_bg_color), c);
2326 c->bgcolorbtn = button; /* We should remember this */
2327
2328
2329 /* Sep */
2330 sep = gtk_vseparator_new();
2331 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
2332
2333 /* Insert IM Image */
2334 button = gaim_pixbuf_toolbar_button_from_file("insert-image-small.png");
2335 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_image), c);
2336 gtk_size_group_add_widget(sg, button);
2337 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2338 c->imagebtn = button;
2339
2340 /* Insert Link */
2341 button = gaim_pixbuf_toolbar_button_from_file("insert-link-small.png");
2342 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_link), c);
2343 gtk_size_group_add_widget(sg, button);
2344 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2345 c->link = button;
2346
2347 /* Insert Smiley */
2348 button = gaim_pixbuf_toolbar_button_from_file("insert-smiley-small.png");
2349 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_smiley), c);
2350 gtk_size_group_add_widget(sg, button);
2351 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
2352 c->smiley = button;
2353
2354 sep = gtk_hseparator_new();
2355 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
2356
2357 gtk_widget_show_all(vbox);
2358
2359 return vbox;
2360 }
2361
2164 GtkWidget *build_conv_toolbar(struct conversation *c) 2362 GtkWidget *build_conv_toolbar(struct conversation *c)
2165 { 2363 {
2166 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, 2364 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i,
2167 *wood_i, *viewer_i, *fgcolor_i, *bgcolor_i, *link_i, *font_i, *smiley_i, *save_i, *image_i; 2365 *wood_i, *viewer_i, *fgcolor_i, *bgcolor_i, *link_i, *font_i, *smiley_i, *save_i, *image_i;
2168 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, 2366 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p,
2486 gboolean rebuild = FALSE; 2684 gboolean rebuild = FALSE;
2487 2685
2488 if (find_buddy(c->gc, c->name)) { 2686 if (find_buddy(c->gc, c->name)) {
2489 if (!gtk_object_get_user_data(GTK_OBJECT(c->add))) { 2687 if (!gtk_object_get_user_data(GTK_OBJECT(c->add))) {
2490 gtk_widget_destroy(c->add); 2688 gtk_widget_destroy(c->add);
2491 c->add = picture_button2(c->window, _("Remove"), gnome_remove_xpm, dispstyle); 2689 c->add = gaim_pixbuf_button_from_stock(_("Remove"), "gtk-remove", GAIM_BUTTON_VERTICAL);
2492 rebuild = TRUE; 2690 rebuild = TRUE;
2493 } 2691 }
2494 if (c->gc) { 2692 if (c->gc) {
2495 if (c->gc->prpl->remove_buddy == NULL) 2693 if (c->gc->prpl->remove_buddy == NULL)
2496 gtk_widget_set_sensitive(c->add, FALSE); 2694 gtk_widget_set_sensitive(c->add, FALSE);
2500 gtk_widget_set_sensitive(c->add, FALSE); 2698 gtk_widget_set_sensitive(c->add, FALSE);
2501 gtk_object_set_user_data(GTK_OBJECT(c->add), c); 2699 gtk_object_set_user_data(GTK_OBJECT(c->add), c);
2502 } else { 2700 } else {
2503 if (gtk_object_get_user_data(GTK_OBJECT(c->add))) { 2701 if (gtk_object_get_user_data(GTK_OBJECT(c->add))) {
2504 gtk_widget_destroy(c->add); 2702 gtk_widget_destroy(c->add);
2505 c->add = picture_button2(c->window, _("Add"), gnome_add_xpm, dispstyle); 2703 c->add = gaim_pixbuf_button_from_stock(_("Add"), "gtk-add", GAIM_BUTTON_VERTICAL);
2506 rebuild = TRUE; 2704 rebuild = TRUE;
2507 } 2705 }
2508 if (c->gc) { 2706 if (c->gc) {
2509 if (c->gc->prpl->add_buddy == NULL) 2707 if (c->gc->prpl->add_buddy == NULL)
2510 gtk_widget_set_sensitive(c->add, FALSE); 2708 gtk_widget_set_sensitive(c->add, FALSE);
2514 gtk_widget_set_sensitive(c->add, FALSE); 2712 gtk_widget_set_sensitive(c->add, FALSE);
2515 } 2713 }
2516 2714
2517 if (rebuild) { 2715 if (rebuild) {
2518 gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); 2716 gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
2519 gtk_box_pack_end(GTK_BOX(parent), c->add, dispstyle, dispstyle, 0); 2717 gtk_box_pack_start(GTK_BOX(parent), c->add, FALSE, FALSE, 0);
2520 gtk_box_reorder_child(GTK_BOX(parent), c->add, 2); 2718 gtk_box_reorder_child(GTK_BOX(parent), c->add, 3);
2719 gtk_button_set_relief(GTK_BUTTON(c->add), GTK_RELIEF_NONE);
2720 gtk_size_group_add_widget(c->sg, c->add);
2521 gtk_widget_show(c->add); 2721 gtk_widget_show(c->add);
2522 } 2722 }
2523 } 2723 }
2524 2724
2525 static void create_convo_menu(struct conversation *cnv) 2725 static void create_convo_menu(struct conversation *cnv)
2628 2828
2629 if (c->gc->prpl->get_info == NULL && c->info) 2829 if (c->gc->prpl->get_info == NULL && c->info)
2630 gtk_widget_set_sensitive(c->info, FALSE); 2830 gtk_widget_set_sensitive(c->info, FALSE);
2631 else if (c->info) 2831 else if (c->info)
2632 gtk_widget_set_sensitive(c->info, TRUE); 2832 gtk_widget_set_sensitive(c->info, TRUE);
2633 2833 /*
2834 if (!c->is_chat && c->gc->prpl->file_transfer_out)
2835 gtk_widget_set_sensitive(c->sendfile_btn, TRUE);
2836 else
2837 gtk_widget_set_sensitive(c->sendfile_btn, FALSE);
2838 */
2634 if (c->is_chat) { 2839 if (c->is_chat) {
2635 if (c->gc->prpl->chat_send == NULL && c->send) 2840 if (c->gc->prpl->chat_send == NULL && c->send)
2636 gtk_widget_set_sensitive(c->send, FALSE); 2841 gtk_widget_set_sensitive(c->send, FALSE);
2637 else 2842 else
2638 gtk_widget_set_sensitive(c->send, TRUE); 2843 gtk_widget_set_sensitive(c->send, TRUE);
2844
2639 gtk_widget_set_sensitive(c->imagebtn, FALSE); 2845 gtk_widget_set_sensitive(c->imagebtn, FALSE);
2846 gtk_widget_set_sensitive(c->image_menubtn, FALSE);
2640 } else { 2847 } else {
2641 if (c->gc->prpl->send_im == NULL && c->send) 2848 if (c->gc->prpl->send_im == NULL && c->send)
2642 gtk_widget_set_sensitive(c->send, FALSE); 2849 gtk_widget_set_sensitive(c->send, FALSE);
2643 else 2850 else
2644 gtk_widget_set_sensitive(c->send, TRUE); 2851 gtk_widget_set_sensitive(c->send, TRUE);
2645 if (c->gc->prpl->options & OPT_PROTO_IM_IMAGE) 2852 if (c->gc->prpl->options & OPT_PROTO_IM_IMAGE) {
2646 gtk_widget_set_sensitive(c->imagebtn, TRUE); 2853 gtk_widget_set_sensitive(c->imagebtn, TRUE);
2647 else 2854 gtk_widget_set_sensitive(c->image_menubtn, TRUE);
2855 }
2856 else {
2857 gtk_widget_set_sensitive(c->image_menubtn, FALSE);
2648 gtk_widget_set_sensitive(c->imagebtn, FALSE); 2858 gtk_widget_set_sensitive(c->imagebtn, FALSE);
2859 }
2649 } 2860 }
2650 2861
2651 if (c->gc->prpl->warn == NULL && c->warn) 2862 if (c->gc->prpl->warn == NULL && c->warn)
2652 gtk_widget_set_sensitive(c->warn, FALSE); 2863 gtk_widget_set_sensitive(c->warn, FALSE);
2653 else if (c->warn) 2864 else if (c->warn)
2811 GtkWidget *paned; 3022 GtkWidget *paned;
2812 GtkWidget *add; 3023 GtkWidget *add;
2813 GtkWidget *toolbar; 3024 GtkWidget *toolbar;
2814 GtkWidget *hbox; 3025 GtkWidget *hbox;
2815 GtkWidget *label; 3026 GtkWidget *label;
2816 int dispstyle = set_dispstyle(0); 3027 GtkWidget *menubar;
3028
3029 c->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
2817 3030
2818 c->font_dialog = NULL; 3031 c->font_dialog = NULL;
2819 c->fg_color_dialog = NULL; 3032 c->fg_color_dialog = NULL;
2820 c->bg_color_dialog = NULL; 3033 c->bg_color_dialog = NULL;
2821 c->smiley_dialog = NULL; 3034 c->smiley_dialog = NULL;
2880 cont = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); 3093 cont = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2881 c->window = win; 3094 c->window = win;
2882 gtk_object_set_user_data(GTK_OBJECT(win), c); 3095 gtk_object_set_user_data(GTK_OBJECT(win), c);
2883 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim"); 3096 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim");
2884 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); 3097 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
2885 gtk_container_border_width(GTK_CONTAINER(win), 10); 3098 gtk_container_border_width(GTK_CONTAINER(win), 0);
2886 gtk_widget_realize(win); 3099 gtk_widget_realize(win);
2887 gtk_signal_connect(GTK_OBJECT(win), "delete_event", 3100 gtk_signal_connect(GTK_OBJECT(win), "delete_event",
2888 GTK_SIGNAL_FUNC(delete_event_convo), c); 3101 GTK_SIGNAL_FUNC(delete_event_convo), c);
2889 } 3102 }
2890 set_convo_title(c); 3103 set_convo_title(c);
2895 gtk_widget_show(paned); 3108 gtk_widget_show(paned);
2896 3109
2897 vbox = gtk_vbox_new(FALSE, 5); 3110 vbox = gtk_vbox_new(FALSE, 5);
2898 gtk_paned_pack1(GTK_PANED(paned), vbox, FALSE, TRUE); 3111 gtk_paned_pack1(GTK_PANED(paned), vbox, FALSE, TRUE);
2899 gtk_widget_show(vbox); 3112 gtk_widget_show(vbox);
3113
3114 menubar = build_conv_menubar(c);
3115 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
2900 3116
2901 sw = gtk_scrolled_window_new(NULL, NULL); 3117 sw = gtk_scrolled_window_new(NULL, NULL);
2902 c->sw = sw; 3118 c->sw = sw;
2903 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); 3119 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
2904 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); 3120 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
2940 entry = gtk_text_new(NULL, NULL); 3156 entry = gtk_text_new(NULL, NULL);
2941 c->entry = entry; 3157 c->entry = entry;
2942 if (!(im_options & OPT_IM_ONE_WINDOW)) 3158 if (!(im_options & OPT_IM_ONE_WINDOW))
2943 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); 3159 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry);
2944 3160
2945 toolbar = build_conv_toolbar(c); 3161 toolbar = build_conv_toolbar2(c);
2946 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 0); 3162 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 0);
2947 3163
2948 gtk_object_set_user_data(GTK_OBJECT(entry), c); 3164 gtk_object_set_user_data(GTK_OBJECT(entry), c);
2949 gtk_text_set_editable(GTK_TEXT(entry), TRUE); 3165 gtk_text_set_editable(GTK_TEXT(entry), TRUE);
2950 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE); 3166 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE);
2962 3178
2963 c->bbox = bbox = gtk_hbox_new(FALSE, 5); 3179 c->bbox = bbox = gtk_hbox_new(FALSE, 5);
2964 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 0); 3180 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 0);
2965 gtk_widget_show(bbox); 3181 gtk_widget_show(bbox);
2966 3182
3183 /* I'm leaving this here just incase we want to bring this back. I'd rather not have the close
3184 * button any more. If we do, though, it needs to be on the left side. I might bring it back and put
3185 * it on that side. */
3186
3187 /*
2967 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle); 3188 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle);
2968 c->close = close; 3189 c->close = close;
2969 gtk_object_set_user_data(GTK_OBJECT(close), c); 3190 gtk_object_set_user_data(GTK_OBJECT(close), c);
2970 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c); 3191 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c);
2971 gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 0); 3192 gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 0);
2972 gtk_widget_show(close); 3193 gtk_widget_show(close);
2973 3194
2974 c->sep1 = gtk_vseparator_new(); 3195 c->sep1 = gtk_vseparator_new();
2975 gtk_box_pack_end(GTK_BOX(bbox), c->sep1, dispstyle, dispstyle, 0); 3196 gtk_box_pack_end(GTK_BOX(bbox), c->sep1, dispstyle, dispstyle, 0);
2976 gtk_widget_show(c->sep1); 3197 gtk_widget_show(c->sep1);
3198 */
3199
3200 /* Put the send button on the right */
3201 send = gaim_pixbuf_button_from_stock(_("Send"), "gtk-convert", GAIM_BUTTON_VERTICAL);
3202 c->send = send;
3203 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c);
3204 gtk_box_pack_end(GTK_BOX(bbox), send, FALSE, FALSE, 0);
3205 gtk_widget_show(send);
3206
3207 c->sep2 = gtk_vseparator_new();
3208 gtk_box_pack_end(GTK_BOX(bbox), c->sep2, FALSE, TRUE, 0);
3209 gtk_widget_show(c->sep2);
3210
3211 /* And put the other buttons on the left */
2977 3212
2978 if (c->gc && find_buddy(c->gc, c->name) != NULL) { 3213 if (c->gc && find_buddy(c->gc, c->name) != NULL) {
2979 add = picture_button2(win, _("Remove"), gnome_remove_xpm, dispstyle); 3214 add = gaim_pixbuf_button_from_stock(_("Remove"), "gtk-remove", GAIM_BUTTON_VERTICAL);
2980 gtk_object_set_user_data(GTK_OBJECT(add), c); 3215 gtk_object_set_user_data(GTK_OBJECT(add), c);
2981 } else 3216 } else
2982 add = picture_button2(win, _("Add"), gnome_add_xpm, dispstyle); 3217 add = gaim_pixbuf_button_from_stock(_("Add"), "gtk-add", GAIM_BUTTON_VERTICAL);
3218
2983 c->add = add; 3219 c->add = add;
2984 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); 3220 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
2985 gtk_box_pack_end(GTK_BOX(bbox), add, dispstyle, dispstyle, 0); 3221 gtk_box_pack_start(GTK_BOX(bbox), add, FALSE, FALSE, 0);
2986 gtk_widget_show(add); 3222 gtk_widget_show(add);
2987 3223
2988 block = picture_button2(win, _("Block"), block_xpm, dispstyle); 3224 warn = gaim_pixbuf_button_from_stock(_("Warn"), "gtk-dialog-warning", GAIM_BUTTON_VERTICAL);
3225 c->warn = warn;
3226 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c);
3227 gtk_box_pack_start(GTK_BOX(bbox), warn, FALSE, FALSE, 0);
3228 gtk_widget_show(warn);
3229
3230 info = gaim_pixbuf_button_from_stock(_("Info"), "gtk-find", GAIM_BUTTON_VERTICAL);
3231 c->info = info;
3232 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c);
3233 gtk_box_pack_start(GTK_BOX(bbox), info, FALSE, FALSE, 0);
3234 gtk_widget_show(info);
3235
3236
3237 block = gaim_pixbuf_button_from_stock(_("Block"), "gtk-stop", GAIM_BUTTON_VERTICAL);
2989 c->block = block; 3238 c->block = block;
2990 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c); 3239 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c);
2991 gtk_box_pack_end(GTK_BOX(bbox), block, dispstyle, dispstyle, 0); 3240 gtk_box_pack_start(GTK_BOX(bbox), block, FALSE, FALSE, 0);
2992 gtk_widget_show(block); 3241 gtk_widget_show(block);
2993 3242
2994 warn = picture_button2(win, _("Warn"), warn_xpm, dispstyle); 3243 /* I don't know if these should have borders. They look kind of dumb
2995 c->warn = warn; 3244 * with borders. */
2996 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c); 3245 gtk_button_set_relief(GTK_BUTTON(info), GTK_RELIEF_NONE);
2997 gtk_box_pack_end(GTK_BOX(bbox), warn, dispstyle, dispstyle, 0); 3246 gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE);
2998 gtk_widget_show(warn); 3247 gtk_button_set_relief(GTK_BUTTON(warn), GTK_RELIEF_NONE);
2999 3248 gtk_button_set_relief(GTK_BUTTON(send), GTK_RELIEF_NONE);
3000 info = picture_button2(win, _("Info"), tb_search_xpm, dispstyle); 3249 gtk_button_set_relief(GTK_BUTTON(block), GTK_RELIEF_NONE);
3001 c->info = info; 3250
3002 3251 gtk_size_group_add_widget(c->sg, info);
3003 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c); 3252 gtk_size_group_add_widget(c->sg, add);
3004 gtk_box_pack_end(GTK_BOX(bbox), info, dispstyle, dispstyle, 0); 3253 gtk_size_group_add_widget(c->sg, warn);
3005 gtk_widget_show(info); 3254 gtk_size_group_add_widget(c->sg, send);
3006 3255 gtk_size_group_add_widget(c->sg, block);
3007 c->sep2 = gtk_vseparator_new(); 3256
3008 gtk_box_pack_end(GTK_BOX(bbox), c->sep2, dispstyle, dispstyle, 0); 3257 gtk_box_reorder_child(GTK_BOX(bbox), c->warn, 1);
3009 gtk_widget_show(c->sep2); 3258 gtk_box_reorder_child(GTK_BOX(bbox), c->block, 2);
3010 3259 gtk_box_reorder_child(GTK_BOX(bbox), c->add, 3);
3011 send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle); 3260 gtk_box_reorder_child(GTK_BOX(bbox), c->info, 4);
3012 c->send = send; 3261
3013 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c);
3014 gtk_box_pack_end(GTK_BOX(bbox), send, dispstyle, dispstyle, 0);
3015 gtk_widget_show(send);
3016 3262
3017 update_buttons_by_protocol(c); 3263 update_buttons_by_protocol(c);
3264
3018 if (!(im_options & OPT_IM_ONE_WINDOW)) 3265 if (!(im_options & OPT_IM_ONE_WINDOW))
3019 gtk_widget_grab_focus(c->entry); 3266 gtk_widget_grab_focus(c->entry);
3020 gtk_widget_show(win); 3267 gtk_widget_show(win);
3021 } 3268 }
3022 3269
3676 gdk_pixbuf_unref(scale); 3923 gdk_pixbuf_unref(scale);
3677 3924
3678 frame = gtk_frame_new(NULL); 3925 frame = gtk_frame_new(NULL);
3679 gtk_frame_set_shadow_type(GTK_FRAME(frame), bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN); 3926 gtk_frame_set_shadow_type(GTK_FRAME(frame), bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN);
3680 gtk_box_pack_start(GTK_BOX(c->bbox), frame, FALSE, FALSE, 5); 3927 gtk_box_pack_start(GTK_BOX(c->bbox), frame, FALSE, FALSE, 5);
3928 gtk_box_reorder_child(GTK_BOX(c->bbox), frame, 0);
3681 gtk_widget_show(frame); 3929 gtk_widget_show(frame);
3682 3930
3683 event = gtk_event_box_new(); 3931 event = gtk_event_box_new();
3684 gtk_container_add(GTK_CONTAINER(frame), event); 3932 gtk_container_add(GTK_CONTAINER(frame), event);
3685 gtk_signal_connect(GTK_OBJECT(event), "button-press-event", GTK_SIGNAL_FUNC(icon_menu), c); 3933 gtk_signal_connect(GTK_OBJECT(event), "button-press-event", GTK_SIGNAL_FUNC(icon_menu), c);