[libpeas] Make peas_plugin_info_get_authors() consistent with other API.
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Make peas_plugin_info_get_authors() consistent with other API.
- Date: Sat, 26 Mar 2011 18:55:16 +0000 (UTC)
commit d883e816828cbe2d1f8928bcd13affb36a1ee60b
Author: Garrett Regier <alias301 gmail com>
Date: Fri Mar 25 21:56:25 2011 -0700
Make peas_plugin_info_get_authors() consistent with other API.
The PeasPluginInfo getters usually return an empty array rather than
NULL, so let's be consistent here.
libpeas/peas-plugin-info.c | 2 ++
tests/libpeas/plugin-info.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libpeas/peas-plugin-info.c b/libpeas/peas-plugin-info.c
index 10a59e0..f76f893 100644
--- a/libpeas/peas-plugin-info.c
+++ b/libpeas/peas-plugin-info.c
@@ -209,6 +209,8 @@ _peas_plugin_info_new (const gchar *filename,
/* Get Authors */
info->authors = g_key_file_get_string_list (plugin_file, "Plugin",
"Authors", NULL, NULL);
+ if (info->authors == NULL)
+ info->authors = g_new0 (gchar *, 1);
/* Get Copyright */
str = g_key_file_get_string (plugin_file, "Plugin", "Copyright", NULL);
diff --git a/tests/libpeas/plugin-info.c b/tests/libpeas/plugin-info.c
index 6fe6a6b..2202b75 100644
--- a/tests/libpeas/plugin-info.c
+++ b/tests/libpeas/plugin-info.c
@@ -97,6 +97,7 @@ test_plugin_info_verify_min_info (PeasEngine *engine)
{
PeasPluginInfo *info;
GError *error = NULL;
+ const gchar **authors;
info = peas_engine_get_plugin_info (engine, "min-info");
@@ -119,7 +120,8 @@ test_plugin_info_verify_min_info (PeasEngine *engine)
g_assert_cmpstr (peas_plugin_info_get_version (info), ==, NULL);
g_assert_cmpstr (peas_plugin_info_get_help_uri (info), ==, NULL);
- g_assert (peas_plugin_info_get_authors (info) == NULL);
+ authors = peas_plugin_info_get_authors (info);
+ g_assert (authors != NULL && authors[0] == NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]