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

« back to all changes in this revision

Viewing changes to shortcuts/src/applet-init.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
 
 
22
This file is a part of the cairo-dock program,
 
23
released under the terms of the GNU General Public License.
 
24
 
 
25
Written by Fabrice Rey (for any bug report, please mail me to fabounet@users.berlios.de)
 
26
 
 
27
*********************************************************************************/
 
28
#include "stdlib.h"
 
29
#include "string.h"
 
30
 
 
31
#include "applet-config.h"
 
32
#include "applet-notifications.h"
 
33
#include "applet-bookmarks.h"
 
34
#include "applet-load-icons.h"
 
35
#include "applet-struct.h"
 
36
#include "applet-init.h"
 
37
 
 
38
 
 
39
CD_APPLET_DEFINITION ("shortcuts",
 
40
        2, 0, 0,
 
41
        CAIRO_DOCK_CATEGORY_DESKTOP,
 
42
        N_("An applet that let you access quickly to all of your shortcuts.\n"
 
43
        "It can manage disks, network points, and Nautilus bookmarks (even if you don't have Nautilus).\n"
 
44
        "Drag and drop a folder on the main icon or the sub-dock to add a bookmark.\n"
 
45
        "Middle-click on the main icon to acces your desktop easily.\n"
 
46
        "Middle-click on a mounting point icon to (un)mount is quickly.\n"
 
47
        "The applet can also display valuable information about your disks, like free space, type, etc."),
 
48
        "Fabounet (Fabrice Rey) & Jackass (Benjamin SANS)")
 
49
 
 
50
 
 
51
CD_APPLET_INIT_BEGIN
 
52
        /*if (myIcon->acName == NULL && myDock)
 
53
        {
 
54
                CD_APPLET_SET_NAME_FOR_MY_ICON (SHORTCUTS_DEFAULT_NAME);
 
55
        }*/
 
56
        CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE;  // set the default icon if none is specified in conf.
 
57
        
 
58
        //\_______________ On charge les icones dans un sous-dock.
 
59
        myData.pTask = cairo_dock_new_task (0,
 
60
                (CairoDockGetDataAsyncFunc) cd_shortcuts_get_shortcuts_data,
 
61
                (CairoDockUpdateSyncFunc) cd_shortcuts_build_shortcuts_from_data,
 
62
                myApplet);
 
63
        cairo_dock_launch_task (myData.pTask);
 
64
        
 
65
        CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
 
66
        CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT;
 
67
        CD_APPLET_REGISTER_FOR_DROP_DATA_EVENT;
 
68
CD_APPLET_INIT_END
 
69
 
 
70
 
 
71
CD_APPLET_STOP_BEGIN
 
72
        //\_______________ On se desabonne de nos notifications.
 
73
        CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
 
74
        CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
 
75
        CD_APPLET_UNREGISTER_FOR_DROP_DATA_EVENT;
 
76
CD_APPLET_STOP_END
 
77
 
 
78
 
 
79
CD_APPLET_RELOAD_BEGIN
 
80
        //\_______________ On recharge les donnees qui ont pu changer.
 
81
        if (CD_APPLET_MY_CONFIG_CHANGED)
 
82
        {
 
83
                //\_______________ On charge les icones dans un sous-dock.
 
84
                cd_shortcuts_reset_all_datas (myApplet);  // stoppe les mesures.
 
85
                
 
86
                /*if (myIcon->acName == NULL && myDock)
 
87
                {
 
88
                        CD_APPLET_SET_NAME_FOR_MY_ICON (SHORTCUTS_DEFAULT_NAME);
 
89
                }*/
 
90
                CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE;  // set the default icon if none is specified in conf.
 
91
                
 
92
                myData.pTask = cairo_dock_new_task (0,
 
93
                        (CairoDockGetDataAsyncFunc) cd_shortcuts_get_shortcuts_data,
 
94
                        (CairoDockUpdateSyncFunc) cd_shortcuts_build_shortcuts_from_data,
 
95
                        myApplet);
 
96
                cairo_dock_launch_task (myData.pTask);
 
97
        }
 
98
        else if (myDesklet)
 
99
        {
 
100
                cairo_dock_set_desklet_renderer_by_name (myDesklet, "Tree", NULL, CAIRO_DOCK_LOAD_ICONS_FOR_DESKLET, NULL);  // on n'a pas besoin du context sur myIcon.
 
101
        }
 
102
        else
 
103
        {
 
104
                // rien a faire, cairo-dock va recharger notre sous-dock.
 
105
        }
 
106
CD_APPLET_RELOAD_END
 
107