Logo Search packages:      
Sourcecode: kanatest version File versions  Download package

about.c

/*
 * Kanatest
 *
 * Copyright (C) 2001-2004, 2006 Tomasz Maka <pasp@users.sourceforge.net>
 *
 * 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */


#include <config.h>

#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>

#include "gui.h"
#include "prefs.h"
#include "main.h"
#include "i18n.h"


gchar text_contributors[] = {
    "                Vadim Berezniker\n"
    "                Yann Golanski\n"
    "                Avi Bercovich\n"
    "                Tero Pelander\n"
    "                Matt Langford\n"
    "                Dan\n"
    "                Wolfram Sang\n"
    "                Robin Redeker\n"
    "                Jakob Truelsen\n"
    "                Jonas Kölker\n"
    "                Taci Taclipoka\n"
    "                Marianne Ibbotson\n"
};

gchar text_translators[] = {
    "                [pl] Piotr Mąka <sill@ll.pl>\n"
    "                [ru] Taci Taclipoka <taclipoka@gmail.com>\n"
};

gchar text_postcards_address[] = {
    "                   Piotrek\n"
    "                   ul. Ku Słońcu 90\n"
    "                   71-046 Szczecin\n"
    "                   POLAND"
};

gchar text_received_postcards[] = {
    "  * Martin from Örebro (Sweden)\n"
    "  * Mario from Bremen (Germany)\n"
    "  * Angela from Madrit (Spain)\n"
    "  * Lukas from Brno (Czech Republic)\n"
    "  * Wolfram from Kyoto (Japan)\n"
    "  * Gabriel from Marseille (France)\n"
    "  * Unknown from Okinawa Islands (Japan)\n"
};

gchar text_license[] = {
    "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."
    "\n\n"
    "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."
    "\n\n"
    "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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
};


GtkWidget       *about_window;

extern GtkWidget *main_window;


void
about_window_close_cb (void) {

    gdk_window_get_root_origin (about_window->window,
                                &config.about_window_x, &config.about_window_y);

    gtk_widget_destroy (about_window);
}

gint
about_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer data) {

    if (event->keyval == GDK_Escape) {
        about_window_close_cb ();
        return TRUE;
    }

    return FALSE;
}

