Set up the model for the combo box
| 1526 | |
| 1527 | // Set up the model for the combo box |
| 1528 | void |
| 1529 | ghb_init_combo_box(GtkComboBox *combo) |
| 1530 | { |
| 1531 | GtkListStore *store; |
| 1532 | GtkCellRenderer *cell; |
| 1533 | |
| 1534 | ghb_log_func(); |
| 1535 | // First modify the combobox model to allow greying out of options |
| 1536 | if (combo == NULL) |
| 1537 | return; |
| 1538 | // Store contains: |
| 1539 | // 1 - String to display |
| 1540 | // 2 - bool indicating whether the entry is selectable (grey or not) |
| 1541 | // 3 - String that is used for presets |
| 1542 | // 4 - Int value determined by backend |
| 1543 | store = gtk_list_store_new(4, G_TYPE_STRING, G_TYPE_BOOLEAN, |
| 1544 | G_TYPE_STRING, G_TYPE_DOUBLE); |
| 1545 | gtk_combo_box_set_model(combo, GTK_TREE_MODEL(store)); |
| 1546 | gtk_combo_box_set_id_column(combo, 2); |
| 1547 | |
| 1548 | if (!gtk_combo_box_get_has_entry(combo)) |
| 1549 | { |
| 1550 | gtk_cell_layout_clear(GTK_CELL_LAYOUT(combo)); |
| 1551 | cell = GTK_CELL_RENDERER(gtk_cell_renderer_text_new()); |
| 1552 | g_object_set(cell, "max-width-chars", 80, NULL); |
| 1553 | g_object_set(cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
| 1554 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, FALSE); |
| 1555 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell, |
| 1556 | "markup", 0, "sensitive", 1, NULL); |
| 1557 | } |
| 1558 | else |
| 1559 | { // Combo box entry |
| 1560 | gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(combo), 0); |
| 1561 | } |
| 1562 | } |
| 1563 | |
| 1564 | void |
| 1565 | ghb_audio_samplerate_opts_set(GtkComboBox *combo) |
no outgoing calls
no test coverage detected