pidgin/gtkdialogs.c

branch
next.minor
changeset 29662
fc97e81006c3
parent 28969
4fbd469968ef
parent 29530
252b84468a95
child 29676
058499979e7b
equal deleted inserted replaced
28969:4fbd469968ef 29662:fc97e81006c3
43 #include "gtklog.h" 43 #include "gtklog.h"
44 #include "gtkutils.h" 44 #include "gtkutils.h"
45 #include "pidginstock.h" 45 #include "pidginstock.h"
46 46
47 static GList *dialogwindows = NULL; 47 static GList *dialogwindows = NULL;
48
49 static GtkWidget *about = NULL;
50 48
51 struct _PidginGroupMergeObject { 49 struct _PidginGroupMergeObject {
52 PurpleGroup* parent; 50 PurpleGroup* parent;
53 char *new_name; 51 char *new_name;
54 }; 52 };
351 gtk_widget_destroy(dialogwindows->data); 349 gtk_widget_destroy(dialogwindows->data);
352 dialogwindows = g_list_remove(dialogwindows, dialogwindows->data); 350 dialogwindows = g_list_remove(dialogwindows, dialogwindows->data);
353 } 351 }
354 } 352 }
355 353
356 static void destroy_about(void) 354 static void destroy_win(GtkWidget *button, GtkWidget *win)
357 { 355 {
358 if (about != NULL) 356 gtk_widget_destroy(win);
359 gtk_widget_destroy(about);
360 about = NULL;
361 } 357 }
362 358
363 #if 0 359 #if 0
364 /* This function puts the version number onto the pixmap we use in the 'about' 360 /* This function puts the version number onto the pixmap we use in the 'about'
365 * screen in Pidgin. */ 361 * screen in Pidgin. */
398 width, height); 394 width, height);
399 g_object_unref(G_OBJECT(pixmap)); 395 g_object_unref(G_OBJECT(pixmap));
400 } 396 }
401 #endif 397 #endif
402 398
403 void pidgin_dialogs_about() 399 /* Note: Frees 'string' */
404 { 400 static GtkWidget *
405 GtkWidget *vbox; 401 pidgin_build_help_dialog(const char *title, const char *role, GString *string)
406 GtkWidget *logo; 402 {
407 GtkWidget *frame; 403 GtkWidget *win, *vbox, *frame, *logo, *imhtml, *button;
408 GtkWidget *text; 404 GdkPixbuf *pixbuf;
409 GtkWidget *button;
410 GtkTextIter iter; 405 GtkTextIter iter;
411 GString *str;
412 AtkObject *obj; 406 AtkObject *obj;
413 char* filename, *tmp; 407 char *filename, *tmp;
414 GdkPixbuf *pixbuf; 408
415 PidginBuddyList *buddylist; 409 win = pidgin_create_dialog(title, PIDGIN_HIG_BORDER, role, TRUE);
416 410 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, PIDGIN_HIG_BORDER);
417 if (about != NULL) { 411 gtk_window_set_default_size(GTK_WINDOW(win), 450, 450);
418 gtk_window_present(GTK_WINDOW(about));
419 return;
420 }
421
422 tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME);
423 about = pidgin_create_dialog(tmp, PIDGIN_HIG_BORDER, "about", TRUE);
424 g_free(tmp);
425 gtk_window_set_default_size(GTK_WINDOW(about), 340, 450);
426
427 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(about), FALSE, PIDGIN_HIG_BORDER);
428 412
429 /* Generate a logo with a version number */ 413 /* Generate a logo with a version number */
430 logo = gtk_window_new(GTK_WINDOW_TOPLEVEL);
431 gtk_widget_realize(logo);
432 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "logo.png", NULL); 414 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "logo.png", NULL);
433 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); 415 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
434 g_free(filename); 416 g_free(filename);
417
435 #if 0 /* Don't versionize the logo when the logo has the version in it */ 418 #if 0 /* Don't versionize the logo when the logo has the version in it */
436 pidgin_logo_versionize(&pixbuf, logo); 419 pidgin_logo_versionize(&pixbuf, logo);
437 #endif 420 #endif
438 gtk_widget_destroy(logo); 421
422 /* Insert the logo */
439 logo = gtk_image_new_from_pixbuf(pixbuf); 423 logo = gtk_image_new_from_pixbuf(pixbuf);
440 g_object_unref(G_OBJECT(pixbuf)); 424 g_object_unref(G_OBJECT(pixbuf));
441 /* Insert the logo */
442 obj = gtk_widget_get_accessible(logo); 425 obj = gtk_widget_get_accessible(logo);
443 tmp = g_strconcat(PIDGIN_NAME, " " DISPLAY_VERSION, NULL); 426 tmp = g_strconcat(PIDGIN_NAME, " " DISPLAY_VERSION, NULL);
444 atk_object_set_description(obj, tmp); 427 atk_object_set_description(obj, tmp);
445 g_free(tmp); 428 g_free(tmp);
446 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); 429 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0);
447 430
448 frame = pidgin_create_imhtml(FALSE, &text, NULL, NULL); 431 frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL);
449 gtk_imhtml_set_format_functions(GTK_IMHTML(text), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); 432 gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY);
450 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); 433 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
451 434
435 gtk_imhtml_append_text(GTK_IMHTML(imhtml), string->str, GTK_IMHTML_NO_SCROLL);
436 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter);
437 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter);
438
439 button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE,
440 G_CALLBACK(destroy_win), win);
441
442 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
443 gtk_widget_grab_default(button);
444
445 gtk_widget_show_all(win);
446 gtk_window_present(GTK_WINDOW(win));
447
448 g_string_free(string, TRUE);
449
450 return win;
451 }
452
453 void pidgin_dialogs_about(void)
454 {
455 GString *str;
456 char *tmp;
457 static GtkWidget *about = NULL;
458
459 if (about != NULL) {
460 gtk_window_present(GTK_WINDOW(about));
461 return;
462 }
463
452 str = g_string_sized_new(4096); 464 str = g_string_sized_new(4096);
453 465
454 g_string_append_printf(str, 466 g_string_append_printf(str,
455 "<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); 467 "<CENTER><FONT SIZE=\"4\"><B>%s %s</B></FONT></CENTER> (libpurple %s)"
468 "<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION,
469 purple_core_get_version(), REVISION);
456 470
457 g_string_append_printf(str, 471 g_string_append_printf(str,
458 _("%s is a graphical modular messaging client based on " 472 _("%s is a messaging client based on libpurple which is capable of "
459 "libpurple which is capable of connecting to " 473 "connecting to multiple messaging services at once. %s is written "
460 "AIM, MSN, Yahoo!, XMPP, ICQ, IRC, SILC, SIP/SIMPLE, " 474 "in C using GTK+. %s is released, and may be modified and "
461 "Novell GroupWise, Lotus Sametime, Bonjour, Zephyr, " 475 "redistributed, under the terms of the GPL version 2 (or later). "
462 "MySpaceIM, Gadu-Gadu, and QQ all at once. " 476 "A copy of the GPL is distributed with %s. %s is copyrighted by "
463 "It is written using GTK+.<BR><BR>" 477 "its contributors, a list of whom is also distributed with %s. "
464 "You may modify and redistribute the program under " 478 "There is no warranty for %s.<BR><BR>"), PIDGIN_NAME, PIDGIN_NAME,
465 "the terms of the GPL (version 2 or later). A copy of the GPL is " 479 PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
466 "contained in the 'COPYING' file distributed with %s. " 480
467 "%s is copyrighted by its contributors. See the 'COPYRIGHT' "
468 "file for the complete list of contributors. We provide no "
469 "warranty for this program.<BR><BR>"), PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME);
470
471 g_string_append(str, "<FONT SIZE=\"4\">URL:</FONT> <A HREF=\""
472 PURPLE_WEBSITE "\">" PURPLE_WEBSITE "</A><BR/><BR/>");
473 g_string_append_printf(str, _("<FONT SIZE=\"4\">FAQ:</FONT> <A HREF=\""
474 "http://developer.pidgin.im/wiki/FAQ\">"
475 "http://developer.pidgin.im/wiki/FAQ</A><BR/><BR/>"));
476 g_string_append_printf(str, 481 g_string_append_printf(str,
477 _("<font size=\"4\">Help from other Pidgin users:</font> " 482 _("<FONT SIZE=\"4\"><B>Helpful Resources</B></FONT><BR>\t<A "
478 "<a href=\"mailto:support@pidgin.im\">support@pidgin.im</a><br/>" 483 "HREF=\"%s\">Website</A><BR>\t<A HREF=\"%s\">Frequently Asked "
479 "This is a <b>public</b> mailing list! " 484 "Questions</A><BR>\tIRC Channel: #pidgin on irc.freenode.net<BR>"
480 "(<a href=\"http://pidgin.im/pipermail/support/\">archive</a>)<br/>" 485 "\tXMPP MUC: devel@conference.pidgin.im<BR><BR>"), PURPLE_WEBSITE,
481 "We can't help with 3rd party protocols or plugins!<br/>" 486 "http://developer.pidgin.im/wiki/FAQ");
482 "This list's primary language is <b>English</b>. You are " 487
483 "welcome to post in another language, but the responses may " 488 g_string_append_printf(str,
484 "be less helpful.<br/><br/>")); 489 _("<font size=\"4\"><b>Help from other Pidgin users</b></font> is "
485 g_string_append_printf(str, _("<FONT SIZE=\"4\">IRC Channel:</FONT> " 490 "available by e-mailing <a "
486 "#pidgin on irc.freenode.net<BR><BR>")); 491 "href=\"mailto:support@pidgin.im\">support@pidgin.im</a><br/>"
487 g_string_append_printf(str, _("<FONT SIZE=\"4\">XMPP MUC:</FONT> " 492 "This is a <b>public</b> mailing list! "
488 "devel@conference.pidgin.im<BR><BR>")); 493 "(<a href=\"http://pidgin.im/pipermail/support/\">archive</a>)<br/>"
489 494 "We can't help with third-party protocols or plugins!<br/>"
490 /* Current Developers */ 495 "This list's primary language is <b>English</b>. You are "
491 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", 496 "welcome to post in another language, but the responses may "
492 _("Current Developers")); 497 "be less helpful.<br/>"));
493 add_developers(str, developers); 498
494 g_string_append(str, "<BR/>"); 499 tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME);
495 500 about = pidgin_build_help_dialog(tmp, "about", str);
496 /* Crazy Patch Writers */ 501 g_signal_connect(G_OBJECT(about), "destroy", G_CALLBACK(gtk_widget_destroyed), &about);
497 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", 502 g_free(tmp);
498 _("Crazy Patch Writers")); 503 }
499 add_developers(str, patch_writers); 504
500 g_string_append(str, "<BR/>"); 505 void pidgin_dialogs_buildinfo(void)
501 506 {
502 /* Retired Developers */ 507 GString *str;
503 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", 508 char *tmp;
504 _("Retired Developers")); 509 static GtkWidget *buildinfo = NULL;
505 add_developers(str, retired_developers); 510
506 g_string_append(str, "<BR/>"); 511 if (buildinfo != NULL) {
507 512 gtk_window_present(GTK_WINDOW(buildinfo));
508 /* Retired Crazy Patch Writers */ 513 return;
509 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", 514 }
510 _("Retired Crazy Patch Writers")); 515
511 add_developers(str, retired_patch_writers); 516 str = g_string_sized_new(4096);
512 g_string_append(str, "<BR/>"); 517
513 518 g_string_append_printf(str,
514 /* Current Translators */ 519 "<FONT SIZE=\"4\"><B>%s %s</B></FONT> (libpurple %s)<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION);
515 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>", 520
516 _("Current Translators")); 521 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s</B></FONT><br/>", _("Build Information"));
517 add_translators(str, translators);
518 g_string_append(str, "<BR/>");
519
520 /* Past Translators */
521 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
522 _("Past Translators"));
523 add_translators(str, past_translators);
524 g_string_append(str, "<BR/>");
525
526 g_string_append_printf(str, "<FONT SIZE=\"4\">%s</FONT><br/>", _("Debugging Information"));
527 522
528 /* The following primarly intented for user/developer interaction and thus 523 /* The following primarly intented for user/developer interaction and thus
529 ought not be translated */ 524 ought not be translated */
530 525
531 #ifdef CONFIG_ARGS /* win32 build doesn't use configure */ 526 #ifdef CONFIG_ARGS /* win32 build doesn't use configure */
698 #endif 693 #endif
699 #endif 694 #endif
700 695
701 /* End of not to be translated section */ 696 /* End of not to be translated section */
702 697
703 gtk_imhtml_append_text(GTK_IMHTML(text), str->str, GTK_IMHTML_NO_SCROLL); 698 tmp = g_strdup_printf(_("%s Build Information"), PIDGIN_NAME);
704 g_string_free(str, TRUE); 699 buildinfo = pidgin_build_help_dialog(tmp, "buildinfo", str);
705 700 g_signal_connect(G_OBJECT(buildinfo), "destroy", G_CALLBACK(gtk_widget_destroyed), &buildinfo);
706 gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); 701 g_free(tmp);
707 gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); 702 }
708 703
709 /* Close Button */ 704 void pidgin_dialogs_developers(void)
710 button = pidgin_dialog_add_button(GTK_DIALOG(about), GTK_STOCK_CLOSE, 705 {
711 G_CALLBACK(destroy_about), about); 706 GString *str;
712 707 char *tmp;
713 g_signal_connect(G_OBJECT(about), "destroy", 708 static GtkWidget *developer_info = NULL;
714 G_CALLBACK(destroy_about), G_OBJECT(about)); 709
715 710 if (developer_info != NULL) {
716 /* this makes the sizes not work? */ 711 gtk_window_present(GTK_WINDOW(developer_info));
717 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); 712 return;
718 gtk_widget_grab_default(button); 713 }
719 714
720 /* Let's give'em something to talk about -- woah woah woah */ 715 str = g_string_sized_new(4096);
721 buddylist = pidgin_blist_get_default_gtk_blist(); 716
722 if (buddylist) 717 /* Current Developers */
723 gtk_window_set_transient_for(GTK_WINDOW(about), 718 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
724 GTK_WINDOW(buddylist->window)); 719 _("Current Developers"));
725 720 add_developers(str, developers);
726 gtk_widget_show_all(about); 721 g_string_append(str, "<BR/>");
727 gtk_window_present(GTK_WINDOW(about)); 722
723 /* Crazy Patch Writers */
724 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
725 _("Crazy Patch Writers"));
726 add_developers(str, patch_writers);
727 g_string_append(str, "<BR/>");
728
729 /* Retired Developers */
730 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
731 _("Retired Developers"));
732 add_developers(str, retired_developers);
733 g_string_append(str, "<BR/>");
734
735 /* Retired Crazy Patch Writers */
736 g_string_append_printf(str, "<FONT SIZE=\"4\"><B>%s:</B></FONT><BR/>",
737 _("Retired Crazy Patch Writers"));
738 add_developers(str, retired_patch_writers);
739
740 tmp = g_strdup_printf(_("%s Developer Information"), PIDGIN_NAME);
741 developer_info = pidgin_build_help_dialog(tmp, "developer_info", str);
742 g_signal_connect(G_OBJECT(developer_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &developer_info);
743 g_free(tmp);
744 }
745
746 void pidgin_dialogs_translators(void)
747 {
748 GString *str;
749 char *tmp;
750 static GtkWidget *translator_info = NULL;
751
752 if (translator_info != NULL) {
753 gtk_window_present(GTK_WINDOW(translator_info));
754 return;
755 }
756
757 str = g_string_sized_new(4096);
758
759 /* Current Translators */
760 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
761 _("Current Translators"));
762 add_translators(str, translators);
763 g_string_append(str, "<BR/>");
764
765 /* Past Translators */
766 g_string_append_printf(str, "<FONT SIZE=\"4\">%s:</FONT><BR/>",
767 _("Past Translators"));
768 add_translators(str, past_translators);
769
770 tmp = g_strdup_printf(_("%s Translator Information"), PIDGIN_NAME);
771 translator_info = pidgin_build_help_dialog(tmp, "translator_info", str);
772 g_signal_connect(G_OBJECT(translator_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &translator_info);
773 g_free(tmp);
728 } 774 }
729 775
730 static void 776 static void
731 pidgin_dialogs_im_cb(gpointer data, PurpleRequestFields *fields) 777 pidgin_dialogs_im_cb(gpointer data, PurpleRequestFields *fields)
732 { 778 {

mercurial