+2.52.0 (stable):
+
+Gio:
+* UnixSocketAddress::create(): Remove the default value for the type
+ parameter to avoid ambiguity.
+ (Kjell Ahlstedt) Bug #782592
+
+Gio::DBus
+* Proxy: Wrap call() and call_sync() methods.
+ (Vyacheslav Yurkov) Bug #781818
+
+Documentation:
+* RefPtr: Clarify comment about undefined behaviour.
+ (Daniel Boles)
+
2.51.7 (unstable):
Glib:
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([glibmm], [2.51.7],
+AC_INIT([glibmm], [2.52.0],
[http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm],
[glibmm], [http://www.gtkmm.org/])
AC_PREREQ([2.59])
* For instance,
* void on_slot_activated();
*/
- using ActivateSlot = sigc::slot<void()>;
+ using ActivateSlot = sigc::slot<void>;
/** A convenience method for creating a SimpleAction instance
* and adding it to the ActionMap.
* For instance,
* void on_slot_activated(const Glib::VariantBase& parameter);
*/
- using ActivateWithParameterSlot = sigc::slot<void(const Glib::VariantBase&)>;
+ using ActivateWithParameterSlot = sigc::slot<void, const Glib::VariantBase&>;
_DEPRECATE_IFDEF_START
/** A convenience method for creating a SimpleAction instance
property.init(g_variant, false /* no extra reference needed */);
}
-void
-Proxy::call(const Glib::ustring& method_name, const SlotAsyncReady& slot,
- const Glib::RefPtr<Cancellable>& cancellable, const Glib::VariantContainerBase& parameters,
- int timeout_msec, CallFlags flags)
-{
- // Create a copy of the slot.
- // A pointer to it will be passed through the callback's data parameter
- // and deleted in the callback.
- auto slot_copy = new SlotAsyncReady(slot);
-
- g_dbus_proxy_call(gobj(), method_name.c_str(), const_cast<GVariant*>(parameters.gobj()),
- static_cast<GDBusCallFlags>(flags), timeout_msec, Glib::unwrap(cancellable),
- &SignalProxy_async_callback, slot_copy);
-}
-
-void
-Proxy::call(const Glib::ustring& method_name, const SlotAsyncReady& slot,
- const Glib::VariantContainerBase& parameters, int timeout_msec, CallFlags flags)
-{
- // Create a copy of the slot.
- // A pointer to it will be passed through the callback's data parameter
- // and deleted in the callback.
- auto slot_copy = new SlotAsyncReady(slot);
-
- g_dbus_proxy_call(gobj(), method_name.c_str(), const_cast<GVariant*>(parameters.gobj()),
- static_cast<GDBusCallFlags>(flags), timeout_msec, nullptr, &SignalProxy_async_callback,
- slot_copy);
-}
-
-Glib::VariantContainerBase
-Proxy::call_sync(const Glib::ustring& method_name, const Glib::RefPtr<Cancellable>& cancellable,
- const Glib::VariantContainerBase& parameters, int timeout_msec, CallFlags flags)
-{
- GError* g_error = nullptr;
-
- GVariant* const gvariant =
- g_dbus_proxy_call_sync(gobj(), method_name.c_str(), const_cast<GVariant*>(parameters.gobj()),
- static_cast<GDBusCallFlags>(flags), timeout_msec, Glib::unwrap(cancellable), &g_error);
-
- if (g_error)
- ::Glib::Error::throw_exception(g_error);
-
- return Glib::VariantContainerBase(gvariant, false); // Dont' take an extra reference.
-}
-
-Glib::VariantContainerBase
-Proxy::call_sync(const Glib::ustring& method_name, const Glib::VariantContainerBase& parameters,
- int timeout_msec, CallFlags flags)
-{
- GError* g_error = nullptr;
-
- GVariant* const gvariant =
- g_dbus_proxy_call_sync(gobj(), method_name.c_str(), const_cast<GVariant*>(parameters.gobj()),
- static_cast<GDBusCallFlags>(flags), timeout_msec, nullptr, &g_error);
-
- if (g_error)
- ::Glib::Error::throw_exception(g_error);
-
- return Glib::VariantContainerBase(gvariant, false); // Dont' take an extra reference.
-}
-
-#ifdef G_OS_UNIX
-// With a UnixFDList.
-void
-Proxy::call(const Glib::ustring& method_name, const Glib::VariantContainerBase& parameters,
- const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable,
- const Glib::RefPtr<UnixFDList>& fd_list, int timeout_msec, CallFlags flags)
-{
- // Create a copy of the slot.
- // A pointer to it will be passed through the callback's data parameter
- // and deleted in the callback.
- auto slot_copy = new SlotAsyncReady(slot);
-
- g_dbus_proxy_call_with_unix_fd_list(gobj(), method_name.c_str(),
- const_cast<GVariant*>(parameters.gobj()), static_cast<GDBusCallFlags>(flags), timeout_msec,
- Glib::unwrap(fd_list), Glib::unwrap(cancellable), &SignalProxy_async_callback, slot_copy);
-}
-
-// Non-cancellable version (with a UnixFDList).
-void
-Proxy::call(const Glib::ustring& method_name, const Glib::VariantContainerBase& parameters,
- const SlotAsyncReady& slot, const Glib::RefPtr<UnixFDList>& fd_list, int timeout_msec,
- CallFlags flags)
-{
- // Create a copy of the slot.
- // A pointer to it will be passed through the callback's data parameter
- // and deleted in the callback.
- auto slot_copy = new SlotAsyncReady(slot);
-
- g_dbus_proxy_call_with_unix_fd_list(gobj(), method_name.c_str(),
- const_cast<GVariant*>(parameters.gobj()), static_cast<GDBusCallFlags>(flags), timeout_msec,
- Glib::unwrap(fd_list), nullptr, &SignalProxy_async_callback, slot_copy);
-}
-#endif // G_OS_UNIX
-
} // namespace DBus
} // namespace Gio
_WRAP_METHOD(Glib::RefPtr<InterfaceInfo> get_interface_info(), g_dbus_proxy_get_interface_info)
_WRAP_METHOD(Glib::RefPtr<const InterfaceInfo> get_interface_info() const, g_dbus_proxy_get_interface_info, constversion)
- _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_call)
- void call(
- const Glib::ustring& method_name,
- const SlotAsyncReady& slot,
- const Glib::RefPtr<Cancellable>& cancellable,
- const Glib::VariantContainerBase& parameters = Glib::VariantContainerBase(),
- int timeout_msec = -1,
- CallFlags flags = Gio::DBus::CALL_FLAGS_NONE
- );
-
- /// A non-cancellable version of call().
- void call(
- const Glib::ustring& method_name,
- const SlotAsyncReady& slot,
- const Glib::VariantContainerBase& parameters = Glib::VariantContainerBase(),
- int timeout_msec = -1,
- CallFlags flags = Gio::DBus::CALL_FLAGS_NONE
- );
+ _WRAP_METHOD(
+ void call(
+ const Glib::ustring& method_name{.},
+ const SlotAsyncReady& slot{callback?},
+ const Glib::RefPtr<Cancellable>& cancellable{.?},
+ const Glib::VariantContainerBase& parameters{.} = Glib::VariantContainerBase(),
+ int timeout_msec{.} = -1,
+ CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE
+ ),
+ g_dbus_proxy_call, slot_name slot, slot_callback SignalProxy_async_callback
+ )
/** Finishes an operation started with call().
*
*/
_WRAP_METHOD(Glib::VariantContainerBase call_finish(const Glib::RefPtr<AsyncResult>& res), g_dbus_proxy_call_finish, errthrow)
-//TODO: Use _WRAP_METHOD() for this?
- /** Synchronously invokes the method_name method on proxy.
- * See call(), the asynchronous version of this method for more information.
- *
- * @param method_name Name of method to invoke.
- * @param timeout_msec The timeout in milliseconds or -1 to use the proxy
- * default timeout.
- * @param flags Flags from the CallFlags enumeration.
- * @param parameters A Glib::VariantContainerBase tuple with parameters for the
- * signal.
- * @param cancellable A Cancellable.
- * @result A Variant tuple with return values.
- *
- * @throw Glib::Error.
- */
- Glib::VariantContainerBase call_sync(
- const Glib::ustring& method_name,
- const Glib::RefPtr<Cancellable>& cancellable,
- const Glib::VariantContainerBase& parameters = Glib::VariantContainerBase(),
- int timeout_msec = -1,
- CallFlags flags = Gio::DBus::CALL_FLAGS_NONE
- );
- _IGNORE(g_dbus_proxy_call_sync)
-
- /// A non-cancellable version of call_sync().
- Glib::VariantContainerBase call_sync(
- const Glib::ustring& method_name,
- const Glib::VariantContainerBase& parameters = Glib::VariantContainerBase(),
- int timeout_msec = -1,
- CallFlags flags = Gio::DBus::CALL_FLAGS_NONE
- );
-
-
-#ifdef G_OS_UNIX
-//TODO: Use _WRAP_METHOD() for this?
- /** Like call() but also takes a GUnixFDList object.
- * This method is only available on UNIX.
- *
- * This is an asynchronous method. When the operation is finished, callback
- * will be invoked in the thread-default main loop of the thread you are
- * calling this method from. You can then call call_with_unix_fd_finish() to
- * get the result of the operation. See call_sync() for the synchronous
- * version of this function.
- *
- * @param method_name The name of the method to invoke.
- * @param parameters A Glib::VariantContainerBase tuple with parameters for the
- * method or <tt>0</tt> if not passing parameters.
- * @param slot A SlotAsyncReady to call when the request is satisfied.
- * @param cancellable A Cancellable.
- * @param fd_list A UnixFDList.
- * @param timeout_msec The timeout in milliseconds, -1 to use the default
- * timeout or G_MAXINT for no timeout.
- * @param flags Flags from the Gio::DBus::CallFlags enumeration.
- * @newin{2,34}
- */
- void call(
- const Glib::ustring& method_name,
- const Glib::VariantContainerBase& parameters,
- const SlotAsyncReady& slot,
- const Glib::RefPtr<Cancellable>& cancellable,
- const Glib::RefPtr<UnixFDList>& fd_list,
- int timeout_msec = -1,
- CallFlags flags = Gio::DBus::CALL_FLAGS_NONE);
- _IGNORE(g_dbus_proxy_call_with_unix_fd_list)
-
- /** A non-cancellable version of call() (with a UnixFDList).
- * @newin{2,34}
- */
- void call(
- const Glib::ustring& method_name,
- const Glib::VariantContainerBase& parameters,
- const SlotAsyncReady& slot,
- const Glib::RefPtr<UnixFDList>& fd_list,
- int timeout_msec = -1,
- CallFlags flags = Gio::DBus::CALL_FLAGS_NONE);
+ _WRAP_METHOD(
+ Glib::VariantContainerBase call_sync(
+ const Glib::ustring& method_name{.},
+ const Glib::RefPtr<Cancellable>& cancellable{.?},
+ const Glib::VariantContainerBase& parameters{.} = Glib::VariantContainerBase(),
+ int timeout_msec{.} = -1,
+ CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE
+ ),
+ g_dbus_proxy_call_sync, errthrow
+ )
+
+ _WRAP_METHOD(
+ void call(
+ const Glib::ustring& method_name{.},
+ const Glib::VariantContainerBase& parameters{.},
+ const SlotAsyncReady& slot{callback?},
+ const Glib::RefPtr<Cancellable>& cancellable{.?},
+ const Glib::RefPtr<UnixFDList>& fd_list{.},
+ int timeout_msec{.} = -1,
+ CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE
+ ),
+ g_dbus_proxy_call_with_unix_fd_list, ifdef G_OS_UNIX,
+ slot_name slot, slot_callback SignalProxy_async_callback
+ )
/** Finishes an operation started with call() (with a UnixFDList).
* @param res A AsyncResult obtained from the SlotAsyncReady passed to
* @newin{2,34}
*/
_WRAP_METHOD(Glib::VariantContainerBase call_finish(const Glib::RefPtr<AsyncResult>& res{.}, Glib::RefPtr<UnixFDList>& out_fd_list{.>>}), g_dbus_proxy_call_with_unix_fd_list_finish, errthrow, ifdef G_OS_UNIX)
-#endif // G_OS_UNIX
_WRAP_METHOD(
Glib::VariantContainerBase call_sync(
</return>
</function>
+<function name="g_dbus_proxy_call">
+<parameters>
+<parameter name="proxy">
+<parameter_description> A #GDBusProxy.
+</parameter_description>
+</parameter>
+<parameter name="method_name">
+<parameter_description> Name of method to invoke.
+</parameter_description>
+</parameter>
+<parameter name="parameters">
+<parameter_description> A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
+</parameter_description>
+</parameter>
+<parameter name="flags">
+<parameter_description> Flags from the #GDBusCallFlags enumeration.
+</parameter_description>
+</parameter>
+<parameter name="timeout_msec">
+<parameter_description> The timeout in milliseconds (with %G_MAXINT meaning
+"infinite") or -1 to use the proxy default timeout.
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> A #GCancellable or %NULL.
+</parameter_description>
+</parameter>
+<parameter name="callback">
+<parameter_description> A #GAsyncReadyCallback to call when the request is satisfied. Use another overload
+without this parameter if your don't care about the result of the method invocation.
+</parameter_description>
+</parameter>
+<parameter name="user_data">
+<parameter_description> The data to pass to @callback.
+</parameter_description>
+</parameter>
+</parameters>
+</function>
+
+<function name="g_dbus_proxy_call_with_unix_fd_list">
+<parameters>
+<parameter name="proxy">
+<parameter_description> A #GDBusProxy.
+</parameter_description>
+</parameter>
+<parameter name="method_name">
+<parameter_description> Name of method to invoke.
+</parameter_description>
+</parameter>
+<parameter name="parameters">
+<parameter_description> A #GVariant tuple with parameters for the signal or %NULL if not passing parameters.
+</parameter_description>
+</parameter>
+<parameter name="flags">
+<parameter_description> Flags from the #GDBusCallFlags enumeration.
+</parameter_description>
+</parameter>
+<parameter name="timeout_msec">
+<parameter_description> The timeout in milliseconds (with %G_MAXINT meaning
+"infinite") or -1 to use the proxy default timeout.
+</parameter_description>
+</parameter>
+<parameter name="fd_list">
+<parameter_description> A #GUnixFDList or %NULL.
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> A #GCancellable or %NULL.
+</parameter_description>
+</parameter>
+<parameter name="callback">
+<parameter_description> A #GAsyncReadyCallback to call when the request is satisfied. Use another overload
+without this parameter if your don't care about the result of the method invocation.
+</parameter_description>
+</parameter>
+<parameter name="user_data">
+<parameter_description> The data to pass to @callback.
+</parameter_description>
+</parameter>
+</parameters>
+</function>
+
</root>
_WRAP_METHOD_DOCS_ONLY(g_unix_socket_address_new_with_type)
static Glib::RefPtr<UnixSocketAddress> create(const std::string& path,
- UnixSocketAddressType type = Gio::UNIX_SOCKET_ADDRESS_ABSTRACT,
- int path_len = -1);
+ UnixSocketAddressType type, int path_len = -1);
// Deprecated.
_IGNORE(g_unix_socket_address_get_is_abstract)
public:
/** Default constructor
*
- * Afterwards it will be null and use of -> will cause a segmentation fault.
+ * Afterwards it will be null and use of -> will invoke undefined behaviour.
*/
inline RefPtr() noexcept;
void
VariantContainerBase::get_child(VariantBase& child, gsize index) const
{
- if (index >= g_variant_n_children(gobject_))
+ if (index >= get_n_children())
throw std::out_of_range("VariantContainerBase::get_child(): Index out of bounds.");
GVariant* const gvariant = g_variant_get_child_value(gobject_, index);
Glib::ustring
Variant<type_vec_ustring>::get_child(gsize index) const
{
- if (index >= g_variant_n_children(const_cast<GVariant*>(gobj())))
+ if (index >= get_n_children())
throw std::out_of_range(
"Variant< std::vector<Glib::ustring> >::get_child(): Index out of bounds.");
// but the Variant can alternatively hold an array of object paths or DBus type signatures.
type_vec_ustring result;
- gsize n_children = g_variant_n_children(const_cast<GVariant*>(gobj()));
-
- for (gsize i = 0; i < n_children; i++)
+ for (gsize i = 0, n_children = get_n_children(); i < n_children; ++i)
{
GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i);
result.emplace_back(Glib::Variant<Glib::ustring>(gvariant).get());
std::string
Variant<type_vec_string>::get_child(gsize index) const
{
- if (index >= g_variant_n_children(const_cast<GVariant*>(gobj())))
+ if (index >= get_n_children())
throw std::out_of_range(
"Variant< std::vector<std::string> >::get_child(): Index out of bounds.");
// signatures.
type_vec_string result;
- gsize n_children = g_variant_n_children(const_cast<GVariant*>(gobj()));
-
- for (gsize i = 0; i < n_children; i++)
+ for (gsize i = 0, n_children = get_n_children(); i < n_children; ++i)
{
GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i);
result.emplace_back(Glib::Variant<std::string>(gvariant).get());
template<class T>
T Variant< std::vector<T> >::get_child(gsize index) const
{
- if(index >= g_variant_n_children(const_cast<GVariant*>(gobj())))
+ if (index >= get_n_children())
throw std::out_of_range(
"Variant< std::vector<T> >::get_child(): Index out of bounds.");
{
std::vector<T> result;
- gsize n_children = g_variant_n_children(const_cast<GVariant*>(gobj()));
-
- for(gsize i = 0; i < n_children; i++)
+ for (gsize i = 0, n_children = get_n_children(); i < n_children; ++i)
{
Glib::Variant<T> variant;