aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/menuitem.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2009-12-21 16:17:02 -0600
committerTed Gould <ted@gould.cx>2009-12-21 16:17:02 -0600
commit48b791062e98e7a38178656593d57d4ad2d03769 (patch)
tree6e0178c95e5ee0573f236c8a7534f7495dbdc517 /libdbusmenu-glib/menuitem.c
parentac0fbaf02100ff196bef3d97db162a4f01d58d58 (diff)
parent7d0dbc3dd6be6ffaeca675b460767e20e505841e (diff)
downloadlibdbusmenu-48b791062e98e7a38178656593d57d4ad2d03769.tar.gz
libdbusmenu-48b791062e98e7a38178656593d57d4ad2d03769.tar.bz2
libdbusmenu-48b791062e98e7a38178656593d57d4ad2d03769.zip
Using a hash table replace
Diffstat (limited to 'libdbusmenu-glib/menuitem.c')
-rw-r--r--libdbusmenu-glib/menuitem.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index ec37da5..a03117c 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -250,7 +250,7 @@ static guint menuitem_next_id = 1;
/* A small little function to both clear the insides of a
value as well as the memory it itself uses. */
static void
-g_value_free (gpointer data)
+_g_value_free (gpointer data)
{
if (data == NULL) return;
GValue * value = (GValue*)data;
@@ -269,7 +269,7 @@ dbusmenu_menuitem_init (DbusmenuMenuitem *self)
priv->id = 0;
priv->children = NULL;
- priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_value_free);
+ priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_value_free);
priv->root = FALSE;
@@ -815,12 +815,13 @@ dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * prope
g_value_init(lval, G_VALUE_TYPE(value));
g_value_copy(value, lval);
- g_hash_table_insert(priv->properties, lprop, lval);
+ g_hash_table_replace(priv->properties, lprop, lval);
#ifdef MASSIVEDEBUGGING
gchar * valstr = g_strdup_value_contents(lval);
g_debug("Menuitem %d (%s) signalling property '%s' changed to '%s'", ID(mi), LABEL(mi), property, g_utf8_strlen(valstr, 50) < 25 ? valstr : "<too long>");
g_free(valstr);
#endif
+
g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, lval, TRUE);
return TRUE;