aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-05-12 16:25:36 -0500
committerTed Gould <ted@canonical.com>2009-05-12 16:25:36 -0500
commit7b53f1b10253936c905c77e29187493c4e3781e7 (patch)
treeb8e5d9d1dbc61403fe5f27286d6cfe64ad0a334a
parent69228957b49867644ecc5351d5dc1e0f0458fc95 (diff)
downloadlibdbusmenu-7b53f1b10253936c905c77e29187493c4e3781e7.tar.gz
libdbusmenu-7b53f1b10253936c905c77e29187493c4e3781e7.tar.bz2
libdbusmenu-7b53f1b10253936c905c77e29187493c4e3781e7.zip
Adding in signals for child_added and child_removed
-rw-r--r--libdbusmenu-glib/menuitem-marshal.list1
-rw-r--r--libdbusmenu-glib/menuitem.c47
-rw-r--r--libdbusmenu-glib/menuitem.h38
3 files changed, 64 insertions, 22 deletions
diff --git a/libdbusmenu-glib/menuitem-marshal.list b/libdbusmenu-glib/menuitem-marshal.list
index 8962c1b..0d9d340 100644
--- a/libdbusmenu-glib/menuitem-marshal.list
+++ b/libdbusmenu-glib/menuitem-marshal.list
@@ -1 +1,2 @@
VOID: STRING, STRING
+VOID: OBJECT
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 2d50bc6..c4ffa3d 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -55,6 +55,9 @@ struct _DbusmenuMenuitemPrivate
/* Signals */
enum {
PROPERTY_CHANGED,
+ ITEM_ACTIVATED,
+ CHILD_ADDED,
+ CHILD_REMOVED,
LAST_SIGNAL
};
@@ -102,12 +105,44 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass)
updated or added.
*/
signals[PROPERTY_CHANGED] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED,
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(DbusmenuMenuitemClass, property_changed),
- NULL, NULL,
- _dbusmenu_menuitem_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(DbusmenuMenuitemClass, property_changed),
+ NULL, NULL,
+ _dbusmenu_menuitem_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
+ /**
+ DbusmenuMenuitem::child-added:
+ @arg0: The #DbusmenuMenuitem which is the parent.
+ @arg1: The #DbusmenuMenuitem which is the child.
+
+ Signaled when the child menuitem has been added to
+ the parent.
+ */
+ signals[CHILD_ADDED] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(DbusmenuMenuitemClass, child_added),
+ NULL, NULL,
+ _dbusmenu_menuitem_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 2, G_TYPE_OBJECT);
+ /**
+ DbusmenuMenuitem::child-removed:
+ @arg0: The #DbusmenuMenuitem which was the parent.
+ @arg1: The #DbusmenuMenuitem which was the child.
+
+ Signaled when the child menuitem has been requested to
+ be removed from the parent. This signal is called when
+ it has been removed from the list but not yet had
+ #g_object_unref called on it.
+ */
+ signals[CHILD_REMOVED] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(DbusmenuMenuitemClass, child_removed),
+ NULL, NULL,
+ _dbusmenu_menuitem_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 2, G_TYPE_OBJECT);
g_object_class_install_property (object_class, PROP_ID,
g_param_spec_uint("id", "ID for the menu item",
diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h
index 5b71ea6..122c9fb 100644
--- a/libdbusmenu-glib/menuitem.h
+++ b/libdbusmenu-glib/menuitem.h
@@ -44,11 +44,31 @@ G_BEGIN_DECLS
#define DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED "property-changed"
#define DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED "item-activated"
+#define DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED "child-added"
+#define DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED "child-removed"
+
+/**
+ DbusmenuMenuitem:
+
+ This is the #GObject based object that represents a menu
+ item. It gets created the same on both the client and
+ the server side and libdbusmenu-glib does the work of making
+ this object model appear on both sides of DBus. Simple
+ really, though through updates and people coming on and off
+ the bus it can lead to lots of fun complex scenarios.
+*/
+typedef struct _DbusmenuMenuitem DbusmenuMenuitem;
+struct _DbusmenuMenuitem
+{
+ GObject parent;
+};
/**
DbusmenuMenuitemClass:
@property_changed: Slot for #DbusmenuMenuitem::property-changed.
@item_activated: Slot for #DbusmenuMenuitem::item-activated.
+ @child_added: Slot for #DbusmenuMenuitem::child-added.
+ @child_removed: Slot for #DbusmenuMenuitem::child-removed.
@buildxml: Virtual function that appends the strings required
to represent this menu item in the menu XML file.
@reserved1: Reserved for future use.
@@ -64,6 +84,8 @@ struct _DbusmenuMenuitemClass
/* Signals */
void (*property_changed) (gchar * property, gchar * value);
void (*item_activated) (void);
+ void (*child_added) (DbusmenuMenuitem * child);
+ void (*child_removed) (DbusmenuMenuitem * child);
/* Virtual functions */
void (*buildxml) (GPtrArray * stringarray);
@@ -74,22 +96,6 @@ struct _DbusmenuMenuitemClass
void (*reserved4) (void);
};
-/**
- DbusmenuMenuitem:
-
- This is the #GObject based object that represents a menu
- item. It gets created the same on both the client and
- the server side and libdbusmenu-glib does the work of making
- this object model appear on both sides of DBus. Simple
- really, though through updates and people coming on and off
- the bus it can lead to lots of fun complex scenarios.
-*/
-typedef struct _DbusmenuMenuitem DbusmenuMenuitem;
-struct _DbusmenuMenuitem
-{
- GObject parent;
-};
-
GType dbusmenu_menuitem_get_type (void);
DbusmenuMenuitem * dbusmenu_menuitem_new (void);