2 * This file is part of DrNokSnes
4 * Copyright (C) 2009 Javier S. Pedro <maemo@javispedro.com>
6 * This software is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * This software is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this software; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include <hildon/hildon-helper.h>
25 #include <hildon/hildon-defines.h>
26 #include <hildon-mime.h>
28 #if MAEMO_VERSION >= 5
29 #include <hildon/hildon-gtk.h>
30 #define LOGO_ICON_SIZE HILDON_ICON_SIZE_LARGE
32 #define LOGO_ICON_SIZE GTK_ICON_SIZE_DIALOG
38 static GtkDialog* dialog;
40 static void cb_dialog_response(GtkWidget * button, gpointer data)
42 gtk_widget_destroy(GTK_WIDGET(dialog));
45 static void cb_url_response(GtkWidget * button, gpointer data)
48 const gchar * uri = gtk_link_button_get_uri(GTK_LINK_BUTTON(button));
49 HildonURIAction* action = hildon_uri_get_default_action(uri, &error);
50 hildon_uri_open(uri, action, &error);
53 void about_dialog(GtkWindow* parent)
55 dialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("About"),
56 parent, GTK_DIALOG_MODAL,
57 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL));
59 GtkBox* caption_box = GTK_BOX(gtk_hbox_new(FALSE, HILDON_MARGIN_DEFAULT));
60 GtkWidget* logo = gtk_image_new_from_icon_name("drnoksnes",
62 GtkWidget* label = gtk_label_new(NULL);
63 gchar * label_caption = g_strdup_printf("<b>%s</b> %s",
64 "DrNokSnes", G_STRINGIFY(GAME_VERSION));
65 gtk_label_set_markup(GTK_LABEL(label), label_caption);
66 g_free(label_caption);
67 gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f);
69 GtkWidget* separator1 = gtk_hseparator_new();
70 GtkWidget* separator2 = gtk_hseparator_new();
71 GtkWidget* url_label = gtk_link_button_new("http://drnoksnes.garage.maemo.org/");
72 GtkWidget* upstream_label = gtk_label_new("Many thanks to DrPocketSnes authors and contributors.");
73 GtkWidget* wazd_label = gtk_label_new("Thanks to wazd for artwork.");
74 GtkWidget* thanks_label = gtk_label_new("And, of course, thanks to all of maemo.org for their help.");
76 #if MAEMO_VERSION >= 5
77 hildon_gtk_widget_set_theme_size(url_label, HILDON_SIZE_FINGER_HEIGHT);
80 gtk_box_pack_start(caption_box, logo, FALSE, FALSE, HILDON_MARGIN_DEFAULT);
81 gtk_box_pack_start_defaults(caption_box, label);
83 gtk_box_pack_start_defaults(GTK_BOX(dialog->vbox), GTK_WIDGET(caption_box));
84 gtk_box_pack_start(GTK_BOX(dialog->vbox), separator1, FALSE, FALSE, 0);
85 gtk_box_pack_start(GTK_BOX(dialog->vbox), url_label, FALSE, FALSE, HILDON_MARGIN_DEFAULT);
86 gtk_box_pack_start(GTK_BOX(dialog->vbox), separator2, FALSE, FALSE, 0);
87 gtk_box_pack_start(GTK_BOX(dialog->vbox), upstream_label, FALSE, FALSE, 0);
88 gtk_box_pack_start(GTK_BOX(dialog->vbox), wazd_label, FALSE, FALSE, 0);
89 gtk_box_pack_start(GTK_BOX(dialog->vbox), thanks_label, FALSE, FALSE, 0);
91 g_signal_connect(G_OBJECT(dialog), "response",
92 G_CALLBACK (cb_dialog_response), NULL);
93 g_signal_connect(G_OBJECT(url_label), "clicked",
94 G_CALLBACK (cb_url_response), NULL);
96 gtk_widget_show_all(GTK_WIDGET(dialog));