~ubuntu-branches/ubuntu/saucy/cairo-dock-plug-ins/saucy

« back to all changes in this revision

Viewing changes to terminal/src/terminal-config.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-08-26 21:07:39 UTC
  • Revision ID: james.westby@ubuntu.com-20090826210739-gyjuuqezrzuluao4
Tags: upstream-2.0.8.1
ImportĀ upstreamĀ versionĀ 2.0.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
* This file is a part of the Cairo-Dock project
 
3
*
 
4
* Copyright : (C) see the 'copyright' file.
 
5
* E-mail    : see the 'copyright' file.
 
6
*
 
7
* This program is free software; you can redistribute it and/or
 
8
* modify it under the terms of the GNU General Public License
 
9
* as published by the Free Software Foundation; either version 3
 
10
* of the License, or (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
* You should have received a copy of the GNU General Public License
 
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
*/
 
19
 
 
20
/*
 
21
** Login : <ctaf42@gmail.com>
 
22
** Started on  Fri Nov 30 05:31:31 2007 GESTES Cedric
 
23
** $Id$
 
24
**
 
25
** Copyright (C) 2007 GESTES Cedric
 
26
** This program is free software; you can redistribute it and/or modify
 
27
** it under the terms of the GNU General Public License as published by
 
28
** the Free Software Foundation; either version 3 of the License, or
 
29
** (at your option) any later version.
 
30
**
 
31
** This program is distributed in the hope that it will be useful,
 
32
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
33
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
34
** GNU General Public License for more details.
 
35
**
 
36
** You should have received a copy of the GNU General Public License
 
37
** along with this program; if not, write to the Free Software
 
38
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
39
*/
 
40
 
 
41
#include <string.h>
 
42
#include <cairo-dock.h>
 
43
 
 
44
#include "terminal-struct.h"
 
45
#include "terminal-init.h"
 
46
#include "terminal-widget.h"
 
47
#include "terminal-config.h"
 
48
 
 
49
 
 
50
 
 
51
static void set_color(GdkColor *color, double src[3]) {
 
52
  color->red = (guint16)(src[0] * 65535.);
 
53
  color->green = (guint16)(src[1] * 65535.);
 
54
  color->blue = (guint16)(src[2]* 65535.);
 
55
}
 
56
 
 
57
CD_APPLET_GET_CONFIG_BEGIN
 
58
  //0 means completely transparent and 65535 opaque
 
59
  myConfig.transparency = (guint16) (CD_CONFIG_GET_DOUBLE_WITH_DEFAULT ("GUI", "terminal transparency", .84) * 65535);  // 55000
 
60
 
 
61
  double color_back[3] = {1., 1., 1.};
 
62
  CD_CONFIG_GET_COLOR_RVB_WITH_DEFAULT ("GUI", "background color", color_back, color_back);
 
63
  set_color(&myConfig.backcolor, color_back);
 
64
 
 
65
  double color_fore[3] = {0., 0., 0.};
 
66
  CD_CONFIG_GET_COLOR_RVB_WITH_DEFAULT ("GUI", "foreground color", color_fore, color_fore);
 
67
  set_color(&myConfig.forecolor, color_fore);
 
68
 
 
69
  myConfig.shortcut = CD_CONFIG_GET_STRING_WITH_DEFAULT ("GUI", "shortkey", "<Ctrl>F1");
 
70
  myConfig.iNbRows = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("GUI", "nb lines", 25);
 
71
  myConfig.iNbColumns = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("GUI", "nb columns", 70);
 
72
CD_APPLET_GET_CONFIG_END
 
73
 
 
74
 
 
75
CD_APPLET_RESET_CONFIG_BEGIN
 
76
  if (myConfig.shortcut)
 
77
    cd_keybinder_unbind(myConfig.shortcut, (CDBindkeyHandler)term_on_keybinding_pull);
 
78
  g_free (myConfig.shortcut);
 
79
  myConfig.shortcut = NULL;
 
80
CD_APPLET_RESET_CONFIG_END
 
81
 
 
82
 
 
83
CD_APPLET_RESET_DATA_BEGIN
 
84
        if (myData.dialog)
 
85
        {
 
86
                cairo_dock_dialog_unreference (myData.dialog);  // detruit aussi le widget interactif.
 
87
                myData.dialog = NULL;
 
88
        }
 
89
        else if (myData.tab)
 
90
        {
 
91
                gtk_widget_destroy (myData.tab);
 
92
        }
 
93
        myData.tab = NULL;
 
94
CD_APPLET_RESET_DATA_END