/soc/2013/ankitkv/gobjectification: f5d0db1dc2ed: Refactored fin...

Ankit Vani a at nevitus.org
Sun Sep 1 14:06:02 EDT 2013


Changeset: f5d0db1dc2edb542c3a7e5d32ce8fb56d3921f01
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-01 23:16 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/f5d0db1dc2ed

Description:

Refactored finch to show multiple authors

diffstat:

 finch/gntplugin.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (49 lines):

diff --git a/finch/gntplugin.c b/finch/gntplugin.c
--- a/finch/gntplugin.c
+++ b/finch/gntplugin.c
@@ -236,13 +236,18 @@ selection_changed(GntWidget *widget, gpo
 {
 	PurplePlugin *plugin = current;
 	PurplePluginInfo *info;
-	char *text;
+	char *text, *authors = NULL;
+	const char * const *authorlist;
 	GList *list = NULL, *iter = NULL;
 
 	if (!plugin)
 		return;
 
 	info = purple_plugin_get_info(plugin);
+	authorlist = purple_plugin_info_get_authors(info);
+
+	if (authorlist)
+		authors = g_strjoinv(", ", (gchar **)authorlist);
 
 	/* If the selected plugin was unseen before, mark it as seen. But save the list
 	 * only when the plugin list is closed. So if the user enables a plugin, and it
@@ -260,18 +265,23 @@ selection_changed(GntWidget *widget, gpo
 
 	/* XXX: Use formatting and stuff */
 	gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot));
-	text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"),
+	text = g_strdup_printf((g_strv_length((gchar **)authorlist) > 1 ?
+			_("Name: %s\nVersion: %s\nDescription: %s\nAuthors: %s\nWebsite: %s\nFilename: %s\n") :
+			_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n")),
 			SAFE(_(purple_plugin_info_get_name(info))),
 			SAFE(_(purple_plugin_info_get_version(info))),
 			SAFE(_(purple_plugin_info_get_description(info))),
-			SAFE(_(purple_plugin_info_get_author(info))),
+			SAFE(authors),
 			SAFE(_(purple_plugin_info_get_website(info))),
 			SAFE(purple_plugin_get_filename(plugin)));
 
 	gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot),
 			text, GNT_TEXT_FLAG_NORMAL);
 	gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0);
+
 	g_free(text);
+	g_free(authors);
+
 	decide_conf_button(plugin);
 }
 



More information about the Commits mailing list