~helene-verhaeghe27/cairo-dock-core/bugfix

290.1.1 by matttbe
Added Gnu-GPL3 licence in all files + rename .sh
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
96 by fabounet
correction label + API opengl (en cours) + liste clock
20
#include <string.h>
21
#include <stdlib.h>
22
508 by fabounet
the Core can now be compiled with cmake : cmake CMakeLists.txt -DCMAKE_INSTALL_PREFIX=/usr
23
#include "../config.h"
215 by fabounet
restructuration des .h (en cours)
24
#include "cairo-dock-modules.h"
96 by fabounet
correction label + API opengl (en cours) + liste clock
25
#include "cairo-dock-load.h"
26
#include "cairo-dock-draw.h"
27
#include "cairo-dock-dock-factory.h"
215 by fabounet
restructuration des .h (en cours)
28
#include "cairo-dock-dock-facility.h"
96 by fabounet
correction label + API opengl (en cours) + liste clock
29
#include "cairo-dock-log.h"
30
#include "cairo-dock-icons.h"
31
#include "cairo-dock-draw-opengl.h"
32
#include "cairo-dock-dock-manager.h"
33
#include "cairo-dock-internal-taskbar.h"
192 by fabounet
et voila 2 versions en 2 jours ^_^
34
#include "cairo-dock-internal-indicators.h"
114 by fabounet
scroll pour les icones plutot que les vues => alt tab sur une classe d'appli
35
#include "cairo-dock-container.h"
461 by fabounet03
moved hte config for flat/physical separators in the main conf file + enhanced the opengl backend initialisation
36
#include "cairo-dock-keyfile-utilities.h"
315 by Fabounet (Fabrice Rey) - http://cairo-dock.org
added an option to place applis amongst launchers
37
#include "cairo-dock-class-manager.h"
96 by fabounet
correction label + API opengl (en cours) + liste clock
38
#define _INTERNAL_MODULE_
39
#include "cairo-dock-internal-icons.h"
40
41
CairoConfigIcons myIcons;
42
extern CairoDock *g_pMainDock;
43
extern gchar *g_cCurrentThemePath;
44
extern gboolean g_bUseOpenGL;
483 by fabounet
fixed the bug of the input shape with auto-hide on maximized window
45
extern CairoDockImageBuffer g_pDockBackgroundBuffer;
46
96 by fabounet
correction label + API opengl (en cours) + liste clock
47
48
static const gchar * s_cIconTypeNames[(CAIRO_DOCK_NB_TYPES+1)/2] = {"launchers", "applications", "applets"};
49
50
static gboolean get_config (GKeyFile *pKeyFile, CairoConfigIcons *pIcons)
51
{
52
	gboolean bFlushConfFileNeeded = FALSE;
53
	
54
	//\___________________ Ordre des icones.
55
	int i;
56
	for (i = 0; i < CAIRO_DOCK_NB_TYPES; i ++)
57
		pIcons->tIconTypeOrder[i] = i;
58
	gsize length=0;
265 by fabounet
code review of config widgets => plug-ins conf files are to update
59
	
453 by fabounet03 at gmail
reverted the option for icons order + added a function to draw the content of sub-docks as emblems (this is still experimental)
60
	int iSeparateIcons = 0;
61
	if (! g_key_file_has_key (pKeyFile, "Icons", "separate_icons", NULL))  // old parameters.
448 by Fabounet (Fabrice Rey) - http://cairo-dock.org
updated translations and doc + changed the separation of icons by type : separators are always inserted and applis are placed next to their launchers
62
	{
453 by fabounet03 at gmail
reverted the option for icons order + added a function to draw the content of sub-docks as emblems (this is still experimental)
63
		if (!g_key_file_get_boolean (pKeyFile, "Icons", "mix applets with launchers", NULL))
64
		{
65
			if (!g_key_file_get_boolean (pKeyFile, "Icons", "mix applis with launchers", NULL))
66
				iSeparateIcons = 3;
67
			else
68
				iSeparateIcons = 2;
69
		}
70
		else if (!g_key_file_get_boolean (pKeyFile, "Icons", "mix applis with launchers", NULL))
71
			iSeparateIcons = 1;
448 by Fabounet (Fabrice Rey) - http://cairo-dock.org
updated translations and doc + changed the separation of icons by type : separators are always inserted and applis are placed next to their launchers
72
	}
453 by fabounet03 at gmail
reverted the option for icons order + added a function to draw the content of sub-docks as emblems (this is still experimental)
73
	pIcons->iSeparateIcons = cairo_dock_get_integer_key_value (pKeyFile, "Icons", "separate_icons", &bFlushConfFileNeeded, iSeparateIcons , NULL, NULL);
448 by Fabounet (Fabrice Rey) - http://cairo-dock.org
updated translations and doc + changed the separation of icons by type : separators are always inserted and applis are placed next to their launchers
74
	
75
	cairo_dock_get_integer_list_key_value (pKeyFile, "Icons", "icon's type order", &bFlushConfFileNeeded, pIcons->iIconsTypesList, 3, NULL, "Cairo Dock", NULL);  // on le recupere meme si on ne separe pas les icones, pour le panneau de conf simple.
415 by Fabounet (Fabrice Rey) - http://cairo-dock.org
added a simple config panel (available as an easter egg for the moment) + fixed default font system size
76
	if (pIcons->iIconsTypesList[0] == 0 && pIcons->iIconsTypesList[1] == 0)  // old format.
96 by fabounet
correction label + API opengl (en cours) + liste clock
77
	{
283 by fabounet
correction of the icon's order bug + removed RB and Xmms from Makefile + improved theme's versionning
78
		g_print ("icon's type order : old format\n");
265 by fabounet
code review of config widgets => plug-ins conf files are to update
79
		gchar **cIconsTypesList = cairo_dock_get_string_list_key_value (pKeyFile, "Icons", "icon's type order", &bFlushConfFileNeeded, &length, NULL, "Cairo Dock", NULL);
80
		
81
		if (cIconsTypesList != NULL && length > 0)
96 by fabounet
correction label + API opengl (en cours) + liste clock
82
		{
283 by fabounet
correction of the icon's order bug + removed RB and Xmms from Makefile + improved theme's versionning
83
			g_print (" conversion ...\n");
265 by fabounet
code review of config widgets => plug-ins conf files are to update
84
			unsigned int i, j;
85
			for (i = 0; i < length; i ++)
96 by fabounet
correction label + API opengl (en cours) + liste clock
86
			{
283 by fabounet
correction of the icon's order bug + removed RB and Xmms from Makefile + improved theme's versionning
87
				g_print (" %d) %s\n", i, cIconsTypesList[i]);
265 by fabounet
code review of config widgets => plug-ins conf files are to update
88
				for (j = 0; j < ((CAIRO_DOCK_NB_TYPES + 1) / 2); j ++)
96 by fabounet
correction label + API opengl (en cours) + liste clock
89
				{
265 by fabounet
code review of config widgets => plug-ins conf files are to update
90
					if (strcmp (cIconsTypesList[i], s_cIconTypeNames[j]) == 0)
91
					{
283 by fabounet
correction of the icon's order bug + removed RB and Xmms from Makefile + improved theme's versionning
92
						g_print ("   => %d\n", j);
265 by fabounet
code review of config widgets => plug-ins conf files are to update
93
						pIcons->tIconTypeOrder[2*j] = 2 * i;
94
					}
96 by fabounet
correction label + API opengl (en cours) + liste clock
95
				}
96
			}
97
		}
265 by fabounet
code review of config widgets => plug-ins conf files are to update
98
		g_strfreev (cIconsTypesList);
99
		
415 by Fabounet (Fabrice Rey) - http://cairo-dock.org
added a simple config panel (available as an easter egg for the moment) + fixed default font system size
100
		pIcons->iIconsTypesList[0] = pIcons->tIconTypeOrder[2*0]/2;
101
		pIcons->iIconsTypesList[1] = pIcons->tIconTypeOrder[2*1]/2;
102
		pIcons->iIconsTypesList[2] = pIcons->tIconTypeOrder[2*2]/2;
103
		g_print ("mise a jour avec {%d;%d;%d}\n", pIcons->iIconsTypesList[0], pIcons->iIconsTypesList[1], pIcons->iIconsTypesList[2]);
104
		g_key_file_set_integer_list (pKeyFile, "Icons", "icon's type order", pIcons->iIconsTypesList, 3);
265 by fabounet
code review of config widgets => plug-ins conf files are to update
105
		bFlushConfFileNeeded = TRUE;
96 by fabounet
correction label + API opengl (en cours) + liste clock
106
	}
448 by Fabounet (Fabrice Rey) - http://cairo-dock.org
updated translations and doc + changed the separation of icons by type : separators are always inserted and applis are placed next to their launchers
107
	
453 by fabounet03 at gmail
reverted the option for icons order + added a function to draw the content of sub-docks as emblems (this is still experimental)
108
	for (i = 0; i < 3; i ++)
109
		pIcons->tIconTypeOrder[2*pIcons->iIconsTypesList[i]] = 2*i;
110
	if (pIcons->iSeparateIcons == 0)
448 by Fabounet (Fabrice Rey) - http://cairo-dock.org
updated translations and doc + changed the separation of icons by type : separators are always inserted and applis are placed next to their launchers
111
	{
112
		for (i = 0; i < 3; i ++)
113
			pIcons->tIconTypeOrder[2*i] = 0;
114
	}
453 by fabounet03 at gmail
reverted the option for icons order + added a function to draw the content of sub-docks as emblems (this is still experimental)
115
	else if (pIcons->iSeparateIcons == 1)
116
	{
117
		pIcons->tIconTypeOrder[CAIRO_DOCK_APPLET] = pIcons->tIconTypeOrder[CAIRO_DOCK_LAUNCHER];
118
	}
119
	else if (pIcons->iSeparateIcons == 2)
120
	{
121
		pIcons->tIconTypeOrder[CAIRO_DOCK_APPLI] = pIcons->tIconTypeOrder[CAIRO_DOCK_LAUNCHER];
122
	}
123
	
96 by fabounet
correction label + API opengl (en cours) + liste clock
124
	//\___________________ Reflets.
125
	pIcons->fFieldDepth = cairo_dock_get_double_key_value (pKeyFile, "Icons", "field depth", &bFlushConfFileNeeded, 0.7, NULL, NULL);
126
127
	pIcons->fAlbedo = cairo_dock_get_double_key_value (pKeyFile, "Icons", "albedo", &bFlushConfFileNeeded, .6, NULL, NULL);
128
129
	double fMaxScale = cairo_dock_get_double_key_value (pKeyFile, "Icons", "zoom max", &bFlushConfFileNeeded, 0., NULL, NULL);
130
	if (fMaxScale == 0)
131
	{
132
		pIcons->fAmplitude = g_key_file_get_double (pKeyFile, "Icons", "amplitude", NULL);
133
		fMaxScale = 1 + pIcons->fAmplitude;
134
		g_key_file_set_double (pKeyFile, "Icons", "zoom max", fMaxScale);
135
	}
136
	else
137
		pIcons->fAmplitude = fMaxScale - 1;
138
139
	pIcons->iSinusoidWidth = cairo_dock_get_integer_key_value (pKeyFile, "Icons", "sinusoid width", &bFlushConfFileNeeded, 250, NULL, NULL);
140
	pIcons->iSinusoidWidth = MAX (1, pIcons->iSinusoidWidth);
141
142
	pIcons->iIconGap = cairo_dock_get_integer_key_value (pKeyFile, "Icons", "icon gap", &bFlushConfFileNeeded, 0, NULL, NULL);
143
144
	//\___________________ Ficelle.
145
	pIcons->iStringLineWidth = cairo_dock_get_integer_key_value (pKeyFile, "Icons", "string width", &bFlushConfFileNeeded, 0, NULL, NULL);
146
147
	gdouble couleur[4];
148
	cairo_dock_get_double_list_key_value (pKeyFile, "Icons", "string color", &bFlushConfFileNeeded, pIcons->fStringColor, 4, couleur, NULL, NULL);
149
150
	pIcons->fAlphaAtRest = cairo_dock_get_double_key_value (pKeyFile, "Icons", "alpha at rest", &bFlushConfFileNeeded, 1., NULL, NULL);
151
	
407 by Fabounet (Fabrice Rey) - http://cairo-dock.org
small adjustments on the config panel
152
	//\___________________ Theme d'icone.
153
	pIcons->cIconTheme = cairo_dock_get_string_key_value (pKeyFile, "Icons", "default icon directory", &bFlushConfFileNeeded, NULL, "Launchers", NULL);
154
	if (g_key_file_has_key (pKeyFile, "Icons", "local icons", NULL))  // anciens parametres.
155
	{
156
		bFlushConfFileNeeded = TRUE;
157
		gboolean bUseLocalIcons = g_key_file_get_boolean (pKeyFile, "Icons", "local icons", NULL);
158
		if (bUseLocalIcons)
159
		{
160
			g_free (pIcons->cIconTheme);
161
			pIcons->cIconTheme = g_strdup ("_Custom Icons_");
162
			g_key_file_set_string (pKeyFile, "Icons", "default icon directory", pIcons->cIconTheme);
163
		}
164
	}
165
	pIcons->pDefaultIconDirectory = g_new0 (gpointer, 2 * 4);  // theme d'icone + theme local + theme default + NULL final.
242 by fabounet
qques fixs en tout genre (terminal, Sysmonitor, dnd2share, CD
166
	int j = 0;
407 by Fabounet (Fabrice Rey) - http://cairo-dock.org
small adjustments on the config panel
167
	gboolean bLocalIconsUsed = FALSE, bDefaultThemeUsed = FALSE;
242 by fabounet
qques fixs en tout genre (terminal, Sysmonitor, dnd2share, CD
168
	
407 by Fabounet (Fabrice Rey) - http://cairo-dock.org
small adjustments on the config panel
169
	if (pIcons->cIconTheme == NULL || *pIcons->cIconTheme == '\0')  // theme systeme.
170
	{
171
		j ++;
172
		bDefaultThemeUsed = TRUE;
173
	}
174
	else if (pIcons->cIconTheme[0] == '~')
175
	{
176
		pIcons->pDefaultIconDirectory[2*j] = g_strdup_printf ("%s%s", getenv ("HOME"), pIcons->cIconTheme+1);
177
		j ++;
178
	}
179
	else if (pIcons->cIconTheme[0] == '/')
180
	{
181
		pIcons->pDefaultIconDirectory[2*j] = g_strdup (pIcons->cIconTheme);
182
		j ++;
183
	}
184
	else if (strncmp (pIcons->cIconTheme, "_LocalTheme_", 12) == 0 || strncmp (pIcons->cIconTheme, "_ThemeDirectory_", 16) == 0 || strncmp (pIcons->cIconTheme, "_Custom Icons_", 14) == 0)
185
	{
186
		pIcons->pDefaultIconDirectory[2*j] = g_strdup_printf ("%s/%s", g_cCurrentThemePath, CAIRO_DOCK_LOCAL_ICONS_DIR);
187
		j ++;
188
		bLocalIconsUsed = TRUE;
189
	}
190
	else
191
	{
192
		pIcons->pDefaultIconDirectory[2*j+1] = gtk_icon_theme_new ();
193
		gtk_icon_theme_set_custom_theme (pIcons->pDefaultIconDirectory[2*j+1], pIcons->cIconTheme);
194
		j ++;
195
	}
196
	
197
	if (! bLocalIconsUsed)
198
	{
199
		pIcons->pDefaultIconDirectory[2*j] = g_strdup_printf ("%s/%s", g_cCurrentThemePath, CAIRO_DOCK_LOCAL_ICONS_DIR);
200
		j ++;
201
	}
202
	if (! bDefaultThemeUsed)
203
	{
204
		j ++;
205
	}
206
	pIcons->iNbIconPlaces = j;
96 by fabounet
correction label + API opengl (en cours) + liste clock
207
	
208
	gchar *cLauncherBackgroundImageName = cairo_dock_get_string_key_value (pKeyFile, "Icons", "icons bg", &bFlushConfFileNeeded, NULL, NULL, NULL);
209
	if (cLauncherBackgroundImageName != NULL)
210
	{
211
		pIcons->cBackgroundImagePath = cairo_dock_generate_file_path (cLauncherBackgroundImageName);
212
		g_free (cLauncherBackgroundImageName);
213
	}
456 by fabounet03
moved the option to draw subdock icons in the .desktop + default for application icons
214
		
96 by fabounet
correction label + API opengl (en cours) + liste clock
215
	//\___________________ Parametres des lanceurs.
216
	cairo_dock_get_size_key_value_helper (pKeyFile, "Icons", "launcher ", bFlushConfFileNeeded, pIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER], pIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER]);
118 by fabounet
plusieurs petites corrections au lancement
217
	if (pIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER] == 0)
