#include <lttv/lttv.h>
#include <lttvwindow/toolbar.h>
-
-inline LttvToolbars *lttv_toolbars_new() {
+LttvToolbars *lttv_toolbars_new() {
return g_array_new(FALSE, FALSE, sizeof(LttvToolbarClosure));
}
/* MD: delete elements of the array also, but don't free pointed addresses
* (functions).
*/
-inline void lttv_toolbars_destroy(LttvToolbars *h) {
+void lttv_toolbars_destroy(LttvToolbars *h) {
g_debug("lttv_toolbars_destroy");
g_array_free(h, TRUE);
}
-inline void lttv_toolbars_add(LttvToolbars *h, lttvwindow_viewer_constructor f, char* tooltip, char ** pixmap, GtkWidget *widget)
+LttvToolbarClosure lttv_toolbars_add(LttvToolbars *h,
+ lttvwindow_viewer_constructor f,
+ char* tooltip, char ** pixmap, GtkWidget *widget)
{
LttvToolbarClosure c;
- /* if h is null, do nothing, or popup a warning message */
- if(h == NULL)return;
-
c.con = f;
c.tooltip = tooltip;
c.pixmap = pixmap;
c.widget = widget;
- g_array_append_val(h,c);
+ if(h != NULL) g_array_append_val(h,c);
+
+ return c;
}
-gboolean lttv_toolbars_remove(LttvToolbars *h, lttvwindow_viewer_constructor f)
+GtkWidget *lttv_toolbars_remove(LttvToolbars *h, lttvwindow_viewer_constructor f)
{
LttvToolbarClosure * tmp;
- gint i;
+ guint i;
+ GtkWidget *widget;
+
for(i=0;i<h->len;i++){
tmp = & g_array_index(h, LttvToolbarClosure, i);
- if(tmp->con == f)break;
+ 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;
}
unsigned lttv_toolbars_number(LttvToolbars *h)