[shotwell] import-plugin: Move common files into plugin
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] import-plugin: Move common files into plugin
- Date: Sat, 4 Jun 2016 14:34:41 +0000 (UTC)
commit 54bd00ea1e6b622cb7e84c68775d72a70980d9c7
Author: Jens Georg <mail jensge org>
Date: Sat Jun 4 15:10:13 2016 +0200
import-plugin: Move common files into plugin
Signed-off-by: Jens Georg <mail jensge org>
plugins/shotwell-data-imports/Makefile | 4 +-
.../SqliteSupport.vala | 23 +++++++++----------
.../VersionNumber.vala | 9 +++----
3 files changed, 17 insertions(+), 19 deletions(-)
---
diff --git a/plugins/shotwell-data-imports/Makefile b/plugins/shotwell-data-imports/Makefile
index 52329e7..1769771 100644
--- a/plugins/shotwell-data-imports/Makefile
+++ b/plugins/shotwell-data-imports/Makefile
@@ -9,8 +9,8 @@ PLUGIN_PKGS := \
SRC_FILES := \
shotwell-data-imports.vala \
- ../common/VersionNumber.vala \
- ../common/SqliteSupport.vala \
+ VersionNumber.vala \
+ SqliteSupport.vala \
FSpotImporter.vala \
FSpotDatabaseBehavior.vala \
FSpotDatabase.vala \
diff --git a/plugins/common/SqliteSupport.vala b/plugins/shotwell-data-imports/SqliteSupport.vala
similarity index 95%
rename from plugins/common/SqliteSupport.vala
rename to plugins/shotwell-data-imports/SqliteSupport.vala
index 0dcc99c..859dc84 100644
--- a/plugins/common/SqliteSupport.vala
+++ b/plugins/shotwell-data-imports/SqliteSupport.vala
@@ -14,26 +14,26 @@ public errordomain DatabaseError {
}
public abstract class ImportableDatabaseTable {
-
+
protected static Sqlite.Database db;
-
+
public string table_name = null;
-
+
protected void set_table_name(string table_name) {
this.table_name = table_name;
}
-
+
// This method will throw an error on an SQLite return code unless it's OK, DONE, or ROW, which
// are considered normal results.
protected static void throw_error(string method, int res) throws DatabaseError {
string msg = "(%s) [%d] - %s".printf(method, res, db.errmsg());
-
+
switch (res) {
case Sqlite.OK:
case Sqlite.DONE:
case Sqlite.ROW:
return;
-
+
case Sqlite.PERM:
case Sqlite.BUSY:
case Sqlite.READONLY:
@@ -45,26 +45,26 @@ public abstract class ImportableDatabaseTable {
case Sqlite.FORMAT:
case Sqlite.NOTADB:
throw new DatabaseError.BACKING(msg);
-
+
case Sqlite.NOMEM:
throw new DatabaseError.MEMORY(msg);
-
+
case Sqlite.ABORT:
case Sqlite.LOCKED:
case Sqlite.INTERRUPT:
throw new DatabaseError.ABORT(msg);
-
+
case Sqlite.FULL:
case Sqlite.EMPTY:
case Sqlite.TOOBIG:
case Sqlite.CONSTRAINT:
case Sqlite.RANGE:
throw new DatabaseError.LIMITS(msg);
-
+
case Sqlite.SCHEMA:
case Sqlite.MISMATCH:
throw new DatabaseError.TYPESPEC(msg);
-
+
case Sqlite.ERROR:
case Sqlite.INTERNAL:
case Sqlite.MISUSE:
@@ -73,4 +73,3 @@ public abstract class ImportableDatabaseTable {
}
}
}
-
diff --git a/plugins/common/VersionNumber.vala b/plugins/shotwell-data-imports/VersionNumber.vala
similarity index 98%
rename from plugins/common/VersionNumber.vala
rename to plugins/shotwell-data-imports/VersionNumber.vala
index 503cd65..7077597 100644
--- a/plugins/common/VersionNumber.vala
+++ b/plugins/shotwell-data-imports/VersionNumber.vala
@@ -12,25 +12,25 @@ namespace Utils {
*/
public class VersionNumber : Object, Gee.Comparable<VersionNumber> {
private int[] version;
-
+
public VersionNumber(int[] version) {
this.version = version;
}
-
+
public VersionNumber.from_string(string str_version, string separator = ".") {
string[] version_items = str_version.split(separator);
this.version = new int[version_items.length];
for (int i = 0; i < version_items.length; i++)
this.version[i] = int.parse(version_items[i]);
}
-
+
public string to_string() {
string[] version_items = new string[this.version.length];
for (int i = 0; i < this.version.length; i++)
version_items[i] = this.version[i].to_string();
return string.joinv(".", version_items);
}
-
+
public int compare_to(VersionNumber other) {
int max_len = ((this.version.length > other.version.length) ?
this.version.length : other.version.length);
@@ -47,4 +47,3 @@ public class VersionNumber : Object, Gee.Comparable<VersionNumber> {
}
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]