Implement Multi-Device

This patch implements multi-device support:

- The account creation wizzard has now two options "Existing Ring
  account" and "New Ring account".

  "Existing Ring account": Allows for fetching a Ring account archive
  from the DHT. Requires pin and password.

  "New Ring account": This is the previously existing wizard. It was
  modified to ask for a password which will be used to encrypt the
  account archive. This password is then required for exporting the
  account on the Ring.

- Creating a new Ring account with the "+" button now triggers the
  account creation wizard.

- The account menu now has a "devices" tab. This tab contains a table
  with device names (currently a short hash) and device ids (a long
  hash).

  In the "devices" tab, there is an "add device" button which allows
  for exporting the current account to the Ring, giving a pin to the
  user.

- When the client encounters old-format accounts, it will trigger a
  migration popup which asks the user for a password. This password will
  be used to create an archive and encrypt it. One password will be
  asked for each Ring account to migrate.

Change-Id: I3d52b2b7ca4f82cb477ee294c962b5d50d5c6a04
Tuleap: #896
diff --git a/ui/accountmigrationview.ui b/ui/accountmigrationview.ui
new file mode 100644
index 0000000..d185ee9
--- /dev/null
+++ b/ui/accountmigrationview.ui
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <template class="AccountMigrationView" parent="GtkBox">
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">15</property>
+        <property name="valign">center</property>
+        <child>
+          <object class="GtkStack" id="stack_account_migration">
+            <property name="visible">True</property>
+            <property name="transition-type">GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT</property>
+            <property name="transition-duration">300</property>
+            <!-- Main view -->
+            <child>
+              <object class="GtkBox" id="main_view">
+                <property name="visible">True</property>
+                <property name="valign">center</property>
+                <property name="border_width">10</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">15</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Account migration required</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">The following account needs to be migrated to the new Ring account format:</property>
+                  </object>
+                </child>
+                <!-- Begin account display -->
+                <child>
+                  <object class="GtkGrid">
+                    <property name="visible">True</property>
+                    <property name="column-spacing">10</property>
+                    <property name="row-spacing">10</property>
+                    <property name="halign">center</property>
+                    <property name="valign">center</property>
+                    <!-- Begin account alias -->
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Alias:</property>
+                        <property name="halign">start</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label_account_alias">
+                        <property name="visible">True</property>
+                        <property name="halign">start</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <!-- End account alias -->
+                    <!-- Begin accont id -->
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">ID:</property>
+                        <property name="halign">start</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label_account_id">
+                        <property name="visible">True</property>
+                        <property name="halign">start</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <!-- End account id -->
+                    <!-- Begin account avatar -->
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Avatar:</property>
+                        <property name="halign">start</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkImage" id="image_avatar">
+                        <property name="visible">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                      </packing>
+                    </child>
+                    <!-- End account avatar -->
+                  </object>
+                </child>
+                <!-- End account display -->
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">To proceed with the migration, you must choose a password for your account. This password will be used to encrypt your master key. It will be required for adding new devices to your Ring account. If you are not ready to choose a password, you may close Ring and resume the migration later.</property>
+                    <property name="halign">center</property>
+                    <property name="max-width-chars">80</property>
+                    <property name="wrap">True</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label_password_error">
+                    <property name="visible">False</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Passwords don't match</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Password:</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="entry_password">
+                    <property name="max-width-chars">40</property>
+                    <property name="halign">center</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="has_default">True</property>
+                    <property name="xalign">0.5</property>
+                    <property name="visibility">False</property>
+                    <property name="primary_icon_stock">gtk-dialog-authentication</property>
+                    <property name="input_purpose">password</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Password (confirm):</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="entry_password_confirm">
+                    <property name="max-width-chars">40</property>
+                    <property name="halign">center</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="has_default">True</property>
+                    <property name="xalign">0.5</property>
+                    <property name="visibility">False</property>
+                    <property name="primary_icon_stock">gtk-dialog-authentication</property>
+                    <property name="input_purpose">password</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_migrate_account">
+                    <property name="width-request">200</property>
+                    <property name="halign">center</property>
+                    <property name="visible">True</property>
+                    <property name="sensitive">False</property>
+                    <property name="label" translatable="yes">Migrate account</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <!-- End Main view -->
+            <!-- Migrating account spinner -->
+            <child>
+              <object class="GtkBox" id="migrating_account_view">
+                <property name="visible">True</property>
+                <property name="valign">center</property>
+                <property name="border_width">10</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">15</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Migrating account...</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkSpinner">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="active">True</property>
+                    <property name="height_request">50</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <!-- End migrating account spinner -->
+            <!-- Error view -->
+            <child>
+              <object class="GtkBox" id="error_view">
+                <property name="visible">True</property>
+                <property name="valign">center</property>
+                <property name="border_width">10</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">15</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Failed to migrate account. Try again.</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_error_view_ok">
+                    <property name="width-request">200</property>
+                    <property name="halign">center</property>
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">OK</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <!-- End Error view -->
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+      </packing>
+    </child>
+  </template>
+</interface>