218
		pIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER] = 48;
219
	if (pIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER] == 0)
220
		pIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER] = 48;
96 by fabounet
correction label + API opengl (en cours) + liste clock
221
	
222
	//\___________________ Parametres des applis.
223
	cairo_dock_get_size_key_value_helper (pKeyFile, "Icons", "appli ", bFlushConfFileNeeded, pIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLI], pIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLI]);
118 by fabounet
plusieurs petites corrections au lancement
224
	if (pIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLI] == 0)
225
		pIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLET] = pIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER];
226
	if (pIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLI] == 0)
227
		pIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLET] = pIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER];
96 by fabounet
correction label + API opengl (en cours) + liste clock
228
	
229
	//\___________________ Parametres des applets.
230
	cairo_dock_get_size_key_value_helper (pKeyFile, "Icons", "applet ", bFlushConfFileNeeded, pIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLET], pIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLET]);
118 by fabounet
plusieurs petites corrections au lancement
231
	if (pIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLET] == 0)
232
		pIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLET] = pIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER];
233
	if (pIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLET] == 0)
234
		pIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLET] = pIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER];
96 by fabounet
correction label + API opengl (en cours) + liste clock
235
	
236
	//\___________________ Parametres des separateurs.
237
	cairo_dock_get_size_key_value_helper (pKeyFile, "Icons", "separator ", bFlushConfFileNeeded, pIcons->tIconAuthorizedWidth[CAIRO_DOCK_SEPARATOR12], pIcons->tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12]);
