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 program,
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
******************************************************************************/
30
#include "applet-struct.h"
31
#include "applet-config.h"
32
#include "applet-notifications.h"
33
#include "applet-load-icons.h"
34
#include "applet-read-data.h"
35
#include "applet-init.h"
37
CD_APPLET_PRE_INIT_BEGIN (N_("weather"),
39
CAIRO_DOCK_CATEGORY_ACCESSORY,
40
N_("This applet displays weather into your dock.\n"
41
"Data are provided by www.weather.com, you can find your location in the config panel.\n"
42
"It can detach itself to be a totally eye-candy 3D deskelt.\n"
43
"Middle-click on the main icon to have current conditions information, left-click on a sub-icon to have forcast information.\n"),
44
"Fabounet (Fabrice Rey)")
45
CD_APPLET_DEFINE_COMMON_APPLET_INTERFACE
46
pInterface->load_custom_widget = cd_weather_load_custom_widget;
47
CD_APPLET_PRE_INIT_END
51
// On lance la mesure periodique.
52
myData.pTask = cairo_dock_new_task (myConfig.iCheckInterval,
53
(CairoDockGetDataAsyncFunc) cd_weather_get_distant_data,
54
(CairoDockUpdateSyncFunc) cd_weather_update_from_data,
56
cairo_dock_launch_task (myData.pTask);
58
/**if (myConfig.iDeskletRenderer == MY_DESKLET_MAIN_ICON)
60
gpointer data[3] = {"Loading...", NULL, FALSE};
61
CD_APPLET_SET_DESKLET_RENDERER_WITH_DATA ("Mediaplayer", data);
64
// On s'abonne aux notifications.
65
CD_APPLET_REGISTER_FOR_CLICK_EVENT;
66
CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT;
67
CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
72
//\_______________ On se desabonne de nos notifications.
73
CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
74
CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
75
CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
79
CD_APPLET_RELOAD_BEGIN
80
//\_______________ On recharge les donnees qui ont pu changer.
81
g_return_val_if_fail (myConfig.cLocationCode != NULL, FALSE);
83
if (CD_APPLET_MY_CONFIG_CHANGED)
85
if (myConfig.bSetName)
87
CD_APPLET_DELETE_MY_ICONS_LIST; // comme on va changer le nom, autant virer les icones du sous-dock des maintenant.
88
g_free (myIcon->acName);
89
myIcon->acName = NULL;
91
if (myDesklet) //Placé avant pour être sur d'avoir les infos affichées au redraw.
93
///if (myConfig.iDeskletRenderer == MY_DESKLET_CAROUSSEL)
95
gpointer pConfig[2] = {GINT_TO_POINTER (myConfig.bDesklet3D), GINT_TO_POINTER (FALSE)};
96
CD_APPLET_SET_DESKLET_RENDERER_WITH_DATA ("Caroussel", pConfig);
98
/**else if (myConfig.iDeskletRenderer == MY_DESKLET_MAIN_ICON)
100
gpointer data[3] = {"Loading...", NULL, FALSE};
101
CD_APPLET_SET_DESKLET_RENDERER_WITH_DATA ("Mediaplayer", data);
105
cd_weather_reset_all_datas (myApplet); // on bourrine.
107
myData.pTask = cairo_dock_new_task (myConfig.iCheckInterval,
108
(CairoDockGetDataAsyncFunc) cd_weather_get_distant_data,
109
(CairoDockUpdateSyncFunc) cd_weather_update_from_data,
111
cairo_dock_launch_task (myData.pTask);
116
// rien a faire, cairo-dock va recharger notre sous-dock.