← Back to team overview

deja-dup-team team mailing list archive

[Merge] lp:~fenisilius/deja-dup/acd_support into lp:deja-dup

 

Ignacio Quezada has proposed merging lp:~fenisilius/deja-dup/acd_support into lp:deja-dup.

Requested reviews:
  Déjà Dup Developers (deja-dup-hackers)

For more details, see:
https://code.launchpad.net/~fenisilius/deja-dup/acd_support/+merge/302227

Support for the new Amazon Cloud Drive. This patch adds support for the new backend.

duplicity already supports ACD, so this would just use the duplicity capabilities.

An external dependency is needed to use ACD, as there is to use S3 ("boto"). In this case it is the acd_cli which beside from being a cli toold it can be imported in python as well. So that dependency check would ensure the possibility to use ACD.
-- 
Your team Déjà Dup Developers is requested to review the proposed merge of lp:~fenisilius/deja-dup/acd_support into lp:deja-dup.
=== modified file 'data/org.gnome.DejaDup.gschema.xml.in'
--- data/org.gnome.DejaDup.gschema.xml.in	2015-11-29 15:53:51 +0000
+++ data/org.gnome.DejaDup.gschema.xml.in	2016-08-07 21:09:16 +0000
@@ -70,6 +70,7 @@
         <choice value='rackspace'/>
         <choice value='openstack'/>
         <choice value='s3'/>
+        <choice value='acd'/>
         <choice value='u1'/>
       </choices>
       <default>'auto'</default>
@@ -78,6 +79,7 @@
     </key>
     <child name="rackspace" schema="org.gnome.DejaDup.Rackspace"/>
     <child name="openstack" schema="org.gnome.DejaDup.OpenStack"/>
+    <child name="acd" schema="org.gnome.DejaDup.ACD"/>
     <child name="s3" schema="org.gnome.DejaDup.S3"/>
     <child name="gcs" schema="org.gnome.DejaDup.GCS"/>
     <child name="gdrive" schema="org.gnome.DejaDup.GDrive"/>
@@ -100,6 +102,13 @@
       <_description>An optional folder name to store files in.  This folder will be created in the chosen bucket.</_description>
     </key>
   </schema>
+  <schema id="org.gnome.DejaDup.ACD" path="/org/gnome/deja-dup/acd/">
+    <key name="folder" type="s">
+      <default>'$HOSTNAME'</default>
+      <_summary>The Amazon ACD folder</_summary>
+      <_description>A folder name to store files in.  This folder has to be created beforehand.</_description>
+    </key>
+  </schema>
   <schema id="org.gnome.DejaDup.GCS" path="/org/gnome/deja-dup/gcs/">
     <key name="id" type="s">
       <default>''</default>

=== modified file 'deja-dup/widgets/CMakeLists.txt'
--- deja-dup/widgets/CMakeLists.txt	2015-11-29 15:53:51 +0000
+++ deja-dup/widgets/CMakeLists.txt	2016-08-07 21:09:16 +0000
@@ -27,6 +27,7 @@
                        ConfigLabelLocation.vala
                        ConfigList.vala
                        ConfigLocation.vala
+                       ConfigLocationACD.vala
                        ConfigLocationCustom.vala
                        ConfigLocationDAV.vala
                        ConfigLocationFile.vala

=== modified file 'deja-dup/widgets/ConfigLabelLocation.vala'
--- deja-dup/widgets/ConfigLabelLocation.vala	2015-11-29 15:53:51 +0000
+++ deja-dup/widgets/ConfigLabelLocation.vala	2016-08-07 21:09:16 +0000
@@ -27,6 +27,7 @@
   FilteredSettings file_root;
   FilteredSettings gdrive_root;
   FilteredSettings s3_root;
+  FilteredSettings acd_root;
   FilteredSettings rackspace_root;
   FilteredSettings openstack_root;
 
@@ -42,6 +43,7 @@
     watch_key(null, (file_root = DejaDup.get_settings(FILE_ROOT)));
     watch_key(null, (gdrive_root = DejaDup.get_settings(GDRIVE_ROOT)));
     watch_key(null, (s3_root = DejaDup.get_settings(S3_ROOT)));
+    watch_key(null, (acd_root = DejaDup.get_settings(ACD_ROOT)));
     watch_key(null, (rackspace_root = DejaDup.get_settings(RACKSPACE_ROOT)));
     watch_key(null, (openstack_root = DejaDup.get_settings(OPENSTACK_ROOT)));
     set_from_config.begin();

=== modified file 'deja-dup/widgets/ConfigLocation.vala'
--- deja-dup/widgets/ConfigLocation.vala	2015-11-29 15:53:51 +0000
+++ deja-dup/widgets/ConfigLocation.vala	2016-08-07 21:09:16 +0000
@@ -60,6 +60,7 @@
 
   int index_ftp;
   int index_dav;
+  int index_acd = -2;
   int index_s3 = -2;
   int index_gcs = -2;
   int index_gdrive = -2;
@@ -113,6 +114,7 @@
 
     // Insert cloud providers
     insert_u1();
+    insert_acd();
     insert_s3();
     insert_gcs();
     insert_gdrive();
@@ -176,6 +178,14 @@
 
   delegate void CloudCallback();
 
