[evolution-data-server] Convert camel_store_info_name() macro to a function.



commit 633ee69fffbe6a39f08ba1987dee042b50265b4e
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Aug 16 10:54:08 2013 -0400

    Convert camel_store_info_name() macro to a function.

 camel/camel-imapx-store.c   |    3 ++-
 camel/camel-store-summary.c |   24 ++++++++++++++++++++++++
 camel/camel-store-summary.h |    9 ++-------
 3 files changed, 28 insertions(+), 8 deletions(-)
---
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index 1e7a2bc..d37bce0 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -1120,7 +1120,8 @@ add_folder_to_summary (CamelIMAPXStore *imapx_store,
        } else {
                fi->display_name = g_strdup (
                        camel_store_info_name (
-                       imapx_store->summary, si));
+                       CAMEL_STORE_SUMMARY (imapx_store->summary),
+                       (CamelStoreInfo *) si));
        }
 
        fi->flags |= flags;
diff --git a/camel/camel-store-summary.c b/camel/camel-store-summary.c
index 7ddc0aa..e503d07 100644
--- a/camel/camel-store-summary.c
+++ b/camel/camel-store-summary.c
@@ -955,6 +955,30 @@ camel_store_info_path (CamelStoreSummary *summary,
 }
 
 /**
+ * camel_store_info_name:
+ * @summary: a #CamelStoreSummary
+ * @info: a #CamelStoreInfo
+ *
+ * Returns the last segment of the path string from @info.
+ *
+ * Returns: the last segment of the path string from @info
+ **/
+const gchar *
+camel_store_info_name (CamelStoreSummary *summary,
+                       CamelStoreInfo *info)
+{
+       const gchar *cp;
+
+       g_return_val_if_fail (CAMEL_IS_STORE_SUMMARY (summary), NULL);
+       g_return_val_if_fail (info != NULL, NULL);
+
+       cp = strrchr (info->path, '/');
+
+       /* XXX Not thread-safe; should return a duplicate. */
+       return (cp != NULL) ? cp + 1 : info->path;
+}
+
+/**
  * camel_store_summary_lock:
  * @summary: a #CamelStoreSummary
  * @lock: lock type to lock
diff --git a/camel/camel-store-summary.h b/camel/camel-store-summary.h
index f14f4c6..19705af 100644
--- a/camel/camel-store-summary.h
+++ b/camel/camel-store-summary.h
@@ -208,13 +208,8 @@ void               camel_store_info_set_string     (CamelStoreSummary *summary,
 
 const gchar *  camel_store_info_path           (CamelStoreSummary *summary,
                                                 CamelStoreInfo *info);
-
-/* helper macro's */
-#define camel_store_info_name(summary, info) \
-       (camel_store_info_string ( \
-               (CamelStoreSummary *) summary, \
-               (const CamelStoreInfo *) info, \
-               CAMEL_STORE_INFO_NAME))
+const gchar *  camel_store_info_name           (CamelStoreSummary *summary,
+                                                CamelStoreInfo *info);
 
 void           camel_store_summary_lock        (CamelStoreSummary *summary,
                                                 CamelStoreSummaryLock lock);


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