1 /* Hey EMACS -*- linux-c -*- */
2 /* $Id$ */
3 
4 /*  TiLP - Tilp Is a Linking Program
5  *  Copyright (C) 1999-2006  Romain Lievin
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software Foundation,
19  *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include <gtk/gtk.h>
23 
24 #include "tilp_core.h"
25 #include "gstruct.h"
26 #include "support.h"
27 #include "toolbar.h"
28 
29 struct toolbar_window toolbar_wnd = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
30 struct menubar_window menubar_wnd = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
31 
32 /* Put some buttons of the toolbar as sensitive according to some options */
toolbar_refresh_buttons(void)33 void toolbar_refresh_buttons(void)
34 {
35 	CalcFeatures features;
36 
37 	if (toolbar_wnd.toolbar == NULL)
38 		return;
39 
40 	features = ticalcs_calc_features(calc_handle);
41 
42 	gtk_widget_set_sensitive(toolbar_wnd.button10, features & OPS_ISREADY);
43 	gtk_widget_set_sensitive(toolbar_wnd.button11, features & OPS_DIRLIST);
44 	gtk_widget_set_sensitive(toolbar_wnd.button12, features & OPS_BACKUP);
45 	gtk_widget_set_sensitive(toolbar_wnd.button13, features & OPS_BACKUP);
46 	gtk_widget_set_sensitive(toolbar_wnd.button14, features & FTS_NONSILENT);
47 	gtk_widget_set_sensitive(toolbar_wnd.button15, features & FTS_NONSILENT);
48 
49 	gtk_widget_set_sensitive(menubar_wnd.backup, features & OPS_BACKUP);
50 	gtk_widget_set_sensitive(menubar_wnd.restore, features & OPS_BACKUP);
51 	gtk_widget_set_sensitive(menubar_wnd.setclock, features & OPS_CLOCK);
52 	gtk_widget_set_sensitive(menubar_wnd.idlist, features & OPS_IDLIST);
53 	gtk_widget_set_sensitive(menubar_wnd.dumprom, features & OPS_ROMDUMP);
54 	gtk_widget_set_sensitive(menubar_wnd.restore, features & OPS_BACKUP);
55 
56 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menubar_wnd.viewlocal), options.full_gui);
57 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menubar_wnd.showall), options.show_all);
58 }
59