[gnome-builder/wip/chergert/gnome-builder-flatpak: 6/6] flatpak: start on install API for daemon



commit 5592565e39e27a3f502ac5e5f3e5f41574fdc268
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 10 23:23:54 2019 -0700

    flatpak: start on install API for daemon

 .../flatpak/daemon/ipc-flatpak-service-impl.c      | 21 ++++++++++++++++
 src/plugins/flatpak/daemon/meson.build             |  8 +++++++
 .../daemon/org.gnome.Builder.Flatpak.Service.xml   | 10 ++++++++
 .../daemon/org.gnome.Builder.Flatpak.Transfer.xml  | 28 ++++++++++++++++++++++
 4 files changed, 67 insertions(+)
---
diff --git a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c 
b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
index 94ade76e9..e1921ed66 100644
--- a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
+++ b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
@@ -475,12 +475,33 @@ ipc_flatpak_service_impl_install_changed_cb (IpcFlatpakServiceImpl *self,
     }
 }
 
+static gboolean
+ipc_flatpak_service_impl_install (IpcFlatpakService     *service,
+                                  GDBusMethodInvocation *invocation,
+                                  const gchar           *full_ref_name)
+{
+  g_autoptr(FlatpakRef) ref = NULL;
+  g_autoptr(GError) error = NULL;
+
+  g_assert (IPC_IS_FLATPAK_SERVICE_IMPL (service));
+  g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation));
+  g_assert (full_ref_name != NULL);
+
+  if (!(ref = flatpak_ref_parse (full_ref_name, &error)))
+    return complete_wrapped_error (invocation, error);
+
+  ipc_flatpak_service_complete_install (service, invocation, "");
+
+  return TRUE;
+}
+
 static void
 service_iface_init (IpcFlatpakServiceIface *iface)
 {
   iface->handle_add_installation = ipc_flatpak_service_impl_add_installation;
   iface->handle_list_runtimes = ipc_flatpak_service_impl_list_runtimes;
   iface->handle_runtime_is_known = ipc_flatpak_service_impl_runtime_is_known;
+  iface->handle_install = ipc_flatpak_service_impl_install;
 }
 
 G_DEFINE_TYPE_WITH_CODE (IpcFlatpakServiceImpl, ipc_flatpak_service_impl, IPC_TYPE_FLATPAK_SERVICE_SKELETON,
diff --git a/src/plugins/flatpak/daemon/meson.build b/src/plugins/flatpak/daemon/meson.build
index 508ba7065..dcc4f8663 100644
--- a/src/plugins/flatpak/daemon/meson.build
+++ b/src/plugins/flatpak/daemon/meson.build
@@ -11,10 +11,17 @@ ipc_flatpak_service_src = gnome.gdbus_codegen('ipc-flatpak-service',
          namespace: 'Ipc',
 )
 
+ipc_flatpak_transfer_src = gnome.gdbus_codegen('ipc-flatpak-transfer',
+           sources: 'org.gnome.Builder.Flatpak.Transfer.xml',
+  interface_prefix: 'org.gnome.Builder.',
+         namespace: 'Ipc',
+)
+
 gnome_builder_flatpak_sources = [
   'gnome-builder-flatpak.c',
   'ipc-flatpak-service-impl.c',
   ipc_flatpak_service_src,
+  ipc_flatpak_transfer_src,
 ]
 
 gnome_builder_flatpak = executable('gnome-builder-flatpak', gnome_builder_flatpak_sources,
@@ -26,6 +33,7 @@ gnome_builder_flatpak = executable('gnome-builder-flatpak', gnome_builder_flatpa
 test_flatpak_sources = [
   'test-flatpak.c',
   ipc_flatpak_service_src,
+  ipc_flatpak_transfer_src,
 ]
 
 test_flatpak = executable('test-flatpak', 'test-flatpak.c', test_flatpak_sources,
diff --git a/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Service.xml 
b/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Service.xml
index 45641018e..c680e296b 100644
--- a/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Service.xml
+++ b/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Service.xml
@@ -57,5 +57,15 @@
       <arg name="is_known" direction="out" type="b"/>
       <arg name="download_size" direction="out" type="x"/>
     </method>
+    <!--
+      Install:
+      @full_ref_name: the full name of the target to install such as "runtime/org.gnome.Sdk/x86_64/master"
+
+      Installs a ref from a configured remote.
+    -->
+    <method name="Install">
+      <arg name="full_ref_name" direction="in" type="s"/>
+      <arg name="transfer" direction="out" type="o"/>
+    </method>
   </interface>
 </node>
diff --git a/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Transfer.xml 
b/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Transfer.xml
new file mode 100644
index 000000000..e8fe77134
--- /dev/null
+++ b/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Transfer.xml
@@ -0,0 +1,28 @@
+<!DOCTYPE node PUBLIC
+        "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+        "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"; >
+<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd";>
+  <!--
+    Copyright 2019 Christian Hergert <chergert redhat 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 3 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, see <http://www.gnu.org/licenses/>.
+ 
+    SPDX-License-Identifier: GPL-3.0-or-later
+  -->
+  <interface name="org.gnome.Builder.Flatpak.Transfer">
+    <property name="Fraction" type="d" access="read"/>
+    <property name="Message" type="s" access="read"/>
+    <method name="Cancel"/>
+  </interface>
+</node>


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