Mercurial > pidgin
comparison src/multi.c @ 1089:f0f5c10cce63
[gaim-migrate @ 1099]
added a cancel button to the progress meter
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 13 Nov 2000 02:58:00 +0000 |
parents | ce201056e7a6 |
children | 5bc8fdacd2cb |
comparison
equal
deleted
inserted
replaced
1088:18a14e6dd0af | 1089:f0f5c10cce63 |
---|---|
44 struct mod_usr_opt { | 44 struct mod_usr_opt { |
45 struct aim_user *user; | 45 struct aim_user *user; |
46 int opt; | 46 int opt; |
47 }; | 47 }; |
48 | 48 |
49 struct gaim_connection *new_gaim_conn(int proto, char *username, char *password) | 49 struct gaim_connection *new_gaim_conn(struct aim_user *user) |
50 { | 50 { |
51 struct gaim_connection *gc = g_new0(struct gaim_connection, 1); | 51 struct gaim_connection *gc = g_new0(struct gaim_connection, 1); |
52 gc->protocol = proto; | 52 gc->protocol = user->protocol; |
53 gc->prpl = find_prpl(proto); | 53 gc->prpl = find_prpl(user->protocol); |
54 g_snprintf(gc->username, sizeof(gc->username), "%s", username); | 54 g_snprintf(gc->username, sizeof(gc->username), "%s", user->username); |
55 g_snprintf(gc->password, sizeof(gc->password), "%s", password); | 55 g_snprintf(gc->password, sizeof(gc->password), "%s", user->password); |
56 gc->keepalive = -1; | 56 gc->keepalive = -1; |
57 gc->inpa = -1; | 57 gc->inpa = -1; |
58 gc->buddy_chats = NULL; | 58 gc->buddy_chats = NULL; |
59 gc->groups = NULL; | 59 gc->groups = NULL; |
60 gc->permit = NULL; | 60 gc->permit = NULL; |
61 gc->deny = NULL; | 61 gc->deny = NULL; |
62 | 62 |
63 connections = g_slist_append(connections, gc); | 63 connections = g_slist_append(connections, gc); |
64 | |
65 user->gc = gc; | |
66 gc->user = user; | |
64 | 67 |
65 return gc; | 68 return gc; |
66 } | 69 } |
67 | 70 |
68 void destroy_gaim_conn(struct gaim_connection *gc) | 71 void destroy_gaim_conn(struct gaim_connection *gc) |
617 do_pass_dlg(u); | 620 do_pass_dlg(u); |
618 } else { | 621 } else { |
619 #ifdef USE_APPLET | 622 #ifdef USE_APPLET |
620 set_user_state(signing_on); | 623 set_user_state(signing_on); |
621 #endif /* USE_APPLET */ | 624 #endif /* USE_APPLET */ |
625 gtk_clist_set_text(GTK_CLIST(list), row, 1, "Attempting"); | |
622 serv_login(u); | 626 serv_login(u); |
623 } | 627 } |
624 } else { | 628 } else { |
625 signoff(u->gc); | 629 signoff(u->gc); |
626 } | 630 } |
702 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); | 706 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); |
703 | 707 |
704 gtk_widget_show(acctedit); | 708 gtk_widget_show(acctedit); |
705 } | 709 } |
706 | 710 |
707 void account_online(struct aim_user *u, struct gaim_connection *gc) | 711 void account_online(struct gaim_connection *gc) |
708 { | 712 { |
709 int i; | 713 int i; |
710 | |
711 gc->user = u; | |
712 u->gc = gc; | |
713 | 714 |
714 /* first we hide the login progress meter */ | 715 /* first we hide the login progress meter */ |
715 if (gc->meter) | 716 if (gc->meter) |
716 gtk_widget_destroy(gc->meter); | 717 gtk_widget_destroy(gc->meter); |
717 gc->meter = NULL; | 718 gc->meter = NULL; |
751 } | 752 } |
752 | 753 |
753 void account_offline(struct gaim_connection *gc) | 754 void account_offline(struct gaim_connection *gc) |
754 { | 755 { |
755 int i; | 756 int i; |
757 if (gc->meter) | |
758 gtk_widget_destroy(gc->meter); | |
759 gc->meter = NULL; | |
756 gc->user->gc = NULL; /* wasn't that awkward? */ | 760 gc->user->gc = NULL; /* wasn't that awkward? */ |
757 if (!acctedit) return; | 761 if (!acctedit) return; |
758 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); | 762 i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); |
759 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); | 763 gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); |
760 redo_convo_menus(); | 764 redo_convo_menus(); |
775 } | 779 } |
776 u = u->next; | 780 u = u->next; |
777 } | 781 } |
778 } | 782 } |
779 | 783 |
780 static void meter_destroy(GtkWidget *meter, struct gaim_connection *gc) { | 784 static void cancel_signon(GtkWidget *button, struct gaim_connection *gc) { |
781 gtk_widget_destroy(meter); | 785 signoff(gc); |
782 gc->meter = NULL; | 786 } |
787 | |
788 static gint meter_destroy(GtkWidget *meter, GdkEvent *evt, struct gaim_connection *gc) { | |
789 return TRUE; | |
783 } | 790 } |
784 | 791 |
785 void set_login_progress(struct gaim_connection *gc, float howfar, char *message) { | 792 void set_login_progress(struct gaim_connection *gc, float howfar, char *message) { |
786 if (mainwindow) | 793 if (mainwindow) |
787 gtk_widget_hide(mainwindow); | 794 gtk_widget_hide(mainwindow); |
788 | 795 |
789 if (!gc->meter) { | 796 if (!gc->meter) { |
790 GtkWidget *box, *label; | 797 GtkWidget *box, *label, *button; |
791 char buf[256]; | 798 char buf[256]; |
792 | 799 |
793 gc->meter = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 800 gc->meter = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
794 gtk_window_set_policy(GTK_WINDOW(gc->meter), 0, 0, 1); | 801 gtk_window_set_policy(GTK_WINDOW(gc->meter), 0, 0, 1); |
795 gtk_window_set_wmclass(GTK_WINDOW(gc->meter), "signon", "Gaim"); | 802 gtk_window_set_wmclass(GTK_WINDOW(gc->meter), "signon", "Gaim"); |
796 gtk_container_set_border_width(GTK_CONTAINER(gc->meter), 5); | 803 gtk_container_set_border_width(GTK_CONTAINER(gc->meter), 5); |
797 g_snprintf(buf, sizeof(buf), "%s Signing On", gc->username); | 804 g_snprintf(buf, sizeof(buf), "%s Signing On", gc->username); |
798 gtk_window_set_title(GTK_WINDOW(gc->meter), buf); | 805 gtk_window_set_title(GTK_WINDOW(gc->meter), buf); |
799 gtk_signal_connect(GTK_OBJECT(gc->meter), "destroy", | 806 gtk_signal_connect(GTK_OBJECT(gc->meter), "delete_event", |
800 GTK_SIGNAL_FUNC(meter_destroy), gc); | 807 GTK_SIGNAL_FUNC(meter_destroy), gc); |
801 gtk_widget_realize(gc->meter); | 808 gtk_widget_realize(gc->meter); |
802 aol_icon(gc->meter->window); | 809 aol_icon(gc->meter->window); |
803 | 810 |
804 box = gtk_vbox_new(FALSE, 5); | 811 box = gtk_vbox_new(FALSE, 5); |
816 | 823 |
817 gc->status = gtk_statusbar_new(); | 824 gc->status = gtk_statusbar_new(); |
818 gtk_widget_set_usize(gc->status, 150, 0); | 825 gtk_widget_set_usize(gc->status, 150, 0); |
819 gtk_box_pack_start(GTK_BOX(box), gc->status, 0, 0, 5); | 826 gtk_box_pack_start(GTK_BOX(box), gc->status, 0, 0, 5); |
820 gtk_widget_show(gc->status); | 827 gtk_widget_show(gc->status); |
828 | |
829 button = gtk_button_new_with_label(_("Cancel")); | |
830 gtk_box_pack_start(GTK_BOX(box), button, 0, 0, 5); | |
831 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_signon), gc); | |
832 gtk_widget_show(button); | |
821 | 833 |
822 gtk_widget_show(gc->meter); | 834 gtk_widget_show(gc->meter); |
823 } | 835 } |
824 | 836 |
825 gtk_progress_bar_update(GTK_PROGRESS_BAR(gc->progress), howfar / 5); | 837 gtk_progress_bar_update(GTK_PROGRESS_BAR(gc->progress), howfar / 5); |