GNOME Bugzilla – Bug 764547
Use conversion from GDBusProxy* to C++ object not possible outside Gio::DBus namespace.
Last modified: 2016-04-05 17:41:08 UTC
Created attachment 325265 [details] [review] 0001-Gio-DBus-Proxy-allow-using-GDBusProxy-conversion-out.patch Since in conversion definition we're removing namespaces, we're not able use the same conversion in other places. I've fixed conversion from GDBusProxy*, so now it can be used outside Gio::DBus namespace. I think I'm not breaking the API - probably this conversion has been used only in giomm (actually, it can be used only in Gio::DBus namespace, it's very unlikely that someone else used the same namespace and the same class name in his wrapper). Please review, if patch looks OK, I'll push it.
Sure. That looks harmless, though it doesn't seem so hard to put another conversion in your own project.
Of course, I could add own conversion in my project (actually, I did it), but it's kind of duplicating code. So if there are no objections, I'll push it.
There are lots of such duplications. It's very common to skip the namespace where it can be done, and add _CONVERSION()s where they are needed. Some examples: glibmm/tools/m4/convert_gio.m4 ------------------------------ _CONVERSION(`const Glib::RefPtr<AsyncResult>&',`GAsyncResult*',__CONVERT_REFPTR_TO_P) _CONVERSION(`const Glib::RefPtr<MenuModel>&',`GMenuModel*',__CONVERT_CONST_REFPTR_TO_P) _CONVERSION(`GMenuModel*',`Glib::RefPtr<MenuModel>',`Glib::wrap($3)') gtkmm/tools/m4/convert_gtk.m4 ------------------------------ _CONVERSION(`const Glib::RefPtr<Gio::AsyncResult>&',`GAsyncResult*',__CONVERT_REFPTR_TO_P) _CONVERSION(`const Glib::RefPtr<Gio::MenuModel>&',`GMenuModel*',__CONVERT_REFPTR_TO_P) _CONVERSION(`GMenuModel*',`Glib::RefPtr<Gio::MenuModel>',`Glib::wrap($3)')
(In reply to Kjell Ahlstedt from comment #3) > There are lots of such duplications. It's very common to skip the namespace > where it can be done, and add _CONVERSION()s where they are needed. So what do you suggest Should I leave it as it is, or rather fix it? Should we use namespaces for the new conversions? I think that would be a good practice.
Do as you like. I doubt that it will be a new practice to include namespaces everywhere in all _WRAP_METHODs. But it's not consistently left out now. For instance, Gio::DBus::Interface and Gio::DBus::Object are specified with namespaces. If you want to do the same with Gio::DBus::Proxy, it's ok with me.
ok, so I'm pushing my commit. Thanks.