[glibmm] Replace remaining uses of Glib::ListHandle<> with std::vector.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Replace remaining uses of Glib::ListHandle<> with std::vector.
- Date: Mon, 20 Mar 2017 08:52:42 +0000 (UTC)
commit d8a702a891ef69a9ae8adb7db87aaada5f406c12
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Mar 17 12:45:08 2017 +0100
Replace remaining uses of Glib::ListHandle<> with std::vector.
Using Glib::ListHandler<>::list_to_array() and
Glib::ListHandler<>::list_to_vector() instead, and only in the
implementation instead of in the API.
gio/giomm/contenttype.cc | 4 ++--
gio/giomm/contenttype.h | 3 +--
gio/src/appinfo.ccg | 1 -
gio/src/appinfo.hg | 15 ++++++---------
gio/src/applaunchcontext.hg | 7 +++----
gio/src/drive.hg | 5 ++---
gio/src/emblemedicon.hg | 9 ++++-----
gio/src/fileenumerator.hg | 5 ++---
gio/src/volumemonitor.hg | 12 ++++++------
glib/glibmm.h | 2 --
glib/glibmm/filelist.am | 2 --
tools/m4/convert_gio.m4 | 2 +-
12 files changed, 27 insertions(+), 40 deletions(-)
---
diff --git a/gio/giomm/contenttype.cc b/gio/giomm/contenttype.cc
index 9f93a87..816f5b9 100644
--- a/gio/giomm/contenttype.cc
+++ b/gio/giomm/contenttype.cc
@@ -127,10 +127,10 @@ content_type_guess_for_tree(const Glib::RefPtr<const File>& root)
g_content_type_guess_for_tree(const_cast<GFile*>(root->gobj())), Glib::OWNERSHIP_DEEP);
}
-Glib::ListHandle<Glib::ustring>
+std::vector<Glib::ustring>
content_types_get_registered()
{
- return Glib::ListHandle<Glib::ustring>(g_content_types_get_registered(), Glib::OWNERSHIP_DEEP);
+ return Glib::ListHandler<Glib::ustring>::list_to_vector(g_content_types_get_registered(),
Glib::OWNERSHIP_DEEP);
}
} // namespace Gio
diff --git a/gio/giomm/contenttype.h b/gio/giomm/contenttype.h
index 284a786..c9516a6 100644
--- a/gio/giomm/contenttype.h
+++ b/gio/giomm/contenttype.h
@@ -20,7 +20,6 @@
#define _GIOMM_CONTENTTYPE_H
#include <glibmm/ustring.h>
-#include <glibmm/listhandle.h>
#include <giomm/icon.h>
#include <giomm/file.h>
#include <string>
@@ -180,7 +179,7 @@ std::vector<Glib::ustring> content_type_guess_for_tree(const Glib::RefPtr<const
*
* @return List of the registered content types.
*/
-Glib::ListHandle<Glib::ustring> content_types_get_registered();
+std::vector<Glib::ustring> content_types_get_registered();
/** @} group giommContentType */
diff --git a/gio/src/appinfo.ccg b/gio/src/appinfo.ccg
index 8e740ce..8685638 100644
--- a/gio/src/appinfo.ccg
+++ b/gio/src/appinfo.ccg
@@ -18,7 +18,6 @@
*/
#include <giomm/file.h>
-#include <glibmm/listhandle.h>
#include <glibmm/vectorutils.h>
#include "slot_async.h"
#include <gio/gio.h>
diff --git a/gio/src/appinfo.hg b/gio/src/appinfo.hg
index b24aee9..87af9e8 100644
--- a/gio/src/appinfo.hg
+++ b/gio/src/appinfo.hg
@@ -26,7 +26,6 @@ _CONFIGINCLUDE(giommconfig.h)
#include <string>
#include <glibmm/interface.h>
-#include <glibmm/listhandle.h>
#include <glibmm/object.h>
//#include <giomm/file.h>
#include <giomm/icon.h>
@@ -155,10 +154,10 @@ public:
_WRAP_METHOD(bool supports_uris() const, g_app_info_supports_uris)
_WRAP_METHOD(bool supports_files() const, g_app_info_supports_files)
-#m4 _CONVERSION(`const Glib::ListHandle<std::string>&',`GList*',`$3.data()')
+ #m4 _CONVERSION(`const
std::vector<std::string>&',`GList*',`Glib::ListHandler<std::string>::vector_to_list($3).data()')
//TODO: I think we use Glib::ustring elsewhere for URIs:
- _WRAP_METHOD(bool launch_uris(const Glib::ListHandle<std::string>& uris,
+ _WRAP_METHOD(bool launch_uris(const std::vector<std::string>& uris,
const Glib::RefPtr<AppLaunchContext>& launch_context{?}),
g_app_info_launch_uris,
errthrow)
@@ -209,10 +208,10 @@ public:
_WRAP_METHOD(bool set_as_last_used_for_type(const std::string& content_type),
g_app_info_set_as_last_used_for_type, errthrow)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle<Glib::RefPtr<AppInfo> >',`Glib::ListHandle<Glib::RefPtr<AppInfo>
($3, Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(static Glib::ListHandle<Glib::RefPtr<AppInfo> > get_all(), g_app_info_get_all)
+#m4
_CONVERSION(`GList*',`std::vector<Glib::RefPtr<AppInfo>>',`Glib::ListHandler<Glib::RefPtr<AppInfo>>::list_to_vector($3,
Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(static std::vector<Glib::RefPtr<AppInfo>> get_all(), g_app_info_get_all)
- _WRAP_METHOD(static Glib::ListHandle<Glib::RefPtr<AppInfo> > get_all_for_type(const std::string&
content_type), g_app_info_get_all_for_type)
+ _WRAP_METHOD(static std::vector<Glib::RefPtr<AppInfo>> get_all_for_type(const std::string& content_type),
g_app_info_get_all_for_type)
_WRAP_METHOD(static Glib::RefPtr<AppInfo> get_default_for_type(const std::string& content_type, bool
must_support_uris = true), g_app_info_get_default_for_type)
_WRAP_METHOD(static Glib::RefPtr<AppInfo> get_default_for_uri_scheme(const std::string& uri_scheme),
g_app_info_get_default_for_uri_scheme)
_WRAP_METHOD(static void reset_type_associations(const std::string& content_type),
g_app_info_reset_type_associations)
@@ -231,12 +230,10 @@ protected:
//_WRAP_VFUNC(std::string get_description() const, "get_description")
//_WRAP_VFUNC(std::string get_executable() const, "get_executable")
//_WRAP_VFUNC(Glib::RefPtr<Icon> get_icon() const, "get_icon")
-//#m4 _CONVERSION(`const Glib::ListHandle<std::string>&',`GList*',`$3.data()')
-//#m4 _CONVERSION(`GList*',`const Glib::ListHandle<std::string>&',`Glib::ListHandle<std::string>($3,
Glib::OWNERSHIP_NONE)')
//_WRAP_VFUNC(bool launch(const std::vector<Gio::File>& filenames, const Glib::RefPtr<AppLaunchContext>&
launch_context, GError** error), "launch")
//_WRAP_VFUNC(bool supports_uris() const, "supports_uris")
//_WRAP_VFUNC(bool supports_files() const, "supports_files")
- //_WRAP_VFUNC(bool launch_uris(const Glib::ListHandle<std::string>& uris, const
Glib::RefPtr<AppLaunchContext>& launch_context, GError** error), "launch_uris")
+ //_WRAP_VFUNC(bool launch_uris(const std::vector<std::string>& uris, const Glib::RefPtr<AppLaunchContext>&
launch_context, GError** error), "launch_uris")
//_WRAP_VFUNC(bool should_show() const, "should_show")
//_WRAP_VFUNC(bool set_as_default_for_type(const std::string& content_type, GError** error),
"set_as_default_for_type")
//_WRAP_VFUNC(bool set_as_default_for_extension(const std::string& extension, GError** error),
"set_as_default_for_extension")
diff --git a/gio/src/applaunchcontext.hg b/gio/src/applaunchcontext.hg
index 1254977..cd75aed 100644
--- a/gio/src/applaunchcontext.hg
+++ b/gio/src/applaunchcontext.hg
@@ -20,7 +20,6 @@
#include <string>
#include <glibmm/interface.h>
-#include <glibmm/listhandle.h>
#include <glibmm/object.h>
//#include <giomm/file.h>
#include <giomm/icon.h>
@@ -55,11 +54,11 @@ public:
#m4
_CONVERSION(`char**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3,
Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(std::vector<Glib::ustring> get_environment() const, g_app_launch_context_get_environment)
-#m4 _CONVERSION(`const Glib::ListHandle<std::string>&',`GList*',`$3.data()')
- _WRAP_METHOD(std::string get_display(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle<
Glib::RefPtr<Gio::File> >& files),
+#m4 _CONVERSION(`const
std::vector<std::string>&',`GList*',`Glib::ListHandler<std::string>::vector_to_list$3.data()')
+ _WRAP_METHOD(std::string get_display(const Glib::RefPtr<AppInfo>& info, const
std::vector<Glib::RefPtr<Gio::File>>& files),
g_app_launch_context_get_display)
- _WRAP_METHOD(std::string get_startup_notify_id(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle<
Glib::RefPtr<Gio::File> >& files),
+ _WRAP_METHOD(std::string get_startup_notify_id(const Glib::RefPtr<AppInfo>& info, const
std::vector<Glib::RefPtr<Gio::File>>& files),
g_app_launch_context_get_startup_notify_id)
_WRAP_METHOD(void launch_failed(const std::string& startup_notify_id),
g_app_launch_context_launch_failed)
diff --git a/gio/src/drive.hg b/gio/src/drive.hg
index 1b5103d..8250459 100644
--- a/gio/src/drive.hg
+++ b/gio/src/drive.hg
@@ -15,7 +15,6 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/listhandle.h>
#include <giomm/mount.h>
#include <giomm/icon.h>
//#include <giomm/volume.h>
@@ -62,8 +61,8 @@ public:
_WRAP_METHOD(bool has_volumes() const, g_drive_has_volumes)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Volume> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Volume> > get_volumes(), g_drive_get_volumes)
+#m4
_CONVERSION(`GList*',`std::vector<Glib::RefPtr<Volume>>',`Glib::ListHandler<Glib::RefPtr<Volume>>::list_to_vector($3,
Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<Glib::RefPtr<Volume>> get_volumes(), g_drive_get_volumes)
_WRAP_METHOD(bool is_media_removable() const, g_drive_is_media_removable)
_WRAP_METHOD(bool is_removable() const, g_drive_is_removable)
diff --git a/gio/src/emblemedicon.hg b/gio/src/emblemedicon.hg
index 6b22147..8ccd5ad 100644
--- a/gio/src/emblemedicon.hg
+++ b/gio/src/emblemedicon.hg
@@ -17,7 +17,6 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/listhandle.h>
#include <glibmm/object.h>
#include <giomm/icon.h>
#include <giomm/emblem.h>
@@ -81,11 +80,11 @@ public:
_WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_emblemed_icon_get_icon)
_WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const, g_emblemed_icon_get_icon, constversion)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle<Glib::RefPtr<Emblem> >',`$2($3, Glib::OWNERSHIP_NONE)')
- _WRAP_METHOD(Glib::ListHandle<Glib::RefPtr<Emblem> > get_emblems(), g_emblemed_icon_get_emblems)
+#m4
_CONVERSION(`GList*',`std::vector<Glib::RefPtr<Emblem>>',`Glib::ListHandler<Glib::RefPtr<Emblem>>::list_to_vector($3,
Glib::OWNERSHIP_NONE)')
+ _WRAP_METHOD(std::vector<Glib::RefPtr<Emblem>> get_emblems(), g_emblemed_icon_get_emblems)
-//TODO: #m4 _CONVERSION(`GList*',`Glib::ListHandle<Glib::RefPtr<const Emblem> >',`$2($3,
Glib::OWNERSHIP_NONE)')
-// _WRAP_METHOD(Glib::ListHandle<Glib::RefPtr<const Emblem> > get_emblems() const,
g_emblemed_icon_get_emblems, constversion)
+//TODO: #m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<const Emblem>>',`$2($3, Glib::OWNERSHIP_NONE)')
+// _WRAP_METHOD(std::vector<Glib::RefPtr<const Emblem>> get_emblems() const, g_emblemed_icon_get_emblems,
constversion)
_WRAP_METHOD(void add_emblem(const Glib::RefPtr<Emblem>& emblem), g_emblemed_icon_add_emblem)
_WRAP_METHOD(void clear_emblems(), g_emblemed_icon_clear_emblems)
diff --git a/gio/src/fileenumerator.hg b/gio/src/fileenumerator.hg
index 1c0f790..ace27e5 100644
--- a/gio/src/fileenumerator.hg
+++ b/gio/src/fileenumerator.hg
@@ -18,7 +18,6 @@
*/
#include <glibmm/object.h>
-#include <glibmm/listhandle.h>
#include <glibmm/priorities.h>
#include <giomm/asyncresult.h>
#include <giomm/cancellable.h>
@@ -98,8 +97,8 @@ public:
void next_files_async(const SlotAsyncReady& slot, int num_files = 1, int io_priority =
Glib::PRIORITY_DEFAULT);
_IGNORE(g_file_enumerator_next_files_async)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<FileInfo> >', `$2(($3), Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<FileInfo> > next_files_finish(const Glib::RefPtr<AsyncResult>&
result),
+#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<FileInfo>>',
`Glib::ListHandler<Glib::RefPtr<FileInfo>>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Glib::RefPtr<FileInfo>> next_files_finish(const Glib::RefPtr<AsyncResult>&
result),
g_file_enumerator_next_files_finish,
errthrow)
diff --git a/gio/src/volumemonitor.hg b/gio/src/volumemonitor.hg
index b55fc7d..6eb5c65 100644
--- a/gio/src/volumemonitor.hg
+++ b/gio/src/volumemonitor.hg
@@ -43,14 +43,14 @@ public:
_WRAP_METHOD(static Glib::RefPtr<VolumeMonitor> get(), g_volume_monitor_get)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Drive> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Drive> > get_connected_drives(),
g_volume_monitor_get_connected_drives)
+#m4
_CONVERSION(`GList*',`std::vector<Glib::RefPtr<Drive>>',`Glib::ListHandler<Glib::RefPtr<Drive>>::list_to_vector($3,
Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<Glib::RefPtr<Drive>> get_connected_drives(),
g_volume_monitor_get_connected_drives)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Volume> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Volume> > get_volumes(), g_volume_monitor_get_volumes)
+#m4
_CONVERSION(`GList*',`std::vector<Glib::RefPtr<Volume>>',`Glib::ListHandler<Glib::RefPtr<Volume>>::list_to_vector($3,
Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<Glib::RefPtr<Volume>> get_volumes(), g_volume_monitor_get_volumes)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Mount> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Mount> > get_mounts(), g_volume_monitor_get_mounts)
+#m4
_CONVERSION(`GList*',`std::vector<Glib::RefPtr<Mount>>',`Glib::ListHandler<Glib::RefPtr<Mount>>::list_to_vector($3,
Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<Glib::RefPtr<Mount>> get_mounts(), g_volume_monitor_get_mounts)
_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)
diff --git a/glib/glibmm.h b/glib/glibmm.h
index f6226d6..99c93d9 100644
--- a/glib/glibmm.h
+++ b/glib/glibmm.h
@@ -109,7 +109,6 @@
#include <glibmm/iochannel.h>
#include <glibmm/init.h>
#include <glibmm/keyfile.h>
-#include <glibmm/listhandle.h>
#include <glibmm/main.h>
#include <glibmm/markup.h>
#include <glibmm/miscutils.h>
@@ -129,7 +128,6 @@
#include <glibmm/shell.h>
#include <glibmm/signalproxy_connectionnode.h>
#include <glibmm/signalproxy.h>
-#include <glibmm/slisthandle.h>
#include <glibmm/spawn.h>
#include <glibmm/stringutils.h>
#include <glibmm/timer.h>
diff --git a/glib/glibmm/filelist.am b/glib/glibmm/filelist.am
index 5cdfec4..1154feb 100644
--- a/glib/glibmm/filelist.am
+++ b/glib/glibmm/filelist.am
@@ -53,7 +53,6 @@ glibmm_files_extra_h = \
i18n.h \
init.h \
interface.h \
- listhandle.h \
main.h \
object.h \
objectbase.h \
@@ -67,7 +66,6 @@ glibmm_files_extra_h = \
refptr.h \
signalproxy.h \
signalproxy_connectionnode.h \
- slisthandle.h \
stringutils.h \
timer.h \
timeval.h \
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 7db1718..d2b32fa 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -69,7 +69,7 @@ _CONVERSION(`GAppLaunchContext*',`const Glib::RefPtr<AppLaunchContext>&',Glib::w
_CONVERSION(`const Glib::RefPtr<AppInfo>&',`GAppInfo*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`Glib::RefPtr<AppInfo>',`GAppInfo*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GAppInfo*',`const Glib::RefPtr<AppInfo>&',`Glib::wrap($3)')
-_CONVERSION(`const Glib::ListHandle< Glib::RefPtr<Gio::File> >&',`GList*',`$3.data()')
+_CONVERSION(`const
std::vector<Glib::RefPtr<Gio::File>>&',`GList*',`Glib::ListHandler<Glib::RefPtr<Gio::File>>::vector_to_list($3).data()')
# Application
_CONVERSION(`GApplication*',`Glib::RefPtr<Application>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]