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

« back to all changes in this revision

Viewing changes to src/cairo-dock-internal-views.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 <string.h>
21
 
 
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"
29
 
 
30
 
CairoConfigViews myViews;
31
 
extern CairoDock *g_pMainDock;
32
 
 
33
 
static gboolean get_config (GKeyFile *pKeyFile, CairoConfigViews *pViews)
34
 
{
35
 
        gboolean bFlushConfFileNeeded = FALSE;
36
 
        
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);
41
 
 
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);
45
 
 
46
 
        pViews->fSubDockSizeRatio = cairo_dock_get_double_key_value (pKeyFile, "Views", "relative icon size", &bFlushConfFileNeeded, 0.8, "Sub-Docks", NULL);
47
 
 
48
 
        return bFlushConfFileNeeded;
49
 
}
50
 
 
51
 
 
52
 
static void reset_config (CairoConfigViews *pViews)
53
 
{
54
 
        g_free (pViews->cMainDockDefaultRendererName);
55
 
        g_free (pViews->cSubDockDefaultRendererName);
56
 
}
57
 
 
58
 
 
59
 
static void reload (CairoConfigViews *pPrevViews, CairoConfigViews *pViews)
60
 
{
61
 
        CairoDock *pDock = g_pMainDock;
62
 
        
63
 
        if (cairo_dock_strings_differ (pPrevViews->cMainDockDefaultRendererName, pViews->cMainDockDefaultRendererName))
64
 
        {
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);
68
 
        }
69
 
        
70
 
        if (cairo_dock_strings_differ (pPrevViews->cSubDockDefaultRendererName, pViews->cSubDockDefaultRendererName) ||
71
 
                pPrevViews->fSubDockSizeRatio != pViews->fSubDockSizeRatio)
72
 
        {
73
 
                if (pPrevViews->fSubDockSizeRatio != pViews->fSubDockSizeRatio)
74
 
                {
75
 
                        cairo_dock_synchronize_sub_docks_position (pDock, FALSE);
76
 
                        cairo_dock_reload_buffers_in_all_docks (TRUE);  // y compris les applets.
77
 
                }
78
 
                cairo_dock_set_all_views_to_default (2);  // met a jour la taille des sous-docks.
79
 
        }
80
 
}
81
 
 
82
 
 
83
 
DEFINE_PRE_INIT (Views)
84
 
{
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;
94
 
        
95
 
        pModule->reload = (CairoDockInternalModuleReloadFunc) reload;
96
 
        pModule->get_config = (CairoDockInternalModuleGetConfigFunc) get_config;
97
 
        pModule->reset_config = (CairoDockInternalModuleResetConfigFunc) reset_config;
98
 
        pModule->reset_data = NULL;
99
 
        
100
 
        pModule->pConfig = (CairoInternalModuleConfigPtr) &myViews;
101
 
        pModule->pData = NULL;
102
 
}