~ubuntu-branches/ubuntu/saucy/cairo-dock-plug-ins/saucy

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-08-26 21:07:39 UTC
  • Revision ID: james.westby@ubuntu.com-20090826210739-gyjuuqezrzuluao4
Tags: upstream-2.0.8.1
ImportĀ upstreamĀ versionĀ 2.0.8.1

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
 
 
21
#include <string.h>
 
22
#include <cairo-dock.h>
 
23
 
 
24
#include "applet-struct.h"
 
25
#include "applet-config.h"
 
26
 
 
27
CD_APPLET_GET_CONFIG_BEGIN
 
28
        //\_________________ On recupere toutes les valeurs de notre fichier de conf.
 
29
        myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name");
 
30
        myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER ("Configuration", "delay");
 
31
        
 
32
        myConfig.iInfoDisplay = CD_CONFIG_GET_INTEGER ("Configuration", "info display");
 
33
        myConfig.cGThemePath = CD_CONFIG_GET_GAUGE_THEME ("Configuration", "theme");
 
34
        
 
35
        myConfig.bUseGraphic = CD_CONFIG_GET_BOOLEAN ("Configuration", "use graphic");
 
36
        myConfig.iGraphType = CD_CONFIG_GET_INTEGER ("Configuration", "graphic type");
 
37
        CD_CONFIG_GET_COLOR_RVB ("Configuration", "low color", myConfig.fLowColor);
 
38
        CD_CONFIG_GET_COLOR_RVB ("Configuration", "high color", myConfig.fHigholor);
 
39
        CD_CONFIG_GET_COLOR ("Configuration", "bg color", myConfig.fBgColor);
 
40
        
 
41
        myConfig.fAlpha = CD_CONFIG_GET_DOUBLE ("Configuration", "watermark alpha");
 
42
        if (myConfig.fAlpha != 0)
 
43
        {
 
44
                myConfig.cWatermarkImagePath = CD_CONFIG_GET_FILE_PATH ("Configuration", "watermark image", MY_APPLET_ICON_FILE);
 
45
        }
 
46
        
 
47
        myConfig.iNbDisplayedProcesses = CD_CONFIG_GET_INTEGER ("Configuration", "top");
 
48
        myConfig.iProcessCheckInterval = CD_CONFIG_GET_INTEGER ("Configuration", "top delay");
 
49
        
 
50
        myConfig.pTopTextDescription = cairo_dock_duplicate_label_description (&myDialogs.dialogTextDescription);
 
51
        CD_CONFIG_GET_COLOR_RVB ("Configuration", "top color start", myConfig.pTopTextDescription->fColorStart);
 
52
        CD_CONFIG_GET_COLOR_RVB ("Configuration", "top color stop", myConfig.pTopTextDescription->fColorStop);
 
53
        myConfig.pTopTextDescription->bVerticalPattern = TRUE;
 
54
        
 
55
        myConfig.cSystemMonitorCommand = CD_CONFIG_GET_STRING ("Configuration", "sys monitor");
 
56
        myConfig.fUserHZ = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "HZ", 100);
 
57
CD_APPLET_GET_CONFIG_END
 
58
 
 
59
 
 
60
CD_APPLET_RESET_CONFIG_BEGIN
 
61
        g_free (myConfig.defaultTitle);
 
62
        cairo_dock_free_label_description (myConfig.pTopTextDescription);
 
63
        g_free (myConfig.cWatermarkImagePath);
 
64
        g_free (myConfig.cSystemMonitorCommand);
 
65
CD_APPLET_RESET_CONFIG_END
 
66
 
 
67
 
 
68
CD_APPLET_RESET_DATA_BEGIN
 
69
        cairo_dock_free_task (myData.pTask);
 
70
        g_timer_destroy (myData.pClock);
 
71
        
 
72
        cairo_dock_free_gauge (myData.pGauge);
 
73
        cairo_dock_free_graph (myData.pGraph);
 
74
        
 
75
        cairo_dock_free_task (myData.pTopTask);
 
76
        if (myData.pTopClock != NULL)
 
77
                g_timer_destroy (myData.pTopClock);
 
78
        g_free (myData.pTopList);
 
79
        if (myData.pProcessTable != NULL)
 
80
                g_hash_table_destroy (myData.pProcessTable);
 
81
        cairo_surface_destroy (myData.pTopSurface);
 
82
CD_APPLET_RESET_DATA_END
 
83