238
	pIcons->tIconAuthorizedWidth[CAIRO_DOCK_SEPARATOR23] = pIcons->tIconAuthorizedWidth[CAIRO_DOCK_SEPARATOR12];
239
	pIcons->tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR23] = pIcons->tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12];
461 by fabounet03
moved hte config for flat/physical separators in the main conf file + enhanced the opengl backend initialisation
240
	
241
	pIcons->iSeparatorType = cairo_dock_get_integer_key_value (pKeyFile, "Icons", "separator type", &bFlushConfFileNeeded, -1, NULL, NULL);
242
	if (pIcons->iSeparatorType == -1)  // nouveau parametre, avant il etait dans dock-rendering.
243
	{
244
		pIcons->iSeparatorType = 0;  // ce qui suit est tres moche, mais c'est pour eviter d'avoir a repasser derriere tous les themes.
245
		gchar *cRenderingConfFile = g_strdup_printf ("%s/plug-ins/rendering/rendering.conf", g_cCurrentThemePath);
246
		gchar *cMainDockDefaultRendererName = g_key_file_get_string (pKeyFile, "Views", "main dock view", NULL);
247
		if (cMainDockDefaultRendererName && (strcmp (cMainDockDefaultRendererName, "3D plane") == 0 || strcmp (cMainDockDefaultRendererName, "curve") == 0))
248
		{
249
			GKeyFile *keyfile = cairo_dock_open_key_file (cRenderingConfFile);
250
			g_free (cRenderingConfFile);
251
			if (keyfile == NULL)
252
				pIcons->iSeparatorType = 0;
253
			else
254
			{
255
				gsize length=0;
256
				pIcons->iSeparatorType = g_key_file_get_integer (keyfile, "Inclinated Plane", "draw separator", NULL);
257
				double *color = g_key_file_get_double_list (keyfile, "Inclinated Plane", "separator color", &length, NULL);
258
				memcpy (pIcons->fSeparatorColor, color, 4*sizeof (gdouble));
259
				g_key_file_free (keyfile);
260
			}
261
		}
262
		g_key_file_set_integer (pKeyFile, "Icons", "separator type", pIcons->iSeparatorType);
263
	}
