diff options
author | David Robillard <d@drobilla.net> | 2015-03-07 10:22:52 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-03-07 10:22:52 +0000 |
commit | 99e22f10251dc0a90ebdcd97ed323beb05b4ac3a (patch) | |
tree | 8396bba7c48bbba35b4fa8b19a2cc35ff008a4a6 | |
parent | e1d8bd8aef329c0ba4bf82975ad0a2d327a9fcd3 (diff) | |
download | jalv-99e22f10251dc0a90ebdcd97ed323beb05b4ac3a.tar.gz jalv-99e22f10251dc0a90ebdcd97ed323beb05b4ac3a.tar.bz2 jalv-99e22f10251dc0a90ebdcd97ed323beb05b4ac3a.zip |
Save preset bundles with standard naming scheme.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5620 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/jalv_gtk.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c index 8148435..2e95941 100644 --- a/src/jalv_gtk.c +++ b/src/jalv_gtk.c @@ -351,26 +351,39 @@ on_save_preset_activate(GtkWidget* widget, void* ptr) gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dot_lv2); free(dot_lv2); - GtkWidget* content = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); - GtkBox* box = GTK_BOX(new_box(true, 8)); - GtkWidget* uri_label = gtk_label_new("URI (Optional):"); - GtkWidget* uri_entry = gtk_entry_new(); - + GtkWidget* content = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + GtkBox* box = GTK_BOX(new_box(true, 8)); + GtkWidget* uri_label = gtk_label_new("URI (Optional):"); + GtkWidget* uri_entry = gtk_entry_new(); + GtkWidget* add_prefix = gtk_check_button_new_with_mnemonic( + "_Prefix plugin name"); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(add_prefix), TRUE); gtk_box_pack_start(box, uri_label, FALSE, TRUE, 2); gtk_box_pack_start(box, uri_entry, TRUE, TRUE, 2); gtk_box_pack_start(GTK_BOX(content), GTK_WIDGET(box), FALSE, FALSE, 6); + gtk_box_pack_start(GTK_BOX(content), add_prefix, FALSE, FALSE, 6); gtk_widget_show_all(GTK_WIDGET(dialog)); gtk_entry_set_activates_default(GTK_ENTRY(uri_entry), TRUE); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { - const char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); - const char* uri = gtk_entry_get_text(GTK_ENTRY(uri_entry)); + const char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + const char* uri = gtk_entry_get_text(GTK_ENTRY(uri_entry)); + const char* prefix = ""; + const char* sep = ""; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(add_prefix))) { + LilvNode* plug_name = lilv_plugin_get_name(jalv->plugin); + prefix = lilv_node_as_string(plug_name); + sep = "_"; + lilv_node_free(plug_name); + } char* dirname = g_path_get_dirname(path); char* basename = g_path_get_basename(path); char* sym = symbolify(basename); - char* bundle = g_strjoin(NULL, sym, ".lv2/", NULL); + char* sprefix = symbolify(prefix); + char* bundle = g_strjoin(NULL, sprefix, sep, sym, ".preset.lv2/", NULL); char* file = g_strjoin(NULL, sym, ".ttl", NULL); char* dir = g_build_filename(dirname, bundle, NULL); |