Mercurial > pidgin.yaz
comparison console/gntrequest.c @ 14059:2d1b41e3cf0d
[gaim-migrate @ 16674]
Add a way to change some preferences (the preferences for the
conversations do not do anything yet). I used the request-api
for this, which I think is cool. But too many preferences will
make the dialog long, which may not fit in the screen. It looks
alright for now though. You can pop the dialog up with "/prefs"
command in a converastion.
And some other minor fixes.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 09 Aug 2006 03:41:45 +0000 |
parents | 9c4bec886220 |
children | fa8f65cd912c |
comparison
equal
deleted
inserted
replaced
14058:32a71e64ceae | 14059:2d1b41e3cf0d |
---|---|
249 int id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); | 249 int id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); |
250 gaim_request_field_choice_set_value(field, id); | 250 gaim_request_field_choice_set_value(field, id); |
251 } | 251 } |
252 else if (type == GAIM_REQUEST_FIELD_LIST) | 252 else if (type == GAIM_REQUEST_FIELD_LIST) |
253 { | 253 { |
254 GntWidget *tree = field->ui_data; | |
255 GList *list = NULL; | 254 GList *list = NULL; |
256 | |
257 if (gaim_request_field_list_get_multi_select(field)) | 255 if (gaim_request_field_list_get_multi_select(field)) |
258 { | 256 { |
259 const GList *iter; | 257 const GList *iter; |
260 | 258 GntWidget *tree = field->ui_data; |
259 | |
261 iter = gaim_request_field_list_get_items(field); | 260 iter = gaim_request_field_list_get_items(field); |
262 for (; iter; iter = iter->next) | 261 for (; iter; iter = iter->next) |
263 { | 262 { |
264 const char *text = list->data; | 263 const char *text = list->data; |
265 gpointer key = gaim_request_field_list_get_data(field, text); | 264 gpointer key = gaim_request_field_list_get_data(field, text); |
267 list = g_list_prepend(list, key); | 266 list = g_list_prepend(list, key); |
268 } | 267 } |
269 } | 268 } |
270 else | 269 else |
271 { | 270 { |
272 gpointer data = gnt_tree_get_selection_data(GNT_TREE(tree)); | 271 GntWidget *combo = field->ui_data; |
272 gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); | |
273 list = g_list_append(list, data); | 273 list = g_list_append(list, data); |
274 } | 274 } |
275 | 275 |
276 gaim_request_field_list_set_selected(field, list); | 276 gaim_request_field_list_set_selected(field, list); |
277 g_list_free(list); | 277 g_list_free(list); |
313 { | 313 { |
314 GaimRequestFieldGroup *group = list->data; | 314 GaimRequestFieldGroup *group = list->data; |
315 GList *fields = gaim_request_field_group_get_fields(group); | 315 GList *fields = gaim_request_field_group_get_fields(group); |
316 GntWidget *hbox; | 316 GntWidget *hbox; |
317 | 317 |
318 /* XXX: Do something with the title, perhaps add a bold label */ | 318 gnt_box_add_widget(GNT_BOX(box), |
319 gnt_label_new_with_format(gaim_request_field_group_get_title(group), | |
320 GNT_TEXT_FLAG_BOLD)); | |
319 | 321 |
320 for (; fields ; fields = fields->next) | 322 for (; fields ; fields = fields->next) |
321 { | 323 { |
322 GaimRequestField *field = fields->data; | 324 GaimRequestField *field = fields->data; |
323 GaimRequestFieldType type = gaim_request_field_get_type(field); | 325 GaimRequestFieldType type = gaim_request_field_get_type(field); |
326 hbox = gnt_hbox_new(FALSE); | 328 hbox = gnt_hbox_new(FALSE); |
327 gnt_box_set_pad(GNT_BOX(hbox), 0); | 329 gnt_box_set_pad(GNT_BOX(hbox), 0); |
328 gnt_box_add_widget(GNT_BOX(box), hbox); | 330 gnt_box_add_widget(GNT_BOX(box), hbox); |
329 | 331 |
330 if (type != GAIM_REQUEST_FIELD_BOOLEAN) | 332 if (type != GAIM_REQUEST_FIELD_BOOLEAN) |
331 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(label)); | 333 { |
334 GntWidget *l = gnt_label_new(label); | |
335 gnt_widget_set_size(l, 0, 1); | |
336 gnt_box_add_widget(GNT_BOX(hbox), l); | |
337 } | |
332 | 338 |
333 if (type == GAIM_REQUEST_FIELD_BOOLEAN) | 339 if (type == GAIM_REQUEST_FIELD_BOOLEAN) |
334 { | 340 { |
335 GntWidget *check = gnt_check_box_new(label); | 341 GntWidget *check = gnt_check_box_new(label); |
336 gnt_check_box_set_checked(GNT_CHECK_BOX(check), | 342 gnt_check_box_set_checked(GNT_CHECK_BOX(check), |
374 } | 380 } |
375 else if (type == GAIM_REQUEST_FIELD_LIST) | 381 else if (type == GAIM_REQUEST_FIELD_LIST) |
376 { | 382 { |
377 const GList *list; | 383 const GList *list; |
378 gboolean multi = gaim_request_field_list_get_multi_select(field); | 384 gboolean multi = gaim_request_field_list_get_multi_select(field); |
379 GntWidget *tree = gnt_tree_new(); | 385 if (multi) |
380 gnt_box_add_widget(GNT_BOX(hbox), tree); | |
381 field->ui_data = tree; | |
382 | |
383 list = gaim_request_field_list_get_items(field); | |
384 for (; list; list = list->next) | |
385 { | 386 { |
386 const char *text = list->data; | 387 GntWidget *tree = gnt_tree_new(); |
387 gpointer key = gaim_request_field_list_get_data(field, text); | 388 gnt_box_add_widget(GNT_BOX(hbox), tree); |
388 if (multi) | 389 field->ui_data = tree; |
390 | |
391 list = gaim_request_field_list_get_items(field); | |
392 for (; list; list = list->next) | |
389 { | 393 { |
394 const char *text = list->data; | |
395 gpointer key = gaim_request_field_list_get_data(field, text); | |
390 gnt_tree_add_choice(GNT_TREE(tree), key, | 396 gnt_tree_add_choice(GNT_TREE(tree), key, |
391 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); | 397 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); |
392 if (gaim_request_field_list_is_selected(field, text)) | 398 if (gaim_request_field_list_is_selected(field, text)) |
393 gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); | 399 gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); |
394 } | 400 } |
395 else | 401 } |
402 else | |
403 { | |
404 GntWidget *combo = gnt_combo_box_new(); | |
405 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); | |
406 gnt_box_add_widget(GNT_BOX(hbox), combo); | |
407 field->ui_data = combo; | |
408 | |
409 list = gaim_request_field_list_get_items(field); | |
410 for (; list; list = list->next) | |
396 { | 411 { |
397 gnt_tree_add_row_after(GNT_TREE(tree), key, | 412 const char *text = list->data; |
398 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); | 413 gpointer key = gaim_request_field_list_get_data(field, text); |
414 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), key, text); | |
399 if (gaim_request_field_list_is_selected(field, text)) | 415 if (gaim_request_field_list_is_selected(field, text)) |
400 gnt_tree_set_selected(GNT_TREE(tree), key); | 416 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), key); |
401 } | 417 } |
402 } | 418 } |
403 } | 419 } |
404 #if 0 | 420 #if 0 |
405 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) | 421 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
411 { | 427 { |
412 gnt_box_add_widget(GNT_BOX(hbox), | 428 gnt_box_add_widget(GNT_BOX(hbox), |
413 gnt_label_new_with_format(_("Not implemented yet."), | 429 gnt_label_new_with_format(_("Not implemented yet."), |
414 GNT_TEXT_FLAG_BOLD)); | 430 GNT_TEXT_FLAG_BOLD)); |
415 } | 431 } |
416 if (fields->next) | |
417 gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); | |
418 } | 432 } |
433 if (list->next) | |
434 gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); | |
419 } | 435 } |
420 gnt_box_add_widget(GNT_BOX(window), box); | 436 gnt_box_add_widget(GNT_BOX(window), box); |
421 | 437 |
422 box = setup_button_box(userdata, request_fields_cb, fields, | 438 box = setup_button_box(userdata, request_fields_cb, fields, |
423 ok, ok_cb, cancel, cancel_cb, NULL); | 439 ok, ok_cb, cancel, cancel_cb, NULL); |
424 gnt_box_add_widget(GNT_BOX(window), box); | 440 gnt_box_add_widget(GNT_BOX(window), box); |
425 | 441 |
426 gnt_widget_show(window); | 442 gnt_widget_show(window); |
427 | |
428 | 443 |
429 return window; | 444 return window; |
430 } | 445 } |
431 | 446 |
432 static GaimRequestUiOps uiops = | 447 static GaimRequestUiOps uiops = |