~cairo-dock-team/cairo-dock-plug-ins/plug-ins

« back to all changes in this revision

Viewing changes to switcher/src/applet-config.c

  • Committer: Matthieu Baerts
  • Date: 2014-10-19 00:26:10 UTC
  • Revision ID: matttbe@gmail.com-20141019002610-ulf26s9b4c4rw10r
We just switched from BZR to Git.
Follow us on Github: https://github.com/Cairo-Dock

Note: we will only use Github to manage our source code and all pull requests.
Please continue to report your bugs/ideas/messages on our forum or Launchpad! 

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
 
#include <string.h>
21
 
 
22
 
#include "applet-struct.h"
23
 
#include "applet-config.h"
24
 
#include "applet-load-icons.h"
25
 
 
26
 
 
27
 
CD_APPLET_GET_CONFIG_BEGIN
28
 
        //\_________________ On recupere toutes les valeurs de notre fichier de conf.
29
 
        myConfig.bCompactView = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "view", 1);
30
 
        myConfig.bPreserveScreenRatio = CD_CONFIG_GET_BOOLEAN ("Configuration", "preserve ratio");
31
 
        myConfig.iIconDrawing = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "icon drawing", 0);
32
 
        myConfig.bDisplayNumDesk = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display numero desktop", TRUE);
33
 
        myConfig.bDrawWindows = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Draw Windows", TRUE);
34
 
        myConfig.bDisplayHiddenWindows = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Draw hidden Windows", TRUE);
35
 
        myConfig.iActionOnMiddleClick = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "action on click", 0);
36
 
        myConfig.iDesktopsLayout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "layout", SWICTHER_LAYOUT_AUTO);
37
 
        myConfig.bDrawIcons = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Draw icons", TRUE);
38
 
        
39
 
        myConfig.bUseDefaultColors = (CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "style", 1) == 0);
40
 
        
41
 
        if (myConfig.bUseDefaultColors)
42
 
        {
43
 
                myConfig.iInLineSize = myConfig.iLineSize = myStyleParam.iLineWidth;
44
 
        }
45
 
        else
46
 
        {
47
 
                // color of internal lines
48
 
                myConfig.iInLineSize = CD_CONFIG_GET_INTEGER("Configuration", "inlinesize");
49
 
                double inlinecolor[4] = {0., 0., 0.5, 1.};
50
 
                CD_CONFIG_GET_COLOR_RGBA_WITH_DEFAULT ("Configuration", "rgbinlinecolor",myConfig.RGBInLineColors, inlinecolor);
51
 
                
52
 
                // color of the current desktop
53
 
                double indcolor[4] = {0., 0., 0.5, 1.};
54
 
                CD_CONFIG_GET_COLOR_RGBA_WITH_DEFAULT ("Configuration", "rgbindcolor",myConfig.RGBIndColors, indcolor);
55
 
                // color of external lines
56
 
                myConfig.iLineSize = CD_CONFIG_GET_INTEGER("Configuration", "linesize");
57
 
                double linecolor[4] = {0., 0., 0.5, 1.};
58
 
                CD_CONFIG_GET_COLOR_RGBA_WITH_DEFAULT ("Configuration", "rgblinecolor",myConfig.RGBLineColors, linecolor);
59
 
                
60
 
                // color of windows' lines
61
 
                double wlinecolor[4] = {0., 0., 0.5, 1.};
62
 
                CD_CONFIG_GET_COLOR_RGBA_WITH_DEFAULT ("Configuration", "rgbwlinecolor", myConfig.RGBWLineColors, wlinecolor);
63
 
                
64
 
                // color of the background
65
 
                double fillbcolor[4] = {0., 0., 0., 1.};
66
 
                CD_CONFIG_GET_COLOR_RGBA_WITH_DEFAULT ("Configuration", "rgbbgcolor", myConfig.RGBBgColors, fillbcolor);
67
 
        }
68
 
        
69
 
        myConfig.iDrawCurrentDesktopMode = CD_CONFIG_GET_INTEGER ("Configuration", "fill current");
70
 
        
71
 
        // color of windows
72
 
        myConfig.bFillAllWindows = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "fill windows", FALSE);
73
 
        double fillwcolor[4] = {0.33, 0.33, 0.33, 1.};
74
 
        CD_CONFIG_GET_COLOR_RGBA_WITH_DEFAULT ("Configuration", "rgbfindcolor", myConfig.RGBWFillColors, fillwcolor);
75
 
        
76
 
        if (myConfig.iIconDrawing == SWICTHER_MAP_IMAGE)
77
 
                myConfig.cDefaultIcon = CD_CONFIG_GET_FILE_PATH ("Configuration", "default icon", "default.svg");
78
 
        myConfig.cRenderer = CD_CONFIG_GET_STRING ("Configuration", "renderer");
79
 
        
80
 
        gsize iNbNamesSize;
81
 
        myConfig.cDesktopNames = CD_CONFIG_GET_STRING_LIST_WITH_DEFAULT ("Configuration", "desktop names", &iNbNamesSize, "Work;Game;Video;Chat");  // used to be a #U widget, but since it can be set from different ways (the applet's menu or the desktop tools), it's not useful to have it in the config
82
 
CD_APPLET_GET_CONFIG_END
83
 
 
84
 
 
85
 
CD_APPLET_RESET_CONFIG_BEGIN
86
 
        g_free (myConfig.cRenderer);
87
 
        g_free (myConfig.cDefaultIcon);
88
 
        if (myConfig.cDesktopNames != NULL)
89
 
                g_strfreev (myConfig.cDesktopNames);
90
 
CD_APPLET_RESET_CONFIG_END
91
 
 
92
 
 
93
 
CD_APPLET_RESET_DATA_BEGIN
94
 
        CD_APPLET_DELETE_MY_ICONS_LIST;
95
 
        cairo_surface_destroy (myData.pDefaultMapSurface);
96
 
        cairo_surface_destroy (myData.pDesktopBgMapSurface);
97
 
        if (myData.cDesktopNames != NULL)
98
 
                g_strfreev (myData.cDesktopNames);
99
 
CD_APPLET_RESET_DATA_END