Makes a copy of the preset and assigns "PresetFullName" which is use to look up the preset in the preset list should the need arrise, e.g. saving changes to the preset.
| 3179 | // is use to look up the preset in the preset list should the need |
| 3180 | // arrise, e.g. saving changes to the preset. |
| 3181 | GhbValue* |
| 3182 | ghb_get_current_preset(signal_user_data_t *ud) |
| 3183 | { |
| 3184 | GtkTreeView *tv; |
| 3185 | GtkTreeModel *tm; |
| 3186 | GtkTreeSelection *ts; |
| 3187 | GtkTreeIter ti; |
| 3188 | GhbValue *preset = NULL; |
| 3189 | |
| 3190 | tv = GTK_TREE_VIEW(ghb_builder_widget("presets_list")); |
| 3191 | ts = gtk_tree_view_get_selection(tv); |
| 3192 | if (gtk_tree_selection_get_selected(ts, &tm, &ti)) |
| 3193 | { |
| 3194 | hb_preset_index_t *path; |
| 3195 | |
| 3196 | path = tree_get_index(tm, &ti); |
| 3197 | preset = hb_preset_get(path); |
| 3198 | if (preset != NULL) |
| 3199 | { |
| 3200 | char *fullname; |
| 3201 | |
| 3202 | preset = hb_value_dup(preset); |
| 3203 | fullname = preset_get_fullname(path, "/", FALSE); |
| 3204 | ghb_dict_set_string(preset, "PresetFullName", fullname); |
| 3205 | free(fullname); |
| 3206 | } |
| 3207 | free(path); |
| 3208 | } |
| 3209 | return preset; |
| 3210 | } |
| 3211 | |
| 3212 | G_MODULE_EXPORT void |
| 3213 | presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud) |
no test coverage detected