Mercurial > pidgin.yaz
comparison src/multi.c @ 2154:cff133e0ec0c
[gaim-migrate @ 2164]
part 2 of this. first was removing mail notifications; this is moving proto_opt stuff to multi.c and just having prpls say what they want. next it's on to the buddy right-click menu.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 22 Aug 2001 22:05:56 +0000 |
parents | 0befa2d2e540 |
children | 510af3fee78b |
comparison
equal
deleted
inserted
replaced
2153:0befa2d2e540 | 2154:cff133e0ec0c |
---|---|
231 return button; | 231 return button; |
232 } | 232 } |
233 | 233 |
234 static void ok_mod(GtkWidget *w, struct aim_user *u) | 234 static void ok_mod(GtkWidget *w, struct aim_user *u) |
235 { | 235 { |
236 GList *tmp; | |
236 const char *txt; | 237 const char *txt; |
237 int i; | 238 int i; |
238 | 239 |
239 if (u) { | 240 if (u) { |
240 u->options = u->tmp_options; | 241 u->options = u->tmp_options; |
247 gtk_widget_destroy(u->mod); | 248 gtk_widget_destroy(u->mod); |
248 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); | 249 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); |
249 gtk_clist_set_text(GTK_CLIST(list), i, 2, | 250 gtk_clist_set_text(GTK_CLIST(list), i, 2, |
250 (u->options & OPT_USR_AUTO) ? "True" : "False"); | 251 (u->options & OPT_USR_AUTO) ? "True" : "False"); |
251 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); | 252 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); |
253 | |
254 tmp = u->opt_entries; | |
255 while (tmp) { | |
256 GtkEntry *entry = tmp->data; | |
257 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); | |
258 g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s", | |
259 gtk_entry_get_text(entry)); | |
260 tmp = tmp->next; | |
261 } | |
262 if (u->opt_entries) | |
263 g_list_free(tmpusr.opt_entries); | |
264 u->opt_entries = NULL; | |
252 } else { | 265 } else { |
253 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); | 266 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); |
254 u = new_user(txt, tmpusr.protocol, tmpusr.options); | 267 u = new_user(txt, tmpusr.protocol, tmpusr.options); |
255 | 268 |
256 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass)); | 269 txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass)); |
257 g_snprintf(u->password, sizeof(u->password), "%s", txt); | 270 g_snprintf(u->password, sizeof(u->password), "%s", txt); |
258 | 271 |
259 for (i = 0; i < 6; i++) | 272 tmp = tmpusr.opt_entries; |
260 g_snprintf(u->proto_opt[i], sizeof(u->proto_opt[i]), "%s", tmpusr.proto_opt[i]); | 273 while (tmp) { |
274 GtkEntry *entry = tmp->data; | |
275 int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); | |
276 g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s", | |
277 gtk_entry_get_text(entry)); | |
278 tmp = tmp->next; | |
279 } | |
280 if (tmpusr.opt_entries) | |
281 g_list_free(tmpusr.opt_entries); | |
282 tmpusr.opt_entries = NULL; | |
261 | 283 |
262 gtk_widget_destroy(newmod); | 284 gtk_widget_destroy(newmod); |
263 } | 285 } |
264 save_prefs(); | 286 save_prefs(); |
265 } | 287 } |
266 | 288 |
267 static void cancel_mod(GtkWidget *w, struct aim_user *u) | 289 static void cancel_mod(GtkWidget *w, struct aim_user *u) |
268 { | 290 { |
269 if (u) { | 291 if (u) { |
292 if (u->opt_entries) | |
293 g_list_free(u->opt_entries); | |
294 u->opt_entries = NULL; | |
270 gtk_widget_destroy(u->mod); | 295 gtk_widget_destroy(u->mod); |
271 } else { | 296 } else { |
297 if (tmpusr.opt_entries) | |
298 g_list_free(tmpusr.opt_entries); | |
299 tmpusr.opt_entries = NULL; | |
272 gtk_widget_destroy(newmod); | 300 gtk_widget_destroy(newmod); |
273 } | 301 } |
274 } | 302 } |
275 | 303 |
276 static void set_prot(GtkWidget *opt, int proto) | 304 static void set_prot(GtkWidget *opt, int proto) |
455 * particular protocol, so clear it out and make a new one. */ | 483 * particular protocol, so clear it out and make a new one. */ |
456 | 484 |
457 gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1); | 485 gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1); |
458 | 486 |
459 if (p && p->user_opts) { | 487 if (p && p->user_opts) { |
460 if (u) | 488 GList *op = (*p->user_opts)(); |
461 (*p->user_opts)(book, u); | 489 GList *tmp = op; |
462 else | 490 |
463 (*p->user_opts)(book, &tmpusr); | 491 GtkWidget *vbox; |
492 GtkWidget *hbox; | |
493 GtkWidget *label; | |
494 GtkWidget *entry; | |
495 | |
496 char buf[256]; | |
497 | |
498 vbox = gtk_vbox_new(FALSE, 5); | |
499 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | |
500 g_snprintf(buf, sizeof(buf), "%s Options", (*p->name)()); | |
501 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new(buf)); | |
502 gtk_widget_show(vbox); | |
503 | |
504 while (op) { | |
505 struct proto_user_opt *puo = op->data; | |
506 | |
507 hbox = gtk_hbox_new(FALSE, 5); | |
508 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
509 gtk_widget_show(hbox); | |
510 | |
511 label = gtk_label_new(puo->label); | |
512 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
513 gtk_widget_show(label); | |
514 | |
515 entry = gtk_entry_new(); | |
516 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
517 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)puo->pos); | |
518 if (u->proto_opt[puo->pos][0]) { | |
519 debug_printf("setting text %s\n", u->proto_opt[puo->pos]); | |
520 gtk_entry_set_text(GTK_ENTRY(entry), u->proto_opt[puo->pos]); | |
521 } else { | |
522 gtk_entry_set_text(GTK_ENTRY(entry), puo->def); | |
523 } | |
524 gtk_widget_show(entry); | |
525 | |
526 if (u) | |
527 u->opt_entries = g_list_append(u->opt_entries, entry); | |
528 else | |
529 tmpusr.opt_entries = g_list_append(tmpusr.opt_entries, entry); | |
530 | |
531 g_free(puo); | |
532 op = op->next; | |
533 } | |
534 g_list_free(tmp); | |
464 } | 535 } |
465 } | 536 } |
466 | 537 |
467 static void show_acct_mod(struct aim_user *u) | 538 static void show_acct_mod(struct aim_user *u) |
468 { | 539 { |