summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2021-01-11 19:22:17 +0100
committerNiels De Graef <nielsdegraef@gmail.com>2022-08-06 12:45:49 +0200
commitfcbc87c40406b322513c209844d3430bc4108b13 (patch)
tree74efc305e00d893a72b3c8fb22017435b6792111 /data
parentf37176d5e04b3dc7cc2ad8cb9843d7d7fc35485e (diff)
downloadgnome-contacts-fcbc87c40406b322513c209844d3430bc4108b13.tar.gz
Enable importing & exporting VCards
This commit adds the experimental functionality in Contacts to import VCard (*.vcf) files. Since importing a contact means we have to take in untrusted/unvalidated input, let's give a high-level view of what happens: * Contacts starts a native file chooser dialog so the user can choose which file to import * According to the chosen file, Contacts will launch a subprocess to do the actual parsing using a `Contacts.Io.Parser`. At this point, we only have a single subclass, which allows importing VCards. * The helper process serializes the result to a `GLib.Variant`, and sends it to the main process, which will receive the result and parses it again. * After the parsing operation is done, we can then start up a `ImportOperation`, which will import the contacts using libfolks' API. Exporting contacts is quite a bit easier, since we don't have to deal with untrusted input: we serialize the list of selected contacts and asynchronously write each to the given output stream. In the app, that's a user chosen file; in tests, that can be a string. Fixes: https://gitlab.gnome.org/GNOME/gnome-contacts/-/issues/1 Fixes: https://gitlab.gnome.org/GNOME/gnome-contacts/-/issues/38
Diffstat (limited to 'data')
-rw-r--r--data/ui/contacts-main-window.ui14
1 files changed, 14 insertions, 0 deletions
diff --git a/data/ui/contacts-main-window.ui b/data/ui/contacts-main-window.ui
index 289c56c..48e557b 100644
--- a/data/ui/contacts-main-window.ui
+++ b/data/ui/contacts-main-window.ui
@@ -16,6 +16,12 @@
</section>
<section>
<item>
+ <attribute name="label" translatable="yes">Import…</attribute>
+ <attribute name="action">app.import</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
<attribute name="label" translatable="yes">Preferences</attribute>
<attribute name="action">app.show-preferences</attribute>
</item>
@@ -152,9 +158,17 @@
<object class="GtkActionBar" id="actions_bar">
<property name="revealed">False</property>
<child>
+ <object class="GtkButton" id="export_button">
+ <property name="label" translatable="yes" comments="Export refers to the verb">Export</property>
+ <property name="tooltip-text" translatable="yes">Export Selected Contacts</property>
+ <property name="action-name">win.export-marked-contacts</property>
+ </object>
+ </child>
+ <child>
<object class="GtkButton" id="link_button">
<property name="focus_on_click">False</property>
<property name="label" translatable="yes" comments="Link refers to the verb, from linking contacts together">Link</property>
+ <property name="tooltip-text" translatable="yes">Link Selected Contacts Together</property>
<property name="action-name">win.link-marked-contacts</property>
</object>
</child>