1 /* Copyright 2006 The gtkmm Development Team
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the Free
15 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #include <gtk/gtkrecentchooser.h>
20 // This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
22 static int SignalProxy_Compare_gtk_callback(GtkRecentInfo* a, GtkRecentInfo* b, gpointer data)
24 const Gtk::RecentChooser::SlotCompare* the_slot = static_cast<Gtk::RecentChooser::SlotCompare*>(data);
26 #ifdef GLIBMM_EXCEPTIONS_ENABLED
29 #endif //GLIBMM_EXCEPTIONS_ENABLED
30 return (*the_slot)(Glib::wrap(a, true /* take reference */), Glib::wrap(b, true /* take reference */));
31 #ifdef GLIBMM_EXCEPTIONS_ENABLED
35 Glib::exception_handlers_invoke();
39 #endif //GLIBMM_EXCEPTIONS_ENABLED
42 static void SignalProxy_Compare_gtk_callback_destroy(gpointer data)
44 delete static_cast<Gtk::RecentChooser::SlotCompare*>(data);
51 //Allow the generated code to work without the prefix:
52 typedef RecentChooser::ListHandle_RecentInfos ListHandle_RecentInfos;
54 void RecentChooser::set_sort_func(const SlotCompare& slot)
56 SlotCompare* slot_copy = new SlotCompare(slot);
58 gtk_recent_chooser_set_sort_func(
60 &SignalProxy_Compare_gtk_callback, slot_copy,
61 &SignalProxy_Compare_gtk_callback_destroy);
64 Glib::StringArrayHandle RecentChooser::get_uris() const
66 return Glib::StringArrayHandle(gtk_recent_chooser_get_uris(const_cast<GtkRecentChooser*>(gobj()), NULL));
69 void RecentChooser::unset_limit()
71 gtk_recent_chooser_set_limit(gobj(), -1 /* See C docs */);