81
81
//\___________ Here is where you initiate your applet. myConfig is already set at this point, and also myIcon, myContainer, myDock, myDesklet (and myDrawContext if you're in dock mode). The macro CD_APPLET_MY_CONF_FILE and CD_APPLET_MY_KEY_FILE can give you access to the applet's conf-file and its corresponding key-file (also available during reload). If you're in desklet mode, myDrawContext is still NULL, and myIcon's buffers has not been filled, because you may not need them then (idem when reloading).
82
82
CD_APPLET_INIT_BEGIN
84
//\_______________ On definit le dessin de l'icone principale.
85
_set_icon_label (myApplet);
87
myIcon->iSubdockViewType = myConfig.iSubdockViewType;
88
if (myDock && myConfig.iSubdockViewType == 0)
89
CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE;
90
///CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cImageFile, MY_APPLET_ICON_FILE);
92
//\_______________ On lance la tache recuperation des fichiers.
93
_set_comparaison_func (myApplet);
94
if (myConfig.bShowFiles)
84
if (myConfig.cDirPath == NULL)
96
cd_folders_start (myApplet);
86
CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cImageFile);
87
cairo_dock_show_temporary_dialog_with_icon (D_("Open the configuration of the applet to choose a folder to import."),
90
myConfig.iSubdockViewType == 0 ? "same icon" : MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
98
else if (myDesklet) // comme on ne charge pas les icones, on met un renderer "simple" sur notre desklet.
100
CD_APPLET_SET_DESKLET_RENDERER ("Simple");
94
//\_______________ On lance la tache recuperation des fichiers.
95
_set_comparaison_func (myApplet);
96
if (myConfig.bShowFiles)
98
cd_folders_start (myApplet);
101
//\_______________ set the icon rendering
102
if (myDock) // dock mode: set the image or the sub-dock renderer
104
cairo_dock_set_subdock_content_renderer (myIcon, myConfig.iSubdockViewType);
105
if (myConfig.iSubdockViewType == 0)
106
CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cImageFile);
108
else // desklet mode: set the image if we don't show the files.
110
if (! myConfig.bShowFiles)
112
CD_APPLET_SET_DESKLET_RENDERER ("Simple");
113
CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cImageFile);
117
//\_______________ set the label
118
_set_icon_label (myApplet);
103
121
//\_______________ On enregistre nos notifications.
126
144
//\_______________ On detruit les icones des fichiers.
127
145
cd_folders_free_all_data (myApplet);
129
//\_______________ On met a jour l'icone principale.
130
_set_icon_label (myApplet);
132
myIcon->iSubdockViewType = myConfig.iSubdockViewType;
133
if (myDock && myConfig.iSubdockViewType == 0)
134
CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE;
135
///CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cImageFile, MY_APPLET_ICON_FILE);
137
//\_______________ On charge les icones dans un sous-dock.
138
_set_comparaison_func (myApplet);
139
if (myConfig.bShowFiles)
141
cd_folders_start (myApplet);
143
else if (myDock && myIcon->pSubDock) // on veut un comportement de type lanceur, donc on ne veut pas d'un sous-dock vide.
145
cairo_dock_destroy_dock (myIcon->pSubDock, myIcon->cName);
146
myIcon->pSubDock = NULL;
150
CD_APPLET_SET_DESKLET_RENDERER ("Simple");
147
if (myConfig.cDirPath == NULL)
149
CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cImageFile);
150
cairo_dock_show_temporary_dialog_with_icon (D_("Open the configuration of the applet to choose a folder to import."),
153
myConfig.iSubdockViewType == 0 ? "same icon" : MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
157
//\_______________ On charge les icones dans un sous-dock.
158
_set_comparaison_func (myApplet);
159
if (myConfig.bShowFiles)
161
cd_folders_start (myApplet);
163
else if (myDock && myIcon->pSubDock) // dans ce cas on veut un comportement de type lanceur, donc on ne veut pas d'un sous-dock vide.
165
cairo_dock_destroy_dock (myIcon->pSubDock, myIcon->cName);
166
myIcon->pSubDock = NULL;
169
//\_______________ set the icon rendering
170
if (myDock) // dock mode: set the image or the sub-dock renderer
172
cairo_dock_set_subdock_content_renderer (myIcon, myConfig.iSubdockViewType);
173
if (myConfig.iSubdockViewType == 0)
174
CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cImageFile);
176
else // desklet mode: set the image if we don't show the files.
178
if (! myConfig.bShowFiles)
180
CD_APPLET_SET_DESKLET_RENDERER ("Simple");
181
CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cImageFile);
185
//\_______________ set the label
186
_set_icon_label (myApplet);
153
189
CD_APPLET_RELOAD_END