1// -*- c++ -*- 2/* $Id: aboutdialog.ccg,v 1.5 2006/06/13 17:24:35 murrayc Exp $ */ 3 4/* 5 * 6 * Copyright 2004 The gtkmm Development Team 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free 20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 */ 22 23#include <gtk/gtk.h> 24 25_DEPRECATE_IFDEF_START 26//We use a function instead of a static method, so we can make it static, so it is not exported. 27static void SignalProxy_ActivateLink_gtk_callback(GtkAboutDialog* about, const gchar* link, gpointer data) 28{ 29 Gtk::AboutDialog::SlotActivateLink* the_slot = static_cast<Gtk::AboutDialog::SlotActivateLink*>(data); 30 31 try 32 { 33 Gtk::AboutDialog* pCppAbout = Glib::wrap(about); 34 (*the_slot)( *pCppAbout, Glib::convert_const_gchar_ptr_to_ustring(link) ); 35 } 36 catch(...) 37 { 38 Glib::exception_handlers_invoke(); 39 } 40} 41 42static void SignalProxy_ActivateLink_gtk_callback_destroy(void* data) 43{ 44 Gtk::AboutDialog::SlotActivateLink* the_slot = static_cast<Gtk::AboutDialog::SlotActivateLink*>(data); 45 delete the_slot; 46} 47 48 49namespace Gtk 50{ 51 52//static: 53void AboutDialog::set_email_hook(const SlotActivateLink& slot) 54{ 55 // Create a copy of the slot object. A pointer to this will be passed 56 // through the callback's data parameter. It will be deleted 57 // when SignalProxy_SlotForwardPage_gtk_callback_destroy() is called. 58 SlotActivateLink* slot_copy = new SlotActivateLink(slot); 59 60 gtk_about_dialog_set_email_hook( 61 &SignalProxy_ActivateLink_gtk_callback, slot_copy, 62 &SignalProxy_ActivateLink_gtk_callback_destroy); 63} 64 65//static: 66void AboutDialog::set_url_hook(const SlotActivateLink& slot) 67{ 68 // Create a copy of the slot object. A pointer to this will be passed 69 // through the callback's data parameter. It will be deleted 70 // when SignalProxy_SlotForwardPage_gtk_callback_destroy() is called. 71 SlotActivateLink* slot_copy = new SlotActivateLink(slot); 72 73 gtk_about_dialog_set_url_hook( 74 &SignalProxy_ActivateLink_gtk_callback, slot_copy, 75 &SignalProxy_ActivateLink_gtk_callback_destroy); 76} 77_DEPRECATE_IFDEF_END 78 79} // namespace Gtk 80 81