264
	else
265
	{
266
		double couleur[4] = {0.9,0.9,1.0,1.0};
267
		cairo_dock_get_double_list_key_value (pKeyFile, "Icons", "separator color", &bFlushConfFileNeeded, pIcons->fSeparatorColor, 4, couleur, NULL, NULL);
268
	}
96 by fabounet
correction label + API opengl (en cours) + liste clock
269
	pIcons->cSeparatorImage = cairo_dock_get_string_key_value (pKeyFile, "Icons", "separator image", &bFlushConfFileNeeded, NULL, "Separators", NULL);
270
271
	pIcons->bRevolveSeparator = cairo_dock_get_boolean_key_value (pKeyFile, "Icons", "revolve separator image", &bFlushConfFileNeeded, TRUE, "Separators", NULL);
272
273
	pIcons->bConstantSeparatorSize = cairo_dock_get_boolean_key_value (pKeyFile, "Icons", "force size", &bFlushConfFileNeeded, TRUE, "Separators", NULL);
274
	
275
	
276
	pIcons->fReflectSize = 0;
277
	for (i = 0; i < CAIRO_DOCK_NB_TYPES; i ++)
278
	{
279
		if (pIcons->tIconAuthorizedHeight[i] > 0)
280
			pIcons->fReflectSize = MAX (pIcons->fReflectSize, pIcons->tIconAuthorizedHeight[i]);
281
	}
