summaryrefslogtreecommitdiff
path: root/pidgin/gtkdialogs.c
diff options
context:
space:
mode:
Diffstat (limited to 'pidgin/gtkdialogs.c')
-rw-r--r--pidgin/gtkdialogs.c274
1 files changed, 160 insertions, 114 deletions
diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c
index 2560d0a95f..f88e70e8da 100644
--- a/pidgin/gtkdialogs.c
+++ b/pidgin/gtkdialogs.c
@@ -46,8 +46,6 @@
static GList *dialogwindows = NULL;
-static GtkWidget *about = NULL;
-
struct _PidginGroupMergeObject {
PurpleGroup* parent;
char *new_name;
@@ -351,11 +349,9 @@ pidgin_dialogs_destroy_all()
}
}
-static void destroy_about(void)
+static void destroy_win(GtkWidget *button, GtkWidget *win)
{
- if (about != NULL)
- gtk_widget_destroy(about);
- about = NULL;
+ gtk_widget_destroy(win);
}
#if 0
@@ -398,130 +394,129 @@ pidgin_logo_versionize(GdkPixbuf **original, GtkWidget *widget) {
}
#endif
-void pidgin_dialogs_about()
+/* Note: Frees 'string' */
+static GtkWidget *
+pidgin_build_help_dialog(const char *title, const char *role, GString *string)
{
- GtkWidget *vbox;
- GtkWidget *logo;
- GtkWidget *frame;
- GtkWidget *text;
- GtkWidget *button;
+ GtkWidget *win, *vbox, *frame, *logo, *imhtml, *button;
+ GdkPixbuf *pixbuf;
GtkTextIter iter;
- GString *str;
AtkObject *obj;
- char* filename, *tmp;
- GdkPixbuf *pixbuf;
- PidginBuddyList *buddylist;
-
- if (about != NULL) {
- gtk_window_present(GTK_WINDOW(about));
- return;
- }
-
- tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME);
- about = pidgin_create_dialog(tmp, PIDGIN_HIG_BORDER, "about", TRUE);
- g_free(tmp);
- gtk_window_set_default_size(GTK_WINDOW(about), 340, 450);
+ char *filename, *tmp;
- vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(about), FALSE, PIDGIN_HIG_BORDER);
+ win = pidgin_create_dialog(title, PIDGIN_HIG_BORDER, role, TRUE);
+ vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, PIDGIN_HIG_BORDER);
+ gtk_window_set_default_size(GTK_WINDOW(win), 450, 450);
/* Generate a logo with a version number */
- logo = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_realize(logo);
filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "logo.png", NULL);
pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
g_free(filename);
+
#if 0 /* Don't versionize the logo when the logo has the version in it */
pidgin_logo_versionize(&pixbuf, logo);
#endif
- gtk_widget_destroy(logo);
+
+ /* Insert the logo */
logo = gtk_image_new_from_pixbuf(pixbuf);
g_object_unref(G_OBJECT(pixbuf));
- /* Insert the logo */
obj = gtk_widget_get_accessible(logo);
tmp = g_strconcat(PIDGIN_NAME, " " DISPLAY_VERSION, NULL);
atk_object_set_description(obj, tmp);
g_free(tmp);
gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0);
- frame = pidgin_create_imhtml(FALSE, &text, NULL, NULL);
- gtk_imhtml_set_format_functions(GTK_IMHTML(text), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY);
+ frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL);
+ gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY);
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
+ gtk_imhtml_append_text(GTK_IMHTML(imhtml), string->str, GTK_IMHTML_NO_SCROLL);
+ gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter);
+ gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter);
+
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE,
+ G_CALLBACK(destroy_win), win);
+
+ GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(button);
+
+ gtk_widget_show_all(win);
+ gtk_window_present(GTK_WINDOW(win));
+
+ g_string_free(string, TRUE);
+
+ return win;
+}
+
+void pidgin_dialogs_about(void)
+{
+ GString *str;
+ char *tmp;
+ static GtkWidget *about = NULL;
+
+ if (about != NULL) {
+ gtk_window_present(GTK_WINDOW(about));
+ return;
+ }
+
str = g_string_sized_new(4096);
g_string_append_printf(str,
- "<CENTER><FONT SIZE=\"4\"><B>%s %s</B></FONT></CENTER><BR>(libpurple %s)<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION);
+ "<CENTER><FONT SIZE=\"4\"><B>%s %s</B></FONT></CENTER> (libpurple %s)"
+ "<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION,
+ purple_core_get_version(), REVISION);
g_string_append_printf(str,
- _("%s is a graphical modular messaging client based on "
- "libpurple which is capable of connecting to "
- "AIM, MSN, Yahoo!, XMPP, ICQ, IRC, SILC, SIP/SIMPLE, "
- "Novell GroupWise, Lotus Sametime, Bonjour, Zephyr, "
- "MySpaceIM, Gadu-Gadu, and QQ all at once. "
- "It is written using GTK+.<BR><BR>"
- "You may modify and redistribute the program under "
- "the terms of the GPL (version 2 or later). A copy of the GPL is "
- "contained in the 'COPYING' file distributed with %s. "
- "%s is copyrighted by its contributors. See the 'COPYRIGHT' "
- "file for the complete list of contributors. We provide no "
- "warranty for this program.<BR><BR>"), PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
-
- g_string_append(str, "<FONT SIZE=\"4\">URL:</FONT> <A HREF=\""
- PURPLE_WEBSITE "\">" PURPLE_WEBSITE "</A><BR/><BR/>");
- g_string_append_printf(str, _("<FONT SIZE=\"4\">FAQ:</FONT> <A HREF=\""
- "http://developer.pidgin.im/wiki/FAQ\">"
- "http://developer.pidgin.im/wiki/FAQ</A><BR/><BR/>"));
+ _("%s is a messaging client based on libpurple which is capable of "
+ "connecting to multiple messaging services at once. %s is written "
+ "in C using GTK+. %s is released, and may be modified and "
+ "redistributed, under the terms of the GPL version 2 (or later). "
+ "A copy of the GPL is distributed with %s. %s is copyrighted by "
+ "its contributors, a list of whom is also distributed with %s. "
+ "There is no warranty for %s.<BR><BR>"), PIDGIN_NAME, PIDGIN_NAME,
+ PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
+
g_string_append_printf(str,
- _("<font size=\"4\">Help from other Pidgin users:</font> "
- "<a href=\"mailto:support@pidgin.im\">support@pidgin.im</a><br/>"
- "This is a <b>public</b> mailing list! "
- "(<a href=\"http://pidgin.im/pipermail/support/\">archive</a>)<br/>"
- "We can't help with 3rd party protocols or plugins!<br/>"
- "This list's primary language is <b>English</b>. You are "
- "welcome to post in another language, but the responses may "
- "be less helpful.<br/><br/>"));
- g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC Channel:</FONT> "
- "#pidgin on irc.freenode.net<BR><BR>"));
- g_string_append_printf(str, _("<FONT SIZE=\"4\">XMPP MUC:</FONT> "
- "devel@conference.pidgin.im<BR><BR>"));
+ _("<FONT SIZE=\"4\"><B>Helpful Resources</B></FONT><BR>\t<A "
+ "HREF=\"%s\">Website</A><BR>\t<A HREF=\"%s\">Frequently Asked "
+ "Questions</A><BR>\tIRC Channel: #pidgin on irc.freenode.net<BR>"
+ "\tXMPP MUC: devel@conference.pidgin.im<BR><BR>"), PURPLE_WEBSITE,
+ "http://developer.pidgin.im/wiki/FAQ");
- /* Current Developers */
- g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
- _("Current Developers"));
- add_developers(str, developers);
- g_string_append(str, "<BR/>");
+ g_string_append_printf(str,
+ _("<font size=\"4\"><b>Help from other Pidgin users</b></font> is "
+ "available by e-mailing <a "
+ "href=\"mailto:support@pidgin.im\">support@pidgin.im</a><br/>"
+ "This is a <b>public</b> mailing list! "
+ "(<a href=\"http://pidgin.im/pipermail/support/\">archive</a>)<br/>"
+ "We can't help with third-party protocols or plugins!<br/>"
+ "This list's primary language is <b>English</b>. You are "
+ "welcome to post in another language, but the responses may "
+ "be less helpful.<br/>"));
- /* Crazy Patch Writers */
- g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
- _("Crazy Patch Writers"));
- add_developers(str, patch_writers);
- g_string_append(str, "<BR/>");
+ tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME);
+ about = pidgin_build_help_dialog(tmp, "about", str);
+ g_signal_connect(G_OBJECT(about), "destroy", G_CALLBACK(gtk_widget_destroyed), &about);
+ g_free(tmp);
+}
- /* Retired Developers */
- g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
- _("Retired Developers"));
- add_developers(str, retired_developers);
- g_string_append(str, "<BR/>");
+void pidgin_dialogs_buildinfo(void)
+{
+ GString *str;
+ char *tmp;
+ static GtkWidget *buildinfo = NULL;
- /* Retired Crazy Patch Writers */
- g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
- _("Retired Crazy Patch Writers"));
- add_developers(str, retired_patch_writers);
- g_string_append(str, "<BR/>");
+ if (buildinfo != NULL) {
+ gtk_window_present(GTK_WINDOW(buildinfo));
+ return;
+ }
- /* Current Translators */
- g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
- _("Current Translators"));
- add_translators(str, translators);
- g_string_append(str, "<BR/>");
+ str = g_string_sized_new(4096);
- /* Past Translators */
- g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
- _("Past Translators"));
- add_translators(str, past_translators);
- g_string_append(str, "<BR/>");
+ g_string_append_printf(str,
+ "<FONT SIZE=\"4\"><B>%s %s</B></FONT> (libpurple %s)<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION);
- g_string_append_printf(str, "<FONT SIZE=\"4\">%s</FONT><br/>", _("Debugging Information"));
+ g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s</B></FONT><br/>", _("Build Information"));
/* The following primarly intented for user/developer interaction and thus
ought not be translated */
@@ -698,31 +693,82 @@ if (purple_plugins_find_with_id("core-tcl") != NULL) {
/* End of not to be translated section */
- gtk_imhtml_append_text(GTK_IMHTML(text), str->str, GTK_IMHTML_NO_SCROLL);
- g_string_free(str, TRUE);
+ tmp = g_strdup_printf(_("%s Build Information"), PIDGIN_NAME);
+ buildinfo = pidgin_build_help_dialog(tmp, "buildinfo", str);
+ g_signal_connect(G_OBJECT(buildinfo), "destroy", G_CALLBACK(gtk_widget_destroyed), &buildinfo);
+ g_free(tmp);
+}
- gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter);
- gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter);
+void pidgin_dialogs_developers(void)
+{
+ GString *str;
+ char *tmp;
+ static GtkWidget *developer_info = NULL;
- /* Close Button */
- button = pidgin_dialog_add_button(GTK_DIALOG(about), GTK_STOCK_CLOSE,
- G_CALLBACK(destroy_about), about);
+ if (developer_info != NULL) {
+ gtk_window_present(GTK_WINDOW(developer_info));
+ return;
+ }
- g_signal_connect(G_OBJECT(about), "destroy",
- G_CALLBACK(destroy_about), G_OBJECT(about));
+ str = g_string_sized_new(4096);
- /* this makes the sizes not work? */
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button);
+ /* Current Developers */
+ g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
+ _("Current Developers"));
+ add_developers(str, developers);
+ g_string_append(str, "<BR/>");
- /* Let's give'em something to talk about -- woah woah woah */
- buddylist = pidgin_blist_get_default_gtk_blist();
- if (buddylist)
- gtk_window_set_transient_for(GTK_WINDOW(about),
- GTK_WINDOW(buddylist->window));
+ /* Crazy Patch Writers */
+ g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
+ _("Crazy Patch Writers"));
+ add_developers(str, patch_writers);
+ g_string_append(str, "<BR/>");
- gtk_widget_show_all(about);
- gtk_window_present(GTK_WINDOW(about));
+ /* Retired Developers */
+ g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
+ _("Retired Developers"));
+ add_developers(str, retired_developers);
+ g_string_append(str, "<BR/>");
+
+ /* Retired Crazy Patch Writers */
+ g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
+ _("Retired Crazy Patch Writers"));
+ add_developers(str, retired_patch_writers);
+
+ tmp = g_strdup_printf(_("%s Developer Information"), PIDGIN_NAME);
+ developer_info = pidgin_build_help_dialog(tmp, "developer_info", str);
+ g_signal_connect(G_OBJECT(developer_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &developer_info);
+ g_free(tmp);
+}
+
+void pidgin_dialogs_translators(void)
+{
+ GString *str;
+ char *tmp;
+ static GtkWidget *translator_info = NULL;
+
+ if (translator_info != NULL) {
+ gtk_window_present(GTK_WINDOW(translator_info));
+ return;
+ }
+
+ str = g_string_sized_new(4096);
+
+ /* Current Translators */
+ g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
+ _("Current Translators"));
+ add_translators(str, translators);
+ g_string_append(str, "<BR/>");
+
+ /* Past Translators */
+ g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
+ _("Past Translators"));
+ add_translators(str, past_translators);
+
+ tmp = g_strdup_printf(_("%s Translator Information"), PIDGIN_NAME);
+ translator_info = pidgin_build_help_dialog(tmp, "translator_info", str);
+ g_signal_connect(G_OBJECT(translator_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &translator_info);
+ g_free(tmp);
}
static void