| 144 notify_input_cb(GntWidget *button, GntWidget *entry) |
144 notify_input_cb(GntWidget *button, GntWidget *entry) |
| 145 { |
145 { |
| 146 PurpleRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
146 PurpleRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
| 147 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
147 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
| 148 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
148 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
| |
149 GntWidget *window; |
| 149 |
150 |
| 150 if (callback) |
151 if (callback) |
| 151 callback(data, text); |
152 callback(data, text); |
| 152 |
153 |
| 153 while (button->parent) |
154 window = gnt_widget_get_toplevel(button); |
| 154 button = button->parent; |
155 purple_request_close(PURPLE_REQUEST_INPUT, window); |
| 155 |
|
| 156 purple_request_close(PURPLE_REQUEST_INPUT, button); |
|
| 157 } |
156 } |
| 158 |
157 |
| 159 static void * |
158 static void * |
| 160 finch_request_input(const char *title, const char *primary, |
159 finch_request_input(const char *title, const char *primary, |
| 161 const char *secondary, const char *default_value, |
160 const char *secondary, const char *default_value, |
| 191 if (type == PURPLE_REQUEST_FIELDS) { |
190 if (type == PURPLE_REQUEST_FIELDS) { |
| 192 PurpleRequestFields *fields = g_object_get_data(G_OBJECT(widget), "fields"); |
191 PurpleRequestFields *fields = g_object_get_data(G_OBJECT(widget), "fields"); |
| 193 purple_request_fields_destroy(fields); |
192 purple_request_fields_destroy(fields); |
| 194 } |
193 } |
| 195 |
194 |
| 196 while (widget->parent) |
195 widget = gnt_widget_get_toplevel(widget); |
| 197 widget = widget->parent; |
|
| 198 gnt_widget_destroy(widget); |
196 gnt_widget_destroy(widget); |
| 199 } |
197 } |
| 200 |
198 |
| 201 static void |
199 static void |
| 202 request_choice_cb(GntWidget *button, GntComboBox *combo) |
200 request_choice_cb(GntWidget *button, GntComboBox *combo) |
| 203 { |
201 { |
| 204 PurpleRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
202 PurpleRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
| 205 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
203 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
| 206 int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1; |
204 int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1; |
| |
205 GntWidget *window; |
| 207 |
206 |
| 208 if (callback) |
207 if (callback) |
| 209 callback(data, choice); |
208 callback(data, choice); |
| 210 |
209 |
| 211 while (button->parent) |
210 window = gnt_widget_get_toplevel(button); |
| 212 button = button->parent; |
211 purple_request_close(PURPLE_REQUEST_INPUT, window); |
| 213 |
|
| 214 purple_request_close(PURPLE_REQUEST_INPUT, button); |
|
| 215 } |
212 } |
| 216 |
213 |
| 217 static void * |
214 static void * |
| 218 finch_request_choice(const char *title, const char *primary, |
215 finch_request_choice(const char *title, const char *primary, |
| 219 const char *secondary, int default_value, |
216 const char *secondary, int default_value, |
| 302 request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
299 request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
| 303 { |
300 { |
| 304 PurpleRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
301 PurpleRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
| 305 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
302 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
| 306 GList *list; |
303 GList *list; |
| |
304 GntWidget *window; |
| 307 |
305 |
| 308 /* Update the data of the fields. Pidgin does this differently. Instead of |
306 /* Update the data of the fields. Pidgin does this differently. Instead of |
| 309 * updating the fields at the end like here, it updates the appropriate field |
307 * updating the fields at the end like here, it updates the appropriate field |
| 310 * instantly whenever a change is made. That allows it to make sure the |
308 * instantly whenever a change is made. That allows it to make sure the |
| 311 * 'required' fields are entered before the user can hit OK. It's not the case |
309 * 'required' fields are entered before the user can hit OK. It's not the case |
| 402 } |
400 } |
| 403 |
401 |
| 404 if (callback) |
402 if (callback) |
| 405 callback(data, fields); |
403 callback(data, fields); |
| 406 |
404 |
| 407 while (button->parent) |
405 window = gnt_widget_get_toplevel(button); |
| 408 button = button->parent; |
406 purple_request_close(PURPLE_REQUEST_FIELDS, window); |
| 409 |
|
| 410 purple_request_close(PURPLE_REQUEST_FIELDS, button); |
|
| 411 } |
407 } |
| 412 |
408 |
| 413 static void |
409 static void |
| 414 update_selected_account(GntEntry *username, const char *start, const char *end, |
410 update_selected_account(GntEntry *username, const char *start, const char *end, |
| 415 GntComboBox *accountlist) |
411 GntComboBox *accountlist) |