282
	if (pIcons->fReflectSize == 0)  // on n'a pas trouve de hauteur, on va essayer avec la largeur.
283
	{
284
		for (i = 0; i < CAIRO_DOCK_NB_TYPES; i ++)
285
		{
286
			if (pIcons->tIconAuthorizedWidth[i] > 0)
287
				pIcons->fReflectSize = MAX (pIcons->fReflectSize, pIcons->tIconAuthorizedWidth[i]);
288
		}
289
		if (pIcons->fReflectSize > 0)
290
			pIcons->fReflectSize = MIN (48, pIcons->fReflectSize);
291
		else
292
			pIcons->fReflectSize = 48;
293
	}
294
	pIcons->fReflectSize *= pIcons->fFieldDepth;
295
	
296
	return bFlushConfFileNeeded;
297
}
298
299
300
static void reset_config (CairoConfigIcons *pIcons)
301
{
302
	if (pIcons->pDefaultIconDirectory != NULL)
303
	{
304
		gpointer data;
305
		int i;
407 by Fabounet (Fabrice Rey) - http://cairo-dock.org
small adjustments on the config panel
306
		for (i = 0; i < pIcons->iNbIconPlaces; i ++)
96 by fabounet
correction label + API opengl (en cours) + liste clock
307
		{
308
			if (pIcons->pDefaultIconDirectory[2*i] != NULL)
309
				g_free (pIcons->pDefaultIconDirectory[2*i]);
407 by Fabounet (Fabrice Rey) - http://cairo-dock.org
small adjustments on the config panel
310
			else if (pIcons->pDefaultIconDirectory[2*i+1] != NULL)
96 by fabounet
correction label + API opengl (en cours) + liste clock
311
				g_object_unref (pIcons->pDefaultIconDirectory[2*i+1]);
312
		}
407 by Fabounet (Fabrice Rey) - http://cairo-dock.org
small adjustments on the config panel
313
		g_free (pIcons->pDefaultIconDirectory);
96 by fabounet
correction label + API opengl (en cours) + liste clock
314
	}
315
	g_free (pIcons->cSeparatorImage);
316
	g_free (pIcons->cBackgroundImagePath);
407 by Fabounet (Fabrice Rey) - http://cairo-dock.org
small adjustments on the config panel
317
	g_free (pIcons->cIconTheme);
96 by fabounet
correction label + API opengl (en cours) + liste clock
318
}
319
320
321
static void reload (CairoConfigIcons *pPrevIcons, CairoConfigIcons *pIcons)
322
{
323
	CairoDock *pDock = g_pMainDock;
324
	double fMaxScale = cairo_dock_get_max_scale (pDock);
483 by fabounet
fixed the bug of the input shape with auto-hide on maximized window
325
	cairo_t* pCairoContext = cairo_dock_create_drawing_context_generic (CAIRO_CONTAINER (pDock));
265 by fabounet
code review of config widgets => plug-ins conf files are to update
326
	gboolean bInsertSeparators = FALSE;
96 by fabounet
correction label + API opengl (en cours) + liste clock
327
	
328
	gboolean bGroupOrderChanged;
329
	if (pPrevIcons->tIconTypeOrder[CAIRO_DOCK_LAUNCHER] != pIcons->tIconTypeOrder[CAIRO_DOCK_LAUNCHER] ||
330
		pPrevIcons->tIconTypeOrder[CAIRO_DOCK_APPLI] != pIcons->tIconTypeOrder[CAIRO_DOCK_APPLI] ||
192 by fabounet
et voila 2 versions en 2 jours ^_^
331
		pPrevIcons->tIconTypeOrder[CAIRO_DOCK_APPLET] != pIcons->tIconTypeOrder[CAIRO_DOCK_APPLET] ||
453 by fabounet03 at gmail
reverted the option for icons order + added a function to draw the content of sub-docks as emblems (this is still experimental)
332
		pPrevIcons->iSeparateIcons != pIcons->iSeparateIcons)
96 by fabounet
correction label + API opengl (en cours) + liste clock
333
		bGroupOrderChanged = TRUE;
334
	else
335
		bGroupOrderChanged = FALSE;
336
	
192 by fabounet
et voila 2 versions en 2 jours ^_^
337
	if (bGroupOrderChanged)
265 by fabounet
code review of config widgets => plug-ins conf files are to update
338
	{
339
		bInsertSeparators = TRUE;  // on enleve les separateurs avant de re-ordonner.
340
		cairo_dock_remove_automatic_separators (pDock);
315 by Fabounet (Fabrice Rey) - http://cairo-dock.org
added an option to place applis amongst launchers
341
		
453 by fabounet03 at gmail
reverted the option for icons order + added a function to draw the content of sub-docks as emblems (this is still experimental)
342
		if (pPrevIcons->iSeparateIcons && ! pIcons->iSeparateIcons)
315 by Fabounet (Fabrice Rey) - http://cairo-dock.org
added an option to place applis amongst launchers
343
		{
407 by Fabounet (Fabrice Rey) - http://cairo-dock.org
small adjustments on the config panel
344
			cairo_dock_reorder_classes ();  // on re-ordonne les applis a cote des lanceurs/applets.
315 by Fabounet (Fabrice Rey) - http://cairo-dock.org
added an option to place applis amongst launchers
345
		}
346
		
96 by fabounet
correction label + API opengl (en cours) + liste clock
347
		pDock->icons = g_list_sort (pDock->icons, (GCompareFunc) cairo_dock_compare_icons_order);
265 by fabounet
code review of config widgets => plug-ins conf files are to update
348
	}
242 by fabounet
qques fixs en tout genre (terminal, Sysmonitor, dnd2share, CD
349
	
453 by fabounet03 at gmail
reverted the option for icons order + added a function to draw the content of sub-docks as emblems (this is still experimental)
350
	if ((pPrevIcons->iSeparateIcons && ! pIcons->iSeparateIcons) ||
96 by fabounet
correction label + API opengl (en cours) + liste clock
351
		pPrevIcons->cSeparatorImage != pIcons->cSeparatorImage ||
242 by fabounet
qques fixs en tout genre (terminal, Sysmonitor, dnd2share, CD
352
		pPrevIcons->tIconAuthorizedWidth[CAIRO_DOCK_SEPARATOR12] != pIcons->tIconAuthorizedWidth[CAIRO_DOCK_SEPARATOR12] ||
353
		pPrevIcons->tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12] != pIcons->tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12] ||
354
		pPrevIcons->fAmplitude != pIcons->fAmplitude)
355
	{
356
		bInsertSeparators = TRUE;
233 by fabounet
amelioration dnd2share et correction 1 bug au reload -> Mav tu peux generer les paquets a partir de cette rev :-)
357
		cairo_dock_remove_automatic_separators (pDock);
242 by fabounet
qques fixs en tout genre (terminal, Sysmonitor, dnd2share, CD
358
	}
359
	
448 by Fabounet (Fabrice Rey) - http://cairo-dock.org
updated translations and doc + changed the separation of icons by type : separators are always inserted and applis are placed next to their launchers
360
	gboolean bThemeChanged = cairo_dock_strings_differ (pIcons->cIconTheme, pPrevIcons->cIconTheme);
122 by fabounet
2 bugs en moins + update theme winter
361
	
96 by fabounet
correction label + API opengl (en cours) + liste clock
362
	gboolean bIconBackgroundImagesChanged = FALSE;
363
	// if background images are different, reload them and trigger the reload of all icons
213 by fabounet
RB : simplification des pochettes + bug Exif manquant + bug au reload des indicateurs => v2.0.4
364
	if (cairo_dock_strings_differ (pPrevIcons->cBackgroundImagePath, pIcons->cBackgroundImagePath) ||
365
		pPrevIcons->fAmplitude != pIcons->fAmplitude)
96 by fabounet
correction label + API opengl (en cours) + liste clock
366
	{
367
		bIconBackgroundImagesChanged = TRUE;
483 by fabounet
fixed the bug of the input shape with auto-hide on maximized window
368
		cairo_dock_load_icons_background_surface (pIcons->cBackgroundImagePath, fMaxScale);
96 by fabounet
correction label + API opengl (en cours) + liste clock
369
	}
370
	
493 by fabounet
switch from pbuffer to fbo + added an option for unclickable desklets
371
	///cairo_dock_create_icon_pbuffer ();
372
	cairo_dock_create_icon_fbo ();
455 by fabounet03 at gmail
cleant a little + updated the .pot
373
	
96 by fabounet
correction label + API opengl (en cours) + liste clock
374
	if (pPrevIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER] != pIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER] ||
