Fix unused-parameter warnings in plain C code
[ladish.git] / gui / studio_list.c
blobfd1e8d72b247ea0b0c210a13a9aa995b47a7b5f1
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2010 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains the studio list handling code
9 **************************************************************************
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "internal.h"
28 #include "gtk_builder.h"
29 #include "../proxies/control_proxy.h"
30 #include "dynmenu.h"
32 static ladish_dynmenu_handle g_load_studio_list;
33 static ladish_dynmenu_handle g_delete_studio_list;
35 struct ladish_studio_list_closure
37 void
38 (* callback)(
39 void * context,
40 const char * name,
41 void * data,
42 ladish_dynmenu_item_activate_callback item_activate_callback,
43 void (* data_free)());
44 void * context;
47 #define closure_ptr ((struct ladish_studio_list_closure * )context)
49 static
50 void
51 add_item(
52 void * context,
53 const char * studio_name)
55 closure_ptr->callback(closure_ptr->context, studio_name, NULL, NULL, NULL);
58 #undef closure_ptr
60 static
61 bool
62 fill_callback(
63 void
64 (* callback)(
65 void * context,
66 const char * name,
67 void * data,
68 ladish_dynmenu_item_activate_callback item_activate_callback,
69 void (* data_free)()),
70 void * context)
72 struct ladish_studio_list_closure closure;
74 closure.callback = callback;
75 closure.context = context;
77 return control_proxy_get_studio_list(add_item, &closure);
80 static void on_load_studio_wrapper(const char * name, void * data)
82 ASSERT(data == NULL);
83 on_load_studio(name);
86 static void on_delete_studio_wrapper(const char * name, void * data)
88 ASSERT(data == NULL);
89 on_delete_studio(name);
92 bool create_studio_lists(void)
94 if (!ladish_dynmenu_create(
95 "menu_item_load_studio",
96 "load_studio_menu",
97 fill_callback,
98 "studio list",
99 on_load_studio_wrapper,
100 &g_load_studio_list))
102 return false;
105 if (!ladish_dynmenu_create(
106 "menu_item_delete_studio",
107 "delete_studio_menu",
108 fill_callback,
109 "studio list",
110 on_delete_studio_wrapper,
111 &g_delete_studio_list))
113 ladish_dynmenu_destroy(g_load_studio_list);
114 return false;
117 return true;
120 void destroy_studio_lists(void)
122 ladish_dynmenu_destroy(g_delete_studio_list);
123 ladish_dynmenu_destroy(g_load_studio_list);