void
about_create_window (void) {

GtkWidget       *vbox1;
GtkWidget       *vbox2;
GtkWidget       *hseparator;
GtkWidget       *hbuttonbox;
GtkWidget       *close_button;
GtkWidget       *notebook;
GtkWidget       *label;
GtkWidget       *scrolled_window;
GtkWidget       *viewport;
GtkTextBuffer   *entry_buffer = NULL;
GtkWidget       *text_sheet = NULL;
GtkTextIter     iter;
gchar           buffer[BUFFER_SIZE];

    about_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_transient_for(GTK_WINDOW(about_window),GTK_WINDOW(main_window));
    gtk_window_set_resizable (GTK_WINDOW (about_window), TRUE);
    gtk_window_set_modal(GTK_WINDOW(about_window), TRUE);
    gtk_container_set_border_width (GTK_CONTAINER (about_window), 12);
    gtk_window_set_title (GTK_WINDOW (about_window), _("About"));
    gtk_widget_set_size_request (about_window, 410, 460);

    g_signal_connect (G_OBJECT (about_window), "delete_event",
                        G_CALLBACK(about_window_close_cb), NULL);
    g_signal_connect (G_OBJECT(about_window), "key_press_event",
                        G_CALLBACK(about_key_press_cb), NULL);

    gtk_window_move (GTK_WINDOW (about_window),
                                config.about_window_x, config.about_window_y);

    gtk_widget_show (about_window);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox1);
    gtk_container_add (GTK_CONTAINER (about_window), vbox1);

    notebook = gtk_notebook_new ();
    gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
    gtk_widget_show (notebook);
    gtk_box_pack_start (GTK_BOX (vbox1), notebook, TRUE, TRUE, 0);

    /*-----------------------------------------------------------------*/

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox2);

    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window, TRUE, TRUE, 0);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_widget_show (scrolled_window);

    viewport = gtk_viewport_new (NULL, NULL);
    gtk_widget_show (viewport);
    gtk_container_set_border_width (GTK_CONTAINER (viewport), 4);
    gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);

    entry_buffer = gtk_text_buffer_new (NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &iter, 0);
    gtk_text_buffer_create_tag (entry_buffer, "bold",
                  "weight", PANGO_WEIGHT_ULTRABOLD, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "big",
                  "size", 16 * PANGO_SCALE, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "italic",
                  "style", PANGO_STYLE_ITALIC, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "center",
                  "justification", GTK_JUSTIFY_CENTER, NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &iter, 0);
    text_sheet = gtk_text_view_new_with_buffer (entry_buffer);
    gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(text_sheet), 2);
    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_sheet), 8);
    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text_sheet), 8);
    gtk_text_view_set_editable(GTK_TEXT_VIEW (text_sheet), FALSE);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (text_sheet), FALSE);
    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_sheet), GTK_WRAP_WORD);
    gtk_widget_show (text_sheet);
    gtk_container_add (GTK_CONTAINER (viewport), text_sheet);

    gtk_text_buffer_insert_with_tags_by_name (entry_buffer, &iter,
                        "\nKanatest " VERSION "\n", -1, "big", "center", NULL);
    sprintf(buffer, "\n(%s %s, %s)\n\n", _("compiled on"), __DATE__, __TIME__);
    gtk_text_buffer_insert_with_tags_by_name (entry_buffer, &iter, buffer, -1, "center", "italic", NULL);

    sprintf(buffer, "\n%s ", _("Homepage:"));
    gtk_text_buffer_insert_with_tags_by_name (entry_buffer, &iter, buffer, -1, "bold", NULL);
    gtk_text_buffer_insert (entry_buffer, &iter, "http://clay.ll.pl/kanatest\n\n", -1);

    sprintf(buffer, "\n%s\n", _("Programming:"));
    gtk_text_buffer_insert_with_tags_by_name (entry_buffer, &iter, buffer, -1, "bold", NULL);
    gtk_text_buffer_insert (entry_buffer, &iter, "     Tomasz Mąka <pasp@users.sourceforge.net>\n", -1);

    sprintf(buffer, "\n%s\n", _("Graphics:"));
    gtk_text_buffer_insert_with_tags_by_name (entry_buffer, &iter, buffer, -1, "bold", NULL);
    gtk_text_buffer_insert (entry_buffer, &iter, "     Piotr Mąka <sill@ll.pl>\n", -1);
    gtk_text_buffer_insert (entry_buffer, &iter, "     Maja Kocoń (http://ironya.ll.pl)\n", -1);

    label = gtk_label_new (_("About"));
    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox2, label);

    /*-----------------------------------------------------------------*/

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox2);

    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window, TRUE, TRUE, 0);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_widget_show (scrolled_window);

    viewport = gtk_viewport_new (NULL, NULL);
    gtk_widget_show (viewport);
    gtk_container_set_border_width (GTK_CONTAINER (viewport), 4);
    gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);

    entry_buffer = gtk_text_buffer_new (NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &iter, 0);
    gtk_text_buffer_create_tag (entry_buffer, "underline",
                  "underline", PANGO_UNDERLINE_SINGLE, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "big",
                  "size", 12 * PANGO_SCALE, NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &iter, 0);
    text_sheet = gtk_text_view_new_with_buffer (entry_buffer);
    gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(text_sheet), 2);
    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_sheet), 8);
    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text_sheet), 8);
    gtk_text_view_set_editable(GTK_TEXT_VIEW (text_sheet), FALSE);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (text_sheet), FALSE);
    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_sheet), GTK_WRAP_WORD);
    gtk_widget_show (text_sheet);
    gtk_container_add (GTK_CONTAINER (viewport), text_sheet);

    sprintf(buffer, "%s\n\n", _("We would like to thank the following people for suggestions, bug reports and patches:"));
    gtk_text_buffer_insert (entry_buffer, &iter, buffer, -1);

    gtk_text_buffer_insert (entry_buffer, &iter, text_contributors, -1);

    sprintf(buffer, "\n%s\n\n", _("Translators:"));
    gtk_text_buffer_insert (entry_buffer, &iter, buffer, -1);

    gtk_text_buffer_insert (entry_buffer, &iter, text_translators, -1);

    label = gtk_label_new (_("Contributors"));
    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox2, label);

    /*-----------------------------------------------------------------*/

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox2);

    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window, TRUE, TRUE, 0);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_widget_show (scrolled_window);

    viewport = gtk_viewport_new (NULL, NULL);
    gtk_widget_show (viewport);
    gtk_container_set_border_width (GTK_CONTAINER (viewport), 4);
    gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);

    entry_buffer = gtk_text_buffer_new (NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &iter, 0);
    gtk_text_buffer_create_tag (entry_buffer, "underline",
                  "underline", PANGO_UNDERLINE_SINGLE, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "big",
                  "size", 12 * PANGO_SCALE, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "center",
                  "justification", GTK_JUSTIFY_CENTER, NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &iter, 0);
    text_sheet = gtk_text_view_new_with_buffer (entry_buffer);
    gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(text_sheet), 2);
    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_sheet), 8);
    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text_sheet), 8);
    gtk_text_view_set_editable(GTK_TEXT_VIEW (text_sheet), FALSE);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (text_sheet), FALSE);
    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_sheet), GTK_WRAP_WORD);
    gtk_widget_show (text_sheet);
    gtk_container_add (GTK_CONTAINER (viewport), text_sheet);

    sprintf(buffer, "%s\n\n", _("If you like our program, send a postcard with a photo of the city where you live to:"));
    gtk_text_buffer_insert (entry_buffer, &iter, buffer, -1);

    gtk_text_buffer_insert (entry_buffer, &iter, text_postcards_address, -1);

    sprintf(buffer, "\n\n%s\n\n", _("We have received several postcards from our happy users:"));
    gtk_text_buffer_insert (entry_buffer, &iter, buffer, -1);

    gtk_text_buffer_insert (entry_buffer, &iter, text_received_postcards, -1);

    sprintf(buffer, "\n%s\n", _("Your postcards are a kind of motivation that encourages us to keep improving Kanatest :)"));
    gtk_text_buffer_insert (entry_buffer, &iter, buffer, -1);
    sprintf(buffer, "\n%s\n", _("Thank you!"));
    gtk_text_buffer_insert_with_tags_by_name (entry_buffer, &iter, buffer, -1, "center", NULL);

    label = gtk_label_new (_("Postcards"));
    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox2, label);

    /*-----------------------------------------------------------------*/

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox2);

    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window, TRUE, TRUE, 0);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                    GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    gtk_widget_show (scrolled_window);

    viewport = gtk_viewport_new (NULL, NULL);
    gtk_widget_show (viewport);
    gtk_container_set_border_width (GTK_CONTAINER (viewport), 4);
    gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);

    entry_buffer = gtk_text_buffer_new (NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &iter, 0);
    gtk_text_buffer_create_tag (entry_buffer, "underline",
                  "underline", PANGO_UNDERLINE_SINGLE, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "big",
                  "size", 12 * PANGO_SCALE, NULL);
    text_sheet = gtk_text_view_new_with_buffer (entry_buffer);
    gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(text_sheet), 2);
    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_sheet), 8);
    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text_sheet), 8);
    gtk_text_view_set_editable(GTK_TEXT_VIEW (text_sheet), FALSE);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (text_sheet), FALSE);
    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_sheet), GTK_WRAP_WORD);
    gtk_widget_show (text_sheet);
    gtk_container_add (GTK_CONTAINER (viewport), text_sheet);

    gtk_text_buffer_insert (entry_buffer, &iter, text_license, -1);

    label = gtk_label_new (_("License"));
    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox2, label);

    /*-----------------------------------------------------------------*/

    hseparator = gtk_hseparator_new ();
    gtk_widget_show (hseparator);
    gtk_box_pack_start (GTK_BOX (vbox1), hseparator, FALSE, TRUE, 8);

    hbuttonbox = gtk_hbutton_box_new ();
    gtk_widget_show (hbuttonbox);
    gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox), GTK_BUTTONBOX_END);
    gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox, FALSE, TRUE, 0);

    close_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
    gtk_widget_show (close_button);
    g_signal_connect (G_OBJECT (close_button), "clicked",
                        G_CALLBACK (about_window_close_cb), NULL);
    gtk_container_add (GTK_CONTAINER (hbuttonbox), close_button);
    GTK_WIDGET_SET_FLAGS (close_button, GTK_CAN_DEFAULT);

    gtk_widget_grab_default (close_button);

}

/*--------------------------------------------------------------------*/


Generated by  Doxygen 1.6.0   Back to index