375
		pPrevIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER] != pIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER] ||
376
		pPrevIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLI] != pIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLI] ||
377
		pPrevIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLI] != pIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLI] ||
100 by fabounet
vue simple Slide en opengl
378
		pPrevIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLET] != pIcons->tIconAuthorizedWidth[CAIRO_DOCK_APPLET] ||
96 by fabounet
correction label + API opengl (en cours) + liste clock
379
		pPrevIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLET] != pIcons->tIconAuthorizedHeight[CAIRO_DOCK_APPLET] ||
315 by Fabounet (Fabrice Rey) - http://cairo-dock.org
added an option to place applis amongst launchers
380
		pPrevIcons->tIconAuthorizedWidth[CAIRO_DOCK_SEPARATOR12] != pIcons->tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12] ||
381
		pPrevIcons->tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12] != pIcons->tIconAuthorizedHeight[CAIRO_DOCK_SEPARATOR12] ||
96 by fabounet
correction label + API opengl (en cours) + liste clock
382
		pPrevIcons->fAmplitude != pIcons->fAmplitude ||
383
		(!g_bUseOpenGL && pPrevIcons->fFieldDepth != pIcons->fFieldDepth) ||
384
		(!g_bUseOpenGL && pPrevIcons->fAlbedo != pIcons->fAlbedo) ||
