* MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <lttv/lttv.h>
#include <lttvwindow/menu.h>
-inline LttvMenus *lttv_menus_new() {
- return g_array_new(FALSE, FALSE, sizeof(lttv_menu_closure));
+LttvMenus *lttv_menus_new() {
+ return g_array_new(FALSE, FALSE, sizeof(LttvMenuClosure));
}
/* MD: delete elements of the array also, but don't free pointed addresses
* (functions).
*/
-inline void lttv_menus_destroy(LttvMenus *h) {
+void lttv_menus_destroy(LttvMenus *h) {
g_debug("lttv_menus_destroy()");
g_array_free(h, TRUE);
}
-inline void lttv_menus_add(LttvMenus *h, lttv_constructor f, char* menuPath, char* menuText)
+LttvMenuClosure lttv_menus_add(LttvMenus *h,
+ lttvwindow_viewer_constructor f,
+ char* menu_path, char* menu_text, GtkWidget *widget)
{
- lttv_menu_closure c;
-
- /* if h is null, do nothing, or popup a warning message */
- if(h == NULL)return;
+ LttvMenuClosure c;
c.con = f;
- c.menuPath = menuPath;
- c.menuText = menuText;
- g_array_append_val(h,c);
+ c.menu_path = menu_path;
+ c.menu_text = menu_text;
+ c.widget = widget;
+ if(h != NULL) g_array_append_val(h,c);
+
+ return c;
}
-gboolean lttv_menus_remove(LttvMenus *h, lttv_constructor f)
+GtkWidget *lttv_menus_remove(LttvMenus *h, lttvwindow_viewer_constructor f)
{
- lttv_menu_closure * tmp;
- gint i;
+ LttvMenuClosure * tmp;
+ guint i;
+ GtkWidget *widget;
+
for(i=0;i<h->len;i++){
- tmp = & g_array_index(h, lttv_menu_closure, i);
- if(tmp->con == f)break;
+ tmp = & g_array_index(h, LttvMenuClosure, i);
+ if(tmp->con == f) {
+ widget = tmp->widget;
+ break;
+ }
}
if(i<h->len){
g_array_remove_index(h, i);
- return TRUE;
- }else return FALSE;
+ return widget;
+ }else return NULL;
}