2005-11-22 12:26:26 +00:00
|
|
|
/*
|
|
|
|
* about.c - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
2006-05-21 17:51:22 +00:00
|
|
|
* Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de>
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-21 17:51:22 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
2006-05-21 17:51:22 +00:00
|
|
|
* $Id$
|
2005-11-22 12:26:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "about.h"
|
2006-05-21 17:51:22 +00:00
|
|
|
#include "geany.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
#include "utils.h"
|
2006-09-05 14:24:47 +00:00
|
|
|
#include "ui_utils.h"
|
2006-05-21 17:51:22 +00:00
|
|
|
#include "support.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2005-12-16 18:47:02 +00:00
|
|
|
static GtkWidget *gb_window = NULL;
|
|
|
|
#include "gb.c"
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-05-21 17:51:22 +00:00
|
|
|
#define HEADER "<span size=\"larger\" weight=\"bold\">Geany " VERSION "%s</span>"
|
|
|
|
#define INFO "<span size=\"larger\" weight=\"bold\">%s</span>"
|
|
|
|
#define CODENAME "<span weight=\"bold\">\"" GEANY_CODENAME "\"</span>"
|
2006-07-18 22:01:24 +00:00
|
|
|
#define BUILDDATE "<span size=\"smaller\">%s</span>"
|
2006-05-21 17:51:22 +00:00
|
|
|
#define COPYRIGHT "Copyright (c) 2005-2006 \n Enrico Tröger \nAll rights reserved."
|
|
|
|
#define CREDITS \
|
|
|
|
"<span size=\"larger\" weight=\"bold\">%s</span>\n\t\
|
|
|
|
Enrico Tröger - %s\n\t\
|
|
|
|
<enrico.troeger@uvena.de>\n\n\t\
|
|
|
|
Nick Treleaven - %s\n\t\
|
2006-05-29 21:49:56 +00:00
|
|
|
<nick.treleaven@btinternet.com>\n\n\t\
|
|
|
|
Frank Lanitz - %s\n\t\
|
|
|
|
<frank@frank.uvena.de>\n\n\t\
|
2006-05-21 17:51:22 +00:00
|
|
|
\n<span size=\"larger\" weight=\"bold\">%s</span>\n\t\
|
2006-06-12 13:17:11 +00:00
|
|
|
\
|
|
|
|
Yura Semashko - <language> be_BY\n\t\
|
|
|
|
<yurand2@gmail.com>\n\n\t\
|
2006-09-29 16:02:33 +00:00
|
|
|
Toni Garcia-Navarro - <language> ca_ES\n\t\
|
|
|
|
<topi@elpiset.net>\n\n\t\
|
2006-08-28 15:07:48 +00:00
|
|
|
Petr Messner - <language> cs_CZ \n\t\
|
|
|
|
<messa@messa.cz>\n\n\t\
|
2006-06-12 13:17:11 +00:00
|
|
|
Frank Lanitz - <language> de_DE\n\t\
|
2006-05-29 21:49:56 +00:00
|
|
|
<frank@frank.uvena.de>\n\n\t\
|
2006-06-19 14:50:10 +00:00
|
|
|
Damián Viano - <language> es\n\t\
|
|
|
|
<debian@damianv.com.ar>\n\n\t\
|
2006-10-17 09:01:13 +00:00
|
|
|
M. Baldinelli - <language> it\n\t\
|
|
|
|
<m.baldinelli@agora.it>\n\n\t\
|
|
|
|
Dario Santomarco - <language> it\n\t\
|
|
|
|
<dariello@yahoo.it>\n\n\t\
|
2006-09-26 14:00:30 +00:00
|
|
|
Kurt De Bree - <language> nl\n\t\
|
|
|
|
<kdebree@telenet.be>\n\n\t\
|
2006-06-12 13:17:11 +00:00
|
|
|
Jacek Wolszczak - <language> pl_PL\n\t\
|
|
|
|
<shutdownrunner@o2.pl>\n\n\t\
|
2006-07-02 19:11:45 +00:00
|
|
|
Alexandre Moreira - <language> pt_BR\n\t\
|
|
|
|
<alexandream@gmail.com>\n\n\t\
|
2006-06-12 13:17:11 +00:00
|
|
|
brahmann_ - <language> ru_RU\n\t\
|
2006-09-01 11:22:47 +00:00
|
|
|
<brahmann@mthr.net.ru>\n\n\t\
|
|
|
|
Clytie Siddall - <language> vi_VN\n\t\
|
2006-11-14 17:39:40 +00:00
|
|
|
+<clytie@riverland.net.au>\n\n\t\
|
|
|
|
+Dormouse Young - <language> zh_CH\n\t\
|
|
|
|
+<dormouse.young@gmail.com>\n\n\t"
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-05-21 17:51:22 +00:00
|
|
|
static void header_eventbox_style_set(GtkWidget *widget);
|
|
|
|
static void header_label_style_set(GtkWidget *widget);
|
|
|
|
static void homepage_clicked(GtkButton *button, gpointer data);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
|
2006-05-21 17:51:22 +00:00
|
|
|
static GtkWidget *create_dialog(void)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2006-11-14 17:39:40 +00:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *header_image;
|
|
|
|
GtkWidget *header_label;
|
|
|
|
GtkWidget *label_info;
|
|
|
|
GtkWidget *codename_label;
|
|
|
|
GtkWidget *builddate_label;
|
|
|
|
GtkWidget *url_button;
|
|
|
|
GtkWidget *cop_label;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *credits_label;
|
|
|
|
GtkWidget *license_textview;
|
|
|
|
GtkWidget *notebook;
|
|
|
|
GtkWidget *box;
|
|
|
|
GtkWidget *credits_scrollwin;
|
|
|
|
GtkWidget *license_scrollwin;
|
|
|
|
GtkWidget *info_box;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *header_hbox;
|
|
|
|
GtkWidget *header_eventbox;
|
|
|
|
GdkPixbuf *icon;
|
|
|
|
GtkTextBuffer* tb;
|
|
|
|
gchar *license_text = NULL;
|
|
|
|
gchar buffer[512];
|
|
|
|
gchar buffer2[128];
|
|
|
|
gchar *credits;
|
|
|
|
|
|
|
|
dialog = gtk_dialog_new();
|
|
|
|
|
|
|
|
//configure dialog
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(app->window));
|
|
|
|
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog), _("About Geany"));
|
|
|
|
button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
|
|
|
|
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
|
|
|
|
gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
|
|
|
|
g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(gb_on_key_pressed), NULL);
|
|
|
|
|
|
|
|
// create header
|
|
|
|
header_eventbox = gtk_event_box_new();
|
|
|
|
gtk_widget_show(header_eventbox);
|
|
|
|
header_hbox = gtk_hbox_new(FALSE, 12);
|
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(header_hbox), 4);
|
|
|
|
gtk_widget_show(header_hbox);
|
|
|
|
gtk_container_add(GTK_CONTAINER(header_eventbox), header_hbox);
|
|
|
|
header_image = gtk_image_new();
|
|
|
|
gtk_box_pack_start(GTK_BOX(header_hbox), header_image, FALSE,FALSE,0);
|
|
|
|
header_label = gtk_label_new(NULL);
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(header_label), TRUE);
|
|
|
|
// print the subversion revision if it is available
|
|
|
|
g_snprintf(buffer, sizeof(buffer), HEADER, (utils_str_equal(REVISION, "-1")) ? "" : " (" REVISION ")");
|
|
|
|
gtk_label_set_markup(GTK_LABEL(header_label), buffer);
|
|
|
|
gtk_widget_show(header_label);
|
|
|
|
gtk_box_pack_start(GTK_BOX(header_hbox), header_label, FALSE,FALSE,0);
|
|
|
|
header_eventbox_style_set(header_eventbox);
|
|
|
|
header_label_style_set(header_label);
|
|
|
|
g_signal_connect_after(G_OBJECT(header_eventbox), "style_set", G_CALLBACK(header_eventbox_style_set), NULL);
|
|
|
|
g_signal_connect_after(G_OBJECT(header_label), "style_set", G_CALLBACK(header_label_style_set), NULL);
|
|
|
|
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), header_eventbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
// set image
|
|
|
|
icon = ui_new_pixbuf_from_inline(GEANY_IMAGE_LOGO, FALSE);
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(header_image), icon);
|
|
|
|
gtk_window_set_icon(GTK_WINDOW(dialog), icon);
|
|
|
|
|
|
|
|
// create notebook
|
|
|
|
notebook = gtk_notebook_new();
|
|
|
|
gtk_widget_show(notebook);
|
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(notebook), 2);
|
|
|
|
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
// create "Info" tab
|
|
|
|
info_box = gtk_vbox_new(FALSE, 0);
|
|
|
|
//gtk_container_set_border_width(GTK_CONTAINER(info_box), 6);
|
|
|
|
gtk_widget_show(info_box);
|
|
|
|
|
|
|
|
label_info = gtk_label_new(NULL);
|
|
|
|
gtk_label_set_justify(GTK_LABEL(label_info), GTK_JUSTIFY_CENTER);
|
|
|
|
gtk_label_set_selectable(GTK_LABEL(label_info), TRUE);
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(label_info), TRUE);
|
|
|
|
g_snprintf(buffer, sizeof(buffer), INFO, _("A fast and lightweight IDE"));
|
|
|
|
gtk_label_set_markup(GTK_LABEL(label_info), buffer);
|
|
|
|
gtk_misc_set_padding(GTK_MISC(label_info), 2, 11);
|
|
|
|
gtk_widget_show(label_info);
|
|
|
|
gtk_box_pack_start(GTK_BOX(info_box), label_info, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
// Codename label
|
|
|
|
codename_label = gtk_label_new(NULL);
|
|
|
|
gtk_label_set_justify(GTK_LABEL(codename_label), GTK_JUSTIFY_CENTER);
|
|
|
|
gtk_label_set_selectable(GTK_LABEL(codename_label), TRUE);
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(codename_label), TRUE);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(codename_label), CODENAME);
|
|
|
|
gtk_misc_set_padding(GTK_MISC(codename_label), 2, 8);
|
|
|
|
gtk_widget_show(codename_label);
|
|
|
|
gtk_box_pack_start(GTK_BOX(info_box), codename_label, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
// build date label
|
|
|
|
builddate_label = gtk_label_new(NULL);
|
|
|
|
gtk_label_set_justify(GTK_LABEL(builddate_label), GTK_JUSTIFY_CENTER);
|
|
|
|
gtk_label_set_selectable(GTK_LABEL(builddate_label), TRUE);
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(builddate_label), TRUE);
|
|
|
|
g_snprintf(buffer2, sizeof(buffer2), _("(built on %s)"), __DATE__);
|
|
|
|
g_snprintf(buffer, sizeof(buffer), BUILDDATE, buffer2);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(builddate_label), buffer);
|
|
|
|
gtk_misc_set_padding(GTK_MISC(builddate_label), 2, 2);
|
|
|
|
gtk_widget_show(builddate_label);
|
|
|
|
gtk_box_pack_start(GTK_BOX(info_box), builddate_label, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
box = gtk_hbutton_box_new();
|
|
|
|
url_button = gtk_button_new();
|
|
|
|
gtk_button_set_relief(GTK_BUTTON(url_button), GTK_RELIEF_NONE);
|
|
|
|
g_signal_connect(G_OBJECT(url_button), "clicked", G_CALLBACK(homepage_clicked), GEANY_HOMEPAGE);
|
|
|
|
label = gtk_label_new(NULL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(label), GEANY_HOMEPAGE);
|
|
|
|
gtk_widget_show(label);
|
|
|
|
gtk_container_add(GTK_CONTAINER(url_button), label);
|
|
|
|
gtk_widget_show(url_button);
|
|
|
|
gtk_box_pack_start(GTK_BOX(box), url_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(box);
|
|
|
|
gtk_box_pack_start(GTK_BOX(info_box), box, FALSE, FALSE, 10);
|
|
|
|
|
|
|
|
// copyright label
|
|
|
|
cop_label = gtk_label_new(NULL);
|
|
|
|
gtk_label_set_justify(GTK_LABEL(cop_label), GTK_JUSTIFY_CENTER);
|
|
|
|
gtk_label_set_selectable(GTK_LABEL(cop_label), FALSE);
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(cop_label), TRUE);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(cop_label), COPYRIGHT);
|
|
|
|
gtk_misc_set_padding(GTK_MISC(cop_label), 2, 10);
|
|
|
|
gtk_widget_show(cop_label);
|
|
|
|
gtk_box_pack_start(GTK_BOX(info_box), cop_label, FALSE, FALSE, 0);
|
|
|
|
//gtk_container_add(GTK_CONTAINER(info_box), cop_label);
|
|
|
|
|
|
|
|
label = gtk_label_new(_("Info"));
|
|
|
|
gtk_widget_show(label);
|
|
|
|
gtk_widget_show_all(info_box);
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), info_box, label);
|
|
|
|
|
|
|
|
// create "Credits" tab
|
|
|
|
credits_scrollwin = gtk_scrolled_window_new(NULL, NULL);
|
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(credits_scrollwin), 6);
|
|
|
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(credits_scrollwin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
|
|
|
credits_label = gtk_label_new(NULL);
|
|
|
|
gtk_label_set_selectable(GTK_LABEL(credits_label), TRUE);
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(credits_label), TRUE);
|
|
|
|
credits = g_strdup_printf(CREDITS, _("Developers"), _("Maintainer"), _("developer"),
|
|
|
|
_("translation maintainer"), _("Translators"));
|
|
|
|
credits = utils_str_replace(credits, "<language>", _("language"));
|
|
|
|
gtk_label_set_markup(GTK_LABEL(credits_label), credits);
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(credits_label), 0.0, 0.0);
|
|
|
|
gtk_widget_show(credits_label);
|
|
|
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(credits_scrollwin), credits_label);
|
|
|
|
gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_widget_get_parent(credits_label)), GTK_SHADOW_NONE);
|
|
|
|
label = gtk_label_new(_("Credits"));
|
|
|
|
gtk_widget_show(label);
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), credits_scrollwin, label);
|
|
|
|
|
|
|
|
// create "License" tab
|
|
|
|
license_scrollwin = gtk_scrolled_window_new(NULL, NULL);
|
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(license_scrollwin), 6);
|
|
|
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(license_scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
|
|
license_textview = gtk_text_view_new();
|
|
|
|
gtk_text_view_set_editable(GTK_TEXT_VIEW(license_textview), FALSE);
|
|
|
|
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(license_textview), FALSE);
|
|
|
|
gtk_widget_show(license_textview);
|
|
|
|
gtk_container_add(GTK_CONTAINER(license_scrollwin), license_textview);
|
|
|
|
label = gtk_label_new(_("License"));
|
|
|
|
gtk_widget_show(label);
|
|
|
|
|
|
|
|
g_snprintf(buffer, sizeof(buffer), "%s" G_DIR_SEPARATOR_S "GPL-2", app->datadir);
|
|
|
|
|
|
|
|
g_file_get_contents(buffer, &license_text, NULL, NULL);
|
|
|
|
if (license_text == NULL)
|
|
|
|
{
|
|
|
|
license_text = g_strdup("License text could not be found, please google for GPLv2");
|
|
|
|
}
|
|
|
|
tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(license_textview));
|
|
|
|
gtk_text_buffer_set_text(tb, license_text, strlen(license_text));
|
|
|
|
|
|
|
|
g_free(credits);
|
|
|
|
g_free(license_text);
|
|
|
|
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), license_scrollwin, label);
|
|
|
|
|
|
|
|
gtk_widget_show_all(dialog);
|
|
|
|
return dialog;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-21 17:51:22 +00:00
|
|
|
void about_dialog_show(void)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2006-11-14 17:39:40 +00:00
|
|
|
GtkWidget *dialog;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-14 17:39:40 +00:00
|
|
|
dialog = create_dialog();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-14 17:39:40 +00:00
|
|
|
gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
gtk_widget_destroy(dialog);
|
2006-05-21 17:51:22 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
|
2006-05-21 17:51:22 +00:00
|
|
|
static void header_eventbox_style_set(GtkWidget *widget)
|
|
|
|
{
|
2006-11-14 17:39:40 +00:00
|
|
|
static gint recursive = 0;
|
|
|
|
GtkStyle *style;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-14 17:39:40 +00:00
|
|
|
if (recursive > 0)
|
|
|
|
return;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-14 17:39:40 +00:00
|
|
|
++recursive;
|
|
|
|
style = gtk_widget_get_style(widget);
|
|
|
|
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
|
|
|
|
--recursive;
|
2006-05-21 17:51:22 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
|
2006-05-21 17:51:22 +00:00
|
|
|
static void header_label_style_set(GtkWidget *widget)
|
|
|
|
{
|
2006-11-14 17:39:40 +00:00
|
|
|
static gint recursive = 0;
|
|
|
|
GtkStyle *style;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-14 17:39:40 +00:00
|
|
|
if (recursive > 0)
|
|
|
|
return;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-14 17:39:40 +00:00
|
|
|
++recursive;
|
|
|
|
style = gtk_widget_get_style(widget);
|
|
|
|
gtk_widget_modify_fg(widget, GTK_STATE_NORMAL, &style->fg[GTK_STATE_SELECTED]);
|
|
|
|
--recursive;
|
2006-05-21 17:51:22 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
|
2006-05-21 17:51:22 +00:00
|
|
|
static void homepage_clicked(GtkButton *button, gpointer data)
|
|
|
|
{
|
2006-11-14 17:39:40 +00:00
|
|
|
utils_start_browser(data);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|