comparison src/buddy_chat.c @ 1920:5bed3bc833b5

[gaim-migrate @ 1930] in addition, frombase64 mods, needed for buddy icon in toc. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 30 May 2001 18:26:52 +0000
parents 73d73939f698
children 352bd24e03ef
comparison
equal deleted inserted replaced
1919:4dcaa4afc6c0 1920:5bed3bc833b5
439 gtk_widget_grab_focus(GTK_WIDGET(b->entry)); 439 gtk_widget_grab_focus(GTK_WIDGET(b->entry));
440 440
441 441
442 } 442 }
443 443
444 void topic_callback(GtkWidget *widget, struct conversation *b) {
445 char *buf = gtk_entry_get_text(GTK_ENTRY(widget));;
446
447 serv_chat_set_topic(b->gc, b->id, buf);
448
449 g_free(buf);
450 }
444 451
445 static gint insertname(gconstpointer one, gconstpointer two) 452 static gint insertname(gconstpointer one, gconstpointer two)
446 { 453 {
447 const char *a = (const char *)one; 454 const char *a = (const char *)one;
448 const char *b = (const char *)two; 455 const char *b = (const char *)two;
829 cont = gtk_vbox_new(FALSE, 5); 836 cont = gtk_vbox_new(FALSE, 5);
830 gtk_container_set_border_width(GTK_CONTAINER(cont), 5); 837 gtk_container_set_border_width(GTK_CONTAINER(cont), 5);
831 gtk_notebook_append_page(GTK_NOTEBOOK(chat_notebook), cont, gtk_label_new(b->name)); 838 gtk_notebook_append_page(GTK_NOTEBOOK(chat_notebook), cont, gtk_label_new(b->name));
832 gtk_widget_show(cont); 839 gtk_widget_show(cont);
833 } else { 840 } else {
834 cont = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); 841 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
835 b->window = win; 842 b->window = win;
836 gtk_object_set_user_data(GTK_OBJECT(win), b); 843 gtk_object_set_user_data(GTK_OBJECT(win), b);
837 gtk_window_set_wmclass(GTK_WINDOW(win), "buddy_chat", "Gaim"); 844 gtk_window_set_wmclass(GTK_WINDOW(win), "buddy_chat", "Gaim");
838 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); 845 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
839 gtk_container_border_width(GTK_CONTAINER(win), 10); 846 gtk_container_border_width(GTK_CONTAINER(win), 10);
840 gtk_widget_realize(win); 847 gtk_widget_realize(win);
841 aol_icon(win->window); 848 aol_icon(win->window);
842 g_snprintf(buf, sizeof(buf), "Gaim - %s (chat)", b->name); 849 g_snprintf(buf, sizeof(buf), "Gaim - %s (chat)", b->name);
843 gtk_window_set_title(GTK_WINDOW(win), buf); 850 gtk_window_set_title(GTK_WINDOW(win), buf);
844 gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(close_callback), b); 851 gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(close_callback), b);
852
853 cont = gtk_vbox_new(FALSE,5);
854 gtk_container_add(GTK_CONTAINER(win), cont);
855 gtk_widget_show(cont);
856 }
857
858 if (b->gc->prpl->options & OPT_PROTO_CHAT_TOPIC) {
859 GtkWidget *hbox;
860 GtkWidget *label;
861
862 hbox = gtk_hbox_new(FALSE, 0);
863 gtk_box_pack_start(GTK_BOX(cont), hbox, FALSE, FALSE, 5);
864 gtk_widget_show(hbox);
865
866 label = gtk_label_new(_("Topic:"));
867 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
868 gtk_widget_show(label);
869
870 b->topic_text = gtk_entry_new();
871 gtk_signal_connect(GTK_OBJECT(b->topic_text), "activate",
872 GTK_SIGNAL_FUNC(topic_callback), b);
873 gtk_box_pack_start(GTK_BOX(hbox), b->topic_text, TRUE, TRUE, 5);
874 gtk_widget_show(b->topic_text);
845 } 875 }
846 876
847 vpaned = gtk_vpaned_new(); 877 vpaned = gtk_vpaned_new();
848 gtk_paned_set_gutter_size(GTK_PANED(vpaned), 15); 878 gtk_paned_set_gutter_size(GTK_PANED(vpaned), 15);
849 gtk_container_add(GTK_CONTAINER(cont), vpaned); 879 gtk_container_add(GTK_CONTAINER(cont), vpaned);
975 b->hasfg = 0; 1005 b->hasfg = 0;
976 1006
977 update_buttons_by_protocol(b); 1007 update_buttons_by_protocol(b);
978 1008
979 gtk_widget_show(win); 1009 gtk_widget_show(win);
1010 }
1011
1012 void chat_set_topic(struct conversation *b, char* who, char* topic) {
1013
1014 debug_printf("event_chat_topic: \"%s\" \"%s\" %s\n", b->name, who, topic);
1015
1016 gtk_entry_set_text(GTK_ENTRY(b->topic_text), topic);
1017
980 } 1018 }
981 1019
982 1020
983 1021
984 void handle_click_chat(GtkWidget *widget, GdkEventButton * event, struct chat_room *cr) 1022 void handle_click_chat(GtkWidget *widget, GdkEventButton * event, struct chat_room *cr)