diff options
Diffstat (limited to 'gio/src/application.ccg')
-rw-r--r-- | gio/src/application.ccg | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gio/src/application.ccg b/gio/src/application.ccg index d85ae8d7..e1a9f3f5 100644 --- a/gio/src/application.ccg +++ b/gio/src/application.ccg @@ -27,9 +27,25 @@ using Flags = Gio::Application::Flags; namespace // anonymous { +// The function pointer, Application_signal_open_funcptr, is set in +// Application_Class::class_init_function() (generated by gmmproc), making it +// possible to indirectly call an Application_Class member function from +// a function with C linkage. +using Application_signal_open_functype = void (*) (GApplication* self, GFile** files, gint n_files, const gchar* hint); +Application_signal_open_functype Application_signal_open_funcptr; + +extern "C" +{ +// Shall be static. Non-static functions with C linkage get external linkage, +// even if they are defined in an anonymous namespace. +static void +Application_signal_open_default_callback(GApplication* self, GFile** files, gint n_files, const gchar* hint) +{ + Application_signal_open_funcptr(self, files, n_files, hint); +} static void -Application_signal_open_callback( +Application_signal_open_connect_callback( GApplication* self, GFile** files, gint n_files, const gchar* hint, void* data) { using SlotType = sigc::slot<void(const Gio::Application::type_vec_files&, const Glib::ustring&)>; @@ -96,9 +112,10 @@ Application_signal_open_notify_callback( return; } +} // extern "C" static const Glib::SignalProxyInfo Application_signal_open_info = { "open", - (GCallback)&Application_signal_open_callback, + (GCallback)&Application_signal_open_connect_callback, (GCallback)&Application_signal_open_notify_callback }; // The add_main_option_entry*() methods that take a slot parameter are handled @@ -190,7 +207,9 @@ OptionArgCallbackDataMap option_arg_callback_data; // Accesses to option_arg_callback_data must be thread-safe. std::mutex option_arg_callback_data_mutex; -gboolean +extern "C" +{ +static gboolean Application_option_arg_callback( const gchar* option_name, const gchar* value, gpointer /* data */, GError** error) { @@ -256,7 +275,7 @@ Application_option_arg_callback( } return false; } - +} // extern "C" } // anonymous namespace namespace Gio |