summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/contacts.gresource.xml1
-rw-r--r--data/ui/contacts-setup-window.ui93
-rw-r--r--data/ui/contacts-window.ui359
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/contacts-app.vala31
-rw-r--r--src/contacts-setup-window.vala74
-rw-r--r--src/contacts-window.vala53
-rw-r--r--src/meson.build1
8 files changed, 336 insertions, 278 deletions
diff --git a/data/contacts.gresource.xml b/data/contacts.gresource.xml
index ba45a0c..2e4f79c 100644
--- a/data/contacts.gresource.xml
+++ b/data/contacts.gresource.xml
@@ -12,6 +12,7 @@
<file compressed="true" preprocess="xml-stripblanks">ui/contacts-in-app-notification.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/contacts-link-suggestion-grid.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/contacts-list-pane.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">ui/contacts-setup-window.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/contacts-window.ui</file>
</gresource>
</gresources>
diff --git a/data/ui/contacts-setup-window.ui b/data/ui/contacts-setup-window.ui
new file mode 100644
index 0000000..41fffdd
--- /dev/null
+++ b/data/ui/contacts-setup-window.ui
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.22 -->
+ <template class="ContactsSetupWindow" parent="GtkApplicationWindow">
+ <property name="visible">True</property>
+ <property name="default_width">800</property>
+ <property name="default_height">600</property>
+ <property name="icon_name">gnome-contacts</property>
+ <child type="titlebar">
+ <object class="GtkHeaderBar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Contacts Setup</property>
+ <property name="show_close_button">False</property>
+ <style>
+ <class name="titlebar"/>
+ </style>
+ <child>
+ <object class="GtkButton" id="setup_quit_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Quit</property>
+ <property name="action_name">app.quit</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="setup_quit_button_atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Cancel setup and quit</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="setup_done_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="focus_on_click">False</property>
+ <property name="label" translatable="yes">Done</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="setup_done_button_atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Setup complete</property>
+ </object>
+ </child>
+ <style>
+ <class name="text-button"/>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkGrid" id="content">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="halign">center</property>
+ <property name="border_width">12</property>
+ <property name="row_spacing">24</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="label" translatable="yes">Welcome</property>
+ <attributes>
+ <attribute name="scale" value="3.5"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="wrap">True</property>
+ <property name="max_width_chars">55</property>
+ <property name="label" translatable="yes">Please select your main address book: this is where new contacts will be added. If you keep your contacts in an online account, you can add them using the online accounts settings.</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBox" id="providers_list">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/data/ui/contacts-window.ui b/data/ui/contacts-window.ui
index d9d48d2..c5858bc 100644
--- a/data/ui/contacts-window.ui
+++ b/data/ui/contacts-window.ui
@@ -11,7 +11,142 @@
<signal name="key-press-event" handler="key_press_event_cb" object="ContactsWindow" after="yes" swapped="no"/>
<signal name="delete-event" handler="delete_event_cb" object="ContactsWindow" after="no" swapped="no"/>
<child type="titlebar">
- <placeholder />
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHeaderBar" id="left_header">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">All Contacts</property>
+ <property name="show_close_button">True</property>
+ <style>
+ <class name="contacts-left-header-bar"/>
+ <class name="titlebar"/>
+ </style>
+ <child>
+ <object class="GtkButton" id="add_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="new_contact" object="ContactsWindow" after="no" swapped="no"/>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="add_button_atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Add contact</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">list-add-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="select_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="focus_on_click">False</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="select_button_atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Selection mode</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">object-select-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="select_cancel_button">
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="focus_on_click">False</property>
+ <property name="label" translatable="yes">Cancel</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkHeaderBar" id="right_header">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="show_close_button">True</property>
+ <style>
+ <class name="contacts-right-header-bar"/>
+ <class name="titlebar"/>
+ </style>
+ <child>
+ <object class="GtkButton" id="cancel_button">
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="focus_on_click">False</property>
+ <property name="label" translatable="yes">Cancel</property>
+ <property name="width_request">70</property>
+ <property name="valign">center</property>
+ <style>
+ <class name="text-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="edit_button">
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="focus_on_click">False</property>
+ <property name="label" translatable="yes">Edit</property>
+ <property name="width_request">70</property>
+ <property name="valign">center</property>
+ <style>
+ <class name="text-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="done_button">
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="focus_on_click">False</property>
+ <property name="label" translatable="yes">Done</property>
+ <property name="width_request">70</property>
+ <property name="valign">center</property>
+ <style>
+ <class name="text-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
<child>
<object class="GtkStack" id="view_switcher">
@@ -97,46 +232,6 @@
<property name="name">content-view</property>
</packing>
</child>
- <child>
- <object class="GtkGrid" id="setup_view">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <property name="border_width">12</property>
- <property name="row_spacing">24</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="halign">center</property>
- <property name="label" translatable="yes">Welcome</property>
- <attributes>
- <attribute name="scale" value="3.5"/>
- <!-- <attribute name="weight" value="bold"/> -->
- </attributes>
- </object>
- <packing>
- <property name="top_attach">0</property>
- <property name="left_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="setup_explanation_label">
- <property name="visible">True</property>
- <property name="halign">center</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">50</property>
- <property name="label" translatable="yes">Please select your main address book: this is where new contacts will be added. If you keep your contacts in an online account, you can add them using the online accounts settings.</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="left_attach">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="name">setup-view</property>
- </packing>
- </child>
</object>
</child>
</template>
@@ -148,188 +243,6 @@
<widget name="done_button"/>
</widgets>
</object>
- <object class="GtkGrid" id="content_header_bar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkHeaderBar" id="left_header">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="title" translatable="yes">All Contacts</property>
- <property name="show_close_button">True</property>
- <style>
- <class name="contacts-left-header-bar"/>
- <class name="titlebar"/>
- </style>
- <child>
- <object class="GtkButton" id="add_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="new_contact" object="ContactsWindow" after="no" swapped="no"/>
- <child internal-child="accessible">
- <object class="AtkObject" id="add_button_atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Add contact</property>
- </object>
- </child>
- <style>
- <class name="image-button"/>
- </style>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">list-add-symbolic</property>
- <property name="icon_size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="select_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="select_button_atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Selection mode</property>
- </object>
- </child>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">object-select-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="select_cancel_button">
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="label" translatable="yes">Cancel</property>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkHeaderBar" id="right_header">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="show_close_button">True</property>
- <style>
- <class name="contacts-right-header-bar"/>
- <class name="titlebar"/>
- </style>
- <child>
- <object class="GtkButton" id="cancel_button">
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="label" translatable="yes">Cancel</property>
- <property name="width_request">70</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="edit_button">
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="label" translatable="yes">Edit</property>
- <property name="width_request">70</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="done_button">
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="label" translatable="yes">Done</property>
- <property name="width_request">70</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <object class="GtkHeaderBar" id="setup_header_bar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="title" translatable="yes">Contacts Setup</property>
- <property name="show_close_button">False</property>
- <style>
- <class name="titlebar"/>
- </style>
- <child>
- <object class="GtkButton" id="setup_quit_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Quit</property>
- <property name="action_name">app.quit</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="setup_quit_button_atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Cancel setup and quit</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="setup_done_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="label" translatable="yes">Done</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="setup_done_button_atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Setup complete</property>
- </object>
- </child>
- <style>
- <class name="text-button"/>
- <class name="suggested-action"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- </object>
<object class="GtkSizeGroup" id="left_pane_size_group">
<property name="mode">horizontal</property>
<widgets>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6e34260..86f2cc6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,6 +10,7 @@ data/ui/contacts-contact-editor.ui
data/ui/contacts-contact-pane.ui
data/ui/contacts-link-suggestion-grid.ui
data/ui/contacts-list-pane.ui
+data/ui/contacts-setup-window.ui
data/ui/contacts-window.ui
src/contacts-accounts-list.vala
src/contacts-address-map.vala
@@ -25,6 +26,7 @@ src/contacts-esd-setup.c
src/contacts-linked-accounts-dialog.vala
src/contacts-link-suggestion-grid.vala
src/contacts-settings.vala
+src/contacts-setup-window.vala
src/contacts-types.vala
src/contacts-window.vala
src/main.vala
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index da69520..29fb9bc 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -52,6 +52,7 @@ public class Contacts.App : Gtk.Application {
this.settings = new Settings (this);
add_main_option_entries (options);
+ create_actions ();
}
public override int command_line (ApplicationCommandLine command_line) {
@@ -237,7 +238,6 @@ public class Contacts.App : Gtk.Application {
contacts_store.disconnect (id);
Source.remove (id2);
- create_actions ();
create_window ();
window.show ();
@@ -249,7 +249,6 @@ public class Contacts.App : Gtk.Application {
id2 = Timeout.add (500, () => {
contacts_store.disconnect (id);
- create_actions ();
create_window ();
window.show ();
@@ -305,6 +304,33 @@ public class Contacts.App : Gtk.Application {
}
public override void activate () {
+ // Check if we've already done the setup process
+ if (this.settings.did_initial_setup)
+ create_new_window ();
+ else
+ run_setup ();
+ }
+
+ private void run_setup () {
+ // Disable the change-book action (don't want the user to do that during setup)
+ var change_book_action = lookup_action ("change-book") as SimpleAction;
+ change_book_action.set_enabled (false);
+
+ // Create and show the setup window
+ var setup_window = new SetupWindow (this, this.contacts_store);
+ setup_window.setup_done.connect ( (selected_store) => {
+ setup_window.destroy ();
+
+ eds_source_registry.set_default_address_book (selected_store.source);
+ this.settings.did_initial_setup = true;
+
+ change_book_action.set_enabled (true); // re-enable change-book action
+ create_new_window ();
+ });
+ setup_window.show ();
+ }
+
+ private void create_new_window () {
/* window creation code */
if (window == null) {
if (!this.contacts_store.is_prepared) {
@@ -314,7 +340,6 @@ public class Contacts.App : Gtk.Application {
}
}
- create_actions ();
create_window ();
window.show ();
}
diff --git a/src/contacts-setup-window.vala b/src/contacts-setup-window.vala
new file mode 100644
index 0000000..4b13a85
--- /dev/null
+++ b/src/contacts-setup-window.vala
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2011 Alexander Larsson <alexl@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 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, see <http://www.gnu.org/licenses/>.
+ */
+
+using Gee;
+using Gtk;
+using Folks;
+
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-setup-window.ui")]
+public class Contacts.SetupWindow : Gtk.ApplicationWindow {
+ [GtkChild]
+ private Grid content;
+
+ [GtkChild]
+ private Button setup_done_button;
+
+ private AccountsList setup_accounts_list;
+
+ /**
+ * Fired after the user has succesfully performed the setup proess.
+ */
+ public signal void setup_done (Edsf.PersonaStore selected_address_book);
+
+ public SetupWindow (App app, Store store) {
+ Object (application: app);
+ this.setup_accounts_list = new AccountsList (store);
+ this.setup_accounts_list.hexpand = true;
+ this.setup_accounts_list.halign = Align.CENTER;
+ this.setup_accounts_list.show ();
+ this.content.add (this.setup_accounts_list);
+
+ // Listen for changes
+ store.eds_persona_store_changed.connect ( () => {
+ this.setup_accounts_list.update_contents (false);
+ });
+
+ ulong id2 = 0;
+ id2 = this.setup_accounts_list.account_selected.connect (() => {
+ this.setup_done_button.set_sensitive (true);
+ this.setup_accounts_list.disconnect (id2);
+ });
+
+ fill_accounts_list (store);
+
+ this.setup_done_button.clicked.connect (() => {
+ var selected_store = this.setup_accounts_list.selected_store as Edsf.PersonaStore;
+ setup_done (selected_store);
+ });
+ }
+
+ private void fill_accounts_list (Store store) {
+ if (store.is_prepared) {
+ this.setup_accounts_list.update_contents (false);
+ return;
+ }
+
+ store.prepared.connect ( () => {
+ this.setup_accounts_list.update_contents (false);
+ });
+ }
+}
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 5c1899b..de0bef7 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -51,17 +51,6 @@ public class Contacts.Window : Gtk.ApplicationWindow {
[GtkChild]
private Stack view_switcher;
- [GtkChild]
- private Grid content_header_bar;
-
- [GtkChild]
- private Grid setup_view;
- [GtkChild]
- private HeaderBar setup_header_bar;
- [GtkChild]
- private Button setup_done_button;
- private AccountsList setup_accounts_list;
-
// The 2 panes the window consists of
private ListPane list_pane;
private ContactPane contact_pane;
@@ -137,47 +126,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
create_contact_pane ();
- this.setup_accounts_list = new AccountsList (this.store);
- this.setup_accounts_list.hexpand = true;
- this.setup_accounts_list.halign = Align.CENTER;
- this.setup_accounts_list.show ();
- this.setup_view.attach (this.setup_accounts_list, 0, 2);
-
- if (settings.did_initial_setup) {
- view_switcher.visible_child_name = "content-view";
- set_titlebar (content_header_bar);
- } else {
- var change_book_action = app.lookup_action ("change-book") as GLib.SimpleAction;
- if (change_book_action != null)
- change_book_action.set_enabled (false);
-
- store.eds_persona_store_changed.connect ( () => {
- setup_accounts_list.update_contents (false);
- });
- ulong id2 = 0;
- id2 = setup_accounts_list.account_selected.connect (() => {
- setup_done_button.set_sensitive (true);
- setup_accounts_list.disconnect (id2);
- });
-
- view_switcher.visible_child_name = "setup-view";
- set_titlebar (setup_header_bar);
-
- setup_accounts_list.update_contents (false);
-
- setup_done_button.clicked.connect (() => {
- view_switcher.visible_child_name = "content-view";
- set_titlebar (content_header_bar);
-
- var e_store = setup_accounts_list.selected_store as Edsf.PersonaStore;
- eds_source_registry.set_default_address_book (e_store.source);
- settings.did_initial_setup = true;
-
- if (change_book_action != null) {
- change_book_action.set_enabled (true);
- }
- });
- }
+ view_switcher.visible_child_name = "content-view";
init_content_widgets ();
}
diff --git a/src/meson.build b/src/meson.build
index e5e6dec..8e25a04 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -21,6 +21,7 @@ contacts_vala_sources = [
'contacts-linking.vala',
'contacts-list-pane.vala',
'contacts-settings.vala',
+ 'contacts-setup-window.vala',
'contacts-store.vala',
'contacts-types.vala',
'contacts-utils.vala',