From 9a843265cf2bd6acfacb5bc00cf8a051add09661 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Sun, 8 Jan 2006 16:32:18 +0000 Subject: [PATCH] Initial import --- gnoemoe/mcp/gm-iuserlist.c | 40 ++++++++++++++++++++++++++++++++++++++ gnoemoe/mcp/gm-iuserlist.h | 30 ++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 gnoemoe/mcp/gm-iuserlist.c create mode 100644 gnoemoe/mcp/gm-iuserlist.h diff --git a/gnoemoe/mcp/gm-iuserlist.c b/gnoemoe/mcp/gm-iuserlist.c new file mode 100644 index 0000000..5d2167a --- /dev/null +++ b/gnoemoe/mcp/gm-iuserlist.c @@ -0,0 +1,40 @@ +#include "gm-iuserlist.h" + +GType +gm_iuserlist_get_type() { + static GType iuserlist_type = 0; + + if (iuserlist_type == 0) { + static const GTypeInfo iuserlist_info = { + sizeof (GmIUserlistInterface), + NULL, /* base_init */ + NULL, /* base_finalize */ + NULL, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + 0, + 0, /* n_preallocs */ + NULL /* instance_init */ + }; + + iuserlist_type = g_type_register_static(G_TYPE_INTERFACE, + "GmIUserlist", &iuserlist_info, 0); + } + + return iuserlist_type; +} + +GList * +gm_iuserlist_get_menu(GmIUserlist *self, gint id) { + GmIUserlistInterface *iface; + + g_return_val_if_fail(GM_IS_IUSERLIST(self), FALSE); + + iface = GM_IUSERLIST_GET_INTERFACE(self); + + if (iface->get_menu) { + return (* iface->get_menu) (self, id); + } else { + return NULL; + } +} diff --git a/gnoemoe/mcp/gm-iuserlist.h b/gnoemoe/mcp/gm-iuserlist.h new file mode 100644 index 0000000..f7fa15e --- /dev/null +++ b/gnoemoe/mcp/gm-iuserlist.h @@ -0,0 +1,30 @@ +#ifndef __GM_IUSERLIST_H__ +#define __GM_IUSERLIST_H__ + +#include +#include + +#define GM_TYPE_IUSERLIST (gm_iuserlist_get_type()) +#define GM_IUSERLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GM_TYPE_IUSERLIST, GmIUserlist)) +#define GM_IUSERLIST_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST((obj), \ + GM_TYPE_IUSERLIST, GmIUserlistInterface)) +#define GM_IS_IUSERLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GM_TYPE_IUSERLIST)) +#define GM_IUSERLIST_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE( \ + (inst), GM_TYPE_IUSERLIST, GmIUserlistInterface)) + +typedef struct _GmIUserlist GmIUserlist; /* dummy object */ +typedef struct _GmIUserlistInterface GmIUserlistInterface; + +struct _GmIUserlistInterface { + GTypeInterface parent; + + GList *(* get_menu) (GmIUserlist *self, gint id); +}; + +GType gm_iuserlist_get_type(); + +GList *gm_iuserlist_get_menu(GmIUserlist *self, gint id); + +#endif /* __GM_IUSERLIST_H__ */