Re: Wrapping GtkPlacesSidebar



2013-08-25 12:19, Juan Rafael Garcia Blanco skrev:
Hello,

I'm fairly new to developing inside gtkmm. I'm trying to wrap GtkPlacesSidebar. I managed to get a first version (https://bugzilla.gnome.org/show_bug.cgi?id=705642) and now I'm writing a simple example to test it.

In that example program I attach a handler to the open-location signal. That signal, when emitted, provides a Gio::File object in the form of Glib::Object; when it is emitted I get this message:

glibmm-WARNING **: Failed to wrap object of type 'GLocalFile'. Hint: this error is commonly caused by failing to call a library init() function.

GtkPlacesSidebar docs state that the signature for that signal handler should be:

void user_function (GtkPlacesSidebar *sidebar,
   GObject *location,
   ...)

where location is a GFile.

I've added Gio::init() at the beginning of my main.cc, but the problem remains. I would like to learn how this can be done, and why it is not working.

Thank you very much in advance.

Regards,
Juan.

gtk_init() must be called in a gtk+ program, and thus also in a gtkmm program. gtk_init() is called by
  Gtk::Application::create(int& argc, char**& argv, const Glib::ustring& application_id, Gio::ApplicationFlags flags)
but it's not called by
  Gtk::Application::create(const Glib::ustring& application_id, Gio::ApplicationFlags flags)

Don't know if this is bug, or done deliberately. My guess is that both Gtk::Application::create() shall call gtk_init().
Don't know if a missing call to gtk_init() is the reason for your warning message.

Kjell



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]