2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
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.
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/>.
22
#include "cairo-dock-modules.h"
23
#include "cairo-dock-load.h"
24
#include "cairo-dock-log.h"
25
#include "cairo-dock-dock-manager.h"
26
#include "cairo-dock-internal-accessibility.h"
27
#define _INTERNAL_MODULE_
28
#include "cairo-dock-internal-views.h"
30
CairoConfigViews myViews;
31
extern CairoDock *g_pMainDock;
33
static gboolean get_config (GKeyFile *pKeyFile, CairoConfigViews *pViews)
35
gboolean bFlushConfFileNeeded = FALSE;
37
pViews->cMainDockDefaultRendererName = cairo_dock_get_string_key_value (pKeyFile, "Views", "main dock view", &bFlushConfFileNeeded, CAIRO_DOCK_DEFAULT_RENDERER_NAME, "Cairo Dock", NULL);
38
if (pViews->cMainDockDefaultRendererName == NULL)
39
pViews->cMainDockDefaultRendererName = g_strdup (CAIRO_DOCK_DEFAULT_RENDERER_NAME);
40
cd_message ("cMainDockDefaultRendererName <- %s", pViews->cMainDockDefaultRendererName);
42
pViews->cSubDockDefaultRendererName = cairo_dock_get_string_key_value (pKeyFile, "Views", "sub-dock view", &bFlushConfFileNeeded, CAIRO_DOCK_DEFAULT_RENDERER_NAME, "Sub-Docks", NULL);
43
if (pViews->cSubDockDefaultRendererName == NULL)
44
pViews->cSubDockDefaultRendererName = g_strdup (CAIRO_DOCK_DEFAULT_RENDERER_NAME);
46
pViews->fSubDockSizeRatio = cairo_dock_get_double_key_value (pKeyFile, "Views", "relative icon size", &bFlushConfFileNeeded, 0.8, "Sub-Docks", NULL);
48
return bFlushConfFileNeeded;
52
static void reset_config (CairoConfigViews *pViews)
54
g_free (pViews->cMainDockDefaultRendererName);
55
g_free (pViews->cSubDockDefaultRendererName);
59
static void reload (CairoConfigViews *pPrevViews, CairoConfigViews *pViews)
61
CairoDock *pDock = g_pMainDock;
63
if (cairo_dock_strings_differ (pPrevViews->cMainDockDefaultRendererName, pViews->cMainDockDefaultRendererName))
65
cairo_dock_set_all_views_to_default (1); // met a jour la taille des docks principaux.
66
cairo_dock_redraw_root_docks (FALSE); // FALSE <=> main dock inclus.
67
cairo_dock_reserve_space_for_all_root_docks (myAccessibility.bReserveSpace);
70
if (cairo_dock_strings_differ (pPrevViews->cSubDockDefaultRendererName, pViews->cSubDockDefaultRendererName) ||
71
pPrevViews->fSubDockSizeRatio != pViews->fSubDockSizeRatio)
73
if (pPrevViews->fSubDockSizeRatio != pViews->fSubDockSizeRatio)
75
cairo_dock_synchronize_sub_docks_position (pDock, FALSE);
76
cairo_dock_reload_buffers_in_all_docks (TRUE); // y compris les applets.
78
cairo_dock_set_all_views_to_default (2); // met a jour la taille des sous-docks.
83
DEFINE_PRE_INIT (Views)
85
static const gchar *cDependencies[3] = {"dock rendering", N_("It provides different views to Cairo-Dock. Activate it first if you want to select a different view for your docks."), NULL};
86
pModule->cModuleName = "Views";
87
pModule->cTitle = N_("Views");
88
pModule->cIcon = "icon-views.png";
89
pModule->cDescription = N_("Select a view for each of your docks.");
90
pModule->iCategory = CAIRO_DOCK_CATEGORY_THEME;
91
pModule->iSizeOfConfig = sizeof (CairoConfigViews);
92
pModule->iSizeOfData = 0;
93
pModule->cDependencies = cDependencies;
95
pModule->reload = (CairoDockInternalModuleReloadFunc) reload;
96
pModule->get_config = (CairoDockInternalModuleGetConfigFunc) get_config;
97
pModule->reset_config = (CairoDockInternalModuleResetConfigFunc) reset_config;
98
pModule->reset_data = NULL;
100
pModule->pConfig = (CairoInternalModuleConfigPtr) &myViews;
101
pModule->pData = NULL;