[glibmm] Deprecate API which is deprecated in glib
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Deprecate API which is deprecated in glib
- Date: Fri, 13 Jun 2014 14:39:51 +0000 (UTC)
commit a463062b533fe3ac0c86858832fe87d8662d5ea6
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Fri Jun 13 16:32:09 2014 +0200
Deprecate API which is deprecated in glib
* gio/src/application.hg: Deprecate set_action_group().
* gio/src/desktopappinfo.hg: Deprecate set_desktop_env().
* gio/src/settings.[hg|ccg]: Deprecate list_schemas(), range_check() and
property_schema().
* gio/src/simpleactiongroup.hg: Define GLIB_DISABLE_DEPRECATION_WARNINGS
in the .cc file.
* gio/src/tlsconnection.hg: Deprecate [set|get]_use_system_certdb()
and property_use_system_certdb().
* gio/src/volumemonitor.hg: Deprecate adopt_orphan_mount() also in
the .cc file.
* glib/glibmm/filelist.am: Build only the glibmm_files_used.
* glib/src/filelist.am: Add glibmm_files_deprecated_hg. Move thread.hg
and valuearray.hg to it.
* glib/src/keyfile.hg: Deprecate one of the load_from_dirs() methods
also in the .cc file.
* glib/src/valuearray.hg: Deprecate the whole class Glib::ValueArray.
* tests/glibmm_valuearray/main.cc: Undefine GLIBMM_DISABLE_DEPRECATED.
gio/src/application.hg | 14 +++++++++-----
gio/src/desktopappinfo.hg | 10 +++++++++-
gio/src/settings.ccg | 2 ++
gio/src/settings.hg | 17 ++++++++++++++---
gio/src/simpleactiongroup.hg | 11 ++++++++---
gio/src/tlsconnection.hg | 15 ++++++++++++---
gio/src/volumemonitor.hg | 9 ++++-----
glib/glibmm/filelist.am | 4 ++--
glib/src/filelist.am | 17 +++++++++++++----
glib/src/keyfile.hg | 7 ++-----
glib/src/valuearray.hg | 7 +++++++
tests/glibmm_valuearray/main.cc | 16 ++++++++++++++++
12 files changed, 98 insertions(+), 31 deletions(-)
---
diff --git a/gio/src/application.hg b/gio/src/application.hg
index 9640c10..48613dc 100644
--- a/gio/src/application.hg
+++ b/gio/src/application.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
#undef G_DISABLE_DEPRECATED
#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
@@ -70,10 +72,11 @@ _WRAP_ENUM(ApplicationFlags, GApplicationFlags, NO_GTYPE)
* changed using hold() and release(). If it drops to zero, the application
* exits.
*
- * Application also implements the ActionGroup interface and lets you easily
- * export actions by adding them with set_action_group(). When
- * invoking an action by calling Gio::ActionGroup::activate_action() on the
- * application, it is always invoked in the primary instance.
+ * Application also implements the ActionGroup and ActionMap
+ * interfaces and lets you easily export actions by adding them with
+ * Gio::ActionMap::add_action(). When invoking an action by calling
+ * Gio::ActionGroup::activate_action() on the application, it is always
+ * invoked in the primary instance.
*
* There is a number of different entry points into an Application:
*
@@ -159,7 +162,8 @@ public:
_WRAP_METHOD(ApplicationFlags get_flags() const, g_application_get_flags)
_WRAP_METHOD(void set_flags(ApplicationFlags flags), g_application_set_flags)
- _WRAP_METHOD(void set_action_group(const Glib::RefPtr<ActionGroup>& action_group),
g_application_set_action_group)
+ _WRAP_METHOD(void set_action_group(const Glib::RefPtr<ActionGroup>& action_group),
g_application_set_action_group,
+ deprecated "Use the Gio::ActionMap interface instead.")
//Note: We would like to add a group, not just some entries,
//so we can do pre and post parsing. See https://bugzilla.gnome.org/show_bug.cgi?id=727602
diff --git a/gio/src/desktopappinfo.hg b/gio/src/desktopappinfo.hg
index 3392b0c..916830e 100644
--- a/gio/src/desktopappinfo.hg
+++ b/gio/src/desktopappinfo.hg
@@ -17,12 +17,19 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <glibmm/object.h>
#include <giomm/appinfo.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef G_DISABLE_DEPRECATED
+#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
+
namespace Glib
{
@@ -55,7 +62,8 @@ public:
_WRAP_METHOD(std::string get_filename() const, g_desktop_app_info_get_filename)
_WRAP_METHOD(bool is_hidden() const, g_desktop_app_info_get_is_hidden)
- _WRAP_METHOD(static void set_desktop_env(const std::string& desktop_env),
g_desktop_app_info_set_desktop_env)
+ _WRAP_METHOD(static void set_desktop_env(const std::string& desktop_env),
g_desktop_app_info_set_desktop_env,
+ deprecated "Do not use this API. Since 2.42 the value of the `XDG_CURRENT_DESKTOP` environment variable
will be used.")
#m4 _CONVERSION(`const char* const*', `std::vector<Glib::ustring>',
`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, Glib::OWNERSHIP_NONE)')
_WRAP_METHOD(std::vector<Glib::ustring> get_keywords() const, g_desktop_app_info_get_keywords)
diff --git a/gio/src/settings.ccg b/gio/src/settings.ccg
index ca92f15..d800aa9 100644
--- a/gio/src/settings.ccg
+++ b/gio/src/settings.ccg
@@ -63,9 +63,11 @@ void Settings::bind_writable(const Glib::ustring& key,
bind_writable(key, property_proxy.get_object(), property_proxy.get_name(), inverted);
}
+_DEPRECATE_IFDEF_START
std::vector<Glib::ustring> Settings::list_schemas()
{
return Glib::ArrayHandler<Glib::ustring>::array_to_vector(g_settings_list_schemas(), Glib::OWNERSHIP_NONE);
}
+_DEPRECATE_IFDEF_END
}
diff --git a/gio/src/settings.hg b/gio/src/settings.hg
index 4e45cee..75407d5 100644
--- a/gio/src/settings.hg
+++ b/gio/src/settings.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <glibmm/arrayhandle.h>
#include <glibmm/object.h>
#include <glibmm/variant.h>
@@ -23,6 +25,11 @@
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef G_DISABLE_DEPRECATED
+#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
+
namespace Gio
{
@@ -164,19 +171,23 @@ public:
_WRAP_METHOD(void reset(const Glib::ustring& key), g_settings_reset)
+_DEPRECATE_IFDEF_START
//We must hand-code this because gmmproc is confused by the static keyword with the vector.
//#m4 _CONVERSION(`const
gchar*const*',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3,
Glib::OWNERSHIP_NONE)')
_WRAP_METHOD_DOCS_ONLY(g_settings_list_schemas)
static std::vector<Glib::ustring> list_schemas();
_IGNORE(g_settings_list_schemas)
+_DEPRECATE_IFDEF_END
#m4
_CONVERSION(`gchar**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3,
Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(std::vector<Glib::ustring> list_children() const, g_settings_list_children)
_WRAP_METHOD(std::vector<Glib::ustring> list_keys() const, g_settings_list_keys)
- //TODO: Choose an appropriate Variant template type: GVariant* g_settings_get_range(const gchar* key)
+ _IGNORE(g_settings_get_range, g_settings_list_relocatable_schemas) // deprecated
- _WRAP_METHOD(bool range_check(const Glib::ustring& key, const Glib::VariantBase& value) const,
g_settings_range_check)
+ _WRAP_METHOD(bool range_check(const Glib::ustring& key, const Glib::VariantBase& value) const,
g_settings_range_check,
+ deprecated "Use g_settings_schema_key_range_check() instead.")
+ //TODO: Wrap GSettingsSchema
#m4 _CONVERSION(`Glib::ObjectBase*',`gpointer',(gpointer)$3->gobj())
_WRAP_METHOD(void bind(const Glib::ustring& key, Glib::ObjectBase* object, const Glib::ustring& property,
SettingsBindFlags flags=SETTINGS_BIND_DEFAULT), g_settings_bind)
@@ -193,7 +204,7 @@ public:
_WRAP_PROPERTY("delay-apply", bool)
_WRAP_PROPERTY("has-unapplied", bool)
_WRAP_PROPERTY("path", std::string)
- _WRAP_PROPERTY("schema", Glib::ustring)
+ _WRAP_PROPERTY("schema", Glib::ustring, deprecated "Use the 'schema-id' property instead. In a future
version, this property may instead refer to a SettingsSchema.")
_WRAP_PROPERTY("schema-id", Glib::ustring)
//TODO: _WRAP_PROPERTY("settings-schema", Glib::RefPtr<SettingsSchema>)
diff --git a/gio/src/simpleactiongroup.hg b/gio/src/simpleactiongroup.hg
index 9055877..138e4fe 100644
--- a/gio/src/simpleactiongroup.hg
+++ b/gio/src/simpleactiongroup.hg
@@ -15,12 +15,19 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <giomm/actionmap.h>
#include <giomm/actiongroup.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef G_DISABLE_DEPRECATED
+#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
+
namespace Gio
{
@@ -53,9 +60,7 @@ public:
_WRAP_METHOD(void insert(const Glib::RefPtr<Action>& action), g_simple_action_group_insert, deprecated
"Use ActionMap::add_action() instead")
_WRAP_METHOD(void remove(const Glib::ustring& action_name), g_simple_action_group_remove, deprecated "Use
ActionMap::remove_action() instead")
- //We ignore g_simple_action_group_add_entries() because it does nothing but call
g_action_map_add_action_entries(),
- //which is already in the base class.
- _IGNORE(g_simple_action_group_add_entries)
+ _IGNORE(g_simple_action_group_add_entries) // deprecated
};
} // namespace Gio
diff --git a/gio/src/tlsconnection.hg b/gio/src/tlsconnection.hg
index 69ff724..bc753d3 100644
--- a/gio/src/tlsconnection.hg
+++ b/gio/src/tlsconnection.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <giomm/iostream.h>
#include <giomm/tlscertificate.h>
#include <giomm/asyncresult.h>
@@ -22,6 +24,11 @@
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/iostream_p.h)
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef G_DISABLE_DEPRECATED
+#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
+
namespace Gio
{
@@ -62,8 +69,10 @@ public:
_WRAP_METHOD(void set_rehandshake_mode(TlsRehandshakeMode mode), g_tls_connection_set_rehandshake_mode)
_WRAP_METHOD(TlsRehandshakeMode get_rehandshake_mode() const, g_tls_connection_get_rehandshake_mode)
- _WRAP_METHOD(void set_use_system_certdb(bool use_system_certdb = true),
g_tls_connection_set_use_system_certdb)
- _WRAP_METHOD(bool get_use_system_certdb() const, g_tls_connection_get_use_system_certdb)
+ _WRAP_METHOD(void set_use_system_certdb(bool use_system_certdb = true),
g_tls_connection_set_use_system_certdb,
+ deprecated "Use set_database() instead.")
+ _WRAP_METHOD(bool get_use_system_certdb() const, g_tls_connection_get_use_system_certdb,
+ deprecated "Use get_database() instead.")
_WRAP_METHOD(Glib::RefPtr<TlsDatabase> get_database(), g_tls_connection_get_database)
_WRAP_METHOD(Glib::RefPtr<const TlsDatabase> get_database() const, g_tls_connection_get_database,
constversion)
@@ -90,7 +99,7 @@ public:
_WRAP_PROPERTY("peer-certificate-errors", TlsCertificateFlags)
_WRAP_PROPERTY("rehandshake-mode", TlsRehandshakeMode)
_WRAP_PROPERTY("require-close-notify", bool)
- _WRAP_PROPERTY("use-system-certdb", bool)
+ _WRAP_PROPERTY("use-system-certdb", bool, deprecated "Use property_database() instead.")
#m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr<const TlsCertificate>&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(bool accept_certificate(const Glib::RefPtr<const TlsCertificate>& peer_cert,
TlsCertificateFlags errors), "accept_certificate")
diff --git a/gio/src/volumemonitor.hg b/gio/src/volumemonitor.hg
index 6e7cc1a..5a5fcf9 100644
--- a/gio/src/volumemonitor.hg
+++ b/gio/src/volumemonitor.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
#undef G_DISABLE_DEPRECATED
#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
@@ -60,11 +62,8 @@ public:
_WRAP_METHOD(Glib::RefPtr<Volume> get_volume_for_uuid(const std::string& uuid),
g_volume_monitor_get_volume_for_uuid, refreturn)
_WRAP_METHOD(Glib::RefPtr<Mount> get_mount_for_uuid(const std::string& uuid),
g_volume_monitor_get_mount_for_uuid, refreturn)
-_DEPRECATE_IFDEF_START
-
- _WRAP_METHOD(static Glib::RefPtr<Volume> adopt_orphan_mount(const Glib::RefPtr<Mount>& mount),
g_volume_monitor_adopt_orphan_mount)
-
-_DEPRECATE_IFDEF_END
+ _WRAP_METHOD(static Glib::RefPtr<Volume> adopt_orphan_mount(const Glib::RefPtr<Mount>& mount),
g_volume_monitor_adopt_orphan_mount,
+ deprecated "Instead of using this function, create shadow mounts with the URI of the mount you intend to
adopt.")
#m4 _CONVERSION(`GVolume*',`const Glib::RefPtr<Volume>&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(void volume_added(const Glib::RefPtr<Volume>& volume), volume_added)
diff --git a/glib/glibmm/filelist.am b/glib/glibmm/filelist.am
index dcc3294..97170ce 100644
--- a/glib/glibmm/filelist.am
+++ b/glib/glibmm/filelist.am
@@ -1,7 +1,7 @@
## This file is part of glibmm.
-glibmm_files_built_cc = $(glibmm_files_hg:.hg=.cc) $(glibmm_files_cc_m4:.m4=) wrap_init.cc
-glibmm_files_built_h = $(glibmm_files_hg:.hg=.h) $(glibmm_files_h_m4:.m4=)
+glibmm_files_built_cc = $(glibmm_files_used_hg:.hg=.cc) $(glibmm_files_cc_m4:.m4=) wrap_init.cc
+glibmm_files_built_h = $(glibmm_files_used_hg:.hg=.h) $(glibmm_files_h_m4:.m4=)
glibmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(glibmm_files_hg))
glibmm_files_extra_cc = \
diff --git a/glib/src/filelist.am b/glib/src/filelist.am
index 8db8500..d240146 100644
--- a/glib/src/filelist.am
+++ b/glib/src/filelist.am
@@ -14,8 +14,7 @@ glibmm_files_defs = \
glib_docs.xml \
glib_docs_override.xml
-# Note that all of thread.hg is deprecated
-glibmm_files_hg = \
+glibmm_files_any_hg = \
balancedtree.hg \
bytes.hg \
bytearray.hg \
@@ -35,17 +34,27 @@ glibmm_files_hg = \
regex.hg \
shell.hg \
spawn.hg \
- thread.hg \
threads.hg \
timezone.hg \
unicode.hg \
uriutils.hg \
- valuearray.hg \
variant.hg \
variantdict.hg \
variantiter.hg \
varianttype.hg
+glibmm_files_deprecated_hg = \
+ thread.hg \
+ valuearray.hg
+
+if DISABLE_DEPRECATED_API
+glibmm_files_used_hg = $(glibmm_files_any_hg)
+else
+glibmm_files_used_hg = $(glibmm_files_any_hg) $(glibmm_files_deprecated_hg)
+endif
+
+glibmm_files_hg = $(glibmm_files_any_hg) $(glibmm_files_deprecated_hg)
+
glibmm_files_ccg = $(glibmm_files_hg:.hg=.ccg)
glibmm_files_cc_m4 = value_basictypes.cc.m4 variant_basictypes.cc.m4
diff --git a/glib/src/keyfile.hg b/glib/src/keyfile.hg
index b1560e9..5f7c199 100644
--- a/glib/src/keyfile.hg
+++ b/glib/src/keyfile.hg
@@ -136,11 +136,8 @@ public:
#m4 _CONVERSION(`const Glib::ArrayHandle<std::string>&', `const gchar**', `const_cast<const
gchar**>($3.data())')
#m4 _CONVERSION(`Glib::ArrayHandle<std::string>&', `gchar**', `const_cast<gchar**>($3.data())')
-_DEPRECATE_IFDEF_START
-
- _WRAP_METHOD(bool load_from_dirs(const std::string& file, const Glib::ArrayHandle<std::string>&
search_dirs, Glib::ArrayHandle<std::string>& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE),
g_key_file_load_from_dirs, errthrow)
-
-_DEPRECATE_IFDEF_END
+ _WRAP_METHOD(bool load_from_dirs(const std::string& file, const Glib::ArrayHandle<std::string>&
search_dirs, Glib::ArrayHandle<std::string>& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE),
+ g_key_file_load_from_dirs, errthrow, deprecated "Use the load_from_dirs() method that takes a
std::string& full_path.")
_WRAP_METHOD_DOCS_ONLY(g_key_file_load_from_dirs)
bool load_from_dirs(const std::string& file, const Glib::ArrayHandle<std::string>& search_dirs,
std::string& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE);
diff --git a/glib/src/valuearray.hg b/glib/src/valuearray.hg
index fa3231a..518123f 100644
--- a/glib/src/valuearray.hg
+++ b/glib/src/valuearray.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(glibmmconfig.h)
+
_DEFS(glibmm,glib)
#include <glib-object.h>
@@ -26,6 +28,8 @@ _DEFS(glibmm,glib)
#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
#m4 _POP()
+_IS_DEPRECATED // This whole file is deprecated.
+
namespace Glib
{
@@ -35,6 +39,9 @@ namespace Glib
* elements.
*
* @newin{2,22}
+ *
+ * @deprecated Use std::vector<Glib::ValueBase*> or std::vector< Glib::Value<> >
+ * instead of Glib::ValueArray.
*/
class ValueArray
{
diff --git a/tests/glibmm_valuearray/main.cc b/tests/glibmm_valuearray/main.cc
index b3e3184..2139d43 100644
--- a/tests/glibmm_valuearray/main.cc
+++ b/tests/glibmm_valuearray/main.cc
@@ -1,6 +1,21 @@
+// Glib::ValueArray is deprecated, but let's keep the test.
+// The recommended replacement is std::vector<> which requires no test here.
+#undef GLIBMM_DISABLE_DEPRECATED
+
#include <glibmm.h>
#include <iostream>
+#ifdef GLIBMM_DISABLE_DEPRECATED
+int main(int, char**)
+{
+ // If glibmm is configured with --disable-deprecated-api, GLIBMM_DISABLE_DEPRECATED
+ // is defined in glibmm.h (actually in glibmmconfig.h). The undef at the start of
+ // this file has no effect.
+ return 77; // Tell automake's test harness to skip this test.
+}
+
+#else
+
//Use this line if you want debug output:
//std::ostream& ostr = std::cout;
@@ -84,3 +99,4 @@ int main(int, char**)
return EXIT_SUCCESS;
}
+#endif //GLIBMM_DISABLE_DEPRECATED
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]