MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / ghb_init_combo_box

Function ghb_init_combo_box

gtk/src/hb-backend.c:1528–1562  ·  view source on GitHub ↗

Set up the model for the combo box

Source from the content-addressed store, hash-verified

1526
1527// Set up the model for the combo box
1528void
1529ghb_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
1564void
1565ghb_audio_samplerate_opts_set(GtkComboBox *combo)

Callers 2

init_ui_combo_boxesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected