comparison src/dialogs.c @ 2550:01dad6d8ba5b

[gaim-migrate @ 2563] New buddy pounce action: popup notification window. Thanks for the suggestion, Allan Third. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Fri, 19 Oct 2001 18:44:52 +0000
parents 2bc6ee172103
children d3e463a5cafc
comparison
equal deleted inserted replaced
2549:7c64b3ad0c3d 2550:01dad6d8ba5b
132 GtkWidget *messentry; 132 GtkWidget *messentry;
133 GtkWidget *commentry; 133 GtkWidget *commentry;
134 GtkWidget *command; 134 GtkWidget *command;
135 GtkWidget *sendim; 135 GtkWidget *sendim;
136 GtkWidget *openwindow; 136 GtkWidget *openwindow;
137 GtkWidget *popupnotify;
137 GtkWidget *p_signon; 138 GtkWidget *p_signon;
138 GtkWidget *p_unaway; 139 GtkWidget *p_unaway;
139 GtkWidget *p_unidle; 140 GtkWidget *p_unidle;
140 GtkWidget *save; 141 GtkWidget *save;
141 GtkWidget *menu; 142 GtkWidget *menu;
976 977
977 bp->protocol = b->user->protocol; 978 bp->protocol = b->user->protocol;
978 979
979 bp->options = 0; 980 bp->options = 0;
980 981
982 if (GTK_TOGGLE_BUTTON(b->popupnotify)->active)
983 bp->options |= OPT_POUNCE_NOTIFY;
984
981 if (GTK_TOGGLE_BUTTON(b->openwindow)->active) 985 if (GTK_TOGGLE_BUTTON(b->openwindow)->active)
982 bp->options |= OPT_POUNCE_POPUP; 986 bp->options |= OPT_POUNCE_POPUP;
983 987
984 if (GTK_TOGGLE_BUTTON(b->sendim)->active) 988 if (GTK_TOGGLE_BUTTON(b->sendim)->active)
985 bp->options |= OPT_POUNCE_SEND_IM; 989 bp->options |= OPT_POUNCE_SEND_IM;
1016 { 1020 {
1017 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); 1021 struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt));
1018 b->user = u; 1022 b->user = u;
1019 } 1023 }
1020 1024
1021 static void pounce_user_menu(struct addbp *b, GtkWidget *box) 1025 static GtkWidget *pounce_user_menu(struct addbp *b)
1022 { 1026 {
1023 GtkWidget *hbox;
1024 GtkWidget *label;
1025 GtkWidget *optmenu; 1027 GtkWidget *optmenu;
1026 GtkWidget *menu; 1028 GtkWidget *menu;
1027 GtkWidget *opt; 1029 GtkWidget *opt;
1028 GSList *u = aim_users; 1030 GSList *u = aim_users;
1029 struct aim_user *a; 1031 struct aim_user *a;
1030 1032
1031 hbox = gtk_hbox_new(FALSE, 5);
1032 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
1033 gtk_widget_show(hbox);
1034
1035 label = gtk_label_new(_("Pounce buddy as:"));
1036 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1037 gtk_widget_show(label);
1038
1039 optmenu = gtk_option_menu_new(); 1033 optmenu = gtk_option_menu_new();
1040 gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 0);
1041 gtk_widget_show(optmenu);
1042 1034
1043 menu = gtk_menu_new(); 1035 menu = gtk_menu_new();
1044 1036
1045 /* We should go ahead and set this in order to prevent problems */ 1037 /* We should go ahead and set this in order to prevent problems */
1046 if (u) { 1038 if (u) {
1063 g_slist_index(aim_users, 1055 g_slist_index(aim_users,
1064 ((struct gaim_connection *)connections->data)->user)); 1056 ((struct gaim_connection *)connections->data)->user));
1065 b->user = ((struct gaim_connection *)connections->data)->user; 1057 b->user = ((struct gaim_connection *)connections->data)->user;
1066 1058
1067 b->menu = optmenu; 1059 b->menu = optmenu;
1060
1061 return optmenu;
1068 } 1062 }
1069 1063
1070 1064
1071 void show_new_bp(char *name) 1065 void show_new_bp(char *name)
1072 { 1066 {
1074 GtkWidget *bbox; 1068 GtkWidget *bbox;
1075 GtkWidget *vbox; 1069 GtkWidget *vbox;
1076 GtkWidget *hbox; 1070 GtkWidget *hbox;
1077 GtkWidget *button; 1071 GtkWidget *button;
1078 GtkWidget *sep; 1072 GtkWidget *sep;
1073 GtkWidget *frame;
1074 GtkWidget *table;
1075 GtkWidget *optmenu;
1079 1076
1080 struct addbp *b = g_new0(struct addbp, 1); 1077 struct addbp *b = g_new0(struct addbp, 1);
1081 1078
1082 b->window = gtk_window_new(GTK_WINDOW_DIALOG); 1079 b->window = gtk_window_new(GTK_WINDOW_DIALOG);
1083 dialogwindows = g_list_prepend(dialogwindows, b->window); 1080 dialogwindows = g_list_prepend(dialogwindows, b->window);
1091 vbox = gtk_vbox_new(FALSE, 5); 1088 vbox = gtk_vbox_new(FALSE, 5);
1092 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); 1089 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1093 gtk_container_add(GTK_CONTAINER(b->window), vbox); 1090 gtk_container_add(GTK_CONTAINER(b->window), vbox);
1094 gtk_widget_show(vbox); 1091 gtk_widget_show(vbox);
1095 1092
1096 pounce_user_menu(b, vbox); 1093 /* <pounce type="who"> */
1097 1094 frame = gtk_frame_new(_("Pounce Who"));
1098 hbox = gtk_hbox_new(FALSE, 5); 1095 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
1099 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); 1096 gtk_widget_show(GTK_WIDGET(frame));
1100 gtk_widget_show(hbox); 1097
1101 1098 table = gtk_table_new(2, 2, FALSE);
1102 label = gtk_label_new(_("Buddy:")); 1099 gtk_container_add(GTK_CONTAINER(frame), table);
1103 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 1100 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
1101 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
1102 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
1103 gtk_widget_show(table);
1104
1105 label = gtk_label_new(_("Account"));
1106 gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
1107 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
1104 gtk_widget_show(label); 1108 gtk_widget_show(label);
1105 1109
1110 optmenu = pounce_user_menu(b);
1111 gtk_table_attach(GTK_TABLE(table), optmenu, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
1112 gtk_widget_show(optmenu);
1113
1114 label = gtk_label_new(_("Buddy"));
1115 gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
1116 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
1117 gtk_widget_show(label);
1118
1106 b->nameentry = gtk_entry_new(); 1119 b->nameentry = gtk_entry_new();
1107 gtk_box_pack_start(GTK_BOX(hbox), b->nameentry, TRUE, TRUE, 0); 1120 gtk_table_attach(GTK_TABLE(table), b->nameentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
1108 if (name !=NULL) 1121 if (name !=NULL)
1109 gtk_entry_set_text(GTK_ENTRY(b->nameentry), name); 1122 gtk_entry_set_text(GTK_ENTRY(b->nameentry), name);
1110 gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry); 1123 gtk_window_set_focus(GTK_WINDOW(b->window), b->nameentry);
1111 gtk_widget_show(b->nameentry); 1124 gtk_widget_show(b->nameentry);
1112 1125 /* </pounce type="who"> */
1113 sep = gtk_hseparator_new(); 1126
1114 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); 1127
1115 gtk_widget_show(sep); 1128 /* <pounce type="when"> */
1116 1129 frame = gtk_frame_new(_("Pounce When"));
1130 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
1131 gtk_widget_show(GTK_WIDGET(frame));
1132
1133 table = gtk_table_new(2, 2, FALSE);
1134 gtk_container_add(GTK_CONTAINER(frame), table);
1135 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
1136 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
1137 gtk_widget_show(table);
1138
1117 b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on")); 1139 b->p_signon = gtk_check_button_new_with_label(_("Pounce on sign on"));
1118 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), TRUE); 1140 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->p_signon), TRUE);
1119 gtk_box_pack_start(GTK_BOX(vbox), b->p_signon, FALSE, FALSE, 0); 1141 gtk_table_attach(GTK_TABLE(table), b->p_signon, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
1120 gtk_widget_show(b->p_signon); 1142 gtk_widget_show(b->p_signon);
1121 1143
1122 b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away")); 1144 b->p_unaway = gtk_check_button_new_with_label(_("Pounce on return from away"));
1123 gtk_box_pack_start(GTK_BOX(vbox), b->p_unaway, FALSE, FALSE, 0); 1145 gtk_table_attach(GTK_TABLE(table), b->p_unaway, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
1124 gtk_widget_show(b->p_unaway); 1146 gtk_widget_show(b->p_unaway);
1125 1147
1126 b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle")); 1148 b->p_unidle = gtk_check_button_new_with_label(_("Pounce on return from idle"));
1127 gtk_box_pack_start(GTK_BOX(vbox), b->p_unidle, FALSE, FALSE, 0); 1149 gtk_table_attach(GTK_TABLE(table), b->p_unidle, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
1128 gtk_widget_show(b->p_unidle); 1150 gtk_widget_show(b->p_unidle);
1129 1151
1130 sep = gtk_hseparator_new(); 1152 label = gtk_label_new(NULL);
1131 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); 1153 gtk_table_attach(GTK_TABLE(table), label, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
1132 gtk_widget_show(sep); 1154 gtk_widget_show(label);
1133 1155 /* </pounce type="when"> */
1134 b->openwindow = gtk_check_button_new_with_label(_("Open IM window on pounce")); 1156
1157 /* <pounce type="action"> */
1158 frame = gtk_frame_new(_("Pounce Action"));
1159 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
1160 gtk_widget_show(GTK_WIDGET(frame));
1161
1162 table = gtk_table_new(4, 2, FALSE);
1163 gtk_container_add(GTK_CONTAINER(frame), table);
1164 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
1165 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
1166 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
1167 gtk_widget_show(table);
1168
1169 b->openwindow = gtk_check_button_new_with_label(_("Open IM Window"));
1135 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE); 1170 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->openwindow), FALSE);
1136 gtk_box_pack_start(GTK_BOX(vbox), b->openwindow, FALSE, FALSE, 0); 1171 gtk_table_attach(GTK_TABLE(table), b->openwindow, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
1137 gtk_widget_show(b->openwindow); 1172 gtk_widget_show(b->openwindow);
1138 1173
1139 b->sendim = gtk_check_button_new_with_label(_("Send IM on pounce")); 1174 b->popupnotify = gtk_check_button_new_with_label(_("Popup Notification"));
1175 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->popupnotify), FALSE);
1176 gtk_table_attach(GTK_TABLE(table), b->popupnotify, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
1177 gtk_widget_show(b->popupnotify);
1178
1179 b->sendim = gtk_check_button_new_with_label(_("Send Message"));
1140 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE); 1180 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sendim), TRUE);
1141 gtk_box_pack_start(GTK_BOX(vbox), b->sendim, FALSE, FALSE, 0); 1181 gtk_table_attach(GTK_TABLE(table), b->sendim, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
1142 gtk_widget_show(b->sendim); 1182 gtk_widget_show(b->sendim);
1143 1183
1144 hbox = gtk_hbox_new(FALSE, 5);
1145 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
1146 gtk_widget_show(hbox);
1147
1148 label = gtk_label_new(_("Message:"));
1149 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1150 gtk_widget_show(label);
1151
1152 b->messentry = gtk_entry_new(); 1184 b->messentry = gtk_entry_new();
1153 gtk_box_pack_start(GTK_BOX(hbox), b->messentry, TRUE, TRUE, 0); 1185 gtk_table_attach(GTK_TABLE(table), b->messentry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
1154 gtk_signal_connect(GTK_OBJECT(b->messentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b); 1186 gtk_signal_connect(GTK_OBJECT(b->messentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b);
1155 gtk_widget_show(b->messentry); 1187 gtk_widget_show(b->messentry);
1156 1188
1157 gtk_signal_connect(GTK_OBJECT(b->sendim), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), 1189 gtk_signal_connect(GTK_OBJECT(b->sendim), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive),
1158 b->messentry); 1190 b->messentry);
1159 1191
1160 b->command = gtk_check_button_new_with_label(_("Execute command on pounce")); 1192 b->command = gtk_check_button_new_with_label(_("Execute command on pounce"));
1161 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->command), FALSE); 1193 gtk_table_attach(GTK_TABLE(table), b->command, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
1162 gtk_box_pack_start(GTK_BOX(vbox), b->command, FALSE, FALSE, 0);
1163 gtk_widget_show(b->command); 1194 gtk_widget_show(b->command);
1164 1195
1165 hbox = gtk_hbox_new(FALSE, 5);
1166 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
1167 gtk_widget_show(hbox);
1168
1169 label = gtk_label_new(_("Command:"));
1170 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1171 gtk_widget_show(label);
1172
1173 b->commentry = gtk_entry_new(); 1196 b->commentry = gtk_entry_new();
1174 gtk_box_pack_start(GTK_BOX(hbox), b->commentry, TRUE, TRUE, 0); 1197 gtk_table_attach(GTK_TABLE(table), b->commentry, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, 0, 0, 0);
1175 gtk_signal_connect(GTK_OBJECT(b->commentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b); 1198 gtk_signal_connect(GTK_OBJECT(b->commentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b);
1176 gtk_widget_show(b->commentry); 1199 gtk_widget_show(b->commentry);
1177 1200
1178 gtk_widget_set_sensitive(b->commentry, FALSE); 1201 gtk_widget_set_sensitive(b->commentry, FALSE);
1179 gtk_signal_connect(GTK_OBJECT(b->command), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), 1202 gtk_signal_connect(GTK_OBJECT(b->command), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive),
1180 b->commentry); 1203 b->commentry);
1181 1204
1182 b->sound = gtk_check_button_new_with_label(_("Play sound on pounce")); 1205 b->sound = gtk_check_button_new_with_label(_("Play sound on pounce"));
1183 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sound), FALSE); 1206 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->sound), FALSE);
1184 gtk_box_pack_start(GTK_BOX(vbox), b->sound, FALSE, FALSE, 0); 1207 gtk_table_attach(GTK_TABLE(table), b->sound, 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
1185 gtk_widget_show(b->sound); 1208 gtk_widget_show(b->sound);
1186 1209
1187 hbox = gtk_hbox_new(FALSE, 5);
1188 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
1189 gtk_widget_show(hbox);
1190
1191 label = gtk_label_new(_("Sound:"));
1192 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1193 gtk_widget_show(label);
1194
1195 b->soundentry = gtk_entry_new(); 1210 b->soundentry = gtk_entry_new();
1196 gtk_box_pack_start(GTK_BOX(hbox), b->soundentry, TRUE, TRUE, 0); 1211 gtk_table_attach(GTK_TABLE(table), b->soundentry, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, 0, 0, 0);
1197 gtk_signal_connect(GTK_OBJECT(b->soundentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b); 1212 gtk_signal_connect(GTK_OBJECT(b->soundentry), "activate", GTK_SIGNAL_FUNC(do_new_bp), b);
1198 gtk_widget_show(b->soundentry); 1213 gtk_widget_show(b->soundentry);
1199 1214
1200 gtk_widget_set_sensitive(b->soundentry, FALSE); 1215 gtk_widget_set_sensitive(b->soundentry, FALSE);
1201 gtk_signal_connect(GTK_OBJECT(b->sound), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), 1216 gtk_signal_connect(GTK_OBJECT(b->sound), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive),
1202 b->soundentry); 1217 b->soundentry);
1203 1218 /* </pounce type="action"> */
1204 sep = gtk_hseparator_new();
1205 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
1206 gtk_widget_show(sep);
1207 1219
1208 b->save = gtk_check_button_new_with_label(_("Save this pounce after activation")); 1220 b->save = gtk_check_button_new_with_label(_("Save this pounce after activation"));
1221 gtk_container_set_border_width(GTK_CONTAINER(b->save), 7);
1209 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->save), FALSE); 1222 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(b->save), FALSE);
1210 gtk_box_pack_start(GTK_BOX(vbox), b->save, FALSE, FALSE, 0); 1223 gtk_box_pack_start(GTK_BOX(vbox), b->save, FALSE, FALSE, 0);
1211 gtk_widget_show(b->save); 1224 gtk_widget_show(b->save);
1212
1213 sep = gtk_hseparator_new();
1214 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
1215 gtk_widget_show(sep);
1216 1225
1217 bbox = gtk_hbox_new(FALSE, 5); 1226 bbox = gtk_hbox_new(FALSE, 5);
1218 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); 1227 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
1219 gtk_widget_show(bbox); 1228 gtk_widget_show(bbox);
1220 1229