Initial import
This commit is contained in:
parent
c59b768027
commit
9a843265cf
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef __GM_IUSERLIST_H__
|
||||
#define __GM_IUSERLIST_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
|
||||
#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__ */
|
Reference in New Issue