diff options
author | Ted Gould <ted@canonical.com> | 2009-05-12 16:55:00 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-05-12 16:55:00 -0500 |
commit | 9a9f8a2e19a14c03fe45b53867d4aa12127333a6 (patch) | |
tree | a01153619f1c534b01bf817faa94be28a272fa43 | |
parent | 5971493366cde4f9cc55d963b22d451dd7ffbbcd (diff) | |
download | libdbusmenu-9a9f8a2e19a14c03fe45b53867d4aa12127333a6.tar.gz libdbusmenu-9a9f8a2e19a14c03fe45b53867d4aa12127333a6.tar.bz2 libdbusmenu-9a9f8a2e19a14c03fe45b53867d4aa12127333a6.zip |
Start signalling when children are added or removed
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 6cfd581..2563eb2 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -308,6 +308,15 @@ dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi) return priv->children; } +/* For all the taken children we need to signal + that they were removed */ +static void +take_children_signal (gpointer data, gpointer user_data) +{ + g_signal_emit(G_OBJECT(user_data), signals[CHILD_REMOVED], 0, DBUSMENU_MENUITEM(data), TRUE); + return; +} + /** dbusmenu_menuitem_take_children: @mi: The #DbusmenMenuitem to take the children from. @@ -328,6 +337,7 @@ dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi) DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); GList * children = priv->children; priv->children = NULL; + g_list_foreach(children, take_children_signal, mi); return children; } @@ -379,6 +389,7 @@ dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); priv->children = g_list_append(priv->children, child); + g_signal_emit(G_OBJECT(mi), signals[CHILD_ADDED], 0, child, TRUE); return TRUE; } @@ -401,6 +412,7 @@ dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); priv->children = g_list_remove(priv->children, child); + g_signal_emit(G_OBJECT(mi), signals[CHILD_REMOVED], 0, child, TRUE); return TRUE; } @@ -424,6 +436,7 @@ dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); priv->children = g_list_insert(priv->children, child, position); + g_signal_emit(G_OBJECT(mi), signals[CHILD_ADDED], 0, child, TRUE); return TRUE; } |