Mercurial > pidgin.yaz
diff src/request.c @ 9502:578986136bac
[gaim-migrate @ 10329]
Make gaim_request_file support saving files as well as opening files.
Changed silc appropriately, and made the Save dialog in the debug
window use this.
I changed request.c so that, when closing a request window, it also
tries to change any requests or notifies that were created using the
ui_handle as the handle.
It's similar to using "gc" as the first parameter of a gaim_request_bleh
or gaim_notify_bleh function.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 10 Jul 2004 18:38:20 +0000 |
parents | 1bbe99a07e36 |
children | 9aa0b6d11bbf |
line wrap: on
line diff
--- a/src/request.c Sat Jul 10 16:45:36 2004 +0000 +++ b/src/request.c Sat Jul 10 18:38:20 2004 +0000 @@ -22,6 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "notify.h" #include "request.h" #include "debug.h" @@ -1278,27 +1279,59 @@ return NULL; } +void * +gaim_request_file(void *handle, const char *title, const char *filename, + gboolean savedialog, + GCallback ok_cb, GCallback cancel_cb, void *user_data) +{ + GaimRequestUiOps *ops; + + ops = gaim_request_get_ui_ops(); + + if (ops != NULL && ops->request_file != NULL) { + GaimRequestInfo *info; + + info = g_new0(GaimRequestInfo, 1); + info->type = GAIM_REQUEST_FILE; + info->handle = handle; + info->ui_handle = ops->request_file(title, filename, savedialog, + ok_cb, cancel_cb, user_data); + handles = g_list_append(handles, info); + return info->ui_handle; + } + + return NULL; +} + +static void +gaim_request_close_info(GaimRequestInfo *info) +{ + GaimRequestUiOps *ops; + + ops = gaim_request_get_ui_ops(); + + gaim_notify_close_with_handle(info->ui_handle); + gaim_request_close_with_handle(info->ui_handle); + + if (ops != NULL && ops->close_request != NULL) + ops->close_request(info->type, info->ui_handle); + + g_free(info); +} + void gaim_request_close(GaimRequestType type, void *ui_handle) { GList *l; - GaimRequestUiOps *ops; g_return_if_fail(ui_handle != NULL); - ops = gaim_request_get_ui_ops(); - for (l = handles; l != NULL; l = l->next) { GaimRequestInfo *info = l->data; if (info->ui_handle == ui_handle) { handles = g_list_remove(handles, info); - - if (ops != NULL && ops->close_request != NULL) - ops->close_request(info->type, ui_handle); - - g_free(info); - + gaim_request_close_info(info); break; } } @@ -1308,12 +1341,9 @@ gaim_request_close_with_handle(void *handle) { GList *l, *l_next; - GaimRequestUiOps *ops; g_return_if_fail(handle != NULL); - ops = gaim_request_get_ui_ops(); - for (l = handles; l != NULL; l = l_next) { GaimRequestInfo *info = l->data; @@ -1321,40 +1351,11 @@ if (info->handle == handle) { handles = g_list_remove(handles, info); - - if (ops != NULL && ops->close_request != NULL) - ops->close_request(info->type, info->ui_handle); - - g_free(info); + gaim_request_close_info(info); } } } -void * -gaim_request_file(void *handle, - const char *title, const char *filename, - GCallback ok_cb, GCallback cancel_cb, - void *user_data) -{ - GaimRequestUiOps *ops; - - ops = gaim_request_get_ui_ops(); - - if (ops != NULL && ops->request_file != NULL) { - GaimRequestInfo *info; - - info = g_new0(GaimRequestInfo, 1); - info->type = GAIM_REQUEST_INPUT; - info->handle = handle; - info->ui_handle = ops->request_file(title, filename, - ok_cb, cancel_cb, user_data); - handles = g_list_append(handles, info); - return info->ui_handle; - } - - return NULL; -} - void gaim_request_set_ui_ops(GaimRequestUiOps *ops) {