| 1 |
/* |
| 2 |
* Copyright (C) 2006 Rob Staudinger <[email protected]> |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU General Public License |
| 6 |
* as published by the Free Software Foundation; either version 2 |
| 7 |
* of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This program is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License |
| 15 |
* along with this program; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 17 |
* 02110-1301 USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifdef HAVE_CONFIG_H |
| 21 |
#include "config.h" |
| 22 |
#endif |
| 23 |
|
| 24 |
#include <gtk/gtk.h> |
| 25 |
|
| 26 |
#include "ut_string.h" |
| 27 |
#include "ut_assert.h" |
| 28 |
|
| 29 |
#include "xap_Dialog_Id.h" |
| 30 |
#include "xap_Frame.h" |
| 31 |
|
| 32 |
#include "xap_UnixApp.h" |
| 33 |
#include "xap_UnixFrameImpl.h" |
| 34 |
#include "xap_UnixDlg_About.h" |
| 35 |
|
| 36 |
XAP_Dialog * XAP_UnixDialog_About::static_constructor(XAP_DialogFactory * pFactory, XAP_Dialog_Id id) |
| 37 |
{ |
| 38 |
XAP_UnixDialog_About * p = new XAP_UnixDialog_About(pFactory,id); |
| 39 |
return p; |
| 40 |
} |
| 41 |
|
| 42 |
XAP_UnixDialog_About::XAP_UnixDialog_About(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id) |
| 43 |
: XAP_Dialog_About(pDlgFactory, id) |
| 44 |
{} |
| 45 |
|
| 46 |
XAP_UnixDialog_About::~XAP_UnixDialog_About(void) |
| 47 |
{} |
| 48 |
|
| 49 |
static void onAboutDialogActivate (GtkAboutDialog * /*about*/, |
| 50 |
const gchar *link, |
| 51 |
gpointer /*data*/) |
| 52 |
{ |
| 53 |
XAP_App::getApp()->openURL(link); |
| 54 |
} |
| 55 |
|
| 56 |
void XAP_UnixDialog_About::runModal(XAP_Frame * /*pFrame*/) |
| 57 |
{ |
| 58 |
static const gchar *authors[] = {"Abi the Ant <[email protected]>", |
| 59 |
NULL}; |
| 60 |
|
| 61 |
static const gchar *documenters[] = {"David Chart <[email protected]>", |
| 62 |
NULL}; |
| 63 |
|
| 64 |
static const gchar *copyright = "(c) 1998-2012 Dom Lachowicz and other contributors, GNU GPL v2.0"; |
| 65 |
|
| 66 |
static const gchar *website = "http://www.abisource.com"; |
| 67 |
|
| 68 |
static GdkPixbuf * logo = NULL; |
| 69 |
static GtkWidget * dlg = NULL; |
| 70 |
|
| 71 |
// TODO Rob: use the more fancy "sidebar.png" logo, just like win32 |
| 72 |
if (!logo) { |
| 73 |
std::string str (ICONDIR); |
| 74 |
str += "/hicolor/48x48/apps/abiword.png"; |
| 75 |
logo = gdk_pixbuf_new_from_file (str.c_str(), NULL); // ignore errors |
| 76 |
} |
| 77 |
|
| 78 |
dlg = gtk_about_dialog_new(); |
| 79 |
#if !GTK_CHECK_VERSION(2,24,0) |
| 80 |
gtk_about_dialog_set_url_hook(onAboutDialogActivate, NULL, NULL); |
| 81 |
#else |
| 82 |
//JEAN: do we really need the "activate-link" signal? |
| 83 |
g_signal_connect(dlg, "activate-link", G_CALLBACK(onAboutDialogActivate), NULL); |
| 84 |
#endif |
| 85 |
gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dlg), authors); |
| 86 |
gtk_about_dialog_set_documenters(GTK_ABOUT_DIALOG(dlg), documenters); |
| 87 |
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dlg), copyright); |
| 88 |
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dlg), logo); |
| 89 |
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dlg), XAP_App::s_szBuild_Version); |
| 90 |
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dlg), website); |
| 91 |
gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(dlg), website); |
| 92 |
gtk_window_set_icon(GTK_WINDOW(dlg), logo); |
| 93 |
gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER); |
| 94 |
gtk_dialog_run(GTK_DIALOG(dlg)); |
| 95 |
gtk_widget_destroy(dlg); |
| 96 |
} |