/glib/glibmm-*.pc
/glib/glibmm/balancedtree.cc
/glib/glibmm/balancedtree.h
+/glib/glibmm/bytes.cc
+/glib/glibmm/bytes.h
/glib/glibmm/checksum.cc
/glib/glibmm/checksum.h
/glib/glibmm/convert.cc
+2.33.4:
+
+2012-08-01 Murray Cumming <murrayc@murrayc.com>
+
+ gio_extra_objects: Mention GMenuItem.
+
+ * gio/src/gio_extra_objects.defs:
+ This helps the documentation generator.
+
+2012-07-28 Krzesimir Nowak <qdlacz@gmail.com>
+
+ Add a test checking whether floating variants are always sunk.
+
+ * tests/glibmm_variant/main.cc: New test.
+ Bug #680407
+
+2012-07-28 Krzesimir Nowak <qdlacz@gmail.com>
+
+ Implement custom cast constructor for VariantBase.
+
+ * glib/src/variant.hg:
+ * glib/src/variant.ccg: Use _CUSTOM_CTOR_CAST macro and implement
+ cast constructor. This is needed, because we always want to sink
+ a GVariant.
+ Bug #680407
+
+2012-07-28 Krzesimir Nowak <qdlacz@gmail.com>
+
+ Add _CUSTOM_CTOR_CAST macro for _CLASS_OPAQUE_COPYABLE.
+
+ * tools/m4/class_opaque_copyable.m4: New macro.
+ Bug #680407
+
+2012-07-26 Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
+
+ Glib::Threads:[Rec]Mutex: Add wrap() functions.
+
+ * glib/src/threads.[hg|ccg]: Add Mutex* wrap(GMutex*) and
+ RecMutex* wrap(GRecMutex*). Bug #483790.
+
+2012-07-22 Krzesimir Nowak <qdlacz@gmail.com>
+
+ Properly wrap g_key_file_load_from_dirs().
+
+ * glib/src/keyfile.hg:
+ * glib/src/keyfile.ccg: The just deprecated wrapper was
+ incorrectly passing an array wrapper for full_path parameter when
+ it should pass a std::string&, because full_path is an output
+ parameter. Added handwritten wrapper passing proper parameter.
+
+2012-07-22 Krzesimir Nowak <qdlacz@gmail.com>
+
+ Wrap g_variant_type_peek_string() by hand.
+
+ * glib/src/gvarianttype.hg:
+ * glib/src/gvarianttype.ccg: The wrapped function does not return
+ a C string (it is not NULL terminated), so std::string(str, size)
+ constructor needs to be used. I wonder how glibmm_variant test
+ passed through all distchecks so far...
+
+2012-07-16 Murray Cumming <murrayc@murrayc.com>
+
+ Show get_type() in the API documentation.
+
+ * tools/m4/class_boxedtype.m4:
+ * tools/m4/class_boxedtype_static.m4:
+ * tools/m4/class_gobject.m4:
+ * tools/m4/class_interface.m4: Move the static get_type()
+ functions out of the ifdef so that doxygen can see them,
+ because they are sometimes needed, for instance when
+ implementing a custom container.
+ Bug #670212 (Mark Vender).
+
+2012-07-10 Krzesimir Nowak <qdlacz@gmail.com>
+
+ Glib::Checksum: Fix a typo.
+
+ * glib/src/checksum.hg: Should be *_SHOULD_*, not *_SHOUD_*.
+
2.33.3:
2012-07-10 Murray Cumming <murrayc@murrayc.com>
+2.33.4 (unstable):
+
+Glib:
+* KeyFile: Correct the load_from_dirs() implementation.
+ (Krzesimir Nowak)
+* Variant: Make sure that we always sink the initial reference.
+ (Krzesimir Nowak) Bug #680407
+* VariantType: peek_string(): Correct this to handle
+ the non-null-terminated result from g_variant_type_peek_string().
+* Threads::Mutex, RecMutex: Add wrap() functions.
+ (Kjell Ahlstedt) Bug #483790
+
+gmmproc:
+* Add _CUSTOM_CTOR_CAST
+ (Krzesimir Nowak)
+
+Documentation:
+* Show the get_type() functions in the API documentation.
+ (Murray Cumming) Bug #670212 (Mark Vender).
+
+
2.33.3 (unstable):
Glib:
AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library])
])
-glibreq='2.0 >= 2.33.3'
+glibreq='2.0 >= 2.33.4'
GLIBMM_MODULES="sigc++-2.0 >= 2.2.10 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq"
(gtype-id "G_TYPE_FILE_INFO")
)
+(define-object MenuItem
+ (in-module "Gio")
+ (c-name "GMenuItem")
+ (gtype-id "G_TYPE_MENU_ITEM")
+)
+
(define-object Proxy
(in-module "Gio")
(c-name "GProxy")
#include <glib.h>
#include <string>
-#ifndef DOXYGEN_SHOUD_SKIP_THIS
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _GChecksum GChecksum; }
#endif
return (result != 0);
}
+bool KeyFile::load_from_dirs(const std::string& file, const Glib::ArrayHandle<std::string>& search_dirs, std::string& full_path, KeyFileFlags flags)
+{
+ GError* gerror = 0;
+ char* full_path_c = 0;
+
+ const gboolean result = g_key_file_load_from_dirs(
+ gobj(), file.c_str(), const_cast<const gchar**>(search_dirs.data()),
+ &full_path_c, static_cast<GKeyFileFlags>(unsigned(flags)),
+ &gerror);
+
+ if(gerror)
+ {
+ if (full_path_c)
+ {
+ g_free(full_path_c);
+ }
+ Glib::Error::throw_exception(gerror);
+ }
+
+ if(full_path_c)
+ full_path = Glib::ScopedPtr<char>(full_path_c).get();
+ else
+ full_path.erase();
+
+ return (result != 0);
+}
+
Glib::ustring KeyFile::to_data()
{
GError* gerror = 0;
#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_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);
+
/** Looks for a KeyFile named @a file in the paths returned from
* g_get_user_data_dir() and g_get_system_data_dirs() and loads them
* into the keyfile object, placing the full path to the file in
g_mutex_unlock(&gobject_);
}
+Mutex* wrap(GMutex* gobject)
+{
+ return reinterpret_cast<Mutex*>(gobject);
+}
+
/**** Glib::RecMutex *******************************************************/
RecMutex::RecMutex()
g_rec_mutex_unlock(&gobject_);
}
+RecMutex* wrap(GRecMutex* gobject)
+{
+ return reinterpret_cast<RecMutex*>(gobject);
+}
+
/**** Glib::RWLock ***************************************************/
void RWLock::reader_lock()
Mutex::Lock& operator=(const Mutex::Lock&);
};
-//TODO: Docuemenation
+/** A C++ wrapper for the C object.
+ * Do not use operator delete on the returned pointer. If the caller owns the
+ * GMutex object, the caller must destroy it in the same way as if this function
+ * had not been called.
+ *
+ * @param gobject The C instance.
+ * @result The GMutex* cast to a Glib::Threads::Mutex*.
+ *
+ * @relates Glib::Threads::Mutex
+ */
+Mutex* wrap(GMutex* gobject);
+
+//TODO: Documentation
class RecMutex
{
public:
RecMutex::Lock& operator=(const RecMutex::Lock&);
};
+/** A C++ wrapper for the C object.
+ * Do not use operator delete on the returned pointer. If the caller owns the
+ * GRecMutex object, the caller must destroy it in the same way as if this function
+ * had not been called.
+ *
+ * @param gobject The C instance.
+ * @result The GRecMutex* cast to a Glib::Threads::RecMutex*.
+ *
+ * @relates Glib::Threads::RecMutex
+ */
+RecMutex* wrap(GRecMutex* gobject);
//TODO: Documentation
class RWLock
namespace Glib
{
+VariantBase::VariantBase(GVariant* castitem, bool make_a_copy /* = false */)
+{
+ if (castitem)
+ {
+ if (g_variant_is_floating(castitem))
+ {
+ g_variant_ref_sink (castitem);
+ }
+ if (make_a_copy)
+ {
+ g_variant_ref (castitem);
+ }
+ }
+
+ gobject_ = castitem;
+}
+
void VariantBase::get_normal_form(VariantBase& result) const
{
GVariant* const g_value =
class VariantBase
{
_CLASS_OPAQUE_COPYABLE(VariantBase, GVariant, NONE, g_variant_ref_sink, g_variant_unref)
+ _CUSTOM_CTOR_CAST()
_IGNORE(g_variant_ref, g_variant_ref_sink, g_variant_unref,
g_variant_get, g_variant_get_va)
public:
const VariantType VARIANT_TYPE_BYTESTRING_ARRAY(G_VARIANT_TYPE_STRING_ARRAY);
+std::string VariantType::get_string() const
+{
+ return std::string(g_variant_type_peek_string(gobj()), g_variant_type_get_string_length(gobj()));
+}
+
}
//TODO: Use something instead of gsize?
_WRAP_METHOD(gsize _get_string_length() const, g_variant_type_get_string_length)
- _WRAP_METHOD(std::string get_string() const, g_variant_type_peek_string)
+ dnl wrapped by hand, because g_variant_type_peek_string does not return a C string.
+ _WRAP_METHOD_DOCS_ONLY(g_variant_type_peek_string)
+ std::string get_string() const;
_IGNORE(g_variant_type_dup_string)
_WRAP_METHOD(bool is_definite() const, g_variant_type_is_definite)
std::stringstream debug;
std::ostream& ostr = debug;
+static void test_variant_floating();
static void test_dynamic_cast();
int main(int, char**)
" in the variant are: " << value << '.' << std::endl;
}
+ test_variant_floating();
test_dynamic_cast();
return EXIT_SUCCESS;
test_dynamic_cast_ustring_types();
test_dynamic_cast_string_types();
}
+
+static GLogLevelFlags
+get_log_flags()
+{
+ return static_cast<GLogLevelFlags>(static_cast<unsigned>(G_LOG_LEVEL_CRITICAL) | static_cast<unsigned>(G_LOG_LEVEL_WARNING));
+}
+
+struct WarnCatcher
+{
+ WarnCatcher(const std::string& domain)
+ : m_domain(domain)
+ , m_old_flags(g_log_set_fatal_mask(m_domain.c_str(), get_log_flags()))
+ {}
+
+ ~WarnCatcher()
+ {
+ g_log_set_fatal_mask(m_domain.c_str(), m_old_flags);
+ }
+
+ std::string m_domain;
+ GLogLevelFlags m_old_flags;
+};
+
+static void test_variant_floating()
+{
+ WarnCatcher warn_catcher("GLib");
+
+ {
+ GVariant* cv = g_variant_new("i", 42);
+ Glib::VariantBase cxxv = Glib::wrap(cv, false);
+
+ g_assert(!cxxv.is_floating());
+ }
+
+ {
+ GVariant* cv = g_variant_new("i", 42);
+ Glib::VariantBase cxxv = Glib::wrap(cv, true);
+
+ g_assert(!cxxv.is_floating());
+
+ g_variant_unref(cv);
+ }
+
+ {
+ GVariant* cv = g_variant_new("i", 42);
+
+ if (g_variant_is_floating(cv))
+ {
+ g_variant_ref_sink(cv);
+ }
+
+ Glib::VariantBase cxxv = Glib::wrap(cv, false);
+
+ g_assert(!cxxv.is_floating());
+ }
+
+ {
+ GVariant* cv = g_variant_new("i", 42);
+
+ if (g_variant_is_floating(cv))
+ {
+ g_variant_ref_sink(cv);
+ }
+
+ Glib::VariantBase cxxv = Glib::wrap(cv, true);
+
+ g_assert(!cxxv.is_floating());
+
+ g_variant_unref(cv);
+ }
+}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __CNAME__ BaseObjectType;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+ /** Get the GType for this class, for use with the underlying GObject type system.
+ */
static GType get_type() G_GNUC_CONST;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
',`dnl else
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __CNAME__ BaseObjectType;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+ /** Get the GType for this class, for use with the underlying GObject type system.
+ */
static GType get_type() G_GNUC_CONST;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',,`dnl else
__CPPNAME__`'();
_IMPORT(SECTION_DTOR_DOCUMENTATION)
virtual ~__CPPNAME__`'();
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ /** Get the GType for this class, for use with the underlying GObject type system.
+ */
static GType get_type() G_GNUC_CONST;
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
ifdef(`__BOOL_DYNAMIC_GTYPE_REGISTRATION__',`
static GType get_type(GTypeModule* module) G_GNUC_CONST;
',`')
static void add_interface(GType gtype_implementer);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ /** Get the GType for this class, for use with the underlying GObject type system.
+ */
static GType get_type() G_GNUC_CONST;
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
_POP()
')
+define(`_CUSTOM_CTOR_CAST',`dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
+_POP()
+')
+
_POP()
_SECTION(SECTION_CLASS2)
') dnl End of _CLASS_OPAQUE_COPYABLE.
gobject_ ((src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0)
{}
+ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem, bool make_a_copy /* = false */)
{
if(!make_a_copy)
gobject_ = 0;
}
}
+')
ifelse(__OPAQUE_FUNC_COPY,NONE,`dnl
',`dnl else