comparison src/prpl.c @ 5935:e11b904c5bd7

[gaim-migrate @ 6375] Removed an old function that hasn't been used in a long time. Hurray code unbloat! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 21 Jun 2003 07:59:53 +0000
parents 059d95c67cda
children 1b56a833d665
comparison
equal deleted inserted replaced
5934:91ee71a394be 5935:e11b904c5bd7
408 0, ga, 2, 408 0, ga, 2,
409 _("Add"), G_CALLBACK(do_add), 409 _("Add"), G_CALLBACK(do_add),
410 _("Cancel"), G_CALLBACK(dont_add)); 410 _("Cancel"), G_CALLBACK(dont_add));
411 } 411 }
412 412
413 static GtkWidget *regdlg = NULL;
414 static GtkWidget *reg_list = NULL;
415 static GtkWidget *reg_area = NULL;
416 static GtkWidget *reg_reg = NULL;
417
418 static void delete_regdlg()
419 {
420 GtkWidget *tmp = regdlg;
421 regdlg = NULL;
422 if (tmp)
423 gtk_widget_destroy(tmp);
424 }
425
426 static void reset_reg_dlg()
427 {
428 GList *P = gaim_plugins_get_protocols();
429
430 if (!regdlg)
431 return;
432
433 while (GTK_BOX(reg_list)->children)
434 gtk_container_remove(GTK_CONTAINER(reg_list),
435 ((GtkBoxChild *)GTK_BOX(reg_list)->children->data)->widget);
436
437 while (GTK_BOX(reg_area)->children)
438 gtk_container_remove(GTK_CONTAINER(reg_area),
439 ((GtkBoxChild *)GTK_BOX(reg_area)->children->data)->widget);
440
441 while (P) {
442 GaimPlugin *p = P->data;
443
444 if (GAIM_PLUGIN_PROTOCOL_INFO(p)->register_user)
445 break;
446
447 P = P->next;
448 }
449
450 if (!P) {
451 GtkWidget *no = gtk_label_new(_("You do not currently have any protocols available"
452 " that are able to register new accounts."));
453 gtk_box_pack_start(GTK_BOX(reg_area), no, FALSE, FALSE, 5);
454 gtk_widget_show(no);
455
456 gtk_widget_set_sensitive(reg_reg, FALSE);
457
458 return;
459 }
460
461 gtk_widget_set_sensitive(reg_reg, TRUE);
462
463 while (P) { /* we can safely ignore all the previous ones */
464 GaimPlugin *p = P->data;
465 P = P->next;
466
467 if (GAIM_PLUGIN_PROTOCOL_INFO(p)->register_user)
468 continue;
469
470 /* do stuff */
471 }
472 }
473
474 void register_dialog()
475 {
476 /* this is just one big hack */
477 GtkWidget *vbox;
478 GtkWidget *frame;
479 GtkWidget *hbox;
480 GtkWidget *close;
481
482 if (regdlg) {
483 gdk_window_raise(regdlg->window);
484 return;
485 }
486
487 regdlg = gtk_window_new(GTK_WINDOW_TOPLEVEL);
488 gtk_window_set_title(GTK_WINDOW(regdlg), _("Gaim - Registration"));
489 gtk_window_set_role(GTK_WINDOW(regdlg), "register");
490 gtk_widget_realize(regdlg);
491 g_signal_connect(G_OBJECT(regdlg), "destroy",
492 G_CALLBACK(delete_regdlg), NULL);
493
494 vbox = gtk_vbox_new(FALSE, 5);
495 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
496 gtk_container_add(GTK_CONTAINER(regdlg), vbox);
497
498 reg_list = gtk_hbox_new(FALSE, 5);
499 gtk_box_pack_start(GTK_BOX(vbox), reg_list, FALSE, FALSE, 5);
500
501 frame = gtk_frame_new(_("Registration Information"));
502 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5);
503
504 reg_area = gtk_hbox_new(FALSE, 5);
505 gtk_container_add(GTK_CONTAINER(frame), reg_area);
506
507 hbox = gtk_hbox_new(FALSE, 5);
508 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
509
510 close = gaim_pixbuf_button_from_stock(_("Close"), GTK_STOCK_CLOSE, GAIM_BUTTON_HORIZONTAL);
511 gtk_box_pack_end(GTK_BOX(hbox), close, FALSE, FALSE, 5);
512 g_signal_connect(G_OBJECT(close), "clicked",
513 G_CALLBACK(delete_regdlg), NULL);
514
515 reg_reg = gaim_pixbuf_button_from_stock(_("Register"), GTK_STOCK_JUMP_TO, GAIM_BUTTON_HORIZONTAL);
516 gtk_box_pack_end(GTK_BOX(hbox), reg_reg, FALSE, FALSE, 5);
517
518 /* fuck me */
519 reset_reg_dlg();
520
521 gtk_widget_show_all(regdlg);
522 }
523