+  void insert_acd() {
+    insert_cloud_if_available("acd", BackendACD.get_checker(),
+                              new ThemedIcon("deja-dup-cloud"),
+                              _("Amazon ACD"),
+                              new ConfigLocationACD(label_sizes),
+                              ref index_acd, insert_acd);
+  }
+
   void insert_s3() {
     insert_cloud_if_available("s3", BackendS3.get_checker(),
                               new ThemedIcon("deja-dup-cloud"),
@@ -442,7 +452,9 @@
 
     // Check the backend type, then GIO uri if needed
     var backend = Backend.get_default_type();
-    if (backend == "s3")
+    if (backend == "acd")
+      index = index_acd;
+    else if (backend == "s3")
       index = index_s3;
     else if (backend == "gcs")
       index = index_gcs;
@@ -538,7 +550,9 @@
     string uuid;
     store.get(iter, COL_INDEX, out index, COL_UUID, out uuid);
 
-    if (index == index_s3)
+    if (index == index_acd)
+      settings.set_string(BACKEND_KEY, "acd");
+    else if (index == index_s3)
       settings.set_string(BACKEND_KEY, "s3");
     else if (index == index_gcs)
       settings.set_string(BACKEND_KEY, "gcs");

=== added file 'deja-dup/widgets/ConfigLocationACD.vala'
--- deja-dup/widgets/ConfigLocationACD.vala	1970-01-01 00:00:00 +0000
+++ deja-dup/widgets/ConfigLocationACD.vala	2016-08-07 21:09:16 +0000
@@ -0,0 +1,37 @@
+/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
+/*
+    This file is part of Déjà Dup.
+    For copyright information, see AUTHORS.
+
+    Déjà Dup 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.
+
+    Déjà Dup 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 Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+using GLib;
+
+namespace DejaDup {
+
+public class ConfigLocationACD : ConfigLocationTable
+{
+  public ConfigLocationACD(Gtk.SizeGroup sg) {
+    Object(label_sizes: sg);
+  }
+
+  construct {
+    add_widget(_("_Folder"),
+               new ConfigFolder(DejaDup.ACD_FOLDER_KEY, DejaDup.ACD_ROOT));
+  }
+}
+
+}
+

=== modified file 'libdeja/Backend.vala'
--- libdeja/Backend.vala	2015-11-29 15:53:51 +0000
+++ libdeja/Backend.vala	2016-08-07 21:09:16 +0000
@@ -56,6 +56,7 @@
     var backend = settings.get_string(BACKEND_KEY);
 
     if (backend != "auto" &&
+        backend != "acd" &&
         backend != "s3" &&
         backend != "gcs" &&
         backend != "gdrive" &&
@@ -71,7 +72,9 @@
   public static Backend? get_default()
   {
     var backend_name = get_default_type();
-    if (backend_name == "s3")
+    if (backend_name == "acd")
+      return new BackendACD();
+    else if (backend_name == "s3")
       return new BackendS3();
     else if (backend_name == "gcs")
       return new BackendGCS();

=== added file 'libdeja/BackendACD.vala'
--- libdeja/BackendACD.vala	1970-01-01 00:00:00 +0000
+++ libdeja/BackendACD.vala	2016-08-07 21:09:16 +0000
@@ -0,0 +1,73 @@
+/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
+/*
+    This file is part of Déjà Dup.
+    For copyright information, see AUTHORS.
+
+    Déjà Dup 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.
+
+    Déjà Dup 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 Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+using GLib;
+
+namespace DejaDup {
+
+public const string ACD_ROOT = "ACD";
+public const string ACD_FOLDER_KEY = "folder";
+
+const string ACD_SERVER = "api.amazon.com";
+
+public class BackendACD : Backend
+{
+  public static Checker get_checker() {
+    return PythonChecker.get_checker("acdcli");
+  }
+
+  public override Backend clone() {
+    return new BackendACD();
+  }
+  
+  public override bool is_native() {
+    return false;
+  }
+  
+  public override Icon? get_icon() {
+    return new ThemedIcon("deja-dup-cloud");
+  }
+
+  public override async bool is_ready(out string when) {
+    when = _("Backup will begin when a network connection becomes available.");
+    return yield Network.get().can_reach ("http://%s/".printf(ACD_SERVER));
+  }
+
+  public override string get_location(ref bool as_root)
+  {
+    var settings = get_settings(ACD_ROOT);
+    var folder = get_folder_key(settings, ACD_FOLDER_KEY);
+    return "acd+acdcli:///%s".printf(folder);
+  }
+  
+  public override string get_location_pretty()
+  {
+    var settings = get_settings(ACD_ROOT);
+    var folder = get_folder_key(settings, ACD_FOLDER_KEY);
+    if (folder == "")
+      return _("Amazon ACD");
+    else
+      // Translators: %s is a folder.
+      return _("%s on Amazon ACD").printf(folder);
+  }
+
+}
+  
+} // end namespace
+

=== modified file 'libdeja/CMakeLists.txt'
--- libdeja/CMakeLists.txt	2015-11-29 15:53:51 +0000
+++ libdeja/CMakeLists.txt	2016-08-07 21:09:16 +0000
@@ -18,6 +18,7 @@
 
 vala_precompile(VALA_C AsyncCommand.vala
                        Backend.vala
+                       BackendACD.vala
                        BackendAuto.vala
                        BackendFile.vala
                        BackendGCS.vala