// -*- c++ -*-
/* $Id: aboutdialog.ccg,v 1.5 2006/06/13 17:24:35 murrayc Exp $ */

/* 
 *
 * Copyright 2004 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtk/gtkaboutdialog.h>
#include <gtk/gtklabel.h>


//We use a function instead of a static method, so we can make it static, so it is not exported.
static void SignalProxy_ActivateLink_gtk_callback(GtkAboutDialog* about, const gchar* link, gpointer data)
{
  Gtk::AboutDialog::SlotActivateLink* the_slot = static_cast<Gtk::AboutDialog::SlotActivateLink*>(data);

  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  try
  {
  #endif //GLIBMM_EXCEPTIONS_ENABLED
    Gtk::AboutDialog* pCppAbout = Glib::wrap(about);
    (*the_slot)( *pCppAbout, Glib::convert_const_gchar_ptr_to_ustring(link) );
  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
  #endif //GLIBMM_EXCEPTIONS_ENABLED
}

static void SignalProxy_ActivateLink_gtk_callback_destroy(void* data)
{
  Gtk::AboutDialog::SlotActivateLink* the_slot = static_cast<Gtk::AboutDialog::SlotActivateLink*>(data);
  delete the_slot;
}


namespace Gtk
{

//static:
void AboutDialog::set_email_hook(const SlotActivateLink& slot)
{
  // Create a copy of the slot object. A pointer to this will be passed
  // through the callback's data parameter.  It will be deleted
  // when SignalProxy_SlotForwardPage_gtk_callback_destroy() is called.
  SlotActivateLink* slot_copy = new SlotActivateLink(slot);

  gtk_about_dialog_set_email_hook(
      &SignalProxy_ActivateLink_gtk_callback, slot_copy,
      &SignalProxy_ActivateLink_gtk_callback_destroy);
}
  
//static:
void AboutDialog::set_url_hook(const SlotActivateLink& slot)
{
  // Create a copy of the slot object. A pointer to this will be passed
  // through the callback's data parameter.  It will be deleted
  // when SignalProxy_SlotForwardPage_gtk_callback_destroy() is called.
  SlotActivateLink* slot_copy = new SlotActivateLink(slot);

  gtk_about_dialog_set_url_hook(
      &SignalProxy_ActivateLink_gtk_callback, slot_copy,
      &SignalProxy_ActivateLink_gtk_callback_destroy);
} 

} // namespace Gtk

