aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-16 11:26:18 -0500
committerTed Gould <ted@canonical.com>2009-04-16 11:26:18 -0500
commit1c3341e725030bd50bc953f3dead9782bf0e3871 (patch)
tree48e865f5c3d19482160f91aa0e56c8b67516f40e /libdbusmenu-glib
parentc6483c1852a4bf840b7609eb7872f46a73cb1638 (diff)
downloadlibdbusmenu-1c3341e725030bd50bc953f3dead9782bf0e3871.tar.gz
libdbusmenu-1c3341e725030bd50bc953f3dead9782bf0e3871.tar.bz2
libdbusmenu-1c3341e725030bd50bc953f3dead9782bf0e3871.zip
Adding in the server signals
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/Makefile.am16
-rw-r--r--libdbusmenu-glib/server-marshal.list1
-rw-r--r--libdbusmenu-glib/server.c45
-rw-r--r--libdbusmenu-glib/server.h15
4 files changed, 72 insertions, 5 deletions
diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am
index e248403..2bc23ec 100644
--- a/libdbusmenu-glib/Makefile.am
+++ b/libdbusmenu-glib/Makefile.am
@@ -20,6 +20,8 @@ libdbusmenu_glib_la_SOURCES = \
menuitem.c \
server.h \
server.c \
+ server-marshal.h \
+ server-marshal.c \
client.h \
client.c
@@ -39,7 +41,9 @@ pkgconfigdir = $(libdir)/pkgconfig
BUILT_SOURCES = \
dbusmenu-client.h \
- dbusmenu-server.h
+ dbusmenu-server.h \
+ server-marshal.h \
+ server-marshal.c
dbusmenu-server.h: dbus-menu.xml
dbus-binding-tool \
@@ -55,3 +59,13 @@ dbusmenu-client.h: dbus-menu.xml
--output=dbusmenu-client.h \
$(srcdir)/dbus-menu.xml
+server-marshal.h: $(srcdir)/server-marshal.list
+ glib-genmarshal --header \
+ --prefix=_dbusmenu_server_marshal $(srcdir)/server-marshal.list \
+ > server-marshal.h
+
+server-marshal.c: $(srcdir)/server-marshal.list
+ glib-genmarshal --body \
+ --prefix=_dbusmenu_server_marshal $(srcdir)/server-marshal.list \
+ > server-marshal.c
+
diff --git a/libdbusmenu-glib/server-marshal.list b/libdbusmenu-glib/server-marshal.list
new file mode 100644
index 0000000..950fc9d
--- /dev/null
+++ b/libdbusmenu-glib/server-marshal.list
@@ -0,0 +1 @@
+VOID: UINT, STRING, STRING
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index 7115eaa..39e70d2 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -3,6 +3,7 @@
#endif
#include "server.h"
+#include "server-marshal.h"
/* DBus Prototypes */
static gboolean _dbusmenu_server_get_property (void);
@@ -12,17 +13,31 @@ static gboolean _dbusmenu_server_list_properties (void);
#include "dbusmenu-server.h"
+/* Privates, I'll show you mine... */
typedef struct _DbusmenuServerPrivate DbusmenuServerPrivate;
struct _DbusmenuServerPrivate
{
DbusmenuMenuitem * root;
+ gchar * dbusobject;
};
#define DBUSMENU_SERVER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_SERVER, DbusmenuServerPrivate))
-static void dbusmenu_server_class_init (DbusmenuServerClass *klass);
+/* Signals */
+enum {
+ ID_PROP_UPDATE,
+ ID_UPDATE,
+ LAYOUT_UPDATE,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+/* Properties */
+
+static void dbusmenu_server_class_init (DbusmenuServerClass *class);
static void dbusmenu_server_init (DbusmenuServer *self);
static void dbusmenu_server_dispose (GObject *object);
static void dbusmenu_server_finalize (GObject *object);
@@ -30,15 +45,37 @@ static void dbusmenu_server_finalize (GObject *object);
G_DEFINE_TYPE (DbusmenuServer, dbusmenu_server, G_TYPE_OBJECT);
static void
-dbusmenu_server_class_init (DbusmenuServerClass *klass)
+dbusmenu_server_class_init (DbusmenuServerClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
- g_type_class_add_private (klass, sizeof (DbusmenuServerPrivate));
+ g_type_class_add_private (class, sizeof (DbusmenuServerPrivate));
object_class->dispose = dbusmenu_server_dispose;
object_class->finalize = dbusmenu_server_finalize;
+ signals[ID_PROP_UPDATE] = g_signal_new(DBUSMENU_SERVER_SIGNAL_ID_PROP_UPDATE,
+ G_TYPE_FROM_CLASS(class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(DbusmenuServerClass, id_prop_update),
+ NULL, NULL,
+ _dbusmenu_server_marshal_VOID__UINT_STRING_STRING,
+ G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
+ signals[ID_UPDATE] = g_signal_new(DBUSMENU_SERVER_SIGNAL_ID_UPDATE,
+ G_TYPE_FROM_CLASS(class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(DbusmenuServerClass, id_update),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE, 1, G_TYPE_UINT);
+ signals[LAYOUT_UPDATE] = g_signal_new(DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE,
+ G_TYPE_FROM_CLASS(class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(DbusmenuServerClass, layout_update),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
dbus_g_object_type_install_info(DBUSMENU_TYPE_SERVER, &dbus_glib__dbusmenu_server_object_info);
return;
diff --git a/libdbusmenu-glib/server.h b/libdbusmenu-glib/server.h
index a39b3b8..45a47e1 100644
--- a/libdbusmenu-glib/server.h
+++ b/libdbusmenu-glib/server.h
@@ -15,11 +15,26 @@ G_BEGIN_DECLS
#define DBUSMENU_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUSMENU_TYPE_SERVER))
#define DBUSMENU_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUSMENU_TYPE_SERVER, DbusmenuServerClass))
+#define DBUSMENU_SERVER_SIGNAL_ID_PROP_UPDATE "id-prop-update"
+#define DBUSMENU_SERVER_SIGNAL_ID_UPDATE "id-update"
+#define DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE "layout-update"
+
typedef struct _DbusmenuServer DbusmenuServer;
typedef struct _DbusmenuServerClass DbusmenuServerClass;
struct _DbusmenuServerClass {
GObjectClass parent_class;
+
+ /* Signals */
+ void (*id_prop_update)(guint id, gchar * property, gchar * value);
+ void (*id_update)(guint id);
+ void (*layout_update)(void);
+
+ /* Reserved */
+ void (*dbusmenu_server_reserved1)(void);
+ void (*dbusmenu_server_reserved2)(void);
+ void (*dbusmenu_server_reserved3)(void);
+ void (*dbusmenu_server_reserved4)(void);
};
struct _DbusmenuServer {