~ubuntu-branches/ubuntu/maverick/cairo-dock/maverick

« back to all changes in this revision

Viewing changes to src/cairo-dock-internal-system.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20100809232612-yp4c6ig3jt1bzpdv
Tags: 2.2.0~0beta4-0ubuntu1
* New Upstream Version (LP: #614624)
* Fixed a few bugs on LP:
 - LP: #518453: Dock appears under all windows
                 (Compiz - fullscreen window)
 - LP: #521369: Separator are not removed when closing
                 grouped windows
 - LP: #521762: Some sentences are not correct
 - LP: #526466: Icons of apps with same class shouldn't
                 be stacked by default
 - LP: #535083: Dialogues looks ugly when a lot of them
                 appears at the same time
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - Man pages are now included in the source code
* debian/copyright:
 - Updated with the new pathes and new files
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev as Build-deps
 - Bump Standard-Version to 3.9.1
* debian/cairo-dock-core.install:
 - Man pages are now included in the source code
 - All sonames are now installed into lib32 or lib64
* debian/cairo-dock-dev.install:
 - pkgconfig is now installed into lib32 or lib64

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 <math.h>
21
 
#include "cairo-dock-modules.h"
22
 
#include "cairo-dock-load.h"
23
 
#include "cairo-dock-opengl.h"
24
 
#include "cairo-dock-dock-manager.h"
25
 
#include "cairo-dock-dock-facility.h"
26
 
#include "cairo-dock-file-manager.h"
27
 
#define _INTERNAL_MODULE_
28
 
#include "cairo-dock-internal-system.h"
29
 
 
30
 
CairoConfigSystem mySystem;
31
 
extern CairoDock *g_pMainDock;
32
 
extern CairoDockGLConfig g_openglConfig;
33
 
extern gboolean g_bUseOpenGL;
34
 
extern CairoDockDesktopBackground *g_pFakeTransparencyDesktopBg;
35
 
 
36
 
static gboolean get_config (GKeyFile *pKeyFile, CairoConfigSystem *pSystem)
37
 
{
38
 
        gboolean bFlushConfFileNeeded = FALSE;
39
 
        
40
 
        // lisibilite des labels
41
 
        pSystem->fLabelAlphaThreshold = cairo_dock_get_double_key_value (pKeyFile, "System", "alpha threshold", &bFlushConfFileNeeded, 10., "Labels", NULL);
42
 
        pSystem->fLabelAlphaThreshold = (pSystem->fLabelAlphaThreshold + 10.) / 10.;  // [0;50] -> [1;6]
43
 
        pSystem->bTextAlwaysHorizontal = cairo_dock_get_boolean_key_value (pKeyFile, "System", "always horizontal", &bFlushConfFileNeeded, FALSE, "Labels", NULL);
44
 
        
45
 
        // vitesse des animations.
46
 
        pSystem->bAnimateOnAutoHide = cairo_dock_get_boolean_key_value (pKeyFile, "System", "animate on auto-hide", &bFlushConfFileNeeded, TRUE, NULL, NULL);
47
 
        
48
 
        pSystem->bAnimateSubDock = cairo_dock_get_boolean_key_value (pKeyFile, "System", "animate subdocks", &bFlushConfFileNeeded, TRUE, "Sub-Docks", NULL);
49
 
        
50
 
        pSystem->iUnfoldingDuration = cairo_dock_get_integer_key_value (pKeyFile, "System", "unfold duration", &bFlushConfFileNeeded, 400, NULL, NULL);
51
 
        
52
 
        int iNbSteps = cairo_dock_get_integer_key_value (pKeyFile, "System", "grow nb steps", &bFlushConfFileNeeded, 10, NULL, NULL);
53
 
        iNbSteps = MAX (iNbSteps, 1);
54
 
        pSystem->iGrowUpInterval = MAX (1, CAIRO_DOCK_NB_MAX_ITERATIONS / iNbSteps);
55
 
        
56
 
        iNbSteps = cairo_dock_get_integer_key_value (pKeyFile, "System", "shrink nb steps", &bFlushConfFileNeeded, 8, NULL, NULL);
57
 
        iNbSteps = MAX (iNbSteps, 1);
58
 
        pSystem->iShrinkDownInterval = MAX (1, CAIRO_DOCK_NB_MAX_ITERATIONS / iNbSteps);
59
 
        
60
 
        iNbSteps = cairo_dock_get_integer_key_value (pKeyFile, "System", "move up nb steps", &bFlushConfFileNeeded, 10, NULL, NULL);
61
 
        iNbSteps = MAX (iNbSteps, 1);
62
 
        pSystem->fMoveUpSpeed = 1. - pow (10., -2. / iNbSteps);
63
 
        
64
 
        iNbSteps = cairo_dock_get_integer_key_value (pKeyFile, "System", "move down nb steps", &bFlushConfFileNeeded, 12, NULL, NULL);
65
 
        iNbSteps = MAX (iNbSteps, 1);
66
 
        pSystem->fMoveDownSpeed = 1. - pow (10., -2. / iNbSteps);
67
 
        
68
 
        // frequence de rafraichissement.
69
 
        int iRefreshFrequency = cairo_dock_get_integer_key_value (pKeyFile, "System", "refresh frequency", &bFlushConfFileNeeded, 25, NULL, NULL);
70
 
        pSystem->fRefreshInterval = 1000. / iRefreshFrequency;
71
 
        pSystem->bDynamicReflection = cairo_dock_get_boolean_key_value (pKeyFile, "System", "dynamic reflection", &bFlushConfFileNeeded, FALSE, NULL, NULL);
72
 
        
73
 
        iRefreshFrequency = cairo_dock_get_integer_key_value (pKeyFile, "System", "opengl anim freq", &bFlushConfFileNeeded, 33, NULL, NULL);
74
 
        pSystem->iGLAnimationDeltaT = 1000. / iRefreshFrequency;
75
 
        iRefreshFrequency = cairo_dock_get_integer_key_value (pKeyFile, "System", "cairo anim freq", &bFlushConfFileNeeded, 25, NULL, NULL);
76
 
        pSystem->iCairoAnimationDeltaT = 1000. / iRefreshFrequency;
77
 
        
78
 
        pSystem->iFileSortType = cairo_dock_get_integer_key_value (pKeyFile, "System", "sort files", &bFlushConfFileNeeded, CAIRO_DOCK_FM_SORT_BY_NAME, NULL, NULL);
79
 
        pSystem->bShowHiddenFiles = cairo_dock_get_boolean_key_value (pKeyFile, "System", "show hidden files", &bFlushConfFileNeeded, FALSE, NULL, NULL);
80
 
 
81
 
        pSystem->bUseFakeTransparency = cairo_dock_get_boolean_key_value (pKeyFile, "System", "fake transparency", &bFlushConfFileNeeded, FALSE, NULL, NULL);
82
 
        if (g_bUseOpenGL && ! g_openglConfig.bAlphaAvailable)
83
 
                pSystem->bUseFakeTransparency = TRUE;
84
 
        pSystem->bConfigPanelTransparency = cairo_dock_get_boolean_key_value (pKeyFile, "System", "config transparency", &bFlushConfFileNeeded, TRUE, NULL, NULL);
85
 
        
86
 
        pSystem->iFadeOutNbSteps = cairo_dock_get_integer_key_value (pKeyFile, "System", "fade out nb steps", &bFlushConfFileNeeded, 15, NULL, NULL);
87
 
        
88
 
        gsize length=0;
89
 
        pSystem->cActiveModuleList = cairo_dock_get_string_list_key_value (pKeyFile, "System", "modules", &bFlushConfFileNeeded, &length, NULL, "Applets", "modules_0");
90
 
        
91
 
        pSystem->iConnectionTimeout = cairo_dock_get_integer_key_value (pKeyFile, "System", "conn timeout", &bFlushConfFileNeeded, 5, NULL, NULL);
92
 
        pSystem->iConnectiontMaxTime = cairo_dock_get_integer_key_value (pKeyFile, "System", "conn max time", &bFlushConfFileNeeded, 120, NULL, NULL);
93
 
        pSystem->iConnectiontNbRetries = cairo_dock_get_integer_key_value (pKeyFile, "System", "conn retry", &bFlushConfFileNeeded, 0, NULL, NULL);
94
 
        
95
 
        return bFlushConfFileNeeded;
96
 
}
97
 
 
98
 
 
99
 
static void reset_config (CairoConfigSystem *pSystem)
100
 
{
101
 
        g_free (pSystem->cActiveModuleList);
102
 
}
103
 
 
104
 
 
105
 
static void reload (CairoConfigSystem *pPrevSystem, CairoConfigSystem *pSystem)
106
 
{
107
 
        CairoDock *pDock = g_pMainDock;
108
 
        
109
 
        //\_______________ Fake Transparency.
110
 
        if (pSystem->bUseFakeTransparency && ! pPrevSystem->bUseFakeTransparency)
111
 
        {
112
 
                gtk_window_set_keep_below (GTK_WINDOW (pDock->container.pWidget), TRUE);
113
 
                g_pFakeTransparencyDesktopBg = cairo_dock_get_desktop_background (g_bUseOpenGL);
114
 
        }
115
 
        else if (! pSystem->bUseFakeTransparency && pPrevSystem->bUseFakeTransparency)
116
 
        {
117
 
                gtk_window_set_keep_below (GTK_WINDOW (pDock->container.pWidget), FALSE);
118
 
                cairo_dock_destroy_desktop_background (g_pFakeTransparencyDesktopBg);
119
 
                g_pFakeTransparencyDesktopBg = NULL;
120
 
        }
121
 
        
122
 
        if (pSystem->bTextAlwaysHorizontal != pPrevSystem->bTextAlwaysHorizontal)
123
 
        {
124
 
                cairo_dock_reload_buffers_in_all_docks (TRUE);  // les modules aussi.
125
 
        }
126
 
        
127
 
        if (pSystem->iFileSortType != pPrevSystem->iFileSortType || pSystem->bShowHiddenFiles != pPrevSystem->bShowHiddenFiles)
128
 
        {
129
 
                /// re-ordonner les icones ayant un cURI != NULL;
130
 
        }
131
 
}
132
 
 
133
 
 
134
 
DEFINE_PRE_INIT (System)
135
 
{
136
 
        pModule->cModuleName = "System";
137
 
        pModule->cTitle = N_("System");
138
 
        pModule->cIcon = "icon-system.png";
139
 
        pModule->cDescription = N_("All the parameters you will never want to tweak.");
140
 
        pModule->iCategory = CAIRO_DOCK_CATEGORY_SYSTEM;
141
 
        pModule->iSizeOfConfig = sizeof (CairoConfigSystem);
142
 
        pModule->iSizeOfData = 0;
143
 
        
144
 
        pModule->reload = (CairoDockInternalModuleReloadFunc) reload;
145
 
        pModule->get_config = (CairoDockInternalModuleGetConfigFunc) get_config;
146
 
        pModule->reset_config = NULL;
147
 
        pModule->reset_data = NULL;
148
 
        
149
 
        pModule->pConfig = (CairoInternalModuleConfigPtr) &mySystem;
150
 
        pModule->pData = NULL;
151
 
}