quit menu complete
[lttv.git] / ltt / branches / poly / lttv / modules / gui / API / toolbar.c
CommitLineData
c4c15b5e 1#include <lttv/toolbar.h>
561f5852 2
3
4inline LttvToolbars *lttv_toolbars_new() {
5 return g_array_new(FALSE, FALSE, sizeof(lttv_toolbar_closure));
6}
7
8/* MD: delete elements of the array also, but don't free pointed addresses
9 * (functions).
10 */
11inline void lttv_toolbars_destroy(LttvToolbars *h) {
12 g_array_free(h, TRUE);
13}
14
c4c15b5e 15inline void lttv_toolbars_add(LttvToolbars *h, lttv_constructor f, char* tooltip, char ** pixmap)
561f5852 16{
17 lttv_toolbar_closure c;
18
19 /* if h is null, do nothing, or popup a warning message */
20 if(h == NULL)return;
21
22 c.con = f;
23 c.tooltip = tooltip;
24 c.pixmap = pixmap;
25 g_array_append_val(h,c);
26}
27
28gboolean lttv_toolbars_remove(LttvToolbars *h, lttv_constructor f)
29{
30 lttv_toolbar_closure * tmp;
31 gint i;
32 for(i=0;i<h->len;i++){
33 tmp = & g_array_index(h, lttv_toolbar_closure, i);
34 if(tmp->con == f)break;
35 }
36 if(i<h->len){
37 g_array_remove_index(h, i);
38 return TRUE;
39 }else return FALSE;
40}
41
42unsigned lttv_toolbars_number(LttvToolbars *h)
43{
44 return h->len;
45}
46
47
This page took 0.023861 seconds and 4 git commands to generate.