| 409 tree_model = gtk_combo_box_get_model(combo_box); |
409 tree_model = gtk_combo_box_get_model(combo_box); |
| 410 if (!gtk_combo_box_get_active_iter(combo_box, &iter)) |
410 if (!gtk_combo_box_get_active_iter(combo_box, &iter)) |
| 411 return; |
411 return; |
| 412 |
412 |
| 413 if (combo->type == PURPLE_PREF_INT) { |
413 if (combo->type == PURPLE_PREF_INT) { |
| 414 gtk_tree_model_get(tree_model, &iter, PREF_DROPDOWN_VALUE, |
414 gint value; |
| 415 &combo->value.integer, -1); |
415 gtk_tree_model_get(tree_model, &iter, PREF_DROPDOWN_VALUE, &value, -1); |
| 416 purple_prefs_set_int(combo->key, combo->value.integer); |
416 purple_prefs_set_int(combo->key, value); |
| 417 } else if (combo->type == PURPLE_PREF_STRING) { |
417 } else if (combo->type == PURPLE_PREF_STRING) { |
| 418 gtk_tree_model_get(tree_model, &iter, PREF_DROPDOWN_VALUE, |
418 const gchar *value; |
| 419 &combo->value.string, -1); |
419 gtk_tree_model_get(tree_model, &iter, PREF_DROPDOWN_VALUE, &value, -1); |
| 420 purple_prefs_set_string(combo->key, combo->value.string); |
420 purple_prefs_set_string(combo->key, value); |
| 421 } else if (combo->type == PURPLE_PREF_BOOLEAN) { |
421 } else if (combo->type == PURPLE_PREF_BOOLEAN) { |
| 422 gtk_tree_model_get(tree_model, &iter, PREF_DROPDOWN_VALUE, |
422 gboolean value; |
| 423 &combo->value.boolean, -1); |
423 gtk_tree_model_get(tree_model, &iter, PREF_DROPDOWN_VALUE, &value, -1); |
| 424 purple_prefs_set_bool(combo->key, combo->value.boolean); |
424 purple_prefs_set_bool(combo->key, value); |
| 425 } else { |
425 } else { |
| 426 g_return_if_reached(); |
426 g_return_if_reached(); |
| 427 } |
427 } |
| 428 } |
428 } |
| 429 |
429 |
| 432 { |
432 { |
| 433 gchar *text; |
433 gchar *text; |
| 434 GtkListStore *store = NULL; |
434 GtkListStore *store = NULL; |
| 435 GtkTreeIter iter; |
435 GtkTreeIter iter; |
| 436 GtkTreeIter active; |
436 GtkTreeIter active; |
| |
437 int configured_int_value = 0; |
| |
438 const char *configured_str_value = NULL; |
| |
439 gboolean configured_bool_value = FALSE; |
| 437 |
440 |
| 438 g_return_if_fail(menuitems != NULL); |
441 g_return_if_fail(menuitems != NULL); |
| 439 |
442 |
| 440 if (combo->type == PURPLE_PREF_INT) { |
443 if (combo->type == PURPLE_PREF_INT) { |
| 441 combo->value.integer = purple_prefs_get_int(combo->key); |
444 configured_int_value = purple_prefs_get_int(combo->key); |
| 442 } else if (combo->type == PURPLE_PREF_STRING) { |
445 } else if (combo->type == PURPLE_PREF_STRING) { |
| 443 combo->value.string = purple_prefs_get_string(combo->key); |
446 configured_str_value = purple_prefs_get_string(combo->key); |
| 444 } else if (combo->type == PURPLE_PREF_BOOLEAN) { |
447 } else if (combo->type == PURPLE_PREF_BOOLEAN) { |
| 445 combo->value.boolean = purple_prefs_get_bool(combo->key); |
448 configured_bool_value = purple_prefs_get_bool(combo->key); |
| 446 } else { |
449 } else { |
| 447 g_return_if_reached(); |
450 g_return_if_reached(); |
| 448 } |
451 } |
| 449 |
452 |
| 450 store = GTK_LIST_STORE( |
453 store = GTK_LIST_STORE( |
| 481 PREF_DROPDOWN_VALUE, bool_value, |
484 PREF_DROPDOWN_VALUE, bool_value, |
| 482 -1); |
485 -1); |
| 483 } |
486 } |
| 484 |
487 |
| 485 if ((combo->type == PURPLE_PREF_INT && |
488 if ((combo->type == PURPLE_PREF_INT && |
| 486 combo->value.integer == int_value) || |
489 configured_int_value == int_value) || |
| 487 (combo->type == PURPLE_PREF_STRING && |
490 (combo->type == PURPLE_PREF_STRING && |
| 488 purple_strequal(combo->value.string, str_value)) || |
491 purple_strequal(configured_str_value, str_value)) || |
| 489 (combo->type == PURPLE_PREF_BOOLEAN && |
492 (combo->type == PURPLE_PREF_BOOLEAN && |
| 490 (combo->value.boolean == bool_value))) { |
493 (configured_bool_value == bool_value))) { |
| 491 |
494 |
| 492 active = iter; |
495 active = iter; |
| 493 } |
496 } |
| 494 |
497 |
| 495 menuitems = g_list_next(menuitems); |
498 menuitems = g_list_next(menuitems); |
| 505 pidgin_prefs_bind_dropdown(PidginPrefCombo *combo) |
508 pidgin_prefs_bind_dropdown(PidginPrefCombo *combo) |
| 506 { |
509 { |
| 507 GtkTreeModel *store = NULL; |
510 GtkTreeModel *store = NULL; |
| 508 GtkTreeIter iter; |
511 GtkTreeIter iter; |
| 509 GtkTreeIter active; |
512 GtkTreeIter active; |
| |
513 int pref_int_value = 0; |
| |
514 const char *pref_str_value = NULL; |
| |
515 gboolean pref_bool_value = FALSE; |
| 510 |
516 |
| 511 if (combo->type == PURPLE_PREF_INT) { |
517 if (combo->type == PURPLE_PREF_INT) { |
| 512 combo->value.integer = purple_prefs_get_int(combo->key); |
518 pref_int_value = purple_prefs_get_int(combo->key); |
| 513 } else if (combo->type == PURPLE_PREF_STRING) { |
519 } else if (combo->type == PURPLE_PREF_STRING) { |
| 514 combo->value.string = purple_prefs_get_string(combo->key); |
520 pref_str_value = purple_prefs_get_string(combo->key); |
| 515 } else if (combo->type == PURPLE_PREF_BOOLEAN) { |
521 } else if (combo->type == PURPLE_PREF_BOOLEAN) { |
| 516 combo->value.boolean = purple_prefs_get_bool(combo->key); |
522 pref_bool_value = purple_prefs_get_bool(combo->key); |
| 517 } else { |
523 } else { |
| 518 g_return_if_reached(); |
524 g_return_if_reached(); |
| 519 } |
525 } |
| 520 |
526 |
| 521 store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo->combo)); |
527 store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo->combo)); |
| 531 |
537 |
| 532 if (combo->type == PURPLE_PREF_INT) { |
538 if (combo->type == PURPLE_PREF_INT) { |
| 533 gtk_tree_model_get(store, &iter, |
539 gtk_tree_model_get(store, &iter, |
| 534 PREF_DROPDOWN_VALUE, &int_value, |
540 PREF_DROPDOWN_VALUE, &int_value, |
| 535 -1); |
541 -1); |
| 536 if (combo->value.integer == int_value) { |
542 if (pref_int_value == int_value) { |
| 537 active = iter; |
543 active = iter; |
| 538 break; |
544 break; |
| 539 } |
545 } |
| 540 } |
546 } |
| 541 else if (combo->type == PURPLE_PREF_STRING) { |
547 else if (combo->type == PURPLE_PREF_STRING) { |
| 542 gtk_tree_model_get(store, &iter, |
548 gtk_tree_model_get(store, &iter, |
| 543 PREF_DROPDOWN_VALUE, &str_value, |
549 PREF_DROPDOWN_VALUE, &str_value, |
| 544 -1); |
550 -1); |
| 545 if (purple_strequal(combo->value.string, str_value)) { |
551 if (purple_strequal(pref_str_value, str_value)) { |
| 546 active = iter; |
552 active = iter; |
| 547 break; |
553 break; |
| 548 } |
554 } |
| 549 } |
555 } |
| 550 else if (combo->type == PURPLE_PREF_BOOLEAN) { |
556 else if (combo->type == PURPLE_PREF_BOOLEAN) { |
| 551 gtk_tree_model_get(store, &iter, |
557 gtk_tree_model_get(store, &iter, |
| 552 PREF_DROPDOWN_VALUE, &bool_value, |
558 PREF_DROPDOWN_VALUE, &bool_value, |
| 553 -1); |
559 -1); |
| 554 if (combo->value.boolean == bool_value) { |
560 if (pref_bool_value == bool_value) { |
| 555 active = iter; |
561 active = iter; |
| 556 break; |
562 break; |
| 557 } |
563 } |
| 558 } |
564 } |
| 559 } while (gtk_tree_model_iter_next(store, &iter)); |
565 } while (gtk_tree_model_iter_next(store, &iter)); |