122 by fabounet
2 bugs en moins + update theme winter
385
		bThemeChanged ||
96 by fabounet
correction label + API opengl (en cours) + liste clock
386
		bIconBackgroundImagesChanged)  // oui on ne fait pas dans la finesse.
387
	{
483 by fabounet
fixed the bug of the input shape with auto-hide on maximized window
388
		g_pDockBackgroundBuffer.iWidth = g_pDockBackgroundBuffer.iHeight = 0.;  // pour mettre a jour les decorations.
96 by fabounet
correction label + API opengl (en cours) + liste clock
389
		cairo_dock_reload_buffers_in_all_docks (TRUE);  // TRUE <=> y compris les applets.
390
	}
391
	
242 by fabounet
qques fixs en tout genre (terminal, Sysmonitor, dnd2share, CD
392
	if (bInsertSeparators)
96 by fabounet
correction label + API opengl (en cours) + liste clock
393
	{
394
		cairo_dock_insert_separators_in_dock (pDock);
395
	}
396
	
461 by fabounet03
moved hte config for flat/physical separators in the main conf file + enhanced the opengl backend initialisation
397
	if (pPrevIcons->iSeparatorType != pIcons->iSeparatorType)
398
	{
399
		cairo_dock_update_dock_size (pDock);  // le chargement des separateurs plats se fait dans le calcul de max dock size.
400
	}
401
	
192 by fabounet
et voila 2 versions en 2 jours ^_^
402
	if (pPrevIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER] != pIcons->tIconAuthorizedWidth[CAIRO_DOCK_LAUNCHER] ||
213 by fabounet
RB : simplification des pochettes + bug Exif manquant + bug au reload des indicateurs => v2.0.4
403
		pPrevIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER] != pIcons->tIconAuthorizedHeight[CAIRO_DOCK_LAUNCHER] ||
