| 650 | } |
| 651 | |
| 652 | static void |
| 653 | select_preset2(signal_user_data_t *ud, hb_preset_index_t *path) |
| 654 | { |
| 655 | GtkTreeView *treeview; |
| 656 | GtkTreeSelection *selection; |
| 657 | GtkTreeModel *store; |
| 658 | GtkTreeIter iter; |
| 659 | GtkTreePath *treepath; |
| 660 | |
| 661 | if (path == NULL || path->depth == 0) |
| 662 | return; |
| 663 | |
| 664 | treeview = GTK_TREE_VIEW(ghb_builder_widget("presets_list")); |
| 665 | selection = gtk_tree_view_get_selection (treeview); |
| 666 | store = gtk_tree_view_get_model (treeview); |
| 667 | treepath = tree_path_new_from_index(path); |
| 668 | if (treepath != NULL) |
| 669 | { |
| 670 | gtk_tree_view_expand_to_path(treeview, treepath); |
| 671 | if (gtk_tree_model_get_iter(store, &iter, treepath)) |
| 672 | { |
| 673 | gtk_tree_selection_select_iter(selection, &iter); |
| 674 | } |
| 675 | else |
| 676 | { |
| 677 | if (gtk_tree_model_get_iter_first(store, &iter)) |
| 678 | gtk_tree_selection_select_iter(selection, &iter); |
| 679 | } |
| 680 | // Make the selection visible in scroll window if it is not. |
| 681 | gtk_tree_view_scroll_to_cell(treeview, treepath, NULL, FALSE, 0, 0); |
| 682 | gtk_tree_path_free(treepath); |
| 683 | } |
| 684 | set_preset_menu_button_label(ud, path); |
| 685 | |
| 686 | int type = preset_get_type(path); |
| 687 | GSimpleAction * action; |
| 688 | |
| 689 | action =GHB_APPLICATION_ACTION("preset-rename"); |
| 690 | g_simple_action_set_enabled(action, type == HB_PRESET_TYPE_CUSTOM); |
| 691 | action = GHB_APPLICATION_ACTION("preset-save"); |
| 692 | g_simple_action_set_enabled(action, type == HB_PRESET_TYPE_CUSTOM); |
| 693 | action = GHB_APPLICATION_ACTION("preset-default"); |
| 694 | g_simple_action_set_enabled(action, !preset_is_default(path)); |
| 695 | } |
| 696 | |
| 697 | void |
| 698 | ghb_select_preset(signal_user_data_t *ud, const char *name, int type) |
no test coverage detected