[rygel/wip/lms-tizen: 9/12] lms: get db path over dbus from LMS



commit 1ab727d453417a6a81ca27bf3fb80ce6f7c44ac4
Author: Alexander Kanavin <alex kanavin gmail com>
Date:   Mon Mar 24 17:49:19 2014 +0200

    lms: get db path over dbus from LMS

 src/plugins/lms/Makefile.am                    |    3 +-
 src/plugins/lms/rygel-lms-dbus-interfaces.vala |   28 ++++++++++++++++++++++++
 src/plugins/lms/rygel-lms-root-container.vala  |   14 ++++++++---
 3 files changed, 40 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/lms/Makefile.am b/src/plugins/lms/Makefile.am
index 1e777dd..f96a2ab 100644
--- a/src/plugins/lms/Makefile.am
+++ b/src/plugins/lms/Makefile.am
@@ -22,7 +22,8 @@ librygel_lms_la_SOURCES = \
        rygel-lms-image-year.vala \
        rygel-lms-sql-function.vala \
        rygel-lms-sql-operator.vala \
-       rygel-lms-collate.c
+       rygel-lms-collate.c \
+       rygel-lms-dbus-interfaces.vala
 
 librygel_lms_la_VALAFLAGS = \
        --enable-experimental \
diff --git a/src/plugins/lms/rygel-lms-dbus-interfaces.vala b/src/plugins/lms/rygel-lms-dbus-interfaces.vala
new file mode 100644
index 0000000..6c14f5b
--- /dev/null
+++ b/src/plugins/lms/rygel-lms-dbus-interfaces.vala
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 Intel Corporation.
+ *
+ * Author: Alexander Kanavin <alex kanavin gmail com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+[DBus (name = "org.lightmediascanner.Scanner1")]
+interface Rygel.LMS.DBus : Object {
+    public abstract string data_base_path { owned get; }
+
+    //TODO: add all the other API items which are currently unused
+}
\ No newline at end of file
diff --git a/src/plugins/lms/rygel-lms-root-container.vala b/src/plugins/lms/rygel-lms-root-container.vala
index d7307be..a7a7f98 100644
--- a/src/plugins/lms/rygel-lms-root-container.vala
+++ b/src/plugins/lms/rygel-lms-root-container.vala
@@ -38,11 +38,17 @@ public class Rygel.LMS.RootContainer : Rygel.SimpleContainer {
 
         base.root(title);
 
-        string db_path;
+        string db_path = null;
         try {
-            db_path = config.get_string ("LightMediaScanner", "db-path");
-            debug ("Using sqlite database location '%s'", db_path);
-        } catch (GLib.Error error) {
+            LMS.DBus lms_proxy = Bus.get_proxy_sync (BusType.SESSION,
+                                            "org.lightmediascanner",
+                                            "/org/lightmediascanner/Scanner1");
+            db_path = lms_proxy.data_base_path;
+            debug ("Got db path %s from LMS over dbus", db_path);
+        } catch (Error e) {
+            warning("Using dbus to get db location failed: %s", e.message);
+        }
+        if (db_path == null) {
             db_path = Environment.get_user_config_dir() +
                       "/lightmediascannerd/db.sqlite3";
             debug  ("Using default sqlite database location %s", db_path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]