2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
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.
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/>.
20
/**********************************************************************************
22
This file is a part of the cairo-dock clock applet,
23
released under the terms of the GNU General Public License.
25
Written by Fabrice Rey (for any bug report, please mail me to fabounet@users.berlios.de)
27
**********************************************************************************/
33
#include "applet-struct.h"
34
#include "applet-draw.h"
35
#include "applet-notifications.h"
38
static void _cd_clock_launch_time_admin (GtkMenuItem *menu_item, CairoDockModuleInstance *myApplet)
40
if (myConfig.cSetupTimeCommand != NULL)
42
cairo_dock_launch_command (myConfig.cSetupTimeCommand);
46
if (! cairo_dock_fm_setup_time ())
48
if (g_iDesktopEnv == CAIRO_DOCK_KDE)
50
cairo_dock_launch_command ("kcmshell kde-clock.desktop");
54
cd_warning ("couldn't guess what to do to set up time.");
63
CD_APPLET_ON_CLICK_BEGIN
64
if (myData.pCalendarDialog != NULL)
66
cairo_dock_dialog_unreference (myData.pCalendarDialog);
67
myData.pCalendarDialog = NULL;
71
GtkWidget *pCalendar = gtk_calendar_new ();
72
myData.pCalendarDialog = cairo_dock_show_dialog_full (_("Calendar"),
75
MY_APPLET_SHARE_DATA_DIR"/dates.svg",
79
CD_APPLET_ON_CLICK_END
82
CD_APPLET_ON_BUILD_MENU_BEGIN
83
GtkWidget *pSubMenu = CD_APPLET_CREATE_MY_SUB_MENU ();
84
CD_APPLET_ADD_IN_MENU (D_("Set up time and date"), _cd_clock_launch_time_admin, pSubMenu);
85
CD_APPLET_ADD_ABOUT_IN_MENU (pSubMenu);
86
CD_APPLET_ON_BUILD_MENU_END
89
CD_APPLET_ON_MIDDLE_CLICK_BEGIN
90
if (myData.iAlarmPID > 0)
92
kill (myData.iAlarmPID, 1);
95
cairo_dock_remove_dialog_if_any (myIcon);
96
myData.pCalendarDialog = NULL;
97
CD_APPLET_ON_MIDDLE_CLICK_END
100
CD_APPLET_ON_UPDATE_ICON_BEGIN
101
myData.iSmoothAnimationStep ++;
102
int iDetlaT = cairo_dock_get_slow_animation_delta_t (myContainer);
103
int iNbSteps = 1.*myConfig.iSmoothAnimationDuration / iDetlaT; // on anime l'aiguille sur 500ms.
104
if (myData.iSmoothAnimationStep > iNbSteps)
105
CD_APPLET_SKIP_UPDATE_ICON;
107
// taille de la texture.
109
CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
112
cd_clock_render_analogic_to_texture (myApplet, iWidth, iHeight, &myData.currentTime, 1.*myData.iSmoothAnimationStep / iNbSteps);
113
CD_APPLET_ON_UPDATE_ICON_END