comparison src/dialogs.c @ 149:9d684979f507

[gaim-migrate @ 159] You can now change passwords. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sun, 23 Apr 2000 23:27:29 +0000
parents 99248fb977c2
children aaa8f0a2140e
comparison
equal deleted inserted replaced
148:c09b48f8f7f4 149:9d684979f507
1041 aol_icon(b->window->window); 1041 aol_icon(b->window->window);
1042 1042
1043 gtk_widget_show(b->window); 1043 gtk_widget_show(b->window);
1044 } 1044 }
1045 1045
1046 void do_change_password(GtkWidget *widget, struct passwddlg *b)
1047 {
1048 gchar *orig, *new1, *new2;
1049 gchar *buf;
1050
1051 orig = gtk_entry_get_text(GTK_ENTRY(b->original));
1052 new1 = gtk_entry_get_text(GTK_ENTRY(b->new1));
1053 new2 = gtk_entry_get_text(GTK_ENTRY(b->new2));
1054
1055 if (strcasecmp(new1, new2)) {
1056 do_error_dialog("New Passwords Do Not Match", "Gaim - Change Password Error");
1057 return ;
1058 }
1059
1060 if ((strlen(orig) < 1) || (strlen(new1) < 1) || (strlen(new2) < 1)) {
1061 do_error_dialog("Fill out all fields completely", "Gaim - Change Password Error");
1062 return;
1063 }
1064
1065 buf = g_malloc(BUF_LONG);
1066 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new1);
1067 sflap_send(buf, strlen(buf), TYPE_DATA);
1068 g_free(buf);
1069
1070 destroy_dialog(NULL, b->window);
1071 g_free(b);
1072 }
1073
1046 void show_change_passwd() 1074 void show_change_passwd()
1047 { 1075 {
1048 GtkWidget *hbox; 1076 GtkWidget *hbox;
1049 GtkWidget *label; 1077 GtkWidget *label;
1050 GtkWidget *vbox; 1078 GtkWidget *vbox;
1079 GtkWidget *table;
1051 struct passwddlg *b = g_new0(struct passwddlg, 1); 1080 struct passwddlg *b = g_new0(struct passwddlg, 1);
1052 1081
1053 b->window = gtk_window_new(GTK_WINDOW_DIALOG); 1082 b->window = gtk_window_new(GTK_WINDOW_DIALOG);
1054 dialogwindows = g_list_prepend(dialogwindows, b->window); 1083 dialogwindows = g_list_prepend(dialogwindows, b->window);
1084
1085 b->ok = gtk_button_new_with_label("Ok");
1055 b->cancel = gtk_button_new_with_label("Cancel"); 1086 b->cancel = gtk_button_new_with_label("Cancel");
1056 b->ok = gtk_button_new_with_label("Ok"); 1087
1057 1088 gtk_widget_show(b->ok);
1058 vbox = gtk_vbox_new(FALSE, 10); 1089 gtk_widget_show(b->cancel);
1059 label = gtk_label_new("Changing Password"); 1090
1060 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 10); 1091 table = gtk_table_new(3, 2, TRUE);
1061 gtk_widget_show(label); 1092
1062 1093
1063 hbox = gtk_hbox_new(FALSE, 10); 1094
1064 label = gtk_label_new("Original Password"); 1095 label = gtk_label_new("Original Password");
1065 gtk_widget_show(label); 1096 gtk_widget_show(label);
1066 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10); 1097 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
1067
1068 b->original = gtk_entry_new(); 1098 b->original = gtk_entry_new();
1069 gtk_box_pack_start(GTK_BOX(hbox), b->original, FALSE, FALSE, 10); 1099 gtk_widget_show(b->original);
1070 1100 gtk_table_attach_defaults(GTK_TABLE(table), b->original, 1, 2, 0, 1);
1071 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 10); 1101
1102 label = gtk_label_new("New Password");
1103 gtk_widget_show(label);
1104 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
1105 b->new1 = gtk_entry_new();
1106 gtk_widget_show(b->new1);
1107 gtk_table_attach_defaults(GTK_TABLE(table), b->new1, 1, 2, 1, 2);
1108
1109 label = gtk_label_new("New Password (again)");
1110 gtk_widget_show(label);
1111 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
1112 b->new2 = gtk_entry_new();
1113 gtk_widget_show(b->new2);
1114 gtk_table_attach_defaults(GTK_TABLE(table), b->new2, 1, 2, 2, 3);
1115
1116 gtk_widget_show(table);
1117
1118 vbox = gtk_vbox_new(TRUE, TRUE);
1119 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 5);
1120
1121 hbox = gtk_hbox_new(TRUE, TRUE);
1122 gtk_box_pack_start(GTK_BOX(hbox), b->ok, FALSE, FALSE, 5);
1123 gtk_box_pack_start(GTK_BOX(hbox), b->cancel, FALSE, FALSE, 5);
1124 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
1072 gtk_widget_show(hbox); 1125 gtk_widget_show(hbox);
1073
1074
1075 label = gtk_label_new("Got sleepy, Will add the rest later.");
1076 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 10);
1077 gtk_widget_show(label);
1078 1126
1079 gtk_container_add(GTK_CONTAINER(b->window), vbox); 1127 gtk_container_add(GTK_CONTAINER(b->window), vbox);
1080 gtk_widget_show(vbox); 1128 gtk_widget_show(vbox);
1081 gtk_widget_show(b->original); 1129
1082 aol_icon(b->window->window); 1130 gtk_container_border_width(GTK_CONTAINER(b->window), 10);
1083 gtk_widget_realize(b->window); 1131 gtk_window_set_title(GTK_WINDOW(b->window), "Gaim - Password Change");
1084 gtk_widget_show(b->window); 1132 gtk_widget_show(b->window);
1133
1134 gtk_signal_connect(GTK_OBJECT(b->window), "destroy",
1135 GTK_SIGNAL_FUNC(destroy_dialog), b->window);
1136 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked",
1137 GTK_SIGNAL_FUNC(destroy_dialog), b->window);
1138 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked",
1139 GTK_SIGNAL_FUNC(do_change_password), b);
1140
1141
1085 } 1142 }
1086 1143
1087 void show_set_info() 1144 void show_set_info()
1088 { 1145 {
1089 GtkWidget *bot; 1146 GtkWidget *bot;