diff options
author | Ted Gould <ted@gould.cx> | 2011-02-21 21:27:13 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-02-21 21:27:13 -0600 |
commit | ac9229802235759397ce6fffc4d89f27be64ad3d (patch) | |
tree | d1e9f449e689a8fc38d621bbec943bc10d86cc9e /libdbusmenu-glib | |
parent | 5192d305b96683f10567f961913e74bbe23f6e37 (diff) | |
download | libdbusmenu-ac9229802235759397ce6fffc4d89f27be64ad3d.tar.gz libdbusmenu-ac9229802235759397ce6fffc4d89f27be64ad3d.tar.bz2 libdbusmenu-ac9229802235759397ce6fffc4d89f27be64ad3d.zip |
Fleshing out the check for if a property is a default value.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 862cf63..bc2daf5 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1566,10 +1566,23 @@ dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp) /* Checks to see if the value of this property is unique or just the default value. */ -/* TODO: Implement this */ gboolean dbusmenu_menuitem_property_is_default (DbusmenuMenuitem * mi, const gchar * property) { - /* No defaults system yet */ + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + GVariant * currentval = (GVariant *)g_hash_table_lookup(priv->properties, property); + if (currentval != NULL) { + /* If we're storing it locally, then it shouldn't be a default */ + return FALSE; + } + + currentval = dbusmenu_defaults_default_get(priv->defaults, menuitem_get_type(mi), property); + if (currentval != NULL) { + return TRUE; + } + + g_warn_if_reached(); return FALSE; } |