diff -r 4fbd469968ef -r fc97e81006c3 pidgin/gtkdialogs.c
--- a/pidgin/gtkdialogs.c Mon Nov 23 19:00:00 2009 +0000
+++ b/pidgin/gtkdialogs.c Mon Nov 23 23:53:19 2009 +0000
@@ -46,8 +46,6 @@
static GList *dialogwindows = NULL;
-static GtkWidget *about = NULL;
-
struct _PidginGroupMergeObject {
PurpleGroup* parent;
char *new_name;
@@ -353,11 +351,9 @@
}
}
-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
@@ -400,130 +396,129 @@
}
#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;
- GtkTextIter iter;
- GString *str;
- AtkObject *obj;
- char* filename, *tmp;
+ GtkWidget *win, *vbox, *frame, *logo, *imhtml, *button;
GdkPixbuf *pixbuf;
- PidginBuddyList *buddylist;
-
- if (about != NULL) {
- gtk_window_present(GTK_WINDOW(about));
- return;
- }
+ GtkTextIter iter;
+ AtkObject *obj;
+ char *filename, *tmp;
- 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);
-
- 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,
- "
%s %s
(libpurple %s)
%s
", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION);
+ "%s %s (libpurple %s)"
+ "
%s
", PIDGIN_NAME, DISPLAY_VERSION,
+ purple_core_get_version(), REVISION);
+
+ g_string_append_printf(str,
+ _("%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.
"), PIDGIN_NAME, PIDGIN_NAME,
+ PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
+
+ g_string_append_printf(str,
+ _("Helpful Resources
\tWebsite
\tFrequently Asked "
+ "Questions
\tIRC Channel: #pidgin on irc.freenode.net
"
+ "\tXMPP MUC: devel@conference.pidgin.im
"), PURPLE_WEBSITE,
+ "http://developer.pidgin.im/wiki/FAQ");
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+.
"
- "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.
"), PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
+ _("Help from other Pidgin users is "
+ "available by e-mailing support@pidgin.im
"
+ "This is a public mailing list! "
+ "(archive)
"
+ "We can't help with third-party protocols or plugins!
"
+ "This list's primary language is English. You are "
+ "welcome to post in another language, but the responses may "
+ "be less helpful.
"));
- g_string_append(str, "URL: " PURPLE_WEBSITE "
");
- g_string_append_printf(str, _("FAQ: "
- "http://developer.pidgin.im/wiki/FAQ
"));
- g_string_append_printf(str,
- _("Help from other Pidgin users: "
- "support@pidgin.im
"
- "This is a public mailing list! "
- "(archive)
"
- "We can't help with 3rd party protocols or plugins!
"
- "This list's primary language is English. You are "
- "welcome to post in another language, but the responses may "
- "be less helpful.
"));
- g_string_append_printf(str, _("IRC Channel: "
- "#pidgin on irc.freenode.net
"));
- g_string_append_printf(str, _("XMPP MUC: "
- "devel@conference.pidgin.im
"));
+ 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);
+}
- /* Current Developers */
- g_string_append_printf(str, "%s:
",
- _("Current Developers"));
- add_developers(str, developers);
- g_string_append(str, "
");
-
- /* Crazy Patch Writers */
- g_string_append_printf(str, "%s:
",
- _("Crazy Patch Writers"));
- add_developers(str, patch_writers);
- g_string_append(str, "
");
-
- /* Retired Developers */
- g_string_append_printf(str, "%s:
",
- _("Retired Developers"));
- add_developers(str, retired_developers);
- g_string_append(str, "
");
+void pidgin_dialogs_buildinfo(void)
+{
+ GString *str;
+ char *tmp;
+ static GtkWidget *buildinfo = NULL;
- /* Retired Crazy Patch Writers */
- g_string_append_printf(str, "%s:
",
- _("Retired Crazy Patch Writers"));
- add_developers(str, retired_patch_writers);
- g_string_append(str, "
");
+ if (buildinfo != NULL) {
+ gtk_window_present(GTK_WINDOW(buildinfo));
+ return;
+ }
- /* Current Translators */
- g_string_append_printf(str, "%s:
",
- _("Current Translators"));
- add_translators(str, translators);
- g_string_append(str, "
");
+ str = g_string_sized_new(4096);
- /* Past Translators */
- g_string_append_printf(str, "%s:
",
- _("Past Translators"));
- add_translators(str, past_translators);
- g_string_append(str, "
");
+ g_string_append_printf(str,
+ "%s %s (libpurple %s)
%s
", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION);
- g_string_append_printf(str, "%s
", _("Debugging Information"));
+ g_string_append_printf(str, "%s
", _("Build Information"));
/* The following primarly intented for user/developer interaction and thus
ought not be translated */
@@ -700,31 +695,82 @@
/* 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;
+
+ if (developer_info != NULL) {
+ gtk_window_present(GTK_WINDOW(developer_info));
+ return;
+ }
- /* Close Button */
- button = pidgin_dialog_add_button(GTK_DIALOG(about), GTK_STOCK_CLOSE,
- G_CALLBACK(destroy_about), about);
+ str = g_string_sized_new(4096);
+
+ /* Current Developers */
+ g_string_append_printf(str, "%s:
",
+ _("Current Developers"));
+ add_developers(str, developers);
+ g_string_append(str, "
");
- g_signal_connect(G_OBJECT(about), "destroy",
- G_CALLBACK(destroy_about), G_OBJECT(about));
+ /* Crazy Patch Writers */
+ g_string_append_printf(str, "%s:
",
+ _("Crazy Patch Writers"));
+ add_developers(str, patch_writers);
+ g_string_append(str, "
");
+
+ /* Retired Developers */
+ g_string_append_printf(str, "%s:
",
+ _("Retired Developers"));
+ add_developers(str, retired_developers);
+ g_string_append(str, "
");
- /* this makes the sizes not work? */
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button);
+ /* Retired Crazy Patch Writers */
+ g_string_append_printf(str, "%s:
",
+ _("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;
- /* 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));
+ if (translator_info != NULL) {
+ gtk_window_present(GTK_WINDOW(translator_info));
+ return;
+ }
+
+ str = g_string_sized_new(4096);
- gtk_widget_show_all(about);
- gtk_window_present(GTK_WINDOW(about));
+ /* Current Translators */
+ g_string_append_printf(str, "%s:
",
+ _("Current Translators"));
+ add_translators(str, translators);
+ g_string_append(str, "
");
+
+ /* Past Translators */
+ g_string_append_printf(str, "%s:
",
+ _("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