summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2022-04-07 15:21:36 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2022-04-07 15:21:36 +0200
commit85edfe90e1f34009bd3d60b65480f52893a4c9b9 (patch)
treef6e26c2af263e49424f0b98da8ec91f15b38ed80
parent645947b3b8443995b58e3b5db1f953a80ec84d74 (diff)
downloadglibmm-85edfe90e1f34009bd3d60b65480f52893a4c9b9.tar.gz
Glib, Gio: Add some methods for glibmm 2.72
* configure.ac: * meson.build: Require glib-2.0 >= 2.71.2. * gio/src/dbusproxy.hg: signal_signal() accepts a signal name. * gio/src/file.[ccg|hg]: Add move_async() and move_finish(). * gio/src/socketclient.hg: Deprecate set/get/property_tls_validation_flags(). * gio/src/tlscertificate.hg: Add properties private_key, private_key_pem, pkcs11_uri, private_key_pkcs11_uri. * gio/src/tlsclientconnection.hg: Deprecate set/get/property_validation_flags(). * glib/glibmm/main.[cc|h]: Add create(MainContextFlags flags). * glib/src/enums.hg: Add enum Glib::MainContextFlags.
-rw-r--r--configure.ac2
-rw-r--r--gio/src/dbusproxy.hg5
-rw-r--r--gio/src/file.ccg95
-rw-r--r--gio/src/file.hg41
-rw-r--r--gio/src/socketclient.hg13
-rw-r--r--gio/src/tlscertificate.hg10
-rw-r--r--gio/src/tlsclientconnection.hg13
-rw-r--r--glib/glibmm/main.cc8
-rw-r--r--glib/glibmm/main.h15
-rw-r--r--glib/src/enums.hg1
-rw-r--r--meson.build2
11 files changed, 157 insertions, 48 deletions
diff --git a/configure.ac b/configure.ac
index 7ba8acce..3b835148 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,7 +83,7 @@ AS_IF([test "x$enable_static" = xyes],
AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library])
])
-glibreq='2.0 >= 2.69.1'
+glibreq='2.0 >= 2.71.2'
GLIBMM_MODULES="sigc++-3.0 >= 3.0.0 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq"
diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg
index 4deb01b9..c3dfebbc 100644
--- a/gio/src/dbusproxy.hg
+++ b/gio/src/dbusproxy.hg
@@ -50,7 +50,7 @@ _WRAP_ENUM(ProxyFlags, GDBusProxyFlags, gtype_func g_dbus_proxy_flags_get_type,
* If a Proxy is used for a well-known name, the owner of the name is
* tracked and can be read from property_g_name_owner().
*
- * The generic signal_g_properties_changed() and signal_g_signal() signals are
+ * The generic signal_properties_changed() and signal_signal() signals are
* not very convenient to work with. Therefore, the recommended way of working
* with proxies is to subclass Proxy, and have more natural properties and
* signals in your derived class.
@@ -356,7 +356,8 @@ public:
#m4 _CONVERSION(`GVariant*', `const Glib::VariantContainerBase&', `Glib::VariantContainerBase($3, true)')
#m4 _CONVERSION(`const Glib::VariantContainerBase&', `GVariant*', `const_cast<GVariant*>(($3).gobj())')
- _WRAP_SIGNAL(void signal(const Glib::ustring& sender_name, const Glib::ustring& signal_name, const Glib::VariantContainerBase& parameters), "g-signal")
+ _WRAP_SIGNAL(void signal(const Glib::ustring& sender_name, const Glib::ustring& signal_name, const Glib::VariantContainerBase& parameters), "g-signal",
+ detail_name signal_name, two_signal_methods)
};
} //namespace
diff --git a/gio/src/file.ccg b/gio/src/file.ccg
index 3fab96d2..adef931e 100644
--- a/gio/src/file.ccg
+++ b/gio/src/file.ccg
@@ -586,8 +586,7 @@ File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot,
bool res;
// Create a copy of the slot.
- // A pointer to it will be passed through the callback's data parameter
- // and deleted in the callback.
+ // A pointer to it will be passed through the callback's data parameter.
SlotFileProgress* slot_copy = new SlotFileProgress(slot);
res = g_file_copy(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags),
@@ -608,8 +607,7 @@ File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot,
bool res;
// Create a copy of the slot.
- // A pointer to it will be passed through the callback's data parameter
- // and deleted in the callback.
+ // A pointer to it will be passed through the callback's data parameter.
SlotFileProgress* slot_copy = new SlotFileProgress(slot);
res = g_file_copy(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags), nullptr,
@@ -642,7 +640,7 @@ File::copy_async(const Glib::RefPtr<File>& destination, const SlotFileProgress&
CopyFlags flags, int io_priority)
{
// Create a new pair which will hold copies of passed slots.
- // This will be deleted in the SignalProxy_file_copy_async_callback() callback
+ // This will be deleted in the SignalProxy_file_copy_async_callback() callback.
CopySlots* slots = new CopySlots();
SlotFileProgress* slot_progress_copy = new SlotFileProgress(slot_progress);
SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
@@ -659,9 +657,9 @@ void
File::copy_async(const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready,
const Glib::RefPtr<Cancellable>& cancellable, CopyFlags flags, int io_priority)
{
- // Create copies of slots.
- // Pointers to them will be passed through the callbacks' data parameter
- // and deleted in the corresponding callback.
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
g_file_copy_async(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags),
@@ -674,7 +672,7 @@ File::copy_async(const Glib::RefPtr<File>& destination, const SlotFileProgress&
const SlotAsyncReady& slot_ready, CopyFlags flags, int io_priority)
{
// Create a new pair which will hold copies of passed slots.
- // This will be deleted in the SignalProxy_file_copy_async_callback() callback
+ // This will be deleted in the SignalProxy_file_copy_async_callback() callback.
CopySlots* slots = new CopySlots();
SlotFileProgress* slot_progress_copy = new SlotFileProgress(slot_progress);
SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
@@ -691,9 +689,9 @@ void
File::copy_async(const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready,
CopyFlags flags, int io_priority)
{
- // Create copies of slots.
- // Pointers to them will be passed through the callbacks' data parameter
- // and deleted in the corresponding callback.
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
g_file_copy_async(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags),
@@ -707,9 +705,8 @@ File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot,
GError* gerror = nullptr;
bool res;
- // Create a move of the slot.
- // A pointer to it will be passed through the callback's data parameter
- // and deleted in the callback.
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter.
SlotFileProgress* slot_copy = new SlotFileProgress(slot);
res = g_file_move(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags),
@@ -729,9 +726,8 @@ File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot,
GError* gerror = nullptr;
bool res;
- // Create a move of the slot.
- // A pointer to it will be passed through the callback's data parameter
- // and deleted in the callback.
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter.
SlotFileProgress* slot_copy = new SlotFileProgress(slot);
res = g_file_move(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags), nullptr,
@@ -761,6 +757,69 @@ File::move(const Glib::RefPtr<File>& destination, CopyFlags flags)
}
void
+File::move_async(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress,
+ const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable,
+ CopyFlags flags, int io_priority)
+{
+ // Create a new pair which will hold copies of passed slots.
+ // This will be deleted in the SignalProxy_file_copy_async_callback() callback.
+ CopySlots* slots = new CopySlots();
+ SlotFileProgress* slot_progress_copy = new SlotFileProgress(slot_progress);
+ SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
+
+ slots->first = slot_progress_copy;
+ slots->second = slot_ready_copy;
+
+ g_file_move_async(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags),
+ io_priority, Glib::unwrap(cancellable), &SignalProxy_file_progress_callback, slot_progress_copy,
+ &SignalProxy_file_copy_async_callback, slots);
+}
+
+void
+File::move_async(const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready,
+ const Glib::RefPtr<Cancellable>& cancellable, CopyFlags flags, int io_priority)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
+
+ g_file_move_async(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags),
+ io_priority, Glib::unwrap(cancellable), nullptr, nullptr, &SignalProxy_async_callback,
+ slot_ready_copy);
+}
+
+void
+File::move_async(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress,
+ const SlotAsyncReady& slot_ready, CopyFlags flags, int io_priority)
+{
+ // Create a new pair which will hold copies of passed slots.
+ // This will be deleted in the SignalProxy_file_copy_async_callback() callback.
+ CopySlots* slots = new CopySlots();
+ SlotFileProgress* slot_progress_copy = new SlotFileProgress(slot_progress);
+ SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
+
+ slots->first = slot_progress_copy;
+ slots->second = slot_ready_copy;
+
+ g_file_move_async(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags),
+ io_priority, nullptr, &SignalProxy_file_progress_callback, slot_progress_copy,
+ &SignalProxy_file_copy_async_callback, slots);
+}
+
+void
+File::move_async(const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready,
+ CopyFlags flags, int io_priority)
+{
+ // Create a copy of the slot.
+ // A pointer to it will be passed through the callback's data parameter
+ // and deleted in the callback.
+ SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
+
+ g_file_move_async(gobj(), Glib::unwrap(destination), static_cast<GFileCopyFlags>(flags),
+ io_priority, nullptr, nullptr, nullptr, &SignalProxy_async_callback, slot_ready_copy);
+}
+void
File::set_attributes_async(const Glib::RefPtr<FileInfo>& info, const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags, int io_priority)
{
diff --git a/gio/src/file.hg b/gio/src/file.hg
index 263d6e36..e640934b 100644
--- a/gio/src/file.hg
+++ b/gio/src/file.hg
@@ -145,6 +145,7 @@ public:
_WRAP_METHOD(std::string get_basename() const, g_file_get_basename)
_WRAP_METHOD(std::string get_path() const, g_file_get_path)
+ _IGNORE(g_file_peek_path)
_WRAP_METHOD(std::string get_uri() const, g_file_get_uri)
_WRAP_METHOD(Glib::ustring get_parse_name() const, g_file_get_parse_name)
@@ -1275,6 +1276,46 @@ public:
bool move(const Glib::RefPtr<File>& destination, CopyFlags flags = CopyFlags::NONE);
_IGNORE(g_file_move)
+ /** Asynchronously moves a file source to the location of @a destination.
+ *
+ * For details of the behaviour, see move().
+ *
+ * If @a slot_progress is not empty, then that slot will be called just like
+ * in move(). The callback will run in the default main context of the thread
+ * calling %move_async() — the same context as @a slot_ready is run in.
+ *
+ * When the operation is finished, @a slot_ready will be called. You can then call
+ * move_finish() to get the result of the operation.
+ *
+ * @newin{2,72}
+ *
+ * @param destination File pointing to the destination location.
+ * @param slot_progress The callback slot to be called with progress information.
+ * @param slot_ready A SlotAsyncReady to call when the request is satisfied.
+ * @param cancellable A Cancellable object which can be used to cancel the operation.
+ * @param flags Set of Gio::File::CopyFlags.
+ * @param io_priority The I/O priority of the request.
+ */
+ void move_async(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress,
+ const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable,
+ CopyFlags flags = CopyFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT);
+
+ void move_async(const Glib::RefPtr<File>& destination,
+ const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable,
+ CopyFlags flags = CopyFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT);
+
+ void move_async(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress,
+ const SlotAsyncReady& slot_ready,
+ CopyFlags flags = CopyFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT);
+
+ void move_async(const Glib::RefPtr<File>& destination,
+ const SlotAsyncReady& slot_ready,
+ CopyFlags flags = CopyFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT);
+ _IGNORE(g_file_move_async)
+
+ _WRAP_METHOD(bool move_finish(const Glib::RefPtr<AsyncResult>& res),
+ g_file_move_finish, errthrow)
+
_WRAP_METHOD(bool make_directory(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_make_directory,
errthrow)
diff --git a/gio/src/socketclient.hg b/gio/src/socketclient.hg
index 915d84e7..662fbc67 100644
--- a/gio/src/socketclient.hg
+++ b/gio/src/socketclient.hg
@@ -142,13 +142,10 @@ public:
_WRAP_METHOD(bool get_tls() const, g_socket_client_get_tls)
_WRAP_METHOD(void set_tls(bool tls = true), g_socket_client_set_tls)
- //TODO: Deprecate in glibmm 2.72.
_WRAP_METHOD(TlsCertificateFlags get_tls_validation_flags() const, g_socket_client_get_tls_validation_flags,
- ignore_deprecations)
- // deprecated "Do not attempt to ignore validation errors.")
+ deprecated "Do not attempt to ignore validation errors.")
_WRAP_METHOD(void set_tls_validation_flags(TlsCertificateFlags flags), g_socket_client_set_tls_validation_flags,
- ignore_deprecations)
- // deprecated "Do not attempt to ignore validation errors.")
+ deprecated "Do not attempt to ignore validation errors.")
_WRAP_METHOD(Glib::RefPtr<ProxyResolver> get_proxy_resolver(), g_socket_client_get_proxy_resolver, refreturn)
_WRAP_METHOD(Glib::RefPtr<const ProxyResolver> get_proxy_resolver() const, g_socket_client_get_proxy_resolver, refreturn, constversion)
@@ -166,10 +163,8 @@ public:
_WRAP_PROPERTY("timeout", guint)
_WRAP_PROPERTY("enable-proxy", bool)
_WRAP_PROPERTY("tls", bool)
- //TODO: Deprecate in glibmm 2.72.
- _WRAP_PROPERTY("tls-validation-flags", TlsCertificateFlags)
- //_WRAP_PROPERTY("tls-validation-flags", TlsCertificateFlags,
- // deprecated "Do not attempt to ignore validation errors.")
+ _WRAP_PROPERTY("tls-validation-flags", TlsCertificateFlags,
+ deprecated "Do not attempt to ignore validation errors.")
_WRAP_PROPERTY("proxy-resolver", Glib::RefPtr<ProxyResolver>)
#m4 _CONVERSION(`GSocketConnectable*',`const Glib::RefPtr<SocketConnectable>&',`Glib::wrap($3, true)')
diff --git a/gio/src/tlscertificate.hg b/gio/src/tlscertificate.hg
index cfc791d3..b9ea6ef7 100644
--- a/gio/src/tlscertificate.hg
+++ b/gio/src/tlscertificate.hg
@@ -79,18 +79,16 @@ public:
_WRAP_PROPERTY("certificate", Glib::RefPtr<Glib::ByteArray>)
_WRAP_PROPERTY("certificate-pem", std::string)
+ _WRAP_PROPERTY("private-key", Glib::RefPtr<Glib::ByteArray>, newin "2,72")
+ _WRAP_PROPERTY("private-key-pem", std::string, newin "2,72")
_WRAP_PROPERTY("issuer", Glib::RefPtr<TlsCertificate>)
+ _WRAP_PROPERTY("pkcs11-uri", std::string, newin "2,72")
+ _WRAP_PROPERTY("private-key-pkcs11-uri", std::string, newin "2,72")
_WRAP_PROPERTY("not-valid-before", Glib::DateTime)
_WRAP_PROPERTY("not-valid-after", Glib::DateTime)
_WRAP_PROPERTY("subject-name", Glib::ustring)
_WRAP_PROPERTY("issuer-name", Glib::ustring)
- // Write-only and construct-only
- //_WRAP_PROPERTY("private-key", Glib::RefPtr<Glib::ByteArray>)
-
- // Write-only and construct-only
- //_WRAP_PROPERTY("private-key-pem", std::string)
-
protected:
#m4 _CONVERSION(`GSocketConnectable*',`const Glib::RefPtr<const SocketConnectable>&',`Glib::wrap($3, true)')
#m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr<const TlsCertificate>&',`Glib::wrap($3, true)')
diff --git a/gio/src/tlsclientconnection.hg b/gio/src/tlsclientconnection.hg
index 6ee2727c..731ba75f 100644
--- a/gio/src/tlsclientconnection.hg
+++ b/gio/src/tlsclientconnection.hg
@@ -61,13 +61,10 @@ public:
_WRAP_METHOD(Glib::RefPtr<SocketConnectable> get_server_identity(), g_tls_client_connection_get_server_identity, refreturn)
_WRAP_METHOD(Glib::RefPtr<const SocketConnectable> get_server_identity() const, g_tls_client_connection_get_server_identity, constversion)
- //TODO: Deprecate in glibmm 2.72.
_WRAP_METHOD(void set_validation_flags(TlsCertificateFlags flags), g_tls_client_connection_set_validation_flags,
- ignore_deprecations)
- // deprecated "Do not attempt to ignore validation errors.")
+ deprecated "Do not attempt to ignore validation errors.")
_WRAP_METHOD(TlsCertificateFlags get_validation_flags() const, g_tls_client_connection_get_validation_flags,
- ignore_deprecations)
- // deprecated "Do not attempt to ignore validation errors.")
+ deprecated "Do not attempt to ignore validation errors.")
_IGNORE(g_tls_client_connection_set_use_ssl3, g_tls_client_connection_get_use_ssl3) dnl// deprecated
@@ -83,10 +80,8 @@ public:
// specialization is added. Workaround: Use get_accepted_cas().
//_WRAP_PROPERTY("accepted-cas", std::vector<Glib::RefPtr<Glib::ByteArray>>)
_WRAP_PROPERTY("server-identity", Glib::RefPtr<SocketConnectable>)
- //TODO: Deprecate in glibmm 2.72.
- _WRAP_PROPERTY("validation-flags", TlsCertificateFlags)
- //_WRAP_PROPERTY("validation-flags", TlsCertificateFlags,
- // deprecated "Do not attempt to ignore validation errors.")
+ _WRAP_PROPERTY("validation-flags", TlsCertificateFlags,
+ deprecated "Do not attempt to ignore validation errors.")
_IGNORE_PROPERTY(use-ssl3) dnl// deprecated
};
diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc
index 038b4711..b46a615c 100644
--- a/glib/glibmm/main.cc
+++ b/glib/glibmm/main.cc
@@ -546,6 +546,14 @@ MainContext::create()
// static
Glib::RefPtr<MainContext>
+MainContext::create(MainContextFlags flags)
+{
+ return Glib::make_refptr_for_instance<MainContext>(
+ reinterpret_cast<MainContext*>(g_main_context_new_with_flags(static_cast<GMainContextFlags>(flags))));
+}
+
+// static
+Glib::RefPtr<MainContext>
MainContext::get_default()
{
return Glib::wrap(g_main_context_default(), true);
diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h
index 5e57c5ba..ecdfb9a7 100644
--- a/glib/glibmm/main.h
+++ b/glib/glibmm/main.h
@@ -20,6 +20,7 @@
#include <glibmm/refptr.h>
#include <glibmm/priorities.h>
#include <glibmm/iochannel.h>
+#include <glibmm/enums.h>
#include <sigc++/sigc++.h>
#include <vector>
#include <cstddef>
@@ -389,10 +390,20 @@ public:
MainContext(const MainContext& other) = delete;
MainContext& operator=(const MainContext& other) = delete;
- /** Creates a new MainContext.
- * @return The new MainContext.
+ /** Creates a new %MainContext.
+ * @return The new %MainContext.
*/
static Glib::RefPtr<MainContext> create();
+ /** Creates a new %MainContext.
+ *
+ * @param flags A bitwise-OR combination of MainContextFlags flags that
+ * can only be set at creation time.
+ * @return The new %MainContext.
+ *
+ * @newin{2,72}
+ */
+ static Glib::RefPtr<MainContext> create(MainContextFlags flags);
+
/** Returns the global default main context.
* This is the main context used for main loop functions when a main loop
* is not explicitly specified, and corresponds to the "main" main loop.
diff --git a/glib/src/enums.hg b/glib/src/enums.hg
index 49cfb125..4c75a3a1 100644
--- a/glib/src/enums.hg
+++ b/glib/src/enums.hg
@@ -20,6 +20,7 @@ _DEFS(glibmm,glib)
namespace Glib
{
+_WRAP_ENUM(MainContextFlags, GMainContextFlags, NO_GTYPE, decl_prefix GLIBMM_API)
_WRAP_ENUM(ParamFlags, GParamFlags, NO_GTYPE, decl_prefix GLIBMM_API)
} //namespace Glib
diff --git a/meson.build b/meson.build
index 202b1949..90181351 100644
--- a/meson.build
+++ b/meson.build
@@ -101,7 +101,7 @@ install_pkgconfigdir = install_libdir / 'pkgconfig'
# Dependencies when using the <pkg>mm library.
sigcxx_req = '>= 3.0.0'
-glib_req = '>= 2.69.1'
+glib_req = '>= 2.71.2'
# There are pkg-config files for sigc++ and glib on MSVC, so just use that.
sigcxx_dep = dependency('sigc++-3.0', version: sigcxx_req)