/soc/2013/ankitkv/gobjectification: e06a238d2864: Refactored pid...
Ankit Vani
a at nevitus.org
Sun Sep 1 14:06:02 EDT 2013
Changeset: e06a238d2864e47ae7d246433d398fe514155c5c
Author: Ankit Vani <a at nevitus.org>
Date: 2013-09-01 23:35 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/e06a238d2864
Description:
Refactored pidgin to show multiple authors
diffstat:
pidgin/gtkdialogs.c | 27 ++++++++++++++++++++-------
pidgin/gtkplugin.c | 37 +++++++++++++++++++++++++++----------
2 files changed, 47 insertions(+), 17 deletions(-)
diffs (161 lines):
diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c
--- a/pidgin/gtkdialogs.c
+++ b/pidgin/gtkdialogs.c
@@ -832,9 +832,10 @@ void pidgin_dialogs_plugins_info(void)
PurplePlugin *plugin = NULL;
PurplePluginInfo *info;
char *title = g_strdup_printf(_("%s Plugin Information"), PIDGIN_NAME);
- char *pname = NULL, *pauthor = NULL;
+ char *pname = NULL, *authors, *pauthors;
const char *pver, *plicense, *pwebsite, *pid;
gboolean ploaded, ploadable;
+ const char * const *authorlist;
static GtkWidget *plugins_info = NULL;
str = g_string_sized_new(4096);
@@ -848,10 +849,20 @@ void pidgin_dialogs_plugins_info(void)
info = purple_plugin_get_info(plugin);
pname = g_markup_escape_text(purple_plugin_info_get_name(info), -1);
- if ((pauthor = (char *)purple_plugin_info_get_author(info)) != NULL)
- pauthor = g_markup_escape_text(pauthor, -1);
+ authorlist = purple_plugin_info_get_authors(info);
+
+ if (authorlist)
+ authors = g_strjoinv(", ", (gchar **)authorlist);
+ else
+ authors = NULL;
+
+ if (authors)
+ pauthors = g_markup_escape_text(authors, -1);
+ else
+ pauthors = NULL;
+
pver = purple_plugin_info_get_version(info);
- plicense = purple_plugin_info_get_license(info);
+ plicense = purple_plugin_info_get_license_id(info);
pwebsite = purple_plugin_info_get_website(info);
pid = purple_plugin_info_get_id(info);
ploadable = !purple_plugin_info_get_error(info);
@@ -859,7 +870,7 @@ void pidgin_dialogs_plugins_info(void)
g_string_append_printf(str,
"<dt>%s</dt><dd>"
- "<b>Author:</b> %s<br/>"
+ "<b>%s:</b> %s<br/>"
"<b>Version:</b> %s<br/>"
"<b>License:</b> %s<br/>"
"<b>Website:</b> %s<br/>"
@@ -868,7 +879,8 @@ void pidgin_dialogs_plugins_info(void)
"<b>Loaded:</b> %s"
"</dd><br/>",
pname ? pname : "",
- pauthor ? pauthor : "",
+ (g_strv_length((gchar **)authorlist) > 1 ? "Authors" : "Author"),
+ pauthors ? pauthors : "",
pver ? pver : "",
plicense ? plicense : "",
pwebsite ? pwebsite : "",
@@ -877,7 +889,8 @@ void pidgin_dialogs_plugins_info(void)
ploaded ? "Yes" : "No");
g_free(pname);
- g_free(pauthor);
+ g_free(pauthors);
+ g_free(authors);
}
g_list_free(plugins);
diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c
--- a/pidgin/gtkplugin.c
+++ b/pidgin/gtkplugin.c
@@ -63,7 +63,7 @@ static GtkWidget *plugin_dialog = NULL;
static GtkLabel *plugin_name = NULL;
static GtkTextBuffer *plugin_desc = NULL;
static GtkLabel *plugin_error = NULL;
-static GtkLabel *plugin_author = NULL;
+static GtkLabel *plugin_authors = NULL;
static GtkLabel *plugin_website = NULL;
static gchar *plugin_website_uri = NULL;
static GtkLabel *plugin_filename = NULL;
@@ -501,6 +501,8 @@ static gboolean ensure_plugin_visible(vo
static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model)
{
gchar *buf, *tmp, *name, *version;
+ gchar *authors = NULL;
+ const gchar * const *authorlist;
GtkTreeIter iter;
GValue val;
PurplePlugin *plug;
@@ -536,7 +538,13 @@ static void prefs_plugin_sel (GtkTreeSel
g_free(buf);
gtk_text_buffer_set_text(plugin_desc, purple_plugin_info_get_description(info), -1);
- gtk_label_set_text(plugin_author, purple_plugin_info_get_author(info));
+
+ authorlist = purple_plugin_info_get_authors(info);
+ if (authorlist)
+ authors = g_strjoinv(", ", (gchar **)authorlist);
+ gtk_label_set_text(plugin_authors, authors);
+ g_free(authors);
+
gtk_label_set_text(plugin_filename, purple_plugin_get_filename(plug));
g_free(plugin_website_uri);
@@ -688,18 +696,26 @@ pidgin_plugins_create_tooltip(GtkWidget
GtkTreeModel *model = gtk_tree_view_get_model(treeview);
PangoLayout *layout;
int width, height;
- char *markup, *name, *desc, *author;
+ const char * const *authorlist;
+ char *markup, *name, *desc;
+ char *authors = NULL, *pauthors = NULL;
if (!gtk_tree_model_get_iter(model, &iter, path))
return FALSE;
gtk_tree_model_get(model, &iter, 2, &plugin, -1);
info = purple_plugin_get_info(plugin);
+ authorlist = purple_plugin_info_get_authors(info);
+
+ if (authorlist)
+ authors = g_strjoinv(", ", (gchar **)authorlist);
+ if (authors)
+ pauthors = g_markup_escape_text(authors, -1);
markup = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>\n<b>%s:</b> %s\n<b>%s:</b> %s",
name = g_markup_escape_text(purple_plugin_info_get_name(info), -1),
_("Description"), desc = g_markup_escape_text(purple_plugin_info_get_description(info), -1),
- _("Author"), author = g_markup_escape_text(purple_plugin_info_get_author(info), -1));
+ (g_strv_length((gchar **)authorlist) > 1 ? _("Authors") : _("Author")), pauthors);
layout = gtk_widget_create_pango_layout(tipwindow, NULL);
pango_layout_set_markup(layout, markup, -1);
@@ -716,7 +732,8 @@ pidgin_plugins_create_tooltip(GtkWidget
g_free(markup);
g_free(name);
g_free(desc);
- g_free(author);
+ g_free(pauthors);
+ g_free(authors);
return TRUE;
}
@@ -771,12 +788,12 @@ create_details()
gtk_label_set_selectable(plugin_error, TRUE);
gtk_box_pack_start(vbox, GTK_WIDGET(plugin_error), FALSE, FALSE, 0);
- plugin_author = GTK_LABEL(gtk_label_new(NULL));
- gtk_label_set_line_wrap(plugin_author, FALSE);
- gtk_misc_set_alignment(GTK_MISC(plugin_author), 0, 0);
- gtk_label_set_selectable(plugin_author, TRUE);
+ plugin_authors = GTK_LABEL(gtk_label_new(NULL));
+ gtk_label_set_line_wrap(plugin_authors, FALSE);
+ gtk_misc_set_alignment(GTK_MISC(plugin_authors), 0, 0);
+ gtk_label_set_selectable(plugin_authors, TRUE);
pidgin_add_widget_to_vbox(vbox, "", sg,
- GTK_WIDGET(plugin_author), TRUE, &label);
+ GTK_WIDGET(plugin_authors), TRUE, &label);
gtk_label_set_markup(GTK_LABEL(label), _("<b>Written by:</b>"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
More information about the Commits
mailing list