[folks] Use “dup” instead of “get” in method names which return a referenced object



commit c489e94cbf7783946aca62611717aeeee98a535d
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Feb 7 22:25:38 2011 +0000

    Use â??dupâ?? instead of â??getâ?? in method names which return a referenced object
    
    This bumps our Vala dependency to 0.11.6, which includes a necessary fix
    for the CCode annotation we use. Helps: bgo#629078

 NEWS                                |    4 ++++
 configure.ac                        |    2 +-
 folks/backend-store.vala            |   10 +++++++---
 tools/import.vala                   |    2 +-
 tools/inspect/command-backends.vala |    2 +-
 5 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index 3e31188..035a0c5 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ API changes:
 * Rename the URLable interface to Urlable
 * Take a PersonaStore in IndividualAggregator.add_persona_from_details
 * Remove IndividualAggregatorError.STORE_NOT_FOUND
+* Rename the getter for BackendStore.enabled_backends from
+  folks_backend_store_get_enabled_backends() to
+  folks_backend_store_dup_enabled_backends()
+* Rename BackendStore.get_backend_by_name() to .dup_backend_by_name()
 
 Bugs fixed:
 * Bug 640901 â?? Allow it to be determined whether a user Tpf.Persona is in the
diff --git a/configure.ac b/configure.ac
index 37f91d4..5d44c34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,7 +73,7 @@ AC_SUBST([FOLKS_MAJOR_MINOR_VERSION])
 GLIB_REQUIRED=2.24.0
 TP_GLIB_REQUIRED=0.13.1
 # XXX: once we bump this to 0.12.x, remove all the #if VALA_0_12 conditionals
-VALA_REQUIRED=0.10.0
+VALA_REQUIRED=0.11.6
 
 PKG_CHECK_MODULES([GLIB],
                   [glib-2.0 >= $GLIB_REQUIRED
diff --git a/folks/backend-store.vala b/folks/backend-store.vala
index 347c5e7..4801967 100644
--- a/folks/backend-store.vala
+++ b/folks/backend-store.vala
@@ -73,10 +73,11 @@ public class Folks.BackendStore : Object {
    *
    * The backends in this list have been prepared and are ready to use.
    *
-   * @since 0.2.0
+   * @since 0.3.UNRELEASED
    */
   public GLib.List<Backend> enabled_backends
     {
+      [CCode (cname = "folks_backend_store_dup_enabled_backends")]
       owned get
         {
           var backends = new GLib.List<Backend> ();
@@ -340,12 +341,15 @@ public class Folks.BackendStore : Object {
     }
 
   /**
-   * Get a backend from the store by name.
+   * Get a backend from the store by name. If a backend is returned, its
+   * reference count is increased.
    *
    * @param name the backend name to retrieve
    * @return the backend, or `null` if none could be found
+   *
+   * @since 0.3.UNRELEASED
    */
-  public Backend? get_backend_by_name (string name)
+  public Backend? dup_backend_by_name (string name)
     {
       return this._backend_hash.get (name);
     }
diff --git a/tools/import.vala b/tools/import.vala
index 238aab9..5b7ddb4 100644
--- a/tools/import.vala
+++ b/tools/import.vala
@@ -108,7 +108,7 @@ public class Folks.ImportTool : Object
         }
 
       /* Get the key-file backend */
-      Backend kf_backend = backend_store.get_backend_by_name ("key-file");
+      Backend kf_backend = backend_store.dup_backend_by_name ("key-file");
 
       if (kf_backend == null)
         {
diff --git a/tools/inspect/command-backends.vala b/tools/inspect/command-backends.vala
index d3a5d18..1bf12a5 100644
--- a/tools/inspect/command-backends.vala
+++ b/tools/inspect/command-backends.vala
@@ -68,7 +68,7 @@ private class Folks.Inspect.Commands.Backends : Folks.Inspect.Command
         {
           /* Show the details of a particular backend */
           Backend backend =
-              this.client.backend_store.get_backend_by_name (command_string);
+              this.client.backend_store.dup_backend_by_name (command_string);
 
           if (backend == null)
             {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]