comparison src/multi.c @ 988:9523b772e546

[gaim-migrate @ 998] progress meters for signing in. UI should be changed but at least there's something there now committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 13 Oct 2000 19:56:11 +0000
parents 7ec6b092f227
children eacd93d0089a
comparison
equal deleted inserted replaced
987:cf6662982b40 988:9523b772e546
85 void destroy_gaim_conn(struct gaim_connection *gc) 85 void destroy_gaim_conn(struct gaim_connection *gc)
86 { 86 {
87 connections = g_slist_remove(connections, gc); 87 connections = g_slist_remove(connections, gc);
88 g_free(gc); 88 g_free(gc);
89 redo_convo_menus(); 89 redo_convo_menus();
90 if (!connections && mainwindow)
91 gtk_widget_show(mainwindow);
90 } 92 }
91 93
92 struct gaim_connection *find_gaim_conn_by_name(char *name) { 94 struct gaim_connection *find_gaim_conn_by_name(char *name) {
93 char *who = g_strdup(normalize(name)); 95 char *who = g_strdup(normalize(name));
94 GSList *c = connections; 96 GSList *c = connections;
618 620
619 void account_online(struct gaim_connection *gc) 621 void account_online(struct gaim_connection *gc)
620 { 622 {
621 struct aim_user *u; 623 struct aim_user *u;
622 int i; 624 int i;
625 if (gc->meter)
626 gtk_widget_destroy(gc->meter);
627 gc->meter = NULL;
623 if (!acctedit) return; 628 if (!acctedit) return;
624 u = find_user(gc->username); 629 u = find_user(gc->username);
625 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); 630 i = gtk_clist_find_row_from_data(GTK_CLIST(list), u);
626 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); 631 gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes");
627 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol)); 632 gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol));
652 serv_login(a); 657 serv_login(a);
653 } 658 }
654 u = u->next; 659 u = u->next;
655 } 660 }
656 } 661 }
662
663 static void meter_destroy(GtkWidget *meter, struct gaim_connection *gc) {
664 gtk_widget_destroy(meter);
665 gc->meter = NULL;
666 }
667
668 void set_login_progress(struct gaim_connection *gc, float howfar, char *message) {
669 if (mainwindow)
670 gtk_widget_hide(mainwindow);
671
672 if (!gc->meter) {
673 GtkWidget *box, *label;
674 char buf[256];
675
676 gc->meter = gtk_window_new(GTK_WINDOW_TOPLEVEL);
677 gtk_window_set_policy(GTK_WINDOW(gc->meter), 0, 0, 1);
678 gtk_window_set_wmclass(GTK_WINDOW(gc->meter), "signon", "Gaim");
679 gtk_container_set_border_width(GTK_CONTAINER(gc->meter), 5);
680 g_snprintf(buf, sizeof(buf), "%s Signing On", gc->username);
681 gtk_window_set_title(GTK_WINDOW(gc->meter), buf);
682 gtk_signal_connect(GTK_OBJECT(gc->meter), "destroy",
683 GTK_SIGNAL_FUNC(meter_destroy), gc);
684 gtk_widget_realize(gc->meter);
685 aol_icon(gc->meter->window);
686
687 box = gtk_vbox_new(FALSE, 5);
688 gtk_container_add(GTK_CONTAINER(gc->meter), box);
689 gtk_widget_show(box);
690
691 label = gtk_label_new(buf);
692 gtk_box_pack_start(GTK_BOX(box), label, 0, 0, 5);
693 gtk_widget_show(label);
694
695 gc->progress = gtk_progress_bar_new();
696 gtk_widget_set_usize(gc->progress, 150, 0);
697 gtk_box_pack_start(GTK_BOX(box), gc->progress, 0, 0, 5);
698 gtk_widget_show(gc->progress);
699
700 gc->status = gtk_statusbar_new();
701 gtk_widget_set_usize(gc->status, 150, 0);
702 gtk_box_pack_start(GTK_BOX(box), gc->status, 0, 0, 5);
703 gtk_widget_show(gc->status);
704
705 gtk_widget_show(gc->meter);
706 }
707
708 gtk_progress_bar_update(GTK_PROGRESS_BAR(gc->progress), howfar / 5);
709 gtk_statusbar_pop(GTK_STATUSBAR(gc->status), 1);
710 gtk_statusbar_push(GTK_STATUSBAR(gc->status), 1, message);
711 }
712
713 void hide_login_progress(struct gaim_connection *gc, char *why)
714 {
715 char buf[2048];
716 sprintf(buf, _("%s was unable to sign on: %s"), gc->username, why);
717 do_error_dialog(buf, _("Signon Error"));
718 if (gc->meter)
719 gtk_widget_destroy(gc->meter);
720 gc->meter = NULL;
721 }