Debian Codegraph @

terminal/src/terminal-config.c

raw
1 /*
2 ** Login : <[email protected]>
3 ** Started on Fri Nov 30 05:31:31 2007 GESTES Cedric
4 ** $Id$
5 **
6 ** Copyright (C) 2007 GESTES Cedric
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 3 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
19 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 #include <string.h>
23 #include <cairo-dock.h>
24
25 #include "terminal-struct.h"
26 #include "terminal-init.h"
27 #include "terminal-widget.h"
28 #include "terminal-config.h"
29
30 CD_APPLET_GET_CONFIG_BEGIN
31 // Appearance
32 CD_CONFIG_GET_COLOR ("Configuration", "background color", &myConfig.backcolor);
33
34 CD_CONFIG_GET_COLOR ("Configuration", "foreground color", &myConfig.forecolor);
35
36 myConfig.bCustomFont = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "custom font", FALSE);
37 if (myConfig.bCustomFont)
38 myConfig.cCustomFont = CD_CONFIG_GET_STRING ("Configuration", "font");
39
40 // Behaviour
41 myConfig.bScrollOutput = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "scroll output", FALSE);
42 myConfig.bScrollKeystroke = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "scroll key", TRUE);
43 myConfig.bScrollback = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "scrollback", TRUE);
44 if (myConfig.bScrollback)
45 myConfig.iScrollback = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "scrollback length", 512);
46
47 // Terminal
48 myConfig.shortcut = CD_CONFIG_GET_STRING_WITH_DEFAULT ("Configuration", "shortkey", "<Ctrl>F1");
49 myConfig.iNbRows = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "nb lines", 25);
50 myConfig.iNbColumns = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "nb columns", 80);
51 myConfig.cTerminal = CD_CONFIG_GET_STRING ("Configuration", "terminal app");
52 CD_APPLET_GET_CONFIG_END
53
54
55 CD_APPLET_RESET_CONFIG_BEGIN
56 g_free (myConfig.shortcut);
57 myConfig.shortcut = NULL;
58 g_free (myConfig.cCustomFont);
59 g_free (myConfig.cTerminal);
60 CD_APPLET_RESET_CONFIG_END
61
62
63 CD_APPLET_RESET_DATA_BEGIN
64 if (myData.dialog)
65 {
66 gldi_object_unref (GLDI_OBJECT(myData.dialog)); // detruit aussi le widget interactif.
67 myData.dialog = NULL;
68 }
69 else if (myData.tab)
70 {
71 gldi_desklet_steal_interactive_widget (myDesklet);
72 g_object_unref (G_OBJECT (myData.tab));
73 }
74 myData.tab = NULL;
75 CD_APPLET_RESET_DATA_END