aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/menuitem.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-21 21:27:13 -0600
committerTed Gould <ted@gould.cx>2011-02-21 21:27:13 -0600
commitac9229802235759397ce6fffc4d89f27be64ad3d (patch)
treed1e9f449e689a8fc38d621bbec943bc10d86cc9e /libdbusmenu-glib/menuitem.c
parent5192d305b96683f10567f961913e74bbe23f6e37 (diff)
downloadlibdbusmenu-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/menuitem.c')
-rw-r--r--libdbusmenu-glib/menuitem.c17
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;
}