summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-12-13 07:09:22 +0000
committerDavid Robillard <d@drobilla.net>2006-12-13 07:09:22 +0000
commite5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1 (patch)
treeb5fe5c74ba99e604f7beca12617ff71b6c075ae1 /src/libs/client
parentf4bec186d0dfe1e9f0a136c11a6ab0c5e1d74aa9 (diff)
downloadingen-e5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1.tar.gz
ingen-e5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1.tar.bz2
ingen-e5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1.zip
Path parent/child bug fixes, added unit tests.
Breadcrumb/browsing/subsubpatch bug fixes. Fixed about window icon and glade error messages. git-svn-id: http://svn.drobilla.net/lad/ingen@223 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/Loader.cpp28
-rw-r--r--src/libs/client/Loader.h1
2 files changed, 16 insertions, 13 deletions
diff --git a/src/libs/client/Loader.cpp b/src/libs/client/Loader.cpp
index 68b04b58..af51d4c8 100644
--- a/src/libs/client/Loader.cpp
+++ b/src/libs/client/Loader.cpp
@@ -46,6 +46,7 @@ Loader::Loader(SharedPtr<ModelEngineInterface> engine, SharedPtr<Namespaces> nam
bool
Loader::load(const Glib::ustring& filename,
const Path& parent,
+ string patch_name,
Glib::ustring patch_uri,
MetadataMap data)
{
@@ -82,23 +83,24 @@ Loader::load(const Glib::ustring& filename,
size_t patch_poly = atoi(((*results.begin())["poly"]).c_str());
- /* Get name (if available) */
+ /* Get name (if available/necessary) */
- query = RDFQuery(Glib::ustring(
- "SELECT DISTINCT ?name \nFROM <") + document_uri + ">\nWHERE {\n\t" +
- patch_uri + " ingen:name ?name .\n"
- "}");
+ if (patch_name == "") {
+ patch_name = string(filename.substr(filename.find_last_of("/")+1));
+
+ query = RDFQuery(Glib::ustring(
+ "SELECT DISTINCT ?name FROM <") + document_uri + "> WHERE {\n" +
+ patch_uri + " ingen:name ?name .\n"
+ "}");
- results = query.run(document_uri);
-
- string patch_name = string(filename.substr(filename.find_last_of("/")+1));
- Path patch_path = parent.base() + string(filename.substr(filename.find_last_of("/")+1));
+ results = query.run(document_uri);
- if (results.size() > 0)
- patch_path = parent.base() + string((*results.begin())["name"]);
-
- cerr << "************ PATCH: " << patch_path << ", poly = " << patch_poly << endl;
+ if (results.size() > 0)
+ patch_name = string((*results.begin())["name"]);
+ }
+ Path patch_path = parent.base() + patch_name;
+ cerr << "************ PATCH: " << patch_path << ", poly = " << patch_poly << endl;
_engine->create_patch(patch_path, patch_poly);
diff --git a/src/libs/client/Loader.h b/src/libs/client/Loader.h
index 86317c1f..bca385aa 100644
--- a/src/libs/client/Loader.h
+++ b/src/libs/client/Loader.h
@@ -37,6 +37,7 @@ public:
bool load(const Glib::ustring& filename,
const Path& parent,
+ string patch_name,
Glib::ustring patch_uri = "",
MetadataMap initial_data = MetadataMap());