Mercurial > pidgin
diff finch/libgnt/gntmenuitem.c @ 21256:e8b0f224483f
Add gnt_menuitem_activate, and 'activate' signal for GntMenuItem.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 20 Oct 2007 05:52:52 +0000 |
parents | b65f1bff6412 |
children | 88d889b54df4 |
line wrap: on
line diff
--- a/finch/libgnt/gntmenuitem.c Sat Oct 20 05:50:48 2007 +0000 +++ b/finch/libgnt/gntmenuitem.c Sat Oct 20 05:52:52 2007 +0000 @@ -23,6 +23,13 @@ #include "gntmenu.h" #include "gntmenuitem.h" +enum +{ + SIG_ACTIVATE, + SIGS +}; +static guint signals[SIGS] = { 0 }; + static GObjectClass *parent_class = NULL; static void @@ -44,10 +51,18 @@ parent_class = g_type_class_peek_parent(klass); obj_class->dispose = gnt_menuitem_destroy; + + signals[SIG_ACTIVATE] = + g_signal_new("activate", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void -gnt_menuitem_init(GTypeInstance *instance, gpointer class) +gnt_menuitem_init(GTypeInstance *instance, gpointer klass) { } @@ -131,3 +146,13 @@ return item->priv.id; } +gboolean gnt_menuitem_activate(GntMenuItem *item) +{ + g_signal_emit(item, signals[SIG_ACTIVATE], 0); + if (item->callback) { + item->callback(item, item->callbackdata); + return TRUE; + } + return FALSE; +} +