[tracker] tracker: Move all DBus work into its own private module
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker: Move all DBus work into its own private module
- Date: Wed, 10 Dec 2014 15:53:21 +0000 (UTC)
commit 8440c24f488e86ec7d724b2e182bd99ec278e3bf
Author: Martyn Russell <martyn lanedo com>
Date: Mon Oct 6 13:48:50 2014 +0100
tracker: Move all DBus work into its own private module
src/tracker/tracker-dbus.c | 70 ++++++++++++++++++++++++++++++++++++++++++++
src/tracker/tracker-dbus.h | 32 ++++++++++++++++++++
2 files changed, 102 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker/tracker-dbus.c b/src/tracker/tracker-dbus.c
new file mode 100644
index 0000000..4644d33
--- /dev/null
+++ b/src/tracker/tracker-dbus.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2008, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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.
+ */
+
+#include "config.h"
+
+#include <gio/gio.h>
+#include <glib/gi18n.h>
+
+#include <libtracker-common/tracker-common.h>
+
+#include "tracker-dbus.h"
+
+gboolean
+tracker_dbus_get_connection (const gchar *name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ GDBusProxyFlags flags,
+ GDBusConnection **connection,
+ GDBusProxy **proxy)
+{
+ GError *error = NULL;
+
+ *connection = g_bus_get_sync (TRACKER_IPC_BUS, NULL, &error);
+
+ if (!*connection) {
+ g_critical ("%s, %s",
+ _("Could not get D-Bus connection"),
+ error ? error->message : _("No error given"));
+ g_clear_error (&error);
+
+ return FALSE;
+ }
+
+ *proxy = g_dbus_proxy_new_sync (*connection,
+ flags,
+ NULL,
+ name,
+ object_path,
+ interface_name,
+ NULL,
+ &error);
+
+ if (error) {
+ g_critical ("%s, %s",
+ _("Could not create D-Bus proxy to tracker-store"),
+ error ? error->message : _("No error given"));
+ g_clear_error (&error);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/src/tracker/tracker-dbus.h b/src/tracker/tracker-dbus.h
new file mode 100644
index 0000000..13d30c0
--- /dev/null
+++ b/src/tracker/tracker-dbus.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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.
+ */
+
+#include <glib.h>
+
+#ifndef __TRACKER_DBUS_H__
+#define __TRACKER_DBUS_H__
+
+gboolean tracker_dbus_get_connection (const gchar *name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ GDBusProxyFlags flags,
+ GDBusConnection **connection,
+ GDBusProxy **proxy);
+
+#endif /* __TRACKER_DBUS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]