1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/**
* This file is a part of the Cairo-Dock project
*
* Copyright : (C) see the 'copyright' file.
* E-mail : see the 'copyright' file.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdlib.h"
#include "applet-config.h"
#include "applet-notifications.h"
#include "applet-struct.h"
#include "applet-init.h"
CD_APPLET_DEFINITION (N_("logout"),
2, 0, 0,
CAIRO_DOCK_CATEGORY_APPLET_DESKTOP,
N_("A very simple applet that adds an icon to log out from your session\n"
"Left click to log out or change the user, middle click to shutdown or restart\n"
" (you can invert the buttons if you prefer to shutdown on left-click)."),
"You can also lock the screen from the menu on right-click,\n"
" and program an automatic shutdown at a given time.\n"
"Fabounet (Fabrice Rey)")
CD_APPLET_INIT_BEGIN
if (myDesklet)
{
CD_APPLET_SET_DESKLET_RENDERER ("Simple");
}
CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE; // set the default icon if none is specified in conf.
if (g_iDesktopEnv == CAIRO_DOCK_GNOME) // on prend le controle de l'icone de la fenetre.
CD_APPLET_MANAGE_APPLICATION ("gnome-session"); // en fait depuis Gnome 2.28 seulement, avant c'etait x-session-manager.
else if (g_iDesktopEnv == CAIRO_DOCK_XFCE)
CD_APPLET_MANAGE_APPLICATION ("x-session-manager");
/// trouver celui de KDE ...
//\_______________ On enregistre nos notifications.
CD_APPLET_REGISTER_FOR_CLICK_EVENT;
CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT;
CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
//\_______________ On (re)lance l'eteignage programme.
cd_logout_set_timer ();
CD_APPLET_INIT_END
CD_APPLET_STOP_BEGIN
//\_______________ On se desabonne de nos notifications.
CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
CD_APPLET_MANAGE_APPLICATION (NULL); // on relache le controle de l'icone de la fenetre.
if (myData.iSidTimer != 0)
g_source_remove (myData.iSidTimer);
CD_APPLET_STOP_END
CD_APPLET_RELOAD_BEGIN
if (CD_APPLET_MY_CONFIG_CHANGED)
{
if (myDesklet && CD_APPLET_MY_CONTAINER_TYPE_CHANGED) // we are now in a desklet, set a renderer.
{
CD_APPLET_SET_DESKLET_RENDERER ("Simple");
}
CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE; // set the default icon if none is specified in conf.
}
CD_APPLET_RELOAD_END
|