pidgin/pidgin

Parents 5fca0fffc9c3
Children ed47469c4311
Cleanup pidginabout.[ch] and add the plugin searchs paths to it

Clean up the about dialog and add the plugin search paths to it.

Testing Done:
Compiled, ran, viewed the about dialog.

Reviewed at https://reviews.imfreedom.org/r/96/
--- a/pidgin/pidginabout.c Mon Sep 07 05:57:50 2020 -0500
+++ b/pidgin/pidginabout.c Mon Sep 14 20:49:00 2020 -0500
@@ -1,4 +1,8 @@
-/* Purple is the legal property of its developers, whose names are too numerous
+/*
+ * Pidgin - Internet Messenger
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
@@ -13,18 +17,23 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#ifdef HAVE_MESON_CONFIG
+#include "meson-config.h"
+#endif
+
#include <glib/gi18n-lib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+
#include <json-glib/json-glib.h>
+
#include <talkatu.h>
#include "pidginabout.h"
@@ -34,12 +43,6 @@
#include "pidgincore.h"
#include "pidginresources.h"
-#include <stdio.h>
-
-#ifdef HAVE_MESON_CONFIG
-#include "meson-config.h"
-#endif
-
struct _PidginAboutDialog {
GtkDialog parent;
@@ -67,12 +70,8 @@
* Helpers
*****************************************************************************/
static void
-_pidgin_about_dialog_load_application_name(PidginAboutDialog *about) {
- gchar *label = g_strdup_printf(
- "%s %s",
- PIDGIN_NAME,
- VERSION
- );
+pidgin_about_dialog_load_application_name(PidginAboutDialog *about) {
+ gchar *label = g_strdup_printf("%s %s", PIDGIN_NAME, VERSION);
gtk_label_set_text(GTK_LABEL(about->application_name), label);
@@ -80,20 +79,18 @@
}
static void
-_pidgin_about_dialog_load_main_page(PidginAboutDialog *about) {
+pidgin_about_dialog_load_main_page(PidginAboutDialog *about) {
GtkTextIter start;
GInputStream *istream = NULL;
GString *str = NULL;
+ TalkatuMarkdownBuffer *md_buffer = NULL;
gchar buffer[8192];
gssize read = 0, size = 0;
/* now load the html */
- istream = g_resource_open_stream(
- pidgin_get_resource(),
- "/im/pidgin/Pidgin/About/about.md",
- G_RESOURCE_LOOKUP_FLAGS_NONE,
- NULL
- );
+ istream = g_resource_open_stream(pidgin_get_resource(),
+ "/im/pidgin/Pidgin/About/about.md",
+ G_RESOURCE_LOOKUP_FLAGS_NONE, NULL);
str = g_string_new("");
@@ -104,12 +101,8 @@
gtk_text_buffer_get_start_iter(about->main_buffer, &start);
- talkatu_markdown_buffer_insert_markdown(
- TALKATU_MARKDOWN_BUFFER(about->main_buffer),
- &start,
- str->str,
- size
- );
+ md_buffer = TALKATU_MARKDOWN_BUFFER(about->main_buffer);
+ talkatu_markdown_buffer_insert_markdown(md_buffer, &start, str->str, size);
g_string_free(str, TRUE);
@@ -117,7 +110,7 @@
}
static void
-_pidgin_about_dialog_load_json(GtkTreeStore *store, const gchar *json_section) {
+pidgin_about_dialog_load_json(GtkTreeStore *store, const gchar *json_section) {
GInputStream *istream = NULL;
GList *l = NULL, *sections = NULL;
GError *error = NULL;
@@ -127,12 +120,9 @@
JsonArray *sections_array = NULL;
/* get a stream to the credits resource */
- istream = g_resource_open_stream(
- pidgin_get_resource(),
- "/im/pidgin/Pidgin/About/credits.json",
- G_RESOURCE_LOOKUP_FLAGS_NONE,
- NULL
- );
+ istream = g_resource_open_stream(pidgin_get_resource(),
+ "/im/pidgin/Pidgin/About/credits.json",
+ G_RESOURCE_LOOKUP_FLAGS_NONE, NULL);
/* create our parser */
parser = json_parser_new();
@@ -152,21 +142,17 @@
JsonObject *section = json_node_get_object(l->data);
JsonArray *people = NULL;
gchar *markup = NULL;
+ const gchar *title = NULL;
guint idx = 0, n_people = 0;
- markup = g_strdup_printf(
- "<span font_weight=\"bold\" font_size=\"large\">%s</span>",
- json_object_get_string_member(section, "title")
- );
+ title = json_object_get_string_member(section, "title");
+ markup = g_strdup_printf("<b><big>%s</big></b>", title);
gtk_tree_store_append(store, &section_iter, NULL);
- gtk_tree_store_set(
- store,
- &section_iter,
- 0, markup,
- 1, 0.5f,
- -1
- );
+ gtk_tree_store_set(store, &section_iter,
+ 0, markup,
+ 1, 0.5f,
+ -1);
g_free(markup);
@@ -177,13 +163,10 @@
GtkTreeIter person_iter;
gtk_tree_store_append(store, &person_iter, &section_iter);
- gtk_tree_store_set(
- store,
- &person_iter,
- 0, json_array_get_string_element(people, idx),
- 1, 0.5f,
- -1
- );
+ gtk_tree_store_set(store, &person_iter,
+ 0, json_array_get_string_element(people, idx),
+ 1, 0.5f,
+ -1);
}
}
@@ -196,34 +179,29 @@
}
static void
-_pidgin_about_dialog_load_developers(PidginAboutDialog *about) {
- _pidgin_about_dialog_load_json(about->developers_store, "developers");
+pidgin_about_dialog_load_developers(PidginAboutDialog *about) {
+ pidgin_about_dialog_load_json(about->developers_store, "developers");
}
static void
-_pidgin_about_dialog_load_translators(PidginAboutDialog *about) {
- _pidgin_about_dialog_load_json(about->translators_store, "languages");
+pidgin_about_dialog_load_translators(PidginAboutDialog *about) {
+ pidgin_about_dialog_load_json(about->translators_store, "languages");
}
static void
-_pidgin_about_dialog_add_build_args(
- PidginAboutDialog *about,
- const gchar *title,
- const gchar *build_args
-) {
+pidgin_about_dialog_add_build_args(PidginAboutDialog *about, const gchar *title,
+ const gchar *build_args)
+{
GtkTreeIter section, value;
gchar **splits = NULL;
gchar *markup = NULL;
gint idx = 0;
- markup = g_strdup_printf("<span font-weight=\"bold\">%s</span>", title);
+ markup = g_strdup_printf("<b>%s</b>", title);
gtk_tree_store_append(about->build_info_store, &section, NULL);
- gtk_tree_store_set(
- about->build_info_store,
- &section,
- 0, markup,
- -1
- );
+ gtk_tree_store_set(about->build_info_store, &section,
+ 0, markup,
+ -1);
g_free(markup);
/* now walk through the arguments and add them */
@@ -246,157 +224,147 @@
}
static void
-_pidgin_about_dialog_build_info_add_version(
- GtkTreeStore *store,
- GtkTreeIter *section,
- const gchar *title,
- guint major,
- guint minor,
- guint micro
-) {
+pidgin_about_dialog_build_info_add_version(GtkTreeStore *store,
+ GtkTreeIter *section,
+ const gchar *title,
+ guint major,
+ guint minor,
+ guint micro)
+{
GtkTreeIter item;
gchar *version = g_strdup_printf("%u.%u.%u", major, minor, micro);
gtk_tree_store_append(store, &item, section);
- gtk_tree_store_set(
- store, &item,
- 0, title,
- 1, version,
- -1
- );
+ gtk_tree_store_set(store, &item,
+ 0, title,
+ 1, version,
+ -1);
g_free(version);
}
static void
-_pidgin_about_dialog_load_build_info(PidginAboutDialog *about) {
+pidgin_about_dialog_load_build_info(PidginAboutDialog *about) {
GtkTreeIter section, item;
gchar *markup = NULL;
/* create the section */
- markup = g_strdup_printf(
- "<span font-weight=\"bold\">%s</span>",
- _("Build Information")
- );
+ markup = g_strdup_printf("<b>%s</b>", _("Build Information"));
gtk_tree_store_append(about->build_info_store, &section, NULL);
- gtk_tree_store_set(
- about->build_info_store,
- &section,
- 0, markup,
- -1
- );
+ gtk_tree_store_set(about->build_info_store, &section,
+ 0, markup,
+ -1);
g_free(markup);
/* add the commit hash */
gtk_tree_store_append(about->build_info_store, &item, &section);
- gtk_tree_store_set(
- about->build_info_store,
- &item,
- 0, "Commit Hash",
- 1, REVISION,
- -1
- );
+ gtk_tree_store_set(about->build_info_store, &item,
+ 0, "Commit Hash",
+ 1, REVISION,
+ -1);
/* add the purple version */
- _pidgin_about_dialog_build_info_add_version(
- about->build_info_store,
- &section,
- _("Purple Version"),
- PURPLE_MAJOR_VERSION,
- PURPLE_MINOR_VERSION,
- PURPLE_MICRO_VERSION
- );
+ pidgin_about_dialog_build_info_add_version(about->build_info_store,
+ &section, _("Purple Version"),
+ PURPLE_MAJOR_VERSION,
+ PURPLE_MINOR_VERSION,
+ PURPLE_MICRO_VERSION);
/* add the glib version */
- _pidgin_about_dialog_build_info_add_version(
- about->build_info_store,
- &section,
- _("GLib Version"),
- GLIB_MAJOR_VERSION,
- GLIB_MINOR_VERSION,
- GLIB_MICRO_VERSION
- );
+ pidgin_about_dialog_build_info_add_version(about->build_info_store,
+ &section, _("GLib Version"),
+ GLIB_MAJOR_VERSION,
+ GLIB_MINOR_VERSION,
+ GLIB_MICRO_VERSION);
/* add the gtk version */
- _pidgin_about_dialog_build_info_add_version(
- about->build_info_store,
- &section,
- _("GTK+ Version"),
- GTK_MAJOR_VERSION,
- GTK_MINOR_VERSION,
- GTK_MICRO_VERSION
- );
+ pidgin_about_dialog_build_info_add_version(about->build_info_store,
+ &section, _("GTK Version"),
+ GTK_MAJOR_VERSION,
+ GTK_MINOR_VERSION,
+ GTK_MICRO_VERSION);
}
static void
-_pidgin_about_dialog_load_runtime_info(PidginAboutDialog *about) {
+pidgin_about_dialog_load_runtime_info(PidginAboutDialog *about) {
GtkTreeIter section;
gchar *markup = NULL;
/* create the section */
- markup = g_strdup_printf(
- "<span font-weight=\"bold\">%s</span>",
- _("Runtime Information")
- );
+ markup = g_strdup_printf("<b>%s</b>", _("Runtime Information"));
gtk_tree_store_append(about->build_info_store, &section, NULL);
- gtk_tree_store_set(
- about->build_info_store,
- &section,
- 0, markup,
- -1
- );
+ gtk_tree_store_set(about->build_info_store, &section,
+ 0, markup,
+ -1);
g_free(markup);
/* add the purple version */
- _pidgin_about_dialog_build_info_add_version(
- about->build_info_store,
- &section,
- _("Purple Version"),
- purple_major_version,
- purple_minor_version,
- purple_micro_version
- );
+ pidgin_about_dialog_build_info_add_version(about->build_info_store,
+ &section, _("Purple Version"),
+ purple_major_version,
+ purple_minor_version,
+ purple_micro_version);
/* add the glib version */
- _pidgin_about_dialog_build_info_add_version(
- about->build_info_store,
- &section,
- _("GLib Version"),
- glib_major_version,
- glib_minor_version,
- glib_micro_version
- );
+ pidgin_about_dialog_build_info_add_version(about->build_info_store,
+ &section, _("GLib Version"),
+ glib_major_version,
+ glib_minor_version,
+ glib_micro_version);
/* add the gtk version */
- _pidgin_about_dialog_build_info_add_version(
- about->build_info_store,
- &section,
- _("GTK+ Version"),
- gtk_major_version,
- gtk_minor_version,
- gtk_micro_version
- );
+ pidgin_about_dialog_build_info_add_version(about->build_info_store,
+ &section, _("GTK Version"),
+ gtk_major_version,
+ gtk_minor_version,
+ gtk_micro_version);
}
static void
-_pidgin_about_dialog_load_build_configuration(PidginAboutDialog *about) {
+pidgin_about_dialog_load_plugin_search_paths(PidginAboutDialog *about) {
+ GtkTreeIter section;
+ GList *path = NULL;
+ gchar *markup = NULL;
+
+ /* create the section */
+ markup = g_strdup_printf("<b>%s</b>", _("Plugin Search Paths"));
+ gtk_tree_store_append(about->build_info_store, &section, NULL);
+ gtk_tree_store_set(about->build_info_store, &section,
+ 0, markup,
+ -1);
+ g_free(markup);
+
+ /* add the search paths */
+ for(path = gplugin_manager_get_paths(); path != NULL; path = path->next) {
+ GtkTreeIter iter;
+
+ gtk_tree_store_append(about->build_info_store, &iter, &section);
+ gtk_tree_store_set(about->build_info_store, &iter,
+ 0, (gchar*)path->data,
+ -1);
+ }
+}
+
+static void
+pidgin_about_dialog_load_build_configuration(PidginAboutDialog *about) {
#ifdef MESON_ARGS
- _pidgin_about_dialog_add_build_args(about, "Meson Arguments", MESON_ARGS);
+ pidgin_about_dialog_add_build_args(about, _("Meson Arguments"), MESON_ARGS);
#endif /* MESON_ARGS */
- _pidgin_about_dialog_load_build_info(about);
- _pidgin_about_dialog_load_runtime_info(about);
+ pidgin_about_dialog_load_build_info(about);
+ pidgin_about_dialog_load_runtime_info(about);
+ pidgin_about_dialog_load_plugin_search_paths(about);
}
/******************************************************************************
* Callbacks
*****************************************************************************/
static void
-_pidgin_about_dialog_close(GtkWidget *b, gpointer data) {
+pidgin_about_dialog_close(GtkWidget *b, gpointer data) {
gtk_widget_destroy(GTK_WIDGET(data));
}
/******************************************************************************
- * GObject Stuff
+ * GObject Implementation
*****************************************************************************/
G_DEFINE_TYPE(PidginAboutDialog, pidgin_about_dialog, GTK_TYPE_DIALOG);
@@ -434,42 +402,37 @@
gtk_widget_init_template(GTK_WIDGET(about));
/* wire up the close button */
- g_signal_connect(
- about->close_button,
- "clicked",
- G_CALLBACK(_pidgin_about_dialog_close),
- about
- );
+ g_signal_connect(about->close_button, "clicked",
+ G_CALLBACK(pidgin_about_dialog_close), about);
/* setup the application name label */
- _pidgin_about_dialog_load_application_name(about);
+ pidgin_about_dialog_load_application_name(about);
/* setup the main page */
- _pidgin_about_dialog_load_main_page(about);
+ pidgin_about_dialog_load_main_page(about);
/* setup the developers stuff */
- _pidgin_about_dialog_load_developers(about);
+ pidgin_about_dialog_load_developers(about);
gtk_tree_view_expand_all(GTK_TREE_VIEW(about->developers_treeview));
/* setup the translators stuff */
- _pidgin_about_dialog_load_translators(about);
+ pidgin_about_dialog_load_translators(about);
gtk_tree_view_expand_all(GTK_TREE_VIEW(about->translators_treeview));
/* setup the build info page */
- _pidgin_about_dialog_load_build_configuration(about);
+ pidgin_about_dialog_load_build_configuration(about);
gtk_tree_view_expand_all(GTK_TREE_VIEW(about->build_info_treeview));
}
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
GtkWidget *
pidgin_about_dialog_new(void) {
- GtkWidget *about = NULL;
-
- about = g_object_new(
+ return GTK_WIDGET(g_object_new(
PIDGIN_TYPE_ABOUT_DIALOG,
"title", "About Pidgin",
NULL
- );
-
- return about;
+ ));
}
--- a/pidgin/pidginabout.h Mon Sep 07 05:57:50 2020 -0500
+++ b/pidgin/pidginabout.h Mon Sep 14 20:49:00 2020 -0500
@@ -1,3 +1,25 @@
+/*
+ * Pidgin - Internet Messenger
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
# error "only <pidgin.h> may be included directly"
#endif
@@ -18,7 +40,7 @@
#define PIDGIN_TYPE_ABOUT_DIALOG (pidgin_about_dialog_get_type())
G_DECLARE_FINAL_TYPE(PidginAboutDialog, pidgin_about_dialog, PIDGIN,
- ABOUT_DIALOG, GtkDialog)
+ ABOUT_DIALOG, GtkDialog)
GtkWidget *pidgin_about_dialog_new(void);
--- a/pidgin/resources/About/credits.json Mon Sep 07 05:57:50 2020 -0500
+++ b/pidgin/resources/About/credits.json Mon Sep 14 20:49:00 2020 -0500
@@ -2,67 +2,73 @@
"developers": [{
"title": "Developers",
"people": [
+ "Elliott 'QuLogic' Sales de Andrade",
+ "Gary 'grim' Kramlich",
+ "Richard 'rlaager' Laager"
+ ]
+ }, {
+ "title": "Developers (Retired)",
+ "people": [
"Daniel 'datallah' Atallah",
"Ethan 'Paco-Paco' Blanton",
- "Gary 'grim' Kramlich",
- "Richard 'rlaager' Laager",
"Etan 'deryni' Reisner",
"Michael 'Maiku' Ruprecht",
- "Elliott 'QuLogic' Sales de Andrade",
"Kevin 'SimGuy' Stange",
"Tomasz Wasilczyk",
-
- "Paul 'darkrain42' Aurich (Retired)",
- "John 'rekkanoryo' Bailey (Retired)",
- "Herman Bloggs (Retired)",
- "Thomas Butter (Retired)",
- "Ka-Hing Cheung (Retired)",
- "Sadrul Habib Chowdhury (Retired)",
- "Mark 'KingAnt' Doliner (Retired)",
- "Jim Duchek (Retired)",
- "Sean Egan (Retired)",
- "Rob Flynn (Retired)",
- "Adam Fritzler (Retired)",
- "Christian 'ChipX86' Hammond (Retired)",
- "Casey Harkins (Retired)",
- "Ivan Komarov (Retired)",
- "Syd Logan (Retired)",
- "Marcus 'malu' Lundblad (Retired)",
- "Sulabh 'sulabh_m' Mahajan (Retired)",
- "Richard 'wabs' Nelson (Retired)",
- "Christopher 'siege' O'Brien (Retired)",
- "Bartosz Oler (Retired)",
- "Tim 'marv' Rigenbach (Retired)",
- "Luke 'LSchiere' Schierer (Retired)",
- "Megan 'Cae' Schneider (Retired)",
- "Evan Schoenberg (Retired)",
- "Jim Seymour (Retired)",
- "Mark Spencer (Retired)",
- "Will 'resiak' Thompson (Retired)",
- "Stu 'nosnilmot' Tomlinson (Retired)",
- "Jorge 'Masca' VillaseƱor (Retired)",
- "Nathan 'faceprint' Walp (Retired)",
- "Eric Warmenhoven (Retired)"
+ "Paul 'darkrain42' Aurich",
+ "John 'rekkanoryo' Bailey",
+ "Herman Bloggs",
+ "Thomas Butter",
+ "Ka-Hing Cheung",
+ "Sadrul Habib Chowdhury",
+ "Mark 'KingAnt' Doliner",
+ "Jim Duchek",
+ "Sean Egan",
+ "Rob Flynn",
+ "Adam Fritzler",
+ "Christian 'ChipX86' Hammond",
+ "Casey Harkins",
+ "Ivan Komarov",
+ "Syd Logan",
+ "Marcus 'malu' Lundblad",
+ "Sulabh 'sulabh_m' Mahajan",
+ "Richard 'wabs' Nelson",
+ "Christopher 'siege' O'Brien",
+ "Bartosz Oler",
+ "Tim 'marv' Rigenbach",
+ "Luke 'LSchiere' Schierer",
+ "Megan 'Cae' Schneider",
+ "Evan Schoenberg",
+ "Jim Seymour",
+ "Mark Spencer",
+ "Will 'resiak' Thompson",
+ "Stu 'nosnilmot' Tomlinson",
+ "Jorge 'Masca' VillaseƱor",
+ "Nathan 'faceprint' Walp",
+ "Eric Warmenhoven"
]
}, {
"title": "Crazy Patch Writers",
"people": [
- "Jakub 'haakon' Adam",
- "Eion Robb",
-
- "Felipe 'shx' Contreras (Retired)",
- "Decklin Foster (Retired)",
- "Krzysztof Klinikowski (Retired)",
- "Peter 'Bleeter' Lawler (Retired)",
- "Robert 'Robot101' McQueen (Retired)",
- "Benjamin Miller (Retired)",
- "Dennis 'EvilDennisR' Ristuccia (Retired)",
- "Peter 'Fmoo' Ruibal (Retired)",
- "Gabriel 'Nix' Schulhof (Retired)",
- "Ankit Vani (Retired)"
+ "Eion Robb"
]
}, {
- "title": "Artists",
+ "title": "Crazy Patch Writers (Retired)",
+ "people": [
+ "Jakub 'haakon' Adam",
+ "Felipe 'shx' Contreras",
+ "Decklin Foster",
+ "Krzysztof Klinikowski",
+ "Peter 'Bleeter' Lawler",
+ "Robert 'Robot101' McQueen",
+ "Benjamin Miller",
+ "Dennis 'EvilDennisR' Ristuccia",
+ "Peter 'Fmoo' Ruibal",
+ "Gabriel 'Nix' Schulhof",
+ "Ankit Vani"
+ ]
+ }, {
+ "title": "Artists (Retired)",
"people": [
"Hylke Bons"
]