aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-09 23:06:22 -0600
committerTed Gould <ted@gould.cx>2010-02-09 23:06:22 -0600
commitfb1e4ab223f5fd203ac5330a040b8a222bc96ca8 (patch)
treeff707c9ec068451bf0461d35bc82bc1e0d437d91
parent9fcc7e58982ef73d3cfc620fec98f836eff96464 (diff)
downloadlibdbusmenu-fb1e4ab223f5fd203ac5330a040b8a222bc96ca8.tar.gz
libdbusmenu-fb1e4ab223f5fd203ac5330a040b8a222bc96ca8.tar.bz2
libdbusmenu-fb1e4ab223f5fd203ac5330a040b8a222bc96ca8.zip
Setting up signals, and the easy ones are filled out.
-rw-r--r--libdbusmenu-glib/menuitem-proxy.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/libdbusmenu-glib/menuitem-proxy.c b/libdbusmenu-glib/menuitem-proxy.c
index 9a83419..3bd2684 100644
--- a/libdbusmenu-glib/menuitem-proxy.c
+++ b/libdbusmenu-glib/menuitem-proxy.c
@@ -161,6 +161,43 @@ handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, g
return dbusmenu_menuitem_handle_event(priv->mi, name, value, timestamp);
}
+/* Watches a property change and makes sure to put that value
+ into our property list. */
+static void
+proxy_item_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, gpointer user_data)
+{
+ DbusmenuMenuitemProxy * pmi = DBUSMENU_MENUITEM_PROXY(user_data);
+ dbusmenu_menuitem_property_set_value(DBUSMENU_MENUITEM(pmi), property, value);
+ return;
+}
+
+/* Looks for a child getting added and wraps it and places it
+ in our list of children. */
+static void
+proxy_item_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, gpointer user_data)
+{
+ DbusmenuMenuitemProxy * pmi = DBUSMENU_MENUITEM_PROXY(user_data);
+ DbusmenuMenuitemProxy * child_pmi = dbusmenu_menuitem_proxy_new(child);
+ dbusmenu_menuitem_child_add_position(DBUSMENU_MENUITEM(pmi), DBUSMENU_MENUITEM(child_pmi), position);
+ return;
+}
+
+/* Find the wrapper for this child and remove it as well. */
+static void
+proxy_item_child_removed (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, gpointer user_data)
+{
+
+ return;
+}
+
+/* Find the wrapper for the item and move it in our child list */
+static void
+proxy_item_child_moved (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint newpos, guint oldpos)
+{
+
+ return;
+}
+
/* References all of the things we need for talking to this menuitem
including signals and other data. If the menuitem already has
properties we need to signal that they've changed for us. */
@@ -176,6 +213,12 @@ add_menuitem (DbusmenuMenuitemProxy * pmi, DbusmenuMenuitem * mi)
g_object_ref(G_OBJECT(priv->mi));
/* Attach signals */
+ g_signal_connect(G_OBJECT(priv->mi), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(proxy_item_property_changed), pmi);
+ g_signal_connect(G_OBJECT(priv->mi), DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED, G_CALLBACK(proxy_item_child_added), pmi);
+ g_signal_connect(G_OBJECT(priv->mi), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(proxy_item_child_removed), pmi);
+ g_signal_connect(G_OBJECT(priv->mi), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED, G_CALLBACK(proxy_item_child_moved), pmi);
+
+ /* Grab (cache) Properties */
/* Go through children and wrap them */