| 1635 | } |
| 1636 | |
| 1637 | static void |
| 1638 | presets_list_append(signal_user_data_t *ud, const hb_preset_index_t *path) |
| 1639 | { |
| 1640 | hb_preset_index_t *folder_path; |
| 1641 | hb_value_t *dict; |
| 1642 | GtkTreeView *treeview; |
| 1643 | GtkTreeStore *store; |
| 1644 | GtkTreePath *folder_treepath; |
| 1645 | GtkTreeIter iter, parent_iter, *piter; |
| 1646 | const gchar *name; |
| 1647 | const gchar *description; |
| 1648 | gint type; |
| 1649 | gboolean is_folder; |
| 1650 | gboolean is_default; |
| 1651 | |
| 1652 | folder_path = hb_preset_index_dup(path); |
| 1653 | folder_path->depth--; |
| 1654 | |
| 1655 | dict = hb_preset_get(path); |
| 1656 | if (dict == NULL) |
| 1657 | { |
| 1658 | g_message("Ack! Desync between presets and preset list"); |
| 1659 | return; |
| 1660 | } |
| 1661 | |
| 1662 | treeview = GTK_TREE_VIEW(ghb_builder_widget("presets_list")); |
| 1663 | store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview)); |
| 1664 | |
| 1665 | folder_treepath = tree_path_new_from_index(folder_path); |
| 1666 | if (folder_treepath != NULL) |
| 1667 | { |
| 1668 | gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &parent_iter, |
| 1669 | folder_treepath); |
| 1670 | piter = &parent_iter; |
| 1671 | gtk_tree_path_free(folder_treepath); |
| 1672 | } |
| 1673 | else |
| 1674 | { |
| 1675 | piter = NULL; |
| 1676 | } |
| 1677 | |
| 1678 | // Additional settings, add row |
| 1679 | name = ghb_dict_get_string(dict, "PresetName"); |
| 1680 | description = ghb_dict_get_string(dict, "PresetDescription"); |
| 1681 | type = ghb_dict_get_int(dict, "Type"); |
| 1682 | is_folder = ghb_dict_get_bool(dict, "Folder"); |
| 1683 | is_default = ghb_dict_get_bool(dict, "Default"); |
| 1684 | |
| 1685 | gtk_tree_store_append(store, &iter, piter); |
| 1686 | gtk_tree_store_set(store, &iter, |
| 1687 | 0, name, |
| 1688 | 1, is_default ? 700 : 400, |
| 1689 | 2, is_folder && type == HB_PRESET_TYPE_CUSTOM ? 2 : 0, |
| 1690 | 3, description, |
| 1691 | 4, type == HB_PRESET_TYPE_OFFICIAL ? 0 : 1, |
| 1692 | -1); |
| 1693 | if (is_folder) |
| 1694 | { |
no test coverage detected