comparison src/request.c @ 10229:9aa0b6d11bbf

[gaim-migrate @ 11364] This is a heavily warmenhoved patch from Alceste Scalas. Here's what it changes: If the user drags an image file into the buddy list or conversation, it presents three options (when applicable): Set as buddy icon - sets this image to be the buddy icon for this buddy Send image file - Initiates a file transfer to send this image. Insert in message - Inserts in the gtkimhtml for use as an IM image. If the user drags a .desktop web link, it will insert a hyperlink in the conversation. All other types of .desktop files fail with an error dialog. If anyone can think of better ways to handle any of them, let me know. This also happens to implement gaim_request_choice, which had previously been unimplemented. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 22 Nov 2004 02:57:34 +0000
parents 578986136bac
children f0bc5f121684
comparison
equal deleted inserted replaced
10228:37c411c8cde3 10229:9aa0b6d11bbf
1137 void * 1137 void *
1138 gaim_request_choice(void *handle, const char *title, const char *primary, 1138 gaim_request_choice(void *handle, const char *title, const char *primary,
1139 const char *secondary, unsigned int default_value, 1139 const char *secondary, unsigned int default_value,
1140 const char *ok_text, GCallback ok_cb, 1140 const char *ok_text, GCallback ok_cb,
1141 const char *cancel_text, GCallback cancel_cb, 1141 const char *cancel_text, GCallback cancel_cb,
1142 void *user_data, size_t choice_count, ...) 1142 void *user_data, ...)
1143 { 1143 {
1144 void *ui_handle; 1144 void *ui_handle;
1145 va_list args; 1145 va_list args;
1146 1146
1147 g_return_val_if_fail(ok_text != NULL, NULL); 1147 g_return_val_if_fail(ok_text != NULL, NULL);
1148 g_return_val_if_fail(ok_cb != NULL, NULL); 1148 g_return_val_if_fail(ok_cb != NULL, NULL);
1149 g_return_val_if_fail(choice_count > 0, NULL); 1149
1150 1150 va_start(args, user_data);
1151 va_start(args, choice_count);
1152 ui_handle = gaim_request_choice_varg(handle, title, primary, secondary, 1151 ui_handle = gaim_request_choice_varg(handle, title, primary, secondary,
1153 default_value, ok_text, ok_cb, 1152 default_value, ok_text, ok_cb,
1154 cancel_text, cancel_cb, user_data, 1153 cancel_text, cancel_cb, user_data, args);
1155 choice_count, args);
1156 va_end(args); 1154 va_end(args);
1157 1155
1158 return ui_handle; 1156 return ui_handle;
1159 } 1157 }
1160 1158
1161 void * 1159 void *
1162 gaim_request_choice_varg(void *handle, const char *title, 1160 gaim_request_choice_varg(void *handle, const char *title,
1163 const char *primary, const char *secondary, 1161 const char *primary, const char *secondary,
1164 unsigned int default_value, 1162 unsigned int default_value,
1165 const char *ok_text, GCallback ok_cb, 1163 const char *ok_text, GCallback ok_cb,
1166 const char *cancel_text, GCallback cancel_cb, 1164 const char *cancel_text, GCallback cancel_cb,
1167 void *user_data, size_t choice_count, 1165 void *user_data, va_list choices)
1168 va_list choices)
1169 { 1166 {
1170 GaimRequestUiOps *ops; 1167 GaimRequestUiOps *ops;
1171 1168
1172 g_return_val_if_fail(ok_text != NULL, NULL); 1169 g_return_val_if_fail(ok_text != NULL, NULL);
1173 g_return_val_if_fail(ok_cb != NULL, NULL); 1170 g_return_val_if_fail(ok_cb != NULL, NULL);
1174 g_return_val_if_fail(choice_count > 0, NULL);
1175 1171
1176 ops = gaim_request_get_ui_ops(); 1172 ops = gaim_request_get_ui_ops();
1177 1173
1178 if (ops != NULL && ops->request_choice != NULL) { 1174 if (ops != NULL && ops->request_choice != NULL) {
1179 GaimRequestInfo *info; 1175 GaimRequestInfo *info;
1180 1176
1181 info = g_new0(GaimRequestInfo, 1); 1177 info = g_new0(GaimRequestInfo, 1);
1182 info->type = GAIM_REQUEST_CHOICE; 1178 info->type = GAIM_REQUEST_CHOICE;
1183 info->handle = handle; 1179 info->handle = handle;
1184 info->ui_handle = ops->request_choice(title, primary, secondary, 1180 info->ui_handle = ops->request_choice(title, primary, secondary,
1185 default_value, 1181 default_value,
1186 ok_text, ok_cb, 1182 ok_text, ok_cb,
1187 cancel_text, cancel_cb, 1183 cancel_text, cancel_cb,
1188 user_data, choice_count, 1184 user_data, choices);
1189 choices);
1190 1185
1191 handles = g_list_append(handles, info); 1186 handles = g_list_append(handles, info);
1192 1187
1193 return info->ui_handle; 1188 return info->ui_handle;
1194 } 1189 }