404
		pPrevIcons->fAmplitude != pIcons->fAmplitude)
192 by fabounet
et voila 2 versions en 2 jours ^_^
405
	{
483 by fabounet
fixed the bug of the input shape with auto-hide on maximized window
406
		cairo_dock_load_active_window_indicator (myIndicators.cActiveIndicatorImagePath,
192 by fabounet
et voila 2 versions en 2 jours ^_^
407
			fMaxScale,
408
			myIndicators.iActiveCornerRadius,
409
			myIndicators.iActiveLineWidth,
410
			myIndicators.fActiveColor);
213 by fabounet
RB : simplification des pochettes + bug Exif manquant + bug au reload des indicateurs => v2.0.4
411
		if (myTaskBar.bShowAppli && myTaskBar.bGroupAppliByClass)
412
			cairo_dock_load_class_indicator (myIndicators.cClassIndicatorImagePath,
413
				fMaxScale);
414
		if (myTaskBar.bShowAppli && myTaskBar.bMixLauncherAppli)
415
			cairo_dock_load_task_indicator (myIndicators.cIndicatorImagePath,
416
				fMaxScale,
417
				myIndicators.fIndicatorRatio);
192 by fabounet
et voila 2 versions en 2 jours ^_^
418
	}
96 by fabounet
correction label + API opengl (en cours) + liste clock
419
	
483 by fabounet
fixed the bug of the input shape with auto-hide on maximized window
420
	g_pDockBackgroundBuffer.iWidth = g_pDockBackgroundBuffer.iHeight = 0.;
96 by fabounet
correction label + API opengl (en cours) + liste clock
421
	cairo_dock_set_all_views_to_default (0);  // met a jour la taille (decorations incluses) de tous les docks.
422
	cairo_dock_calculate_dock_icons (pDock);
423
	cairo_dock_redraw_root_docks (FALSE);  // main dock inclus.
424
	
425
	cairo_destroy (pCairoContext);
426
}
427
428
429
DEFINE_PRE_INIT (Icons)
430
{
503.1.1 by matttbe
Translations 1
431
	static const gchar *cDependencies[3] = {"Animated icons", N_("Provides various animations for your icons."), NULL};
96 by fabounet
correction label + API opengl (en cours) + liste clock
432
	pModule->cModuleName = "Icons";
186 by fabounet
correction du bug sur les miniatures + maj des scripts : option -m
433
	pModule->cTitle = N_("Icons");
489.1.1 by matttbe
New icons for the panel config (thanks to MastroPino & Humanity dev)
434
	pModule->cIcon = "icon-icons.svg";
145 by fabounet
Xgamma : gamma on startup + webeltl marge a droite & bashfr.org + correction labels + xterm pour les downloads
435
	pModule->cDescription = N_("All about icons :\n size, reflection, icon theme, ...");
96 by fabounet
correction label + API opengl (en cours) + liste clock
436
	pModule->iCategory = CAIRO_DOCK_CATEGORY_THEME;
437
	pModule->iSizeOfConfig = sizeof (CairoConfigIcons);
438
	pModule->iSizeOfData = 0;
439
	
440
	pModule->reload = (CairoDockInternalModuleReloadFunc) reload;
441
	pModule->get_config = (CairoDockInternalModuleGetConfigFunc) get_config;
442
	pModule->reset_config = (CairoDockInternalModuleResetConfigFunc) reset_config;
443
	pModule->reset_data = NULL;
444
	
445
	pModule->pConfig = (CairoInternalModuleConfigPtr) &myIcons;
446
	pModule->pData = NULL;
447
}