[glibmm/glibmm-3maybe] Wrap and use the Glib::UserDirectory enum.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/glibmm-3maybe] Wrap and use the Glib::UserDirectory enum.
- Date: Tue, 8 Jun 2010 15:52:21 +0000 (UTC)
commit 23346763d07c0ea84c099eeb16d660aa46b84e8b
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Jun 8 17:50:43 2010 +0200
Wrap and use the Glib::UserDirectory enum.
* glib/src/enums.[hg|ccg]: Added this, as a place to put generated enums
to use in non-generated files.
* glib/glibmm/miscutils.[h|cc]: get_user_special_dir(): Change the
GUserDirectory parameter to a Glib::UserDirectory.
This fixes bug #581304 (David King)
ChangeLog | 10 ++++++++++
glib/glibmm/miscutils.cc | 4 ++--
glib/glibmm/miscutils.h | 5 +----
glib/src/enums.ccg | 18 ++++++++++++++++++
glib/src/enums.hg | 29 +++++++++++++++++++++++++++++
glib/src/filelist.am | 1 +
6 files changed, 61 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 35ff2cd..a4f9d4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2010-06-08 Murray Cumming <murrayc murrayc com>
+ Wrap and use the Glib::UserDirectory enum.
+
+ * glib/src/enums.[hg|ccg]: Added this, as a place to put generated enums
+ to use in non-generated files.
+ * glib/glibmm/miscutils.[h|cc]: get_user_special_dir(): Change the
+ GUserDirectory parameter to a Glib::UserDirectory.
+ This fixes bug #581304 (David King)
+
+2010-06-08 Murray Cumming <murrayc murrayc com>
+
KeyFile: Remove bool return from methods that throw on error anyway.
* glib/src/keyfile.[hg|ccg]: load_from_file(), load_from_data(),
diff --git a/glib/glibmm/miscutils.cc b/glib/glibmm/miscutils.cc
index 2da6ac9..7c9f1d7 100644
--- a/glib/glibmm/miscutils.cc
+++ b/glib/glibmm/miscutils.cc
@@ -106,9 +106,9 @@ std::string get_current_dir()
return convert_return_gchar_ptr_to_stdstring(g_get_current_dir());
}
-std::string get_user_special_dir(GUserDirectory directory)
+std::string get_user_special_dir(UserDirectory directory)
{
- return convert_const_gchar_ptr_to_stdstring(g_get_user_special_dir(directory));
+ return convert_const_gchar_ptr_to_stdstring(g_get_user_special_dir((GUserDirectory)directory));
}
std::string get_user_data_dir()
diff --git a/glib/glibmm/miscutils.h b/glib/glibmm/miscutils.h
index 8b1ad5d..d3e1015 100644
--- a/glib/glibmm/miscutils.h
+++ b/glib/glibmm/miscutils.h
@@ -168,9 +168,6 @@ std::string get_tmp_dir();
*/
std::string get_current_dir();
-//TODO: We could create a C++ enum to wrap the C GUserDirectory enum,
-//but we would have to either be very careful, or define the enum
-//values in terms of the C enums anyway.
/** Returns the full path of a special directory using its logical id.
*
* On Unix this is done using the XDG special user directories.
@@ -184,7 +181,7 @@ std::string get_current_dir();
*
* @newin{2,14}
*/
-std::string get_user_special_dir(GUserDirectory directory);
+std::string get_user_special_dir(UserDirectory directory);
/** Returns a base directory in which to access application data such as icons
* that is customized for a particular user.
diff --git a/glib/src/enums.ccg b/glib/src/enums.ccg
new file mode 100644
index 0000000..24ee9e8
--- /dev/null
+++ b/glib/src/enums.ccg
@@ -0,0 +1,18 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
diff --git a/glib/src/enums.hg b/glib/src/enums.hg
new file mode 100644
index 0000000..12e5d29
--- /dev/null
+++ b/glib/src/enums.hg
@@ -0,0 +1,29 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glib.h>
+
+_DEFS(glibmm,glib)
+
+namespace Glib
+{
+
+_WRAP_ENUM(UserDirectory, GUserDirectory, NO_GTYPE)
+
+} // namespace Glib
diff --git a/glib/src/filelist.am b/glib/src/filelist.am
index b391034..8d25bfc 100644
--- a/glib/src/filelist.am
+++ b/glib/src/filelist.am
@@ -17,6 +17,7 @@ glibmm_files_hg = \
checksum.hg \
convert.hg \
date.hg \
+ enums.hg \
fileutils.hg \
iochannel.hg \
keyfile.hg \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]