- added "HEAD" feature to tarball creation script, for easier testing
[barry.git] / gui / src / aboutdialog.cc
blob6351e49df23699d3e5ec0bf12e093f3c8c8fc52d
1 //
2 // This was copied from gtkmm 2.10.6 and hacked up a bit, so
3 // that we have a dialog class for systems using older
4 // versions of gtkmm24. Debian stable, I'm looking at you...
5 //
6 // Chris Frey <cdfrey@foursquare.net>
7 //
9 #include "aboutdialog.h"
12 /*
14 * Copyright 2004 The gtkmm Development Team
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Library General Public
18 * License as published by the Free Software Foundation; either
19 * version 2 of the License, or (at your option) any later version.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Library General Public License for more details.
26 * You should have received a copy of the GNU Library General Public
27 * License along with this library; if not, write to the Free
28 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 #include <gtk/gtkaboutdialog.h>
32 #include <gtk/gtklabel.h>
34 //namespace Gtk { class AboutDialog_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; }
36 // Glib::wrap_register(gtk_about_dialog_get_type(), &Gtk::AboutDialog_Class::wrap_new);
39 #include <gtkmm/private/dialog_p.h>
41 #include <glibmm/class.h>
43 namespace Gtk
46 class AboutDialog_Class : public Glib::Class
48 public:
49 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 typedef AboutDialog CppObjectType;
51 typedef GtkAboutDialog BaseObjectType;
52 typedef GtkAboutDialogClass BaseClassType;
53 typedef Gtk::Dialog_Class CppClassParent;
54 typedef GtkDialogClass BaseClassParent;
56 friend class AboutDialog;
57 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
59 const Glib::Class& init();
61 static void class_init_function(void* g_class, void* class_data);
63 static Glib::ObjectBase* wrap_new(GObject*);
65 protected:
67 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
68 //Callbacks (default signal handlers):
69 //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
70 //You could prevent the original default signal handlers being called by overriding the *_impl method.
71 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
73 //Callbacks (virtual functions):
74 #ifdef GLIBMM_VFUNCS_ENABLED
75 #endif //GLIBMM_VFUNCS_ENABLED
79 } // namespace Gtk
83 //We use a function instead of a static method, so we can make it static, so it is not exported.
84 static void SignalProxy_ActivateLink_gtk_callback(GtkAboutDialog* about, const gchar* link, gpointer data)
86 Gtk::AboutDialog::SlotActivateLink* the_slot = static_cast<Gtk::AboutDialog::SlotActivateLink*>(data);
88 #ifdef GLIBMM_EXCEPTIONS_ENABLED
89 try
91 #endif //GLIBMM_EXCEPTIONS_ENABLED
92 Gtk::AboutDialog* pCppAbout = Glib::wrap(about);
93 (*the_slot)( *pCppAbout, Glib::convert_const_gchar_ptr_to_ustring(link) );
94 #ifdef GLIBMM_EXCEPTIONS_ENABLED
96 catch(...)
98 Glib::exception_handlers_invoke();
100 #endif //GLIBMM_EXCEPTIONS_ENABLED
103 static void SignalProxy_ActivateLink_gtk_callback_destroy(void* data)
105 Gtk::AboutDialog::SlotActivateLink* the_slot = static_cast<Gtk::AboutDialog::SlotActivateLink*>(data);
106 delete the_slot;
110 namespace Gtk
113 //static:
114 void AboutDialog::set_email_hook(const SlotActivateLink& slot)
116 // Create a copy of the slot object. A pointer to this will be passed
117 // through the callback's data parameter. It will be deleted
118 // when SignalProxy_SlotForwardPage_gtk_callback_destroy() is called.
119 SlotActivateLink* slot_copy = new SlotActivateLink(slot);
121 gtk_about_dialog_set_email_hook(
122 &SignalProxy_ActivateLink_gtk_callback, slot_copy,
123 &SignalProxy_ActivateLink_gtk_callback_destroy);
126 //static:
127 void AboutDialog::set_url_hook(const SlotActivateLink& slot)
129 // Create a copy of the slot object. A pointer to this will be passed
130 // through the callback's data parameter. It will be deleted
131 // when SignalProxy_SlotForwardPage_gtk_callback_destroy() is called.
132 SlotActivateLink* slot_copy = new SlotActivateLink(slot);
134 gtk_about_dialog_set_url_hook(
135 &SignalProxy_ActivateLink_gtk_callback, slot_copy,
136 &SignalProxy_ActivateLink_gtk_callback_destroy);
139 } // namespace Gtk
142 namespace
144 } // anonymous namespace
147 namespace Glib
150 Gtk::AboutDialog* wrap(GtkAboutDialog* object, bool take_copy)
152 return dynamic_cast<Gtk::AboutDialog *> (Glib::wrap_auto ((GObject*)(object), take_copy));
155 } /* namespace Glib */
157 namespace Gtk
161 /* The *_Class implementation: */
163 const Glib::Class& AboutDialog_Class::init()
165 if(!gtype_) // create the GType if necessary
167 // Glib::Class has to know the class init function to clone custom types.
168 class_init_func_ = &AboutDialog_Class::class_init_function;
170 // This is actually just optimized away, apparently with no harm.
171 // Make sure that the parent type has been created.
172 //CppClassParent::CppObjectType::get_type();
174 // Create the wrapper type, with the same class/instance size as the base type.
175 register_derived_type(gtk_about_dialog_get_type());
177 // Add derived versions of interfaces, if the C type implements any interfaces:
180 return *this;
183 void AboutDialog_Class::class_init_function(void* g_class, void* class_data)
185 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
186 CppClassParent::class_init_function(klass, class_data);
188 #ifdef GLIBMM_VFUNCS_ENABLED
189 #endif //GLIBMM_VFUNCS_ENABLED
191 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
192 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
195 #ifdef GLIBMM_VFUNCS_ENABLED
196 #endif //GLIBMM_VFUNCS_ENABLED
198 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
199 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
202 Glib::ObjectBase* AboutDialog_Class::wrap_new(GObject* o)
204 return new AboutDialog((GtkAboutDialog*)(o)); //top-level windows can not be manage()ed.
209 /* The implementation: */
211 AboutDialog::AboutDialog(const Glib::ConstructParams& construct_params)
213 Gtk::Dialog(construct_params)
217 AboutDialog::AboutDialog(GtkAboutDialog* castitem)
219 Gtk::Dialog((GtkDialog*)(castitem))
223 AboutDialog::~AboutDialog()
225 destroy_();
228 AboutDialog::CppClassType AboutDialog::aboutdialog_class_; // initialize static member
230 GType AboutDialog::get_type()
232 return aboutdialog_class_.init().get_type();
235 GType AboutDialog::get_base_type()
237 return gtk_about_dialog_get_type();
241 AboutDialog::AboutDialog()
243 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
244 Gtk::Dialog(Glib::ConstructParams(aboutdialog_class_.init()))
248 Glib::ustring AboutDialog::get_name() const
250 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_name(const_cast<GtkAboutDialog*>(gobj())));
253 void AboutDialog::set_name(const Glib::ustring& name)
255 gtk_about_dialog_set_name(gobj(), name.c_str());
258 Glib::ustring AboutDialog::get_version() const
260 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_version(const_cast<GtkAboutDialog*>(gobj())));
263 void AboutDialog::set_version(const Glib::ustring& version)
265 gtk_about_dialog_set_version(gobj(), version.c_str());
268 Glib::ustring AboutDialog::get_copyright() const
270 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_copyright(const_cast<GtkAboutDialog*>(gobj())));
273 void AboutDialog::set_copyright(const Glib::ustring& copyright)
275 gtk_about_dialog_set_copyright(gobj(), copyright.c_str());
278 Glib::ustring AboutDialog::get_comments() const
280 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_comments(const_cast<GtkAboutDialog*>(gobj())));
283 void AboutDialog::set_comments(const Glib::ustring& comments)
285 gtk_about_dialog_set_comments(gobj(), comments.c_str());
288 Glib::ustring AboutDialog::get_license() const
290 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_license(const_cast<GtkAboutDialog*>(gobj())));
293 void AboutDialog::set_license(const Glib::ustring& license)
295 gtk_about_dialog_set_license(gobj(), license.c_str());
298 Glib::ustring AboutDialog::get_website() const
300 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_website(const_cast<GtkAboutDialog*>(gobj())));
303 void AboutDialog::set_website(const Glib::ustring& website)
305 gtk_about_dialog_set_website(gobj(), website.c_str());
308 Glib::ustring AboutDialog::get_website_label() const
310 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_website_label(const_cast<GtkAboutDialog*>(gobj())));
313 void AboutDialog::set_website_label(const Glib::ustring& website_label)
315 gtk_about_dialog_set_website_label(gobj(), website_label.c_str());
318 Glib::StringArrayHandle AboutDialog::get_authors() const
320 return Glib::StringArrayHandle(gtk_about_dialog_get_authors(const_cast<GtkAboutDialog*>(gobj())));
323 void AboutDialog::set_authors(const Glib::StringArrayHandle& authors) const
325 gtk_about_dialog_set_authors(const_cast<GtkAboutDialog*>(gobj()), const_cast<const gchar**>((authors).data()));
328 Glib::StringArrayHandle AboutDialog::get_documenters() const
330 return Glib::StringArrayHandle(gtk_about_dialog_get_documenters(const_cast<GtkAboutDialog*>(gobj())));
333 void AboutDialog::set_documenters(const Glib::StringArrayHandle& documenters)
335 gtk_about_dialog_set_documenters(gobj(), const_cast<const gchar**>((documenters).data()));
338 Glib::StringArrayHandle AboutDialog::get_artists() const
340 return Glib::StringArrayHandle(gtk_about_dialog_get_artists(const_cast<GtkAboutDialog*>(gobj())));
343 void AboutDialog::set_artists(const Glib::StringArrayHandle& artists)
345 gtk_about_dialog_set_artists(gobj(), const_cast<const gchar**>((artists).data()));
348 Glib::ustring AboutDialog::get_translator_credits() const
350 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_translator_credits(const_cast<GtkAboutDialog*>(gobj())));
353 void AboutDialog::set_translator_credits(const Glib::ustring& translator_credits)
355 gtk_about_dialog_set_translator_credits(gobj(), translator_credits.c_str());
358 Glib::RefPtr<Gdk::Pixbuf> AboutDialog::get_logo()
360 return Glib::wrap(gtk_about_dialog_get_logo(gobj()));
363 Glib::RefPtr<const Gdk::Pixbuf> AboutDialog::get_logo() const
365 return const_cast<AboutDialog*>(this)->get_logo();
368 void AboutDialog::set_logo(const Glib::RefPtr<Gdk::Pixbuf>& logo)
370 gtk_about_dialog_set_logo(gobj(), Glib::unwrap(logo));
373 Glib::ustring AboutDialog::get_logo_icon_name() const
375 return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_logo_icon_name(const_cast<GtkAboutDialog*>(gobj())));
378 void AboutDialog::set_logo_icon_name(const Glib::ustring& icon_name)
380 gtk_about_dialog_set_logo_icon_name(gobj(), icon_name.c_str());
384 bool AboutDialog::get_wrap_license() const
386 return gtk_about_dialog_get_wrap_license(const_cast<GtkAboutDialog*>(gobj()));
389 void AboutDialog::set_wrap_license(bool wrap_license)
391 gtk_about_dialog_set_wrap_license(gobj(), static_cast<int>(wrap_license));
396 #ifdef GLIBMM_PROPERTIES_ENABLED
397 Glib::PropertyProxy<Glib::ustring> AboutDialog::property_name()
399 return Glib::PropertyProxy<Glib::ustring>(this, "name");
401 #endif //GLIBMM_PROPERTIES_ENABLED
403 #ifdef GLIBMM_PROPERTIES_ENABLED
404 Glib::PropertyProxy_ReadOnly<Glib::ustring> AboutDialog::property_name() const
406 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "name");
408 #endif //GLIBMM_PROPERTIES_ENABLED
410 #ifdef GLIBMM_PROPERTIES_ENABLED
411 Glib::PropertyProxy<Glib::ustring> AboutDialog::property_version()
413 return Glib::PropertyProxy<Glib::ustring>(this, "version");
415 #endif //GLIBMM_PROPERTIES_ENABLED
417 #ifdef GLIBMM_PROPERTIES_ENABLED
418 Glib::PropertyProxy_ReadOnly<Glib::ustring> AboutDialog::property_version() const
420 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "version");
422 #endif //GLIBMM_PROPERTIES_ENABLED
424 #ifdef GLIBMM_PROPERTIES_ENABLED
425 Glib::PropertyProxy<Glib::ustring> AboutDialog::property_copyright()
427 return Glib::PropertyProxy<Glib::ustring>(this, "copyright");
429 #endif //GLIBMM_PROPERTIES_ENABLED
431 #ifdef GLIBMM_PROPERTIES_ENABLED
432 Glib::PropertyProxy_ReadOnly<Glib::ustring> AboutDialog::property_copyright() const
434 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "copyright");
436 #endif //GLIBMM_PROPERTIES_ENABLED
438 #ifdef GLIBMM_PROPERTIES_ENABLED
439 Glib::PropertyProxy<Glib::ustring> AboutDialog::property_comments()
441 return Glib::PropertyProxy<Glib::ustring>(this, "comments");
443 #endif //GLIBMM_PROPERTIES_ENABLED
445 #ifdef GLIBMM_PROPERTIES_ENABLED
446 Glib::PropertyProxy_ReadOnly<Glib::ustring> AboutDialog::property_comments() const
448 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "comments");
450 #endif //GLIBMM_PROPERTIES_ENABLED
452 #ifdef GLIBMM_PROPERTIES_ENABLED
453 Glib::PropertyProxy<Glib::ustring> AboutDialog::property_website()
455 return Glib::PropertyProxy<Glib::ustring>(this, "website");
457 #endif //GLIBMM_PROPERTIES_ENABLED
459 #ifdef GLIBMM_PROPERTIES_ENABLED
460 Glib::PropertyProxy_ReadOnly<Glib::ustring> AboutDialog::property_website() const
462 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "website");
464 #endif //GLIBMM_PROPERTIES_ENABLED
466 #ifdef GLIBMM_PROPERTIES_ENABLED
467 Glib::PropertyProxy<Glib::ustring> AboutDialog::property_website_label()
469 return Glib::PropertyProxy<Glib::ustring>(this, "website-label");
471 #endif //GLIBMM_PROPERTIES_ENABLED
473 #ifdef GLIBMM_PROPERTIES_ENABLED
474 Glib::PropertyProxy_ReadOnly<Glib::ustring> AboutDialog::property_website_label() const
476 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "website-label");
478 #endif //GLIBMM_PROPERTIES_ENABLED
480 #ifdef GLIBMM_PROPERTIES_ENABLED
481 Glib::PropertyProxy<Glib::ustring> AboutDialog::property_license()
483 return Glib::PropertyProxy<Glib::ustring>(this, "license");
485 #endif //GLIBMM_PROPERTIES_ENABLED
487 #ifdef GLIBMM_PROPERTIES_ENABLED
488 Glib::PropertyProxy_ReadOnly<Glib::ustring> AboutDialog::property_license() const
490 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "license");
492 #endif //GLIBMM_PROPERTIES_ENABLED
494 #ifdef GLIBMM_PROPERTIES_ENABLED
495 Glib::PropertyProxy<Glib::StringArrayHandle> AboutDialog::property_authors()
497 return Glib::PropertyProxy<Glib::StringArrayHandle>(this, "authors");
499 #endif //GLIBMM_PROPERTIES_ENABLED
501 #ifdef GLIBMM_PROPERTIES_ENABLED
502 Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle> AboutDialog::property_authors() const
504 return Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle>(this, "authors");
506 #endif //GLIBMM_PROPERTIES_ENABLED
508 #ifdef GLIBMM_PROPERTIES_ENABLED
509 Glib::PropertyProxy<Glib::StringArrayHandle> AboutDialog::property_documenters()
511 return Glib::PropertyProxy<Glib::StringArrayHandle>(this, "documenters");
513 #endif //GLIBMM_PROPERTIES_ENABLED
515 #ifdef GLIBMM_PROPERTIES_ENABLED
516 Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle> AboutDialog::property_documenters() const
518 return Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle>(this, "documenters");
520 #endif //GLIBMM_PROPERTIES_ENABLED
522 #ifdef GLIBMM_PROPERTIES_ENABLED
523 Glib::PropertyProxy<Glib::StringArrayHandle> AboutDialog::property_translator_credits()
525 return Glib::PropertyProxy<Glib::StringArrayHandle>(this, "translator-credits");
527 #endif //GLIBMM_PROPERTIES_ENABLED
529 #ifdef GLIBMM_PROPERTIES_ENABLED
530 Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle> AboutDialog::property_translator_credits() const
532 return Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle>(this, "translator-credits");
534 #endif //GLIBMM_PROPERTIES_ENABLED
536 #ifdef GLIBMM_PROPERTIES_ENABLED
537 Glib::PropertyProxy<Glib::StringArrayHandle> AboutDialog::property_artists()
539 return Glib::PropertyProxy<Glib::StringArrayHandle>(this, "artists");
541 #endif //GLIBMM_PROPERTIES_ENABLED
543 #ifdef GLIBMM_PROPERTIES_ENABLED
544 Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle> AboutDialog::property_artists() const
546 return Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle>(this, "artists");
548 #endif //GLIBMM_PROPERTIES_ENABLED
550 #ifdef GLIBMM_PROPERTIES_ENABLED
551 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > AboutDialog::property_logo()
553 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> >(this, "logo");
555 #endif //GLIBMM_PROPERTIES_ENABLED
557 #ifdef GLIBMM_PROPERTIES_ENABLED
558 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > AboutDialog::property_logo() const
560 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> >(this, "logo");
562 #endif //GLIBMM_PROPERTIES_ENABLED
564 #ifdef GLIBMM_PROPERTIES_ENABLED
565 Glib::PropertyProxy<Glib::ustring> AboutDialog::property_logo_icon_name()
567 return Glib::PropertyProxy<Glib::ustring>(this, "logo-icon-name");
569 #endif //GLIBMM_PROPERTIES_ENABLED
571 #ifdef GLIBMM_PROPERTIES_ENABLED
572 Glib::PropertyProxy_ReadOnly<Glib::ustring> AboutDialog::property_logo_icon_name() const
574 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "logo-icon-name");
576 #endif //GLIBMM_PROPERTIES_ENABLED
578 #ifdef GLIBMM_PROPERTIES_ENABLED
580 Glib::PropertyProxy<bool> AboutDialog::property_wrap_license()
582 return Glib::PropertyProxy<bool>(this, "wrap-license");
585 #endif //GLIBMM_PROPERTIES_ENABLED
587 #ifdef GLIBMM_PROPERTIES_ENABLED
589 Glib::PropertyProxy_ReadOnly<bool> AboutDialog::property_wrap_license() const
591 return Glib::PropertyProxy_ReadOnly<bool>(this, "wrap-license");
594 #endif //GLIBMM_PROPERTIES_ENABLED
597 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
598 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
600 #ifdef GLIBMM_VFUNCS_ENABLED
601 #endif //GLIBMM_VFUNCS_ENABLED
604 } // namespace Gtk