~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/icon-factory/cairo-dock-applet-factory.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

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 <string.h>
 
22
#include <stdlib.h>
 
23
#include <cairo.h>
 
24
 
 
25
#include "cairo-dock-icons.h"
 
26
#include "cairo-dock-modules.h"
 
27
#include "cairo-dock-log.h"
 
28
#include "cairo-dock-applet-factory.h"
 
29
 
 
30
 
 
31
Icon *cairo_dock_new_applet_icon (CairoDockMinimalAppletConfig *pMinimalConfig, CairoDockModuleInstance *pModuleInstance)
 
32
{
 
33
        //\____________ On cree l'icone.
 
34
        Icon *icon = g_new0 (Icon, 1);
 
35
        icon->iType = CAIRO_DOCK_APPLET;
 
36
        icon->iTrueType = CAIRO_DOCK_ICON_TYPE_APPLET;
 
37
        icon->pModuleInstance = pModuleInstance;
 
38
        
 
39
        //\____________ On recupere les infos de sa config.
 
40
        icon->cName = g_strdup (pMinimalConfig->cLabel);
 
41
        icon->cFileName = g_strdup (pMinimalConfig->cIconFileName);
 
42
        
 
43
        icon->fOrder = pMinimalConfig->fOrder;
 
44
        icon->bAlwaysVisible = pMinimalConfig->bAlwaysVisible;
 
45
        
 
46
        if (! pMinimalConfig->bIsDetached)
 
47
        {
 
48
                icon->fWidth = pMinimalConfig->iDesiredIconWidth;
 
49
                icon->fHeight = pMinimalConfig->iDesiredIconHeight;
 
50
                icon->cParentDockName = g_strdup (pMinimalConfig->cDockName != NULL ? pMinimalConfig->cDockName : CAIRO_DOCK_MAIN_DOCK_NAME);
 
51
        }
 
52
        else  // l'applet creera la surface elle-meme, car on ne sait ni la taille qu'elle voudra lui donner, ni meme si elle l'utilisera !
 
53
        {
 
54
                icon->fWidth = -1;
 
55
                icon->fHeight = -1;
 
56
        }
 
57
        icon->fScale = 1;
 
58
        icon->fGlideScale = 1;
 
59
        icon->fWidthFactor = 1.;
 
60
        icon->fHeightFactor = 1.;
 
61
        
 
62
        return icon;
 
63
}