pidgin/gtkplugin.c

branch
soc.2013.gobjectification.plugins
changeset 36644
e06a238d2864
parent 36516
cbf16b28176c
child 36701
5acd461707ae
equal deleted inserted replaced
36643:f5d0db1dc2ed 36644:e06a238d2864
61 static GtkWidget *plugin_dialog = NULL; 61 static GtkWidget *plugin_dialog = NULL;
62 62
63 static GtkLabel *plugin_name = NULL; 63 static GtkLabel *plugin_name = NULL;
64 static GtkTextBuffer *plugin_desc = NULL; 64 static GtkTextBuffer *plugin_desc = NULL;
65 static GtkLabel *plugin_error = NULL; 65 static GtkLabel *plugin_error = NULL;
66 static GtkLabel *plugin_author = NULL; 66 static GtkLabel *plugin_authors = NULL;
67 static GtkLabel *plugin_website = NULL; 67 static GtkLabel *plugin_website = NULL;
68 static gchar *plugin_website_uri = NULL; 68 static gchar *plugin_website_uri = NULL;
69 static GtkLabel *plugin_filename = NULL; 69 static GtkLabel *plugin_filename = NULL;
70 70
71 static GtkWidget *pref_button = NULL; 71 static GtkWidget *pref_button = NULL;
499 } 499 }
500 500
501 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) 501 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model)
502 { 502 {
503 gchar *buf, *tmp, *name, *version; 503 gchar *buf, *tmp, *name, *version;
504 gchar *authors = NULL;
505 const gchar * const *authorlist;
504 GtkTreeIter iter; 506 GtkTreeIter iter;
505 GValue val; 507 GValue val;
506 PurplePlugin *plug; 508 PurplePlugin *plug;
507 PurplePluginInfo *info; 509 PurplePluginInfo *info;
508 510
534 g_free(name); 536 g_free(name);
535 g_free(version); 537 g_free(version);
536 g_free(buf); 538 g_free(buf);
537 539
538 gtk_text_buffer_set_text(plugin_desc, purple_plugin_info_get_description(info), -1); 540 gtk_text_buffer_set_text(plugin_desc, purple_plugin_info_get_description(info), -1);
539 gtk_label_set_text(plugin_author, purple_plugin_info_get_author(info)); 541
542 authorlist = purple_plugin_info_get_authors(info);
543 if (authorlist)
544 authors = g_strjoinv(", ", (gchar **)authorlist);
545 gtk_label_set_text(plugin_authors, authors);
546 g_free(authors);
547
540 gtk_label_set_text(plugin_filename, purple_plugin_get_filename(plug)); 548 gtk_label_set_text(plugin_filename, purple_plugin_get_filename(plug));
541 549
542 g_free(plugin_website_uri); 550 g_free(plugin_website_uri);
543 plugin_website_uri = g_strdup(purple_plugin_info_get_website(info)); 551 plugin_website_uri = g_strdup(purple_plugin_info_get_website(info));
544 552
686 PurplePlugin *plugin = NULL; 694 PurplePlugin *plugin = NULL;
687 PurplePluginInfo *info; 695 PurplePluginInfo *info;
688 GtkTreeModel *model = gtk_tree_view_get_model(treeview); 696 GtkTreeModel *model = gtk_tree_view_get_model(treeview);
689 PangoLayout *layout; 697 PangoLayout *layout;
690 int width, height; 698 int width, height;
691 char *markup, *name, *desc, *author; 699 const char * const *authorlist;
700 char *markup, *name, *desc;
701 char *authors = NULL, *pauthors = NULL;
692 702
693 if (!gtk_tree_model_get_iter(model, &iter, path)) 703 if (!gtk_tree_model_get_iter(model, &iter, path))
694 return FALSE; 704 return FALSE;
695 705
696 gtk_tree_model_get(model, &iter, 2, &plugin, -1); 706 gtk_tree_model_get(model, &iter, 2, &plugin, -1);
697 info = purple_plugin_get_info(plugin); 707 info = purple_plugin_get_info(plugin);
708 authorlist = purple_plugin_info_get_authors(info);
709
710 if (authorlist)
711 authors = g_strjoinv(", ", (gchar **)authorlist);
712 if (authors)
713 pauthors = g_markup_escape_text(authors, -1);
698 714
699 markup = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>\n<b>%s:</b> %s\n<b>%s:</b> %s", 715 markup = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>\n<b>%s:</b> %s\n<b>%s:</b> %s",
700 name = g_markup_escape_text(purple_plugin_info_get_name(info), -1), 716 name = g_markup_escape_text(purple_plugin_info_get_name(info), -1),
701 _("Description"), desc = g_markup_escape_text(purple_plugin_info_get_description(info), -1), 717 _("Description"), desc = g_markup_escape_text(purple_plugin_info_get_description(info), -1),
702 _("Author"), author = g_markup_escape_text(purple_plugin_info_get_author(info), -1)); 718 (g_strv_length((gchar **)authorlist) > 1 ? _("Authors") : _("Author")), pauthors);
703 719
704 layout = gtk_widget_create_pango_layout(tipwindow, NULL); 720 layout = gtk_widget_create_pango_layout(tipwindow, NULL);
705 pango_layout_set_markup(layout, markup, -1); 721 pango_layout_set_markup(layout, markup, -1);
706 pango_layout_set_wrap(layout, PANGO_WRAP_WORD); 722 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
707 pango_layout_set_width(layout, 600000); 723 pango_layout_set_width(layout, 600000);
714 *h = PANGO_PIXELS(height) + 12; 730 *h = PANGO_PIXELS(height) + 12;
715 731
716 g_free(markup); 732 g_free(markup);
717 g_free(name); 733 g_free(name);
718 g_free(desc); 734 g_free(desc);
719 g_free(author); 735 g_free(pauthors);
736 g_free(authors);
720 737
721 return TRUE; 738 return TRUE;
722 } 739 }
723 740
724 static gboolean 741 static gboolean
769 gtk_misc_set_alignment(GTK_MISC(plugin_error), 0, 0); 786 gtk_misc_set_alignment(GTK_MISC(plugin_error), 0, 0);
770 gtk_label_set_line_wrap(plugin_error, FALSE); 787 gtk_label_set_line_wrap(plugin_error, FALSE);
771 gtk_label_set_selectable(plugin_error, TRUE); 788 gtk_label_set_selectable(plugin_error, TRUE);
772 gtk_box_pack_start(vbox, GTK_WIDGET(plugin_error), FALSE, FALSE, 0); 789 gtk_box_pack_start(vbox, GTK_WIDGET(plugin_error), FALSE, FALSE, 0);
773 790
774 plugin_author = GTK_LABEL(gtk_label_new(NULL)); 791 plugin_authors = GTK_LABEL(gtk_label_new(NULL));
775 gtk_label_set_line_wrap(plugin_author, FALSE); 792 gtk_label_set_line_wrap(plugin_authors, FALSE);
776 gtk_misc_set_alignment(GTK_MISC(plugin_author), 0, 0); 793 gtk_misc_set_alignment(GTK_MISC(plugin_authors), 0, 0);
777 gtk_label_set_selectable(plugin_author, TRUE); 794 gtk_label_set_selectable(plugin_authors, TRUE);
778 pidgin_add_widget_to_vbox(vbox, "", sg, 795 pidgin_add_widget_to_vbox(vbox, "", sg,
779 GTK_WIDGET(plugin_author), TRUE, &label); 796 GTK_WIDGET(plugin_authors), TRUE, &label);
780 gtk_label_set_markup(GTK_LABEL(label), _("<b>Written by:</b>")); 797 gtk_label_set_markup(GTK_LABEL(label), _("<b>Written by:</b>"));
781 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); 798 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
782 799
783 website_button = gtk_event_box_new(); 800 website_button = gtk_event_box_new();
784 gtk_event_box_set_visible_window(GTK_EVENT_BOX(website_button), FALSE); 801 gtk_event_box_set_visible_window(GTK_EVENT_BOX(website_button), FALSE);

mercurial