[gnome-contacts] contact: Move get_eds_addressbooks() to App
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] contact: Move get_eds_addressbooks() to App
- Date: Thu, 28 Jun 2012 07:52:47 +0000 (UTC)
commit 72a7a5ccfde8bcc047a8ab6cdce7302efd97a464
Author: Florian MÃllner <fmuellner gnome org>
Date: Tue Jun 26 22:54:52 2012 +0200
contact: Move get_eds_addressbooks() to App
Contact currently references App in a couple of places, which
means the class depends on pretty much any other class. In order
to reuse the Contact class in the shell search provider (which will
be a separate executable), reduce the Contact class' dependencies.
https://bugzilla.gnome.org/show_bug.cgi?id=679002
src/contacts-app.vala | 14 +++++++++++++-
src/contacts-contact.vala | 12 ------------
src/contacts-setup-window.vala | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 70ef154..4e78b53 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -133,7 +133,7 @@ public class Contacts.App : Gtk.Application {
TreeIter iter;
- foreach (var persona_store in Contact.get_eds_address_books ()) {
+ foreach (var persona_store in get_eds_address_books ()) {
var name = Contact.format_persona_store_name (persona_store);
store.append (out iter);
store.set (iter, 0, name, 1, persona_store);
@@ -464,6 +464,18 @@ 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);
this.app = this;
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 695edc5..31c55cd 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -1122,18 +1122,6 @@ public class Contacts.Contact : GLib.Object {
return stores;
}
- public static PersonaStore[] get_eds_address_books () {
- PersonaStore[] stores = {};
- foreach (var backend in App.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 static string format_persona_store_name (PersonaStore store) {
if (store.type_id == "eds") {
unowned string? eds_name = lookup_esource_name_by_uid (store.id);
diff --git a/src/contacts-setup-window.vala b/src/contacts-setup-window.vala
index 3368bdc..d8fca39 100644
--- a/src/contacts-setup-window.vala
+++ b/src/contacts-setup-window.vala
@@ -69,7 +69,7 @@ public class Contacts.SetupWindow : Gtk.Window {
content_grid.add (scrolled);
TreeIter iter;
- foreach (var persona_store in Contact.get_eds_address_books ()) {
+ foreach (var persona_store in App.get_eds_address_books ()) {
var name = Contact.format_persona_store_name (persona_store);
store.append (out iter);
store.set (iter, 0, name, 1, persona_store);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]