waf: display warning if GUI frontend will not be built
[ladish.git] / gui / action.c
blob705c6035e49869b244169fa850d791faf1436933
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 GtkAction related 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 "action.h"
29 #include "gtk_builder.h"
30 #include "jack.h"
32 GtkAction * g_clear_xruns_and_max_dsp_action;
34 void init_actions_and_accelerators(void)
36 static GtkActionGroup * action_group_ptr;
37 static GtkAccelGroup * accel_group_ptr;
39 g_clear_xruns_and_max_dsp_action = GTK_ACTION(get_gtk_builder_object("clear_xruns_and_max_dsp_load_action"));
40 g_signal_connect(G_OBJECT(g_clear_xruns_and_max_dsp_action), "activate", G_CALLBACK(clear_xruns_and_max_dsp), NULL);
42 struct
44 GtkAction * action_ptr;
45 const char * shortcut;
46 } * descriptor_ptr, descriptors [] =
48 {g_clear_xruns_and_max_dsp_action, "c"},
49 {NULL, NULL}
52 action_group_ptr = gtk_action_group_new("main");
53 accel_group_ptr = gtk_accel_group_new();
55 for (descriptor_ptr = descriptors; descriptor_ptr->action_ptr != NULL; descriptor_ptr++)
57 //log_info("action '%s' -> shortcut \"%s\"", gtk_action_get_name(descriptor_ptr->action_ptr), descriptor_ptr->shortcut);
58 gtk_action_group_add_action_with_accel(action_group_ptr, descriptor_ptr->action_ptr, descriptor_ptr->shortcut);
59 gtk_action_set_accel_group(descriptor_ptr->action_ptr, accel_group_ptr);
60 gtk_action_connect_accelerator(descriptor_ptr->action_ptr);
63 gtk_window_add_accel_group(GTK_WINDOW(g_main_win), accel_group_ptr);
66 void enable_action(GtkAction * action)
68 gtk_action_set_sensitive(action, TRUE);
71 void disable_action(GtkAction * action)
73 gtk_action_set_sensitive(action, FALSE);