src/protocols/toc/toc.c

changeset 2154
7d4835b44b85
parent 2149
d28c6abe06e1
child 2162
2a9f076b0af9
equal deleted inserted replaced
2153:f38e418776a7 2154:7d4835b44b85
1041 gtk_object_set_user_data(GTK_OBJECT(button), gc); 1041 gtk_object_set_user_data(GTK_OBJECT(button), gc);
1042 gtk_menu_append(GTK_MENU(menu), button); 1042 gtk_menu_append(GTK_MENU(menu), button);
1043 gtk_widget_show(button); 1043 gtk_widget_show(button);
1044 } 1044 }
1045 1045
1046 static void toc_print_option(GtkEntry *entry, struct aim_user *user) 1046 static GList *toc_user_opts()
1047 { 1047 {
1048 int entrynum; 1048 GList *m = NULL;
1049 1049 struct proto_user_opt *puo;
1050 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); 1050
1051 1051 puo = g_new0(struct proto_user_opt, 1);
1052 if (entrynum == USEROPT_AUTH) { 1052 puo->label = "TOC Host:";
1053 g_snprintf(user->proto_opt[USEROPT_AUTH], 1053 puo->def = "toc.oscar.aol.com";
1054 sizeof(user->proto_opt[USEROPT_AUTH]), "%s", gtk_entry_get_text(entry)); 1054 puo->pos = USEROPT_AUTH;
1055 } else if (entrynum == USEROPT_AUTHPORT) { 1055 m = g_list_append(m, puo);
1056 g_snprintf(user->proto_opt[USEROPT_AUTHPORT], 1056
1057 sizeof(user->proto_opt[USEROPT_AUTHPORT]), "%s", gtk_entry_get_text(entry)); 1057 puo = g_new0(struct proto_user_opt, 1);
1058 } 1058 puo->label = "TOC Port:";
1059 } 1059 puo->def = "9898";
1060 1060 puo->pos = USEROPT_AUTHPORT;
1061 static void toc_user_opts(GtkWidget *book, struct aim_user *user) 1061 m = g_list_append(m, puo);
1062 { 1062
1063 /* so here, we create the new notebook page */ 1063 return m;
1064 GtkWidget *vbox;
1065 GtkWidget *hbox;
1066 GtkWidget *label;
1067 GtkWidget *entry;
1068
1069 vbox = gtk_vbox_new(FALSE, 5);
1070 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1071 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("TOC Options"));
1072 gtk_widget_show(vbox);
1073
1074 hbox = gtk_hbox_new(FALSE, 5);
1075 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1076 gtk_widget_show(hbox);
1077
1078 label = gtk_label_new("TOC Host:");
1079 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1080 gtk_widget_show(label);
1081
1082 entry = gtk_entry_new();
1083 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1084 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTH);
1085 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user);
1086 if (user->proto_opt[USEROPT_AUTH][0]) {
1087 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]);
1088 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTH]);
1089 } else
1090 gtk_entry_set_text(GTK_ENTRY(entry), "toc.oscar.aol.com");
1091 gtk_widget_show(entry);
1092
1093 hbox = gtk_hbox_new(FALSE, 0);
1094 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1095 gtk_widget_show(hbox);
1096
1097 label = gtk_label_new("TOC Port:");
1098 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1099 gtk_widget_show(label);
1100
1101 entry = gtk_entry_new();
1102 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1103 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTHPORT);
1104 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user);
1105 if (user->proto_opt[USEROPT_AUTHPORT][0]) {
1106 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]);
1107 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]);
1108 } else
1109 gtk_entry_set_text(GTK_ENTRY(entry), "9898");
1110
1111 gtk_widget_show(entry);
1112 } 1064 }
1113 1065
1114 static void toc_add_permit(struct gaim_connection *gc, char *who) 1066 static void toc_add_permit(struct gaim_connection *gc, char *who)
1115 { 1067 {
1116 char buf2[BUF_LEN * 2]; 1068 char buf2[BUF_LEN * 2];

mercurial