aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/menuitem.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-21 21:11:48 -0600
committerTed Gould <ted@gould.cx>2011-02-21 21:11:48 -0600
commit32f2fccc8b40dc5ccea70acff83a5b6f0302ffea (patch)
tree350b46e3fe8ed7af2058641b68b8099716da5c9d /libdbusmenu-glib/menuitem.c
parent507b6ec86e0e6c4eacd41863f8900a90c023f915 (diff)
downloadlibdbusmenu-32f2fccc8b40dc5ccea70acff83a5b6f0302ffea.tar.gz
libdbusmenu-32f2fccc8b40dc5ccea70acff83a5b6f0302ffea.tar.bz2
libdbusmenu-32f2fccc8b40dc5ccea70acff83a5b6f0302ffea.zip
Always check the type even if we don't have a value.
Diffstat (limited to 'libdbusmenu-glib/menuitem.c')
-rw-r--r--libdbusmenu-glib/menuitem.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index d25e80d..a773755 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -1024,22 +1024,21 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro
const gchar * type = menuitem_get_type(mi);
GVariant * default_value = NULL;
if (type != NULL) {
+ /* Check the expected type to see if we want to have a warning */
+ GVariantType * default_type = dbusmenu_defaults_default_get_type(priv->defaults, type, property);
+ if (default_type != NULL) {
+ /* If we have an expected type we should check to see if
+ the value we've been given is of the same type and generate
+ a warning if it isn't */
+ if (!g_variant_is_of_type(value, default_type)) {
+ g_warning("Setting menuitem property '%s' with value of type '%s' when expecting '%s'", property, g_variant_get_type_string(value), g_variant_type_peek_string(default_type));
+ }
+ }
+
/* Check the defaults database to see if we have a default
for this property. */
default_value = dbusmenu_defaults_default_get(priv->defaults, type, property);
if (default_value != NULL) {
- /* If we have a default we might also have an expected type */
- GVariantType * default_type = dbusmenu_defaults_default_get_type(priv->defaults, type, property);
-
- if (default_type != NULL) {
- /* If we have an expected type we should check to see if
- the value we've been given is of the same type and generate
- a warning if it isn't */
- if (!g_variant_is_of_type(value, default_type)) {
- g_warning("Setting menuitem property '%s' with value of type '%s' when expecting '%s'", property, g_variant_get_type_string(value), g_variant_type_peek_string(default_type));
- }
- }
-
/* Now see if we're setting this to the same value as the
default. If we are then we just want to swallow this variant
and make the function behave like we're clearing it. */