From fe81b29979d855f08089a6928d064d71113de531 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Sun, 6 Sep 2020 23:42:50 -0700 Subject: [PATCH] Imported Upstream version 2.38.0 --- .gitignore | 4 + NEWS | 196 +++++++++++++++++++++++++++++++++++++++++ configure.ac | 4 +- gio/src/action.ccg | 5 ++ gio/src/action.hg | 60 +++++++++++-- gio/src/actiongroup.hg | 35 +++++++- gio/src/actionmap.hg | 5 +- gio/src/menu.hg | 4 +- gio/src/menuitem.ccg | 18 ++++ gio/src/menuitem.hg | 73 ++++++++++++--- gio/src/settings.hg | 3 + gio/src/simpleaction.hg | 19 +++- glib/src/bytearray.hg | 12 +-- tests/Makefile.am | 8 +- tests/glibmm_bytearray/main.cc | 38 ++++++++ 15 files changed, 447 insertions(+), 37 deletions(-) create mode 100644 tests/glibmm_bytearray/main.cc diff --git a/.gitignore b/.gitignore index 55e81b3..a472604 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ giommconfig.h /build/libtool.m4 /build/lt*.m4 /build/missing +/build/test-driver # MSVC_Net20*/ /MSVC_Net200[58]/giomm/giomm.rc @@ -157,6 +158,9 @@ giommconfig.h # tests/ /tests/*/test +/tests/*/*.trs +/tests/*/*.log +/tests/test-suite.log # tools/ /tools/defs_gen/*.pyc diff --git a/NEWS b/NEWS index ee51fc2..2006d40 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,199 @@ +Changes in 2.38 compared to 2.36: + +Glib: +* Object: Add interfaces to custom types before class_init. + This deprecates the use of Glib::Object as a base class + anywhere but in the last in the list of base classes when + implementing an interface, such as TreeModel or + CellRenderer. + Having it, for instance, as the first base class, + is unfortunately likely to break with glib 3.40. + (Kjell Ahlstedt) Bug #697229 +* Use std::memset() instead of GLIBMM_INITIALIZE_STRUCT + (Because it causes compiler warnings with --std=c++ with g++, + because that defines __STRICT_ANSI__.) and deprecate + GLIBMM_INITIALIZE_STRUCT. + (Kjell Ahlstedt) +* ByteArray: + - Fix refcount problems. + (Krzesimir Nowak) + - ByteArray: Add some tests for methods returning self. + (Krzesimir Nowak) +* DateTime: Fix compare() and equal(). + (Kjell Ahlstedt) Bug #704639 (Aurimas Černius) +* Regex: Add get_max_lookbehind(). + (Murray Cumming) +* Variant: Fix memory leaks. + (Kjell Ahlstedt) Bug #704851 (xanm) + +Gio: +* Action: + - get_state() and get_state_hint() now return something. + We choose not to consider this an ABI break because these + methods were impossible to use for anything useful before. + (Andrew Potter) Bug #690134. + - Add get_state_bool() and change_state(bool), + to make it easier to deal with toggle actions. + However, we might add a whole derived convenience class for these + instead. + (Murray Cumming, Kjell Ahlstedt) + - Add create_radio_string() and create_radio_integer() for + radio items, though we might change this API lots. + (Murray Cumming) + - Add name_is_valid() and print_detailed_name(). + (Murray Cumming) + - Add an activate() method that takes no parameter. + (Murray Cumming) + - print_detailed_name(): Remove the action_name parameter. + (Murray Cumming) + - print_detailed_name() Make this templated. + (Murray Cumming) + - Make get_state() templated. + (Murray Cumming) + - get_state_hint(): Correct a check. + (Murray Cumming) + - Add templated change_state() and activate(). + (Murray Cumming) +* Application: Add mark/unmark_busy(). + (Murray Cumming) +* ActionGroup: + - Add templated getters. + (Murray Cumming) + - activate_action(): Add a method overload + that takes no parameter parameter. + (Murray Cumming) +* ActionMap: + - Add add_action(name, slot). + This is a convenience method similar to + g_action_map_add_action_entries() in C. + (Murray Cumming, Kjell Ahlstedt) + - Add add_action_radio_string() and add_action_radio_integer() + for radio items, though we might change this API lots. + (Murray Cumming) +* DesktopInfo: Add list_actions(), launch_action() and get_action_name(). + (Murray Cumming) +* File: + - Add measure_disk_usage() and measure_disk_usage_async(). + (Murray Cumming) + - Add trash_async(), trash_finish(), make_directory_async() + and make_directory_finish(). + (Murray Cumming) +* Menu: Add remove_all(). + (Murray Cumming) +* MenuItem: + - Add set/unset_icon(). + (Murray Cumming) + - Reimplement the constructors. + (Murray Cumming) Bug #705199 (Pete Woods) + - Add set_action(), unset_target() and + unset_action_and_target(). + (Murray Cumming) + - MenuItem: get/set_attribute(): Deprecated for + get/set_attribute_value() methods. + (Murray Cumming) + - Add insert/append/prepend_section() with no label parameter. + (Murray Cumming) Bug #702456 (Aurimas Černius) +* Settings: + - Add create_action(). + (Murray Cumming) + - Add get/set_uint(). + (Murray Cumming) +* SimpleAction: + - Make set_state() protected. + (Murray Cumming) + - add_action() now takes a slot with no parameter. + Added add_action_with_parameter(). + (Murray Cumming) + - set_enabled(): Add default parameter value. + (Murray Cumming) + - Add constructors and create_bool() methods that take a bool instead of + a VariantBase for the state, to make it easier to deal with toggle actions. + However, we might add a whole derived convenience class for these + instead. + (Murray Cumming) +* SimpleActionGroup: + - lookup(): Add a const version and use refreturn. + (Murray Cumming) + - Deprecate all methods, because they just call methods in + the base ActionMap. The C functions are now deprecated too. + See glib bug #705600 . + (Murray Cumming) +* Add VariantParseError. + Because it is thrown by GtkBuilder, at least for now. + (Murray Cumming + +Gio::DBus: +* Add InterfaceSkeleton. + (José Alburquerque) + +Build: +* Port tools/defs_gen to Python 3. + (Kjell Ahlstedt) Bug #690969 +* tools/h2def.py: Handle functions with Handle *_DEPRECATED_IN_*_FOR (*). + (Murray Cumming) +* Update Visual Studio Projects + (Chun-wei Fan) +* Glib::TypeTraits<>: Avoid warnings when compiling with -Wcast-qual. + (Kjell Ahlstedt) Bug #704640 (Aurimas Černius) +* enums.pl: fixed multi-argument defines as enum values. + (Marcin Kolny) Bug #705113 +* Move to a generated ChangeLog. + (José Alburquerque) + +gmmproc: +* Pass NULL to C function calls for optional empty strings. + (José Alburquerque) Bug #686909. Bug #702456 +* Add parameter return_value in _WRAP_VFUNC. + (Marcin Kolny) Bug #705699. +* Fix _WRAP_SIGNAL with 'ifdef' and 'deprecated'. + (Kjell Ahlstedt) +* docextract_to_xml.py: Add '⇒' to the list of escape sequences. + (José Alburquerque) +* Add _WRAP_ENUM_DOCS_ONLY() and simplify enum docs process. + (José Alburquerque) Bug #703155 +* gmmproc: Use GMMPROC_RETURN_MISMATCHES environment variable. + (José Alburquerque) +* Write glibmm version in generated files. + (Kjell Ahlstedt) Bug #697835 and Bug #700495 + +Documentation: +* gmmproc: Add docs to the default constructor of _CLASS_OPAQUE_COPYABLE. + mentioning that the constructed object is invalid. + (Kjell Ahlstedt) Bug #704639 (Aurimas Černius) + + + +2.38.0 (stable): + +Glib: +* ByteArray: + - Fix refcount problems. + (Krzesimir Nowak) + - ByteArray: Add some tests for methods returning self. + (Krzesimir Nowak) + +Gio +* Action: + - Add an activate() method that takes no parameter. + (Murray Cumming) + - print_detailed_name(): Remove the action_name parameter. + (Murray Cumming) +* ActionGroup: activate_action(): Add a method overload + that takes no parameter parameter. + (Murray Cumming) +* ActionMap: Fix a reference-counting problem. + (Murray Cumming) +* MenuItem: + - Add set_action(), unset_target() and + unset_action_and_target(). + (Murray Cumming) + - MenuItem: get/set_attribute(): Deprecated for + get/set_attribute_value() methods. + (Murray Cumming) +* Settings: Add create_action(). + (Murray Cumming) + + 2.37.93 (unstable): Gio diff --git a/configure.ac b/configure.ac index ab7c959..0d0702e 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ ## You should have received a copy of the GNU Lesser General Public License ## along with this library. If not, see . -AC_INIT([glibmm], [2.37.93], +AC_INIT([glibmm], [2.38.0], [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm], [glibmm], [http://www.gtkmm.org/]) AC_PREREQ([2.59]) @@ -60,7 +60,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.37.93' +glibreq='2.0 >= 2.38.0' GLIBMM_MODULES="sigc++-2.0 >= 2.2.10 glib-$glibreq gobject-$glibreq gmodule-$glibreq" GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq" diff --git a/gio/src/action.ccg b/gio/src/action.ccg index d3dd74a..cc9a5f4 100644 --- a/gio/src/action.ccg +++ b/gio/src/action.ccg @@ -24,4 +24,9 @@ namespace Gio { +void Action::activate() +{ + g_action_activate(gobj(), 0); +} + } // namespace Gio diff --git a/gio/src/action.hg b/gio/src/action.hg index 3e26652..b981e25 100644 --- a/gio/src/action.hg +++ b/gio/src/action.hg @@ -79,9 +79,26 @@ public: _WRAP_METHOD(Glib::VariantType get_parameter_type() const, g_action_get_parameter_type) _WRAP_METHOD(Glib::VariantType get_state_type() const, g_action_get_state_type) - //TODO: Docs //TODO: Is there any specific type that can really be used with this? A std::list<>. We must test this. // See also ActionGroup:::get_action_state_hint(). + /** Requests a hint about the valid range of values for the state of + * the action. + * + * If a null Variant is returned it either means that the action is not stateful + * or that there is no hint about the valid range of values for the + * state of the action. + * + * If a Variant array is returned then each item in the array is a + * possible value for the state. If a Variant pair (ie: two-tuple) is + * returned then the tuple specifies the inclusive lower and upper bound + * of valid values for the state. + * + * In any case, the information is merely a hint. It may be possible to + * have a state value outside of the hinted range and setting a value + * within the range may fail. + * + * @param value This will be set to the state range hint. + */ template void get_state_hint(T_Value& value) const; @@ -118,13 +135,30 @@ public: _WRAP_METHOD(void change_state(const Glib::VariantBase& value), g_action_change_state, deprecated "Use the templated method instead, passing a normal C++ type.") - //TODO: Docs + /** Queries the current state of the action. + * + * If the action is not stateful then a null Variant will be returned. If the + * action is stateful then the type of the return value is the type + * given by get_state_type(). + * + * @param value This will be set to the current state of the action. + */ template void get_state(T_Value& value) const; _WRAP_METHOD(Glib::VariantBase get_state_variant() const, g_action_get_state) - //TODO: Docs + /** Activates the action. + */ + void activate(); + + /** Activates the action. + * + * The @a parameter must be the correct type of parameter for the action (ie: + * the parameter type given at construction time), if any. + * + * @param parameter: The parameter to the activation + */ template void activate(const T_Value& parameter); @@ -143,9 +177,21 @@ public: //TODO: _WRAP_METHOD(static bool parse_detailed_name(const Glib::ustring& detailed_name, gchar** action_name, GVariant** target_value), g_action_parse_detailed_name, errthrow) - //TODO: Docs. + + /** Formats a detailed action name from the action's action_name and @a target_value. + * + * This function is the opposite of parse_detailed_action_name(). + * It will produce a string that can be parsed back to the @a action_name + * and @a target_value by that function. + * + * See that function for the types of strings that will be printed by + * this function. + * + * @param target_value A Variant target value. + * @result A detailed format string. + */ template - Glib::ustring print_detailed_name(const Glib::ustring& action_name, const T_Value& value); + Glib::ustring print_detailed_name(const T_Value& value); _WRAP_METHOD(static Glib::ustring print_detailed_name_variant(const Glib::ustring& action_name, const Glib::VariantBase& parameter), g_action_print_detailed_name) @@ -209,14 +255,14 @@ void Action::get_state_hint(T_Value& value) const } template -Glib::ustring Action::print_detailed_name(const Glib::ustring& action_name, const T_Value& parameter) +Glib::ustring Action::print_detailed_name(const T_Value& parameter) { typedef Glib::Variant type_glib_variant; g_return_val_if_fail( g_variant_type_equal(g_action_get_parameter_type(const_cast(gobj())), type_glib_variant::variant_type().gobj()), Glib::ustring()); - return print_detailed_name_variant(type_glib_variant::create(parameter)); + return print_detailed_name_variant(get_name(), type_glib_variant::create(parameter)); } template diff --git a/gio/src/actiongroup.hg b/gio/src/actiongroup.hg index a715eea..4d706d7 100644 --- a/gio/src/actiongroup.hg +++ b/gio/src/actiongroup.hg @@ -78,7 +78,27 @@ public: _WRAP_METHOD(Glib::VariantContainerBase get_action_state_hint(const Glib::ustring& action_name) const, g_action_group_get_action_state_hint, deprecated "Use the get_action_state() method that takes an output parameter instead.") - //TODO: Docs + //TODO: How do we check for a NULL Variant? + /** + * Requests a hint about the valid range of values for the state of the + * named action within the action group + * + * If a null Variant is returned it either means that the action is not stateful + * or that there is no hint about the valid range of values for the + * state of the action. + * + * If a ariant array is returned then each item in the array is a + * possible value for the state. If Variant pair (ie: two-tuple) is + * returned then the tuple specifies the inclusive lower and upper bound + * of valid values for the state. + * + * In any case, the information is merely a hint. It may be possible to + * have a state value outside of the hinted range and setting a value + * within the range may fail. + * + * @param action_name The name of the action to query. + * @param value This will be set to the state range hint. + */ template void get_action_state_hint(const Glib::ustring& action_name, T_Value& value) const; @@ -87,7 +107,16 @@ public: _WRAP_METHOD(Glib::VariantBase get_action_state(const Glib::ustring& action_name) const, g_action_group_get_action_state, deprecated "Use the get_action_state() method that takes an output parameter instead.") - //TODO: Docs + //TODO: How do we check for a NULL Variant? + /** Queries the current state of the named action within the action group. + * + * If the action is not stateful then a null Variant will be returned. If the + * action is stateful then the type of the return value is the type + * given by get_action_state_type(). + * + * @param action_name The name of the action to query. + * @param value This will be set to the current state of the action. + */ template void get_action_state(const Glib::ustring& action_name, T_Value& value) const; @@ -97,7 +126,7 @@ public: _WRAP_METHOD(void change_action_state(const Glib::ustring& action_name, const Glib::VariantBase& value), g_action_group_change_action_state) //TODO: Add templated method, renaming this to activate_action_variant(). - _WRAP_METHOD(void activate_action(const Glib::ustring& action_name, const Glib::VariantBase& parameter), g_action_group_activate_action) + _WRAP_METHOD(void activate_action(const Glib::ustring& action_name, const Glib::VariantBase& parameter{?}), g_action_group_activate_action) _WRAP_METHOD(void action_added(const Glib::ustring& action_name), g_action_group_action_added) _WRAP_METHOD(void action_removed(const Glib::ustring& action_name), g_action_group_action_removed) diff --git a/gio/src/actionmap.hg b/gio/src/actionmap.hg index f371167..4400a68 100644 --- a/gio/src/actionmap.hg +++ b/gio/src/actionmap.hg @@ -112,8 +112,7 @@ public: */ Glib::RefPtr add_action_bool(const Glib::ustring& name, bool state = false); -//TODO: Docs: Refer to this as a toggle action? - /** A convenience method for creating a boolean-stateful SimpleAction instance + /** A convenience method for creating a boolean-stateful (toggle) SimpleAction instance * and adding it to the ActionMap. * * @param name The name of the Action. @@ -190,6 +189,8 @@ public: _WRAP_VFUNC(Glib::RefPtr lookup_action(const Glib::ustring& name) const, "lookup_action") //TODO: Change this to use const & when we can break ABI. + // ( Changing it causes a symbol lookup error when trying to run already-built applications. ) +#m4 _CONVERSION(`GAction*', `Glib::RefPtr', `Glib::wrap($3, true)') _WRAP_VFUNC(void add_action(Glib::RefPtr action) const, "add_action") _WRAP_VFUNC(void remove_action(const Glib::ustring& name), "remove_action") }; diff --git a/gio/src/menu.hg b/gio/src/menu.hg index fee1ddd..69ae591 100644 --- a/gio/src/menu.hg +++ b/gio/src/menu.hg @@ -48,13 +48,15 @@ public: _WRAP_METHOD(void freeze(), g_menu_freeze) + //TODO: Make the item "const Glib::RefPtr&" when we can break ABI? The function is documented as just copying its attributes. _WRAP_METHOD(void insert_item(int position, const Glib::RefPtr& item), g_menu_insert_item) _WRAP_METHOD(void prepend_item(const Glib::RefPtr& item), g_menu_prepend_item) _WRAP_METHOD(void append_item(const Glib::RefPtr& item), g_menu_append_item) _WRAP_METHOD(void remove(int position), g_menu_remove) _WRAP_METHOD(void remove_all(), g_menu_remove_all) -//TODO: Allow label to be null. +//TODO: Allow label to be null. But when would that be useful? +//We don't return the MenuItem* because the C API can't give us something modifiable: See https://bugzilla.gnome.org/show_bug.cgi?id=708906 _WRAP_METHOD(void insert(int position, const Glib::ustring& label, const Glib::ustring& detailed_action = Glib::ustring()), g_menu_insert) _WRAP_METHOD(void prepend(const Glib::ustring& label, const Glib::ustring& detailed_action = Glib::ustring()), g_menu_prepend) _WRAP_METHOD(void append(const Glib::ustring& label, const Glib::ustring& detailed_action = Glib::ustring()), g_menu_append) diff --git a/gio/src/menuitem.ccg b/gio/src/menuitem.ccg index ed4c6e3..de96ad3 100644 --- a/gio/src/menuitem.ccg +++ b/gio/src/menuitem.ccg @@ -50,6 +50,24 @@ void MenuItem::set_action_and_target(const Glib::ustring& action) g_menu_item_set_action_and_target_value(gobj(), action.c_str(), 0); } +void MenuItem::set_action(const Glib::ustring& action) +{ + g_menu_item_set_action_and_target_value(gobj(), action.c_str(), 0); +} + +void MenuItem::unset_target() +{ + const gchar *action_name = 0; + g_menu_item_get_attribute (gobj(), G_MENU_ATTRIBUTE_ACTION, "&s", &action_name); + + g_menu_item_set_action_and_target_value(gobj(), action_name, 0); +} + +void MenuItem::unset_action_and_target() +{ + g_menu_item_set_action_and_target_value(gobj(), 0, 0); +} + void MenuItem::unset_icon() { g_menu_item_set_icon(gobj(), 0); diff --git a/gio/src/menuitem.hg b/gio/src/menuitem.hg index e762b17..31eeae0 100644 --- a/gio/src/menuitem.hg +++ b/gio/src/menuitem.hg @@ -34,14 +34,38 @@ class MenuItem : public Glib::Object _CLASS_GOBJECT(MenuItem, GMenuItem, G_MENU_ITEM, Glib::Object, GObject) protected: - //TODO: Documentation + /** Creates a new MenuItem. + * + * If @a label is not empty it is used to set the "label" attribute of the + * new item. + * + * If @a detailed_action is not empty it is used to set the "action" and + * possibly the "target" attribute of the new item. See + * set_detailed_action() for more information. + * + * @param label The section label. + * @param detailed_action: The detailed action string. + */ explicit MenuItem(const Glib::ustring& label = Glib::ustring(), const Glib::ustring& detailed_action = Glib::ustring()); _IGNORE(g_menu_item_new) - //TODO: Documentation + /** Creates a new MenuItem representing a submenu. + * + * This is a convenience API around the MenuItem(label, detailed_action) constructor and + * set_submenu(). + * + * @param label The section label. + * @param A MenuModel with the items of the submenu. + */ explicit MenuItem(const Glib::ustring& label, const Glib::RefPtr& submenu); - //TODO: Documentation + /** Creates a new MenuItem representing a submenu. + * + * This is a convenience API around the MenuItem(label, detailed_action) constructor and + * set_submenu(). + * + * @param A MenuModel with the items of the submenu. + */ explicit MenuItem(const Glib::RefPtr& submenu); _IGNORE(g_menu_item_new_submenu) @@ -71,10 +95,12 @@ GMenuItem * g_menu_item_new_section (const Glib::ustring& label, // const Glib::RefPtr& section); //TODO: Add a set_attribute() templated method to get values directly instead - //of requiring a Glib::VariantBase? + //of requiring a Glib::VariantBase, when we can break ABI: + //template + //void set_attribute(const Glib::ustring& attribute, const T_Value& value) const; - _WRAP_METHOD(void set_attribute_value(const Glib::ustring& attribute, const Glib::VariantBase& value), g_menu_item_set_attribute_value, deprecated "Use set_attribute() instead.") - _WRAP_METHOD(void set_attribute(const Glib::ustring& attribute, const Glib::VariantBase& value), g_menu_item_set_attribute_value) + _WRAP_METHOD(void set_attribute_value(const Glib::ustring& attribute, const Glib::VariantBase& value), g_menu_item_set_attribute_value) + _WRAP_METHOD(void set_attribute(const Glib::ustring& attribute, const Glib::VariantBase& value), g_menu_item_set_attribute_value, deprecated "Use set_attribute() instead.") _IGNORE(g_menu_item_set_attribute) //These are documented as transfer-full, so we don't need to use refreturn. @@ -87,19 +113,44 @@ GMenuItem * g_menu_item_new_section (const Glib::ustring& label, _WRAP_METHOD(void set_section(const Glib::RefPtr& section), g_menu_item_set_section) //TODO: Add a get_attribute() templated method to get values directly instead - //of returning a Glib::VariantBase? - - _WRAP_METHOD(Glib::VariantBase get_attribute(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value) + //of returning a Glib::VariantBase, when we can break ABI. + //template + //void get_attribute(const Glib::ustring& attribute, T_Value& value) const; + //_WRAP_METHOD(Glib::VariantBase get_attribute_value(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value) + + _WRAP_METHOD(Glib::VariantBase get_attribute(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value, deprecated "Use get_attribute_value() instead.") + _WRAP_METHOD(Glib::VariantBase get_attribute_value(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value) // Ignore varargs function. _IGNORE(g_menu_item_get_attribute) - //TODO: Rename this to unset_action_target() and deprecate this one. +_DEPRECATE_IFDEF_START /** Unsets the target for the specified @a action. + * @deprecate Use set_action() or unset_target() instead. */ void set_action_and_target(const Glib::ustring& action); +_DEPRECATE_IFDEF_END - //TODO: Add unset_action_and_target(). + /** Sets the action for the menu item. + * See set_action_and_target(). + * + * @newin{2,38} + */ + void set_action(const Glib::ustring& action); + + /** Unsets the target for the menu item. + * See set_action_and_target(). + * + * @newin{2,38} + */ + void unset_target(); + + /** Unsets the action and target for the menu item. + * See set_action_and_target(). + * + * @newin{2,38}. + */ + void unset_action_and_target(); _WRAP_METHOD(void set_action_and_target(const Glib::ustring& action, const Glib::VariantBase& target_value), g_menu_item_set_action_and_target_value) _IGNORE(g_menu_item_set_action_and_target) diff --git a/gio/src/settings.hg b/gio/src/settings.hg index cc45bdc..ff060f4 100644 --- a/gio/src/settings.hg +++ b/gio/src/settings.hg @@ -18,6 +18,7 @@ #include #include #include +#include _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) @@ -122,6 +123,8 @@ public: void bind_writable(const Glib::ustring& key, const Glib::PropertyProxy_Base& property_proxy, bool inverted=false); // TODO: unbind is not actually a class method + _WRAP_METHOD(Glib::RefPtr create_action(const Glib::ustring& key), g_settings_create_action) + //TODO?: _WRAP_PROPERTY("backend", Glib::RefPtr) _WRAP_PROPERTY("delay-apply", bool) diff --git a/gio/src/simpleaction.hg b/gio/src/simpleaction.hg index 20a240d..0a5059a 100644 --- a/gio/src/simpleaction.hg +++ b/gio/src/simpleaction.hg @@ -45,10 +45,25 @@ class SimpleAction : public Glib::Object, public Action _STRUCT_NOT_HIDDEN protected: - //TODO: Docs + /** Creates a new action. + * + * The created action is stateless. + * + * @param name The name of the action. + * @param state The initial state of the action. + */ explicit SimpleAction(const Glib::ustring& name); - //TODO: Docs + /** Creates a new new stateful action. + * + * The created action is stateless. + * + * @a state is the initial state of the action. All future state values + * must have the same VariantType as the initial state. + * + * @param name The name of the action. + * @param state The initial state of the action. + */ SimpleAction(const Glib::ustring& name, const Glib::VariantBase& state); #m4 _CONVERSION(`const Glib::VariantType&',`const GVariantType*',`$3.gobj()') diff --git a/glib/src/bytearray.hg b/glib/src/bytearray.hg index 92cba69..5429275 100644 --- a/glib/src/bytearray.hg +++ b/glib/src/bytearray.hg @@ -62,8 +62,8 @@ public: _WRAP_METHOD(static Glib::RefPtr create(), g_byte_array_new) - _WRAP_METHOD(Glib::RefPtr append(const guint8* data, guint len), g_byte_array_append) - _WRAP_METHOD(Glib::RefPtr prepend(const guint8* data, guint len), g_byte_array_prepend) + _WRAP_METHOD(Glib::RefPtr append(const guint8* data, guint len), g_byte_array_append, refreturn) + _WRAP_METHOD(Glib::RefPtr prepend(const guint8* data, guint len), g_byte_array_prepend, refreturn) /** Gets the size of the byte array. * @return The size. @@ -83,14 +83,14 @@ public: */ const guint8* get_data() const; - _WRAP_METHOD(Glib::RefPtr remove_index(guint index_), g_byte_array_remove_index) - _WRAP_METHOD(Glib::RefPtr remove_index_fast(guint index_), g_byte_array_remove_index_fast) - _WRAP_METHOD(Glib::RefPtr remove_range(guint index_, guint length), g_byte_array_remove_range) + _WRAP_METHOD(Glib::RefPtr remove_index(guint index_), g_byte_array_remove_index, refreturn) + _WRAP_METHOD(Glib::RefPtr remove_index_fast(guint index_), g_byte_array_remove_index_fast, refreturn) + _WRAP_METHOD(Glib::RefPtr remove_range(guint index_, guint length), g_byte_array_remove_range, refreturn) _WRAP_METHOD(void sort(const SlotCompare& slot), g_byte_array_sort_with_data, slot_name slot, slot_callback ByteArray_Compare_Data_Func, no_slot_copy) _IGNORE(g_byte_array_sort) - _WRAP_METHOD(Glib::RefPtr set_size(guint length), g_byte_array_set_size) + _WRAP_METHOD(Glib::RefPtr set_size(guint length), g_byte_array_set_size, refreturn) #ifndef DOXYGEN_SHOULD_SKIP_THIS static GType get_type() G_GNUC_CONST; diff --git a/tests/Makefile.am b/tests/Makefile.am index 36eb067..be9c4c6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -39,9 +39,10 @@ check_PROGRAMS = \ glibmm_bool_vector/test \ glibmm_bool_arrayhandle/test \ glibmm_null_vectorutils/test \ - glibmm_null_containerhandle/test \ - glibmm_refptr_sigc_bind/test - + glibmm_null_containerhandle/test \ + glibmm_refptr_sigc_bind/test \ + glibmm_bytearray/test + TESTS = $(check_PROGRAMS) glibmm_includes = -I$(top_builddir)/glib $(if $(srcdir:.=),-I$(top_srcdir)/glib) @@ -97,3 +98,4 @@ glibmm_null_vectorutils_test_LDADD = $(giomm_ldadd) glibmm_null_containerhandle_test_SOURCES = glibmm_null_containerhandle/main.cc glibmm_null_containerhandle_test_LDADD = $(giomm_ldadd) glibmm_refptr_sigc_bind_test_SOURCES = glibmm_refptr_sigc_bind/main.cc +glibmm_bytearray_test_SOURCES = glibmm_bytearray/main.cc diff --git a/tests/glibmm_bytearray/main.cc b/tests/glibmm_bytearray/main.cc new file mode 100644 index 0000000..ff05f3c --- /dev/null +++ b/tests/glibmm_bytearray/main.cc @@ -0,0 +1,38 @@ +#include +#include +#include + +int +main() +{ + Glib::RefPtr< Glib::ByteArray > array(Glib::ByteArray::create()); + guint8 data[] = {1, 2, 3, 4, 5, 6}; + + array->append(data, sizeof(data)); + // |1, 2, 3, 4, 5, 6| = 6 + g_assert (array->size() == 6); + + array->prepend(data, sizeof(data)); + // |1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6| = 12 + g_assert (array->size() == 12); + + array->remove_index(0); + // |2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6| = 11 + g_assert (array->size() == 11); + + array->remove_index_fast(0); + // |6, 3, 4, 5, 6, 1, 2, 3, 4, 5| = 10 + g_assert (array->size() == 10); + + array->remove_range(0, 4); + // |6, 1, 2, 3, 4, 5,| = 6 + g_assert (array->size() == 6); + + array->set_size(2); + // |6, 1| = 2 + g_assert (array->size() == 2); + + guint8* array_data = array->get_data(); + g_assert (array_data[0] == 6); + g_assert (array_data[1] == 1); +} -- 2.7.4