Index: dialog.c =================================================================== --- dialog.c (revision 14306) +++ dialog.c (working copy) @@ -84,54 +89,28 @@ GtkWidget *dialog; gchar *str; gint res; - + va_start(ap, message); str = g_strdup_vprintf(message, ap); va_end(ap); - + dialog = create_dialog_message_question(window, str); g_free(str); - + res = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); - + return res; } -static const gchar *translator_table[][2] = +void run_dialog_about(GtkWidget *window, gchar *iconpath) { - { "ca", "2004 David Rosal" }, - { "cs", "2004 Petr Vysloužil" }, - { "de", "2004 Sebastian Stach" }, - { "es", "2004 Lucas Vieites" }, - { "fr", "2004 Luc Pionchon" }, - { "hu", "2004 Reviczky Ádám János" }, - { "it", "2004 Alessio D'Ascanio" }, - { "lt", "2004 Lech Jankovski" }, - { "pl", "2004 Michal Wrobel" }, - { "ru", "2004 Artem Vakhitov" }, - { "sv", "2004 Isak Savo" }, - { "ta", "2004 Vijay Durairaj" }, - { "zh_CN", "2004 Carlos Z.F. Liu" }, - { "zh_TW", "2004 OLS3" }, - { NULL, NULL }, -}; - -void run_dialog_about(GtkWidget *window, const gchar *name, const gchar *version, - const gchar *description, const gchar *copyright, gchar *iconpath) -{ GtkWidget *dialog; GtkWidget *vbox; GtkWidget *icon; GtkWidget *margin; - GtkWidget *label; gchar *str; - gint i = 0; - - const gchar *env; - const gchar *translator = NULL; - gchar *translation; - + str = g_strdup_printf(_("About %s"), PACKAGE_NAME); dialog = gtk_dialog_new_with_buttons( str, @@ -141,46 +120,16 @@ NULL); g_free(str); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - + vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, FALSE, FALSE, 0); - + icon = gtk_image_new_from_file(iconpath); gtk_box_pack_start (GTK_BOX (vbox), icon, FALSE, FALSE, 0); - + margin = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(margin), 4); gtk_box_pack_start(GTK_BOX(vbox), margin, FALSE, FALSE, 0); - - /* TODO: use array */ - env = g_getenv("LC_ALL"); - if (!env) - env = g_getenv("LANG"); - if (env) - while (translator_table[i][0]) { - if (strncmp(env, translator_table[i][0], strlen(translator_table[i][0])) == 0) { - translator = translator_table[i][1]; - break; - } - i++; - } - if (translator) - translation = g_strdup_printf("\nTranslation © %s", translator); - else - translation = g_strdup(""); - - label = gtk_label_new(NULL); - str = g_strdup_printf( - "%s %s\n\n%s\n\n%s%s", - name, version, description, copyright, translation); - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER); - gtk_label_set_markup(GTK_LABEL(label), str); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - g_free(str); - g_free(translation); - - gtk_widget_show_all(vbox); - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); + } Index: callback.h =================================================================== --- callback.h (revision 14306) +++ callback.h (working copy) @@ -46,7 +46,7 @@ void cb_option_word_wrap(StructData *sd, guint action, GtkWidget *widget); void cb_option_line_numbers(StructData *sd, guint action, GtkWidget *widget); void cb_option_auto_indent(StructData *sd, guint action, GtkWidget *widget); -void cb_help_about(StructData *sd); +void cb_help_about(GtkWidget *widget, gpointer user_data); void cb_xfprint_closed (GPid pid, gint status, gpointer sd); #endif /* _CALLBACK_H */ Index: dialog.h =================================================================== --- dialog.h (revision 14306) +++ dialog.h (working copy) @@ -26,7 +26,6 @@ void run_dialog_message(GtkWidget *window, GtkMessageType type, gchar *message, ...); GtkWidget *create_dialog_message_question(GtkWidget *window, gchar *message, ...); gint run_dialog_message_question(GtkWidget *window, gchar *message, ...); -void run_dialog_about(GtkWidget *window, const gchar *name, const gchar *version, - const gchar *description, const gchar *copyright, gchar *iconpath); +void run_dialog_about(GtkWidget *window, gchar *iconpath); #endif /* _DIALOG_H */ Index: menu.c =================================================================== --- menu.c (revision 14306) +++ menu.c (working copy) @@ -92,39 +93,39 @@ { N_("/Edit/_Delete"), NULL, G_CALLBACK(cb_edit_delete), 0, "", GTK_STOCK_DELETE }, { "/Edit/---", NULL, - NULL, 0, "" }, + NULL, 0, "", NULL }, { N_("/Edit/Select _All"), "A", - G_CALLBACK(cb_edit_select_all), 0 }, + G_CALLBACK(cb_edit_select_all), 0, NULL, NULL }, { N_("/_Search"), NULL, - NULL, 0, "" }, + NULL, 0, "", NULL }, { N_("/Search/_Find..."), "F", G_CALLBACK(cb_search_find), 0, "", GTK_STOCK_FIND }, { N_("/Search/Find _Next"), "F3", - G_CALLBACK(cb_search_find_next), 0 }, + G_CALLBACK(cb_search_find_next), 0, NULL, NULL }, { N_("/Search/Find _Previous"), "F3", - G_CALLBACK(cb_search_find_prev), 0 }, + G_CALLBACK(cb_search_find_prev), 0, NULL, NULL }, { N_("/Search/_Replace..."), "H", G_CALLBACK(cb_search_replace), 0, "", GTK_STOCK_FIND_AND_REPLACE }, { "/Search/---", NULL, - NULL, 0, "" }, + NULL, 0, "", NULL }, { N_("/Search/_Jump To..."), "J", G_CALLBACK(cb_search_jump_to), 0, "", GTK_STOCK_JUMP_TO }, { N_("/_Options"), NULL, - NULL, 0, "" }, + NULL, 0, "", NULL }, { N_("/Options/_Font..."), NULL, G_CALLBACK(cb_option_font), 0, "", GTK_STOCK_SELECT_FONT }, { N_("/Options/_Word Wrap"), NULL, - G_CALLBACK(cb_option_word_wrap), 0, "" }, + G_CALLBACK(cb_option_word_wrap), 0, "", NULL }, { N_("/Options/_Line Numbers"), NULL, - G_CALLBACK(cb_option_line_numbers), 0, "" }, + G_CALLBACK(cb_option_line_numbers), 0, "", NULL }, { "/Options/---", NULL, - NULL, 0, "" }, + NULL, 0, "", NULL }, { N_("/Options/_Auto Indent"), NULL, - G_CALLBACK(cb_option_auto_indent), 0, "" }, + G_CALLBACK(cb_option_auto_indent), 0, "", NULL }, { N_("/_Help"), NULL, - NULL, 0, "" }, + NULL, 0, "", NULL }, { N_("/Help/_About"), "F1", - G_CALLBACK(cb_help_about), 0, "", GTK_STOCK_HELP }, + G_CALLBACK(cb_help_about), 0, "", GTK_STOCK_ABOUT }, }; static gint nmenu_items = sizeof(menu_items) / sizeof(GtkItemFactoryEntry); Index: callback.c =================================================================== --- callback.c (revision 14306) +++ callback.c (working copy) @@ -351,19 +351,83 @@ { GtkItemFactory *ifactory; gboolean state; - + ifactory = gtk_item_factory_from_widget(widget); state = gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(ifactory, "/Options/Auto Indent"))); indent_set_state(state); } -void cb_help_about(StructData *sd) +static struct { - run_dialog_about(sd->mainwin->window, - PACKAGE_NAME, - PACKAGE_VERSION, - _("A text editor for Xfce"), - "Copyright © 2005 Erik Harrison\nBased on Code by Tarot Osuji and the Gedit team", - ICONDIR G_DIR_SEPARATOR_S PACKAGE ".png"); -} + gchar *name; + gchar *email; + gchar *langcode; +} translator_list[] = { + { "David Rosal", "davidrr@users.sourceforge.net", "ca" }, + { "Petr Vysloužil", "evyslouz@volny.cz", "cs" }, + { "Sebastian Stach", "ruediger@gmx.net", "de" }, + { "Lucas Vieites", "lucas@asixinformatica.com", "es" }, + { "Luc Pionchon", "luc@handhelds.org", "fr" }, + { "Reviczky Ádám János", "reviczky@freemail.hu", "hu" }, + { "Alessio D'Ascanio", "tp@lists.linux.it", "it" }, + { "Daichi Kawahata", "daichik@users.sourceforge.net", "ja" }, + { "Lech Jankovski", "komp_lt@konferencijos.lt", "lt" }, + { "Michal Wrobel", "wrobel@task.gda.pl", "pl" }, + { "Artem Vakhitov", "temcat@mail.ru", "ru" }, + { "Roman Moravcik", "sk-i18n@linux.sk", "sk" }, + { "Isak Savo", "iso01001@student.mdh.se", "sv" }, + { "Vijay Durairaj", "vjd81@yahoo.com", "ta" }, + { "Carlos Z.F. Liu", "carlos_liu@yahoo.com", "zh_CN" }, + { "OLS3", "ols3@lxer.idv.tw", "zh_TW" }, + { NULL, NULL, NULL }, +}; + +void +cb_help_about(GtkWidget *widget, gpointer user_data) +{ + //MousepadWin *mousepad = (MousepadWin *)user_data; + XfceAboutInfo *about; + static GtkWidget *dialog = NULL; + GtkWidget *toplevel = NULL; + GdkPixbuf *mousepad_logo = xfce_themed_icon_load ("mousepad", 48); + + gchar *TRANSLATOR = _("Translator"), translator_str[1024]; + gint i; + + about = xfce_about_info_new("Mousepad", VERSION, + _("A text editor for Xfce\n" + "\n" + "based on Code by Tarot Osuji and the Gedit team"), + XFCE_COPYRIGHT_TEXT("2005", "Erik Harrison"), + XFCE_LICENSE_GPL); + + xfce_about_info_set_homepage(about, "http://www.xfce.org/"); + + xfce_about_info_add_credit(about, "Erik Harrison", "erikharrison@gmail.com", + _("Original Author")); + + xfce_about_info_add_credit(about, "Tarot Osuji", "tarot@sdf.lonestar.org", + _("Original Author of Leafpad")); + + for (i = 0; translator_list[i].name; i++) { + + g_snprintf(translator_str, 1024, "%s (%s)", TRANSLATOR, + translator_list[i].langcode); + xfce_about_info_add_credit(about, translator_list[i].name, + translator_list[i].email, translator_str); + }; + + dialog = xfce_about_dialog_new(GTK_WINDOW(toplevel), about, mousepad_logo); + + gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 400); + xfce_about_info_free(about); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + gtk_widget_destroy(dialog); + + //g_object_unref(mousepad_logo); + +}; +