86
86
switch (iNewDesktopFileType)
88
88
case CAIRO_DOCK_DESKTOP_FILE_FOR_LAUNCHER :
89
cTemplateFile = CAIRO_DOCK_SHARE_DATA_DIR"/"CAIRO_DOCK_LAUNCHER_CONF_FILE;
89
cTemplateFile = GLDI_SHARE_DATA_DIR"/"CAIRO_DOCK_LAUNCHER_CONF_FILE;
91
91
case CAIRO_DOCK_DESKTOP_FILE_FOR_CONTAINER :
92
cTemplateFile = CAIRO_DOCK_SHARE_DATA_DIR"/"CAIRO_DOCK_CONTAINER_CONF_FILE;
92
cTemplateFile = GLDI_SHARE_DATA_DIR"/"CAIRO_DOCK_CONTAINER_CONF_FILE;
94
94
case CAIRO_DOCK_DESKTOP_FILE_FOR_SEPARATOR :
95
cTemplateFile = CAIRO_DOCK_SHARE_DATA_DIR"/"CAIRO_DOCK_SEPARATOR_CONF_FILE;
95
cTemplateFile = GLDI_SHARE_DATA_DIR"/"CAIRO_DOCK_SEPARATOR_CONF_FILE;
97
97
case CAIRO_DOCK_DESKTOP_FILE_FOR_FILE :
98
cTemplateFile = CAIRO_DOCK_SHARE_DATA_DIR"/"CAIRO_DOCK_FILE_CONF_FILE;
98
cTemplateFile = GLDI_SHARE_DATA_DIR"/"CAIRO_DOCK_FILE_CONF_FILE;
101
101
cTemplateFile = NULL;
175
175
//\___________________ On ecrit tout ca dans un fichier base sur le template.
176
176
gchar *cNewDesktopFilePath = g_strdup_printf ("%s/%s", g_cCurrentLaunchersPath, cNewDesktopFileName);
177
cairo_dock_flush_conf_file_full (pKeyFile, cNewDesktopFilePath, CAIRO_DOCK_SHARE_DATA_DIR, FALSE, CAIRO_DOCK_LAUNCHER_CONF_FILE);
177
cairo_dock_flush_conf_file_full (pKeyFile, cNewDesktopFilePath, GLDI_SHARE_DATA_DIR, FALSE, CAIRO_DOCK_LAUNCHER_CONF_FILE);
179
179
g_free (cNewDesktopFilePath);
180
180
g_key_file_free (pKeyFile);
183
183
return cNewDesktopFileName;
186
/**static gchar *_cairo_dock_generate_desktop_file_for_file (const gchar *cURI, const gchar *cDockName, double fOrder, GError **erreur)
188
//\___________________ On recupere le type mime du fichier.
189
gchar *cIconName = NULL, *cName = NULL, *cRealURI = NULL;
190
gboolean bIsDirectory;
193
if (! cairo_dock_fm_get_file_info (cURI, &cName, &cRealURI, &cIconName, &bIsDirectory, &iVolumeID, &fUnusedOrder, 0) || cIconName == NULL)
195
cd_message (" -> cIconName : %s; bIsDirectory : %d; iVolumeID : %d\n", cIconName, bIsDirectory, iVolumeID);
197
//\___________________ On ouvre le patron.
198
const gchar *cDesktopFileTemplate = _cairo_dock_get_launcher_template_conf_file_path (CAIRO_DOCK_DESKTOP_FILE_FOR_FILE);
199
GKeyFile *pKeyFile = cairo_dock_open_key_file (cDesktopFileTemplate);
200
if (pKeyFile == NULL)
203
//\___________________ On renseigne ce qu'on peut.
204
g_key_file_set_double (pKeyFile, "Desktop Entry", "Order", fOrder);
205
g_key_file_set_string (pKeyFile, "Desktop Entry", "Container", cDockName);
206
g_key_file_set_string (pKeyFile, "Desktop Entry", "Base URI", cURI);
208
g_key_file_set_string (pKeyFile, "Desktop Entry", "Name", cName);
210
g_key_file_set_string (pKeyFile, "Desktop Entry", "Exec", cRealURI);
212
g_key_file_set_string (pKeyFile, "Desktop Entry", "Icon", (cIconName != NULL ? cIconName : ""));
215
g_key_file_set_boolean (pKeyFile, "Desktop Entry", "Is mounting point", (iVolumeID > 0));
216
g_key_file_set_integer (pKeyFile, "Desktop Entry", "Nb subicons", (bIsDirectory ? 3 : 0));
218
//\___________________ On lui choisit un nom de fichier tel qu'il n'y ait pas de collision.
219
gchar *cNewDesktopFileName = _cairo_dock_generate_desktop_filename ("file-launcher.desktop", g_cCurrentLaunchersPath);
221
//\___________________ On ecrit tout.
222
gchar *cNewDesktopFilePath = g_strdup_printf ("%s/%s", g_cCurrentLaunchersPath, cNewDesktopFileName);
223
cairo_dock_write_keys_to_file (pKeyFile, cNewDesktopFilePath);
224
g_free (cNewDesktopFilePath);
225
g_key_file_free (pKeyFile);
227
return cNewDesktopFileName;
230
186
static gchar *_cairo_dock_generate_desktop_file_for_script (const gchar *cURI, const gchar *cDockName, double fOrder, GError **erreur)
232
188
//\___________________ On ouvre le patron.
265
221
if (iGroup != CAIRO_DOCK_LAUNCHER && iGroup != CAIRO_DOCK_APPLET) // on n'autorise a placer des icones du theme que parmi les lanceurs ou les applets.
266
222
iGroup = CAIRO_DOCK_LAUNCHER;
267
223
cd_message ("%s (%s)", __func__, cURI);
268
/**double fEffectiveOrder;
269
if (fOrder == CAIRO_DOCK_LAST_ORDER && pDock != NULL)
271
Icon *pLastIcon = cairo_dock_get_last_launcher (pDock->icons);
272
if (pLastIcon != NULL)
273
fEffectiveOrder = pLastIcon->fOrder + 1;
278
fEffectiveOrder = fOrder;*/
280
225
//\_________________ On cree determine le type de lanceur et on ajoute un fichier desktop correspondant.
281
226
GError *tmp_erreur = NULL;
282
227
gchar *cNewDesktopFileName = NULL;
289
234
cd_message ("This file will be treated as a launcher, not as a file.\nIf this doesn't fit you, you should use the Stack applet, which is dedicated to file stacking.");
290
235
cNewDesktopFileName = _cairo_dock_generate_desktop_file_for_script (cURI, cDockName, fOrder, &tmp_erreur);
292
/**else // fichier, repertoire ou point de montage.
294
cNewDesktopFileName = _cairo_dock_generate_desktop_file_for_file (cURI, cDockName, fOrder, &tmp_erreur);
297
238
if (tmp_erreur != NULL)