comparison src/request.c @ 5496:b7c0be69c749

[gaim-migrate @ 5892] do_ask_dialog() will soon go the way of the something that goes away a lot. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 23 May 2003 00:48:20 +0000
parents a41149ee8a29
children 11001789cb22
comparison
equal deleted inserted replaced
5495:5b678994929b 5496:b7c0be69c749
73 void * 73 void *
74 gaim_request_choice(void *handle, const char *title, const char *primary, 74 gaim_request_choice(void *handle, const char *title, const char *primary,
75 const char *secondary, unsigned int default_value, 75 const char *secondary, unsigned int default_value,
76 const char *ok_text, GCallback ok_cb, 76 const char *ok_text, GCallback ok_cb,
77 const char *cancel_text, GCallback cancel_cb, 77 const char *cancel_text, GCallback cancel_cb,
78 void *user_data, const char *choice, ...) 78 void *user_data, size_t choice_count, ...)
79 { 79 {
80 void *ui_handle; 80 void *ui_handle;
81 va_list args; 81 va_list args;
82 82
83 g_return_val_if_fail(primary != NULL, NULL); 83 g_return_val_if_fail(primary != NULL, NULL);
84 g_return_val_if_fail(ok_text != NULL, NULL); 84 g_return_val_if_fail(ok_text != NULL, NULL);
85 g_return_val_if_fail(ok_cb != NULL, NULL); 85 g_return_val_if_fail(ok_cb != NULL, NULL);
86 g_return_val_if_fail(choice != NULL, NULL); 86 g_return_val_if_fail(choice_count > 0, NULL);
87 87
88 va_start(args, choice); 88 va_start(args, choice_count);
89 ui_handle = gaim_request_choice_varg(handle, title, primary, secondary, 89 ui_handle = gaim_request_choice_varg(handle, title, primary, secondary,
90 default_value, ok_text, ok_cb, 90 default_value, ok_text, ok_cb,
91 cancel_text, cancel_cb, user_data, 91 cancel_text, cancel_cb, user_data,
92 args); 92 choice_count, args);
93 va_end(args); 93 va_end(args);
94 94
95 return ui_handle; 95 return ui_handle;
96 } 96 }
97 97
99 gaim_request_choice_varg(void *handle, const char *title, 99 gaim_request_choice_varg(void *handle, const char *title,
100 const char *primary, const char *secondary, 100 const char *primary, const char *secondary,
101 unsigned int default_value, 101 unsigned int default_value,
102 const char *ok_text, GCallback ok_cb, 102 const char *ok_text, GCallback ok_cb,
103 const char *cancel_text, GCallback cancel_cb, 103 const char *cancel_text, GCallback cancel_cb,
104 void *user_data, va_list choices) 104 void *user_data, size_t choice_count,
105 { 105 va_list choices)
106 GaimRequestUiOps *ops; 106 {
107 107 GaimRequestUiOps *ops;
108 g_return_val_if_fail(primary != NULL, NULL); 108
109 g_return_val_if_fail(ok_text != NULL, NULL); 109 g_return_val_if_fail(primary != NULL, NULL);
110 g_return_val_if_fail(ok_cb != NULL, NULL); 110 g_return_val_if_fail(ok_text != NULL, NULL);
111 111 g_return_val_if_fail(ok_cb != NULL, NULL);
112 ops = gaim_get_request_ui_ops(); 112 g_return_val_if_fail(choice_count > 0, NULL);
113 113
114 if (ops != NULL && ops->request_input != NULL) { 114 ops = gaim_get_request_ui_ops();
115
116 if (ops != NULL && ops->request_choice != NULL) {
115 GaimRequestInfo *info; 117 GaimRequestInfo *info;
116 118
117 info = g_new0(GaimRequestInfo, 1); 119 info = g_new0(GaimRequestInfo, 1);
118 info->type = GAIM_REQUEST_CHOICE; 120 info->type = GAIM_REQUEST_CHOICE;
119 info->handle = handle; 121 info->handle = handle;
120 info->ui_handle = ops->request_choice(title, primary, secondary, 122 info->ui_handle = ops->request_choice(title, primary, secondary,
121 default_value, 123 default_value,
122 ok_text, ok_cb, 124 ok_text, ok_cb,
123 cancel_text, cancel_cb, 125 cancel_text, cancel_cb,
124 user_data, choices); 126 user_data, choice_count,
127 choices);
125 128
126 handles = g_list_append(handles, info); 129 handles = g_list_append(handles, info);
127 130
128 return info->ui_handle; 131 return info->ui_handle;
129 } 132 }
132 } 135 }
133 136
134 void * 137 void *
135 gaim_request_action(void *handle, const char *title, const char *primary, 138 gaim_request_action(void *handle, const char *title, const char *primary,
136 const char *secondary, unsigned int default_action, 139 const char *secondary, unsigned int default_action,
137 void *user_data, const char *action, ...) 140 void *user_data, size_t action_count, ...)
138 { 141 {
139 void *ui_handle; 142 void *ui_handle;
140 va_list args; 143 va_list args;
141 144
142 g_return_val_if_fail(primary != NULL, NULL); 145 g_return_val_if_fail(primary != NULL, NULL);
143 g_return_val_if_fail(action != NULL, NULL); 146 g_return_val_if_fail(action_count > 0, NULL);
144 147
145 va_start(args, action); 148 va_start(args, action_count);
146 ui_handle = gaim_request_action_varg(handle, title, primary, secondary, 149 ui_handle = gaim_request_action_varg(handle, title, primary, secondary,
147 default_action, user_data, args); 150 default_action, user_data,
151 action_count, args);
148 va_end(args); 152 va_end(args);
149 153
150 return ui_handle; 154 return ui_handle;
151 } 155 }
152 156
153 void * 157 void *
154 gaim_request_action_varg(void *handle, const char *title, 158 gaim_request_action_varg(void *handle, const char *title,
155 const char *primary, const char *secondary, 159 const char *primary, const char *secondary,
156 unsigned int default_action, void *user_data, 160 unsigned int default_action, void *user_data,
157 va_list actions) 161 size_t action_count, va_list actions)
158 { 162 {
159 GaimRequestUiOps *ops; 163 GaimRequestUiOps *ops;
160 164
161 g_return_val_if_fail(primary != NULL, NULL); 165 g_return_val_if_fail(primary != NULL, NULL);
162 166 g_return_val_if_fail(action_count > 0, NULL);
163 ops = gaim_get_request_ui_ops(); 167
164 168 ops = gaim_get_request_ui_ops();
165 if (ops != NULL && ops->request_input != NULL) { 169
170 if (ops != NULL && ops->request_action != NULL) {
166 GaimRequestInfo *info; 171 GaimRequestInfo *info;
167 172
168 info = g_new0(GaimRequestInfo, 1); 173 info = g_new0(GaimRequestInfo, 1);
169 info->type = GAIM_REQUEST_ACTION; 174 info->type = GAIM_REQUEST_ACTION;
170 info->handle = handle; 175 info->handle = handle;
171 info->ui_handle = ops->request_action(title, primary, secondary, 176 info->ui_handle = ops->request_action(title, primary, secondary,
172 default_action, user_data, 177 default_action, user_data,
173 actions); 178 action_count, actions);
174 179
175 handles = g_list_append(handles, info); 180 handles = g_list_append(handles, info);
176 181
177 return info->ui_handle; 182 return info->ui_handle;
178 } 183 }