[gnome-contacts] Cleanup: Remove App singleton
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Cleanup: Remove App singleton
- Date: Sun, 27 Aug 2017 20:52:21 +0000 (UTC)
commit f279ef77739402511ee73a400655cc57c660426d
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sun Aug 27 22:46:33 2017 +0200
Cleanup: Remove App singleton
src/contacts-accounts-list.vala | 2 +-
src/contacts-app.vala | 15 ---------------
src/contacts-contact-pane.vala | 2 +-
src/contacts-utils.vala | 12 ++++++++++++
4 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/src/contacts-accounts-list.vala b/src/contacts-accounts-list.vala
index 85c6aca..4cbadf3 100644
--- a/src/contacts-accounts-list.vala
+++ b/src/contacts-accounts-list.vala
@@ -77,7 +77,7 @@ public class Contacts.AccountsList : Box {
}
PersonaStore local_store = null;
- foreach (var persona_store in App.get_eds_address_books ()) {
+ foreach (var persona_store in Utils.get_eds_address_books (this.contacts_store)) {
if (persona_store.id == "system-address-book") {
local_store = persona_store;
continue;
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 7101708..5557f33 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -19,8 +19,6 @@ using Gtk;
using Folks;
public class Contacts.App : Gtk.Application {
- public static App app;
-
private Settings settings;
private Store contacts_store;
@@ -330,21 +328,8 @@ public class Contacts.App : Gtk.Application {
return 0;
}
- public static PersonaStore[] get_eds_address_books () {
- PersonaStore[] stores = {};
- foreach (var backend in app.contacts_store.backend_store.enabled_backends.values) {
- foreach (var persona_store in backend.persona_stores.values) {
- if (persona_store.type_id == "eds") {
- stores += persona_store;
- }
- }
- }
- return stores;
- }
-
public App () {
Object (application_id: "org.gnome.Contacts", flags: ApplicationFlags.HANDLES_COMMAND_LINE);
- app = this;
this.settings = new Settings (this);
}
}
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 686897b..5ab541d 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -422,7 +422,7 @@ public class Contacts.ContactPane : Stack {
// Now show it to the user
var contact = this.store.find_contact_with_persona (persona);
if (contact != null)
- App.app.show_contact (contact);
+ this.parent_window.set_shown_contact (contact);
else
show_message_dialog (_("Unable to find newly created contact"));
}
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index 0d5e75c..02a2ef5 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -320,4 +320,16 @@ public class Contacts.Utils : Object {
};
return files;
}
+
+ public static PersonaStore[] get_eds_address_books (Store contacts_store) {
+ PersonaStore[] stores = {};
+ foreach (var backend in contacts_store.backend_store.enabled_backends.values) {
+ foreach (var persona_store in backend.persona_stores.values) {
+ if (persona_store.type_id == "eds") {
+ stores += persona_store;
+ }
+ }
+ }
+ return stores;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]