static Icon * _cd_shortcuts_get_icon (gchar *cFileName, const gchar *cUserName, double fCurrentOrder)
{
	cd_debug ("New icon: %s, %s, %f", cFileName, cUserName, fCurrentOrder);

	/* Nautilus adds custom prefixes which are not supported by gvfs...
	 * gvfs-integration plugin can read x-nautilus-desktop but not others, e.g.:
	 * x-nautilus-search://0/ => specific to Nautilus: open these URI with it.
	 * Note that all these URI have a user-name
	 */
	if (g_str_has_prefix (cFileName, "x-nautilus-")
	    && ! g_str_has_prefix (cFileName, "x-nautilus-desktop://"))
	{
		Icon *pNewIcon = cairo_dock_create_dummy_launcher (
			cUserName ? g_strdup (cUserName) : g_strdup (cFileName),
			cairo_dock_search_icon_s_path (
				CD_SHORTCUT_DEFAULT_DIRECTORY_ICON_FILENAME,
				CAIRO_DOCK_DEFAULT_ICON_SIZE),
			g_strdup_printf ("nautilus %s", cFileName),
			NULL,
			fCurrentOrder);
		pNewIcon->iGroup = CD_BOOKMARK_GROUP;
		pNewIcon->cBaseURI = cFileName;
		pNewIcon->iVolumeID = CD_VOLUME_ID_BOOKMARK_CMD;
		return pNewIcon;
	}

	gchar *cName, *cRealURI, *cIconName;
	gboolean bIsDirectory;
	gint iVolumeID;
	gdouble fOrder;
	if (! cairo_dock_fm_get_file_info (cFileName, &cName, &cRealURI, &cIconName,
		&bIsDirectory, &iVolumeID, &fOrder, CAIRO_DOCK_FM_SORT_BY_NAME))
		return NULL;
	if (cUserName != NULL)
	{
		g_free (cName);
		if (cName == NULL)  // a bookmark on a unmounted system or a folder that doesn't exist any more
			cName = g_strdup_printf ("%s\n[%s]", cUserName, D_("Unmounted"));
		else
			cName = g_strdup (cUserName);
	}
	else if (cName == NULL)  // a bookmark on a unmounted system
	{
		gchar *cGuessedName = g_path_get_basename (cFileName);
		cairo_dock_remove_html_spaces (cGuessedName); // or: g_uri_unescape_string
		cName = g_strdup_printf ("%s\n[%s]", cGuessedName, D_("Unmounted"));
		g_free (cGuessedName);
	}
	if (cRealURI == NULL)
		cRealURI = g_strdup (cFileName);
	if (cIconName == NULL)
		cIconName = cairo_dock_search_icon_s_path (
			CD_SHORTCUT_DEFAULT_DIRECTORY_ICON_FILENAME,
			CAIRO_DOCK_DEFAULT_ICON_SIZE); // should be the default icon

	Icon *pNewIcon = cairo_dock_create_dummy_launcher (cName,
		cIconName,
		cRealURI,
		NULL,
		fCurrentOrder);
	pNewIcon->iGroup = CD_BOOKMARK_GROUP;
	pNewIcon->cBaseURI = cFileName;
	pNewIcon->iVolumeID = iVolumeID;
	return pNewIcon;
}
Exemplo n.º 2
0
static void _manage_event_on_drive (CairoDockFMEventType iEventType, const gchar *cBaseURI, GList *pIconsList, GldiContainer *pContainer, GldiModuleInstance *myApplet)
{
    gchar *cURI = (g_strdup (cBaseURI));
    cairo_dock_remove_html_spaces (cURI);
    cd_debug (" * event %d on '%s'", iEventType, cURI);

    switch (iEventType)
    {
    case CAIRO_DOCK_FILE_DELETED :  // a mount point has been disconnected
    {
        Icon *pConcernedIcon = cairo_dock_get_icon_with_base_uri (pIconsList, cURI);
        if (pConcernedIcon == NULL)  // search by name
        {
            pConcernedIcon = cairo_dock_get_icon_with_name (pIconsList, cURI);
        }
        if (pConcernedIcon == NULL)
        {
            cd_warning ("  an unknown mount point was removed");
            return ;
        }
        //g_print (" %s will be removed\n", pConcernedIcon->cName);

        CD_APPLET_REMOVE_ICON_FROM_MY_ICONS_LIST (pConcernedIcon);
        g_free (myData.cLastDeletedUri);
        myData.cLastDeletedUri = g_strdup (cURI);
    }
    break ;

    case CAIRO_DOCK_FILE_CREATED :  // a mount point has been connected
    {
        //\_______________________does it already exist?
        Icon *pSameIcon = cairo_dock_get_icon_with_base_uri (pIconsList, cURI);
        if (pSameIcon != NULL)
        {
            cd_warning ("this mount point (%s) already exists.", pSameIcon->cName);
            return;  // do nothing, certainly an useless/double signal
        }

        //\_______________________ create a new icon
        Icon *pNewIcon = cairo_dock_fm_create_icon_from_URI (cURI, pContainer, CAIRO_DOCK_FM_SORT_BY_NAME);
        if (pNewIcon == NULL)
        {
            cd_warning ("couldn't create an icon for this mount point");
            return ;
        }
        pNewIcon->iGroup = CD_DRIVE_GROUP;

        //\_______________________ place it at the right position (by name)
        cd_shortcuts_set_icon_order_by_name (pNewIcon, pIconsList);
        cd_debug (" new drive : %s, %s", pNewIcon->cName, pNewIcon->cCommand);

        //\_______________________ added in the list
        CD_APPLET_ADD_ICON_IN_MY_ICONS_LIST (pNewIcon);
        _init_disk_usage (pNewIcon, myApplet);
        if (pNewIcon->cCommand)
        {
            cd_shortcuts_add_progress_bar (pNewIcon, myApplet);
            cd_shortcuts_display_disk_usage (pNewIcon, myApplet);
        }

        //\_______________________ display a notification
        gboolean bIsMounted = FALSE;
        gchar *cUri = cairo_dock_fm_is_mounted (pNewIcon->cBaseURI, &bIsMounted);
        g_free (cUri);
        gldi_dialog_show_temporary_with_icon_printf (
            bIsMounted ? D_("%s is now mounted") : D_("%s has been connected"),
            pNewIcon, pContainer,
            4000,
            NULL,  // it's icon is not already loaded
            pNewIcon->cName);
        g_free (myData.cLastCreatedUri);
        myData.cLastCreatedUri = g_strdup (cURI);
    }
    break ;

    case CAIRO_DOCK_FILE_MODIFIED :  // a mount point has been (un)mounted
    {
        //\_______________________ search the right icon
        Icon *pConcernedIcon = cairo_dock_get_icon_with_base_uri (pIconsList, cURI);
        if (pConcernedIcon == NULL)  // search by using the name
        {
            pConcernedIcon = cairo_dock_get_icon_with_name (pIconsList, cURI);
        }
        if (pConcernedIcon == NULL)
        {
            cd_warning ("  an unknown mount point was modified");
            return ;
        }
        cd_debug (" %s is modified (%s)", pConcernedIcon->cName, pConcernedIcon->cCommand);

        //\_______________________ grab current info
        Icon *pNewIcon = cairo_dock_fm_create_icon_from_URI (cURI, pContainer, CAIRO_DOCK_FM_SORT_BY_NAME);
        if (pNewIcon == NULL)
        {
            cd_warning ("couldn't create an icon for this mount point");
            return ;
        }
        pNewIcon->iGroup = CD_DRIVE_GROUP;

        //\_______________________ replace the icon if smthg has changed
        if (cairo_dock_strings_differ (pConcernedIcon->cName, pNewIcon->cName)
                || cairo_dock_strings_differ (pConcernedIcon->cFileName, pNewIcon->cFileName))
        {
            //g_print (" '%s' -> '%s'\n'%s' -> '%s'\n", pConcernedIcon->cName, pNewIcon->cName, pConcernedIcon->cFileName, pNewIcon->cFileName);

            CD_APPLET_REMOVE_ICON_FROM_MY_ICONS_LIST (pConcernedIcon);
            pIconsList = CD_APPLET_MY_ICONS_LIST;

            cd_shortcuts_set_icon_order_by_name (pNewIcon, pIconsList);
            CD_APPLET_ADD_ICON_IN_MY_ICONS_LIST (pNewIcon);
            _init_disk_usage (pNewIcon, myApplet);
            if (pNewIcon->cCommand)
            {
                cd_shortcuts_add_progress_bar (pNewIcon, myApplet);
            }

            // pConcernedIcon has been distroyed, assigned the new one to display a dialogue just after
            pConcernedIcon = pNewIcon;
        }
        else
        {
            gldi_object_unref (GLDI_OBJECT (pNewIcon));
            pNewIcon = NULL;
        }

        cd_shortcuts_display_disk_usage (pConcernedIcon, myApplet);

        //\_______________________ display a notification
        gldi_dialogs_remove_on_icon (pConcernedIcon); // avoid multiple dialogues
        gboolean bIsMounted = FALSE;
        gchar *cUri = cairo_dock_fm_is_mounted (pConcernedIcon->cBaseURI, &bIsMounted);
        g_free (cUri);
        gldi_dialog_show_temporary_with_icon_printf (
            bIsMounted ? D_("%s is now mounted") : D_("%s is now unmounted"),
            pConcernedIcon, pContainer,
            4000,
            "same icon",  // it's possible to not have the right icon, not so important
            pConcernedIcon->cName);
        // disk has been unmounted but a icon is needed
        if (! bIsMounted && pNewIcon == NULL)
        {
            CDDiskUsage *pDiskUsage = CD_APPLET_GET_MY_ICON_DATA (pConcernedIcon);
            if (pDiskUsage != NULL)
            {
                if (pDiskUsage->iTotal != 0)
                {
                    pDiskUsage->iTotal = 0;
                    pDiskUsage->iAvail = 0;
                    // remove the quick-info because it has been unmounted
                    gldi_icon_set_quick_info (pConcernedIcon, NULL);
                }
            }
        }
    }
    break ;
    case CAIRO_DOCK_NB_EVENT_ON_FILES :
        break ;
    }
    g_free (cURI);
}
Exemplo n.º 3
0
/* Display information about the current song in a dialog.
 */
void cd_musicplayer_popup_info (gint iDialogDuration)
{
	gldi_dialogs_remove_on_icon (myIcon);
	if (myData.iPlayingStatus == PLAYER_PLAYING || myData.iPlayingStatus == PLAYER_PAUSED)
	{
		if (myData.cTitle || myData.cArtist || myData.cAlbum)
		{
			/* It's maybe better to display nothing if we don't have (optional)
			 * info about track number and id than displaying a wrong number
			 */
			GString *sTrack = g_string_new ("");
			if (myData.iTrackNumber > 0)
				g_string_printf (sTrack, "\n%s %d", D_("Track n°"), myData.iTrackNumber);
			if (myData.iTrackListIndex > 0 || myData.iTrackListLength > 0) // 0/0
			{
				g_string_append_printf (sTrack, "%s%s %d",
					sTrack->len > 0 ? ", " : "\n",
					D_("Song n°"), myData.iTrackListIndex + 1); // iTrackListIndex start with 0.
				if (myData.iTrackListLength > 0)
					g_string_append_printf (sTrack, "/%d", myData.iTrackListLength);
			}

			gldi_dialog_show_temporary_with_icon_printf (
				"%s: %s\n%s: %s\n%s: %s\n%s: %d:%02d%s",
				myIcon,
				myContainer,
				iDialogDuration,
				MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE,
				D_("Artist"),
				myData.cArtist != NULL ? myData.cArtist : D_("Unknown"),
				D_("Title"),
				myData.cTitle != NULL ? myData.cTitle : D_("Unknown"),
				D_("Album"),
				myData.cAlbum != NULL ? myData.cAlbum : D_("Unknown"),
				D_("Length"),
				myData.iSongLength/60, myData.iSongLength%60,  // it's not often to have a song more than 1h!
				sTrack->str);

			g_string_free (sTrack, TRUE);
		}
		else if (myData.cPlayingUri)
		{
			// no tags but with a path...
			gchar *str = strrchr (myData.cPlayingUri, '/');
			if (str)
				str ++;
			else
				str = myData.cPlayingUri;
			cairo_dock_remove_html_spaces (str); // %20 => " "
			gldi_dialog_show_temporary_with_icon_printf ("%s : %s",
				myIcon,
				myContainer,
				iDialogDuration,
				MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE,
				D_("Current song"),
				str);
		}  // else just ignore silently
	}
	else
	{
		gldi_dialog_show_temporary_with_icon (D_("There is no media playing."),
			myIcon,
			myContainer,
			iDialogDuration,
			MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
	}
}
Exemplo n.º 4
0
GList *vfs_backend_list_directory (const gchar *cBaseURI, CairoDockFMSortType iSortType, int iNewIconsType, gboolean bListHiddenFiles, gchar **cFullURI)
{
	g_return_val_if_fail (cBaseURI != NULL, NULL);
	cd_message ("%s (%s)", __func__, cBaseURI);
	
	gchar *cURI;
	gboolean bAddHome = FALSE;
	if (strcmp (cBaseURI, CAIRO_DOCK_FM_VFS_ROOT) == 0)
	{
		cURI = g_strdup ("computer://");
		bAddHome = TRUE;
		///*cFullURI = cURI;
		///return vfs_backend_list_volumes ();
		//vfs_backend_list_volumes ();
	}
	else if (strcmp (cBaseURI, CAIRO_DOCK_FM_NETWORK) == 0)
		cURI = g_strdup ("network://");
	else
		cURI = (*cBaseURI == '/' ? g_strconcat ("file://", cBaseURI, NULL) : g_strdup (cBaseURI));
	*cFullURI = cURI;
	
	GFile *pFile = g_file_new_for_uri (cURI);
	GError *erreur = NULL;
	const gchar *cAttributes = G_FILE_ATTRIBUTE_STANDARD_TYPE","
		G_FILE_ATTRIBUTE_STANDARD_SIZE","
		G_FILE_ATTRIBUTE_TIME_MODIFIED","
		G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
		G_FILE_ATTRIBUTE_STANDARD_NAME","
		G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN","
		G_FILE_ATTRIBUTE_STANDARD_ICON","
		G_FILE_ATTRIBUTE_STANDARD_TARGET_URI","
		G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE;
	GFileEnumerator *pFileEnum = g_file_enumerate_children (pFile,
		cAttributes,
		G_FILE_QUERY_INFO_NONE,  /// G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS
		NULL,
		&erreur);
	//g_object_unref (pFile);
	if (erreur != NULL)
	{
		cd_warning ("gnome_integration : %s", erreur->message);
		g_error_free (erreur);
		return NULL;
	}
	
	int iOrder = 0;
	GList *pIconList = NULL;
	Icon *icon;
	GFileInfo *pFileInfo;
	do
	{
		pFileInfo = g_file_enumerator_next_file (pFileEnum, NULL, &erreur);
		if (erreur != NULL)
		{
			cd_warning ("gnome_integration : %s", erreur->message);
			g_error_free (erreur);
			erreur = NULL;
			continue;
		}
		if (pFileInfo == NULL)
			break ;
		
		gboolean bIsHidden = g_file_info_get_is_hidden (pFileInfo);
		if (bListHiddenFiles || ! bIsHidden)
		{
			GFileType iFileType = g_file_info_get_file_type (pFileInfo);
			GIcon *pFileIcon = g_file_info_get_icon (pFileInfo);
			if (pFileIcon == NULL)
			{
				cd_message ("AUCUNE ICONE");
				continue;
			}
			const gchar *cFileName = g_file_info_get_name (pFileInfo);
			const gchar *cMimeType = g_file_info_get_content_type (pFileInfo);
			gchar *cName = NULL;
			
			icon = g_new0 (Icon, 1);
			icon->iType = iNewIconsType;
			icon->cBaseURI = g_strconcat (*cFullURI, "/", cFileName, NULL);
			cd_message ("+ %s (mime:%s)", icon->cBaseURI, cMimeType);
			
			if (iFileType == G_FILE_TYPE_MOUNTABLE)
			{
				const gchar *cTargetURI = g_file_info_get_attribute_string (pFileInfo, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
				cd_message ("  c'est un point de montage correspondant a %s", cTargetURI);
				
				GMount *pMount = NULL;
				if (cTargetURI != NULL)
				{
					icon->acCommand = g_strdup (cTargetURI);
					GFile *file = g_file_new_for_uri (cTargetURI);
					pMount = g_file_find_enclosing_mount (file, NULL, NULL);
					//g_object_unref (file);
				}
				if (pMount != NULL)
				{
					cName = g_mount_get_name (pMount);
					cd_message ("un GMount existe (%s)", cName);
					
					GVolume *volume = g_mount_get_volume (pMount);
					if (volume)
						cd_message ("  volume associe : %s", g_volume_get_name (volume));
					GDrive *drive = g_mount_get_drive (pMount);
					if (drive)
						cd_message ("  disque associe : %s", g_drive_get_name (drive));
					
					///pFileIcon = g_mount_get_icon (pMount);
				}
				else
				{
					cName = g_strdup (cFileName);
					gchar *str = strrchr (cName, '.');  // on vire l'extension ".volume" ou ".drive".
					if (str != NULL)
					{
						*str = '\0';
						if (strcmp (str+1, "link") == 0)
						{
							if (strcmp (cName, "root") == 0)
							{
								g_free (cName);
								cName = g_strdup ("/");
							}
						}
						else if (strcmp (str+1, "drive") == 0)  // on cherche un nom plus parlant si possible.
						{
							gchar *cVolumeName = _cd_find_volume_name_from_drive_name (cName);
							if (cVolumeName != NULL)
							{
								g_free (cName);
								g_free (cVolumeName);
								continue;  /// apparemment il n'est plus necessaire d'afficher les .drives qui ont 1 (ou plusieurs ?) volumes, car ces derniers sont dans la liste, donc ca fait redondant.
								/**if (strcmp (cVolumeName, "discard") == 0)
									continue;
								g_free (cName);
								cName = cVolumeName;*/
							}
						}
					}
				}
				icon->iVolumeID = 1;
				cd_message ("le nom de ce volume est : %s", cName);
			}
			else
				cName = g_strdup (cFileName);
			
			if (icon->acCommand == NULL)
				icon->acCommand = g_strdup (icon->cBaseURI);
			icon->acName = cName;
			icon->acFileName = NULL;
			if (cMimeType != NULL && strncmp (cMimeType, "image", 5) == 0)
			{
				gchar *cHostname = NULL;
				gchar *cFilePath = g_filename_from_uri (icon->cBaseURI, &cHostname, &erreur);
				if (erreur != NULL)
				{
					g_error_free (erreur);
					erreur = NULL;
				}
				else if (cHostname == NULL || strcmp (cHostname, "localhost") == 0)  // on ne recupere la vignette que sur les fichiers locaux.
				{
					icon->acFileName = g_strdup (cFilePath);
					cairo_dock_remove_html_spaces (icon->acFileName);
				}
				g_free (cHostname);
				g_free (cFilePath);
			}
			if (icon->acFileName == NULL)
			{
				icon->acFileName = _cd_get_icon_path (pFileIcon);
				cd_message ("icon->acFileName : %s", icon->acFileName);
			}
			
			if (iSortType == CAIRO_DOCK_FM_SORT_BY_SIZE)
				icon->fOrder = g_file_info_get_size (pFileInfo);
			else if (iSortType == CAIRO_DOCK_FM_SORT_BY_DATE)
			{
				GTimeVal t;
				g_file_info_get_modification_time (pFileInfo, &t);
				icon->fOrder = t.tv_sec;
			}
			else if (iSortType == CAIRO_DOCK_FM_SORT_BY_TYPE)
				icon->fOrder = (cMimeType != NULL ? *((int *) cMimeType) : 0);
			if (icon->fOrder == 0)  // un peu moyen mais mieux que rien non ?
				icon->fOrder = iOrder;
			pIconList = g_list_insert_sorted (pIconList,
				icon,
				(GCompareFunc) cairo_dock_compare_icons_order);
			//g_list_prepend (pIconList, icon);
			iOrder ++;
		}
	} while (TRUE);  // 'g_file_enumerator_close' est appelee lors du dernier 'g_file_enumerator_next_file'.
	
	if (bAddHome && pIconList != NULL)
	{
		icon = g_new0 (Icon, 1);
		icon->iType = iNewIconsType;
		icon->cBaseURI = g_strdup_printf ("file://%s", "/home");
		icon->acCommand = g_strdup ("/home");
		//icon->acCommand = g_strdup (icon->cBaseURI);
		icon->iVolumeID = 0;
		icon->acName = g_strdup ("home");
		Icon *pRootIcon = cairo_dock_get_icon_with_name (pIconList, "/");
		if (pRootIcon == NULL)
		{
			pRootIcon = cairo_dock_get_first_icon (pIconList);
			g_print ("domage ! (%s:%s)\n", pRootIcon->acCommand, pRootIcon->acName);
		}
		icon->acFileName = g_strdup (pRootIcon->acFileName);
		icon->fOrder = iOrder++;
		pIconList = g_list_insert_sorted (pIconList,
			icon,
			(GCompareFunc) cairo_dock_compare_icons_order);
	}
	
	if (iSortType == CAIRO_DOCK_FM_SORT_BY_NAME)
		pIconList = cairo_dock_sort_icons_by_name (pIconList);
	else
		pIconList = cairo_dock_sort_icons_by_order (pIconList);
	
	return pIconList;
}
Exemplo n.º 5
0
void vfs_backend_get_file_info (const gchar *cBaseURI, gchar **cName, gchar **cURI, gchar **cIconName, gboolean *bIsDirectory, int *iVolumeID, double *fOrder, CairoDockFMSortType iSortType)
{
	g_return_if_fail (cBaseURI != NULL);
	GError *erreur = NULL;
	cd_message ("%s (%s)", __func__, cBaseURI);
	
	gchar *cFullURI;
	if (strncmp (cBaseURI, "x-nautilus-desktop://", 21) == 0)
	{
		gchar *cNautilusFile = g_strdup (cBaseURI+14);
		memcpy (cNautilusFile, "file", 4);
		if (g_str_has_suffix (cBaseURI, ".volume"))
		{
			cNautilusFile[strlen(cNautilusFile)-7] = '\0';
		}
		else if (g_str_has_suffix (cBaseURI, ".drive"))
		{
			cNautilusFile[strlen(cNautilusFile)-6] = '\0';
		}
		cFullURI = g_filename_from_uri (cNautilusFile, NULL, &erreur);
		if (erreur != NULL)
		{
			cd_warning ("gnome_integration : %s", erreur->message);
			g_error_free (erreur);
			return ;
		}
		gchar *cVolumeName = cFullURI + 1;  // on saute le '/'.
		cd_message ("cVolumeName : %s", cVolumeName);
		
		GMount *pMount = NULL;
		_cd_find_mount_from_volume_name (cVolumeName, &pMount, cURI, cIconName);
		g_return_if_fail (pMount != NULL);
		
		*cName = g_strdup (cVolumeName);
		*bIsDirectory = TRUE;
		*iVolumeID = 1;
		*fOrder = 0;
		//g_object_unref (pMount);
		
		g_free (cFullURI);
		//g_free (cNautilusFile);
		return;
	}
	else
	{
		if (*cBaseURI == '/')
			cFullURI = g_filename_to_uri (cBaseURI, NULL, NULL);
		else
			cFullURI = g_strdup (cBaseURI);
	}
	cd_message (" -> cFullURI : %s", cFullURI);
	
	GFile *pFile = g_file_new_for_uri (cFullURI);
	
	const gchar *cQuery = G_FILE_ATTRIBUTE_STANDARD_TYPE","
		G_FILE_ATTRIBUTE_STANDARD_SIZE","
		G_FILE_ATTRIBUTE_TIME_MODIFIED","
		G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
		G_FILE_ATTRIBUTE_STANDARD_NAME","
		G_FILE_ATTRIBUTE_STANDARD_ICON","
		G_FILE_ATTRIBUTE_STANDARD_TARGET_URI","
		G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE;
	GFileInfo *pFileInfo = g_file_query_info (pFile,
		cQuery,
		G_FILE_QUERY_INFO_NONE,  /// G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS
		NULL,
		&erreur);
	//g_object_unref (pFile);
	if (erreur != NULL)
	{
		cd_warning ("gnome_integration : %s", erreur->message);
		g_error_free (erreur);
		return ;
	}
	
	*cURI = cFullURI;
	const gchar *cFileName = g_file_info_get_name (pFileInfo);
	const gchar *cMimeType = g_file_info_get_content_type (pFileInfo);
	GFileType iFileType = g_file_info_get_file_type (pFileInfo);
	
	if (iSortType == CAIRO_DOCK_FM_SORT_BY_DATE)
	{
		GTimeVal t;
		g_file_info_get_modification_time (pFileInfo, &t);
		*fOrder = t.tv_sec;
	}
	else if (iSortType == CAIRO_DOCK_FM_SORT_BY_SIZE)
		*fOrder = g_file_info_get_size (pFileInfo);
	else if (iSortType == CAIRO_DOCK_FM_SORT_BY_TYPE)
		*fOrder = (cMimeType != NULL ? *((int *) cMimeType) : 0);
	else
		*fOrder = 0;
	
	*bIsDirectory = (iFileType == G_FILE_TYPE_DIRECTORY);
	cd_message (" => '%s' (mime:%s ; bIsDirectory:%d)", cFileName, cMimeType, *bIsDirectory);
	
	if (iFileType == G_FILE_TYPE_MOUNTABLE)
	{
		*cName = NULL;
		*iVolumeID = 1;
		
		const gchar *cTargetURI = g_file_info_get_attribute_string (pFileInfo, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
		cd_message ("  cTargetURI:%s", cTargetURI);
		GMount *pMount = NULL;
		if (cTargetURI != NULL)
		{
			GFile *file = g_file_new_for_uri (cTargetURI);
			pMount = g_file_find_enclosing_mount (file, NULL, NULL);
			//g_object_unref (file);
		}
		if (pMount != NULL)
		{
			*cName = g_mount_get_name (pMount);
			cd_message ("un GMount existe (%s)",* cName);
		}
		else
		{
			gchar *cMountName = g_strdup (cFileName);
			gchar *str = strrchr (cMountName, '.');  // on vire l'extension ".volume" ou ".drive".
			if (str != NULL)
			{
				*str = '\0';
				if (strcmp (str+1, "link") == 0)  // pour les liens, on prend le nom du lien.
				{
					if (strcmp (cMountName, "root") == 0)  // on remplace 'root' par un nom plus parlant, sinon on prendra le nom du lien.
					{
						*cName = g_strdup ("/");
					}
				}
				else if (strcmp (str+1, "drive") == 0)  // on cherche un nom plus parlant si possible.
				{
					gchar *cVolumeName = _cd_find_volume_name_from_drive_name (cMountName);
					if (cVolumeName != NULL)
					{
						*cName = cVolumeName;
					}
				}
			}
			if (*cName == NULL)
				*cName = cMountName;
			//else
				//g_free (cMountName);
		}
		if (*cName ==  NULL)
			*cName = g_strdup (cFileName);
	}
	else
	{
		*iVolumeID = 0;
		*cName = g_strdup (cFileName);
	}
	
	*cIconName = NULL;
	if (cMimeType != NULL && strncmp (cMimeType, "image", 5) == 0)
	{
		gchar *cHostname = NULL;
		GError *erreur = NULL;
		gchar *cFilePath = g_filename_from_uri (cBaseURI, &cHostname, &erreur);
		if (erreur != NULL)
		{
			g_error_free (erreur);
		}
		else if (cHostname == NULL || strcmp (cHostname, "localhost") == 0)  // on ne recupere la vignette que sur les fichiers locaux.
		{
			*cIconName = g_strdup (cFilePath);
			cairo_dock_remove_html_spaces (*cIconName);
		}
		//g_free (cHostname);
	}
	if (*cIconName == NULL)
	{
		GIcon *pSystemIcon = g_file_info_get_icon (pFileInfo);
		if (pSystemIcon != NULL)
		{
			*cIconName = _cd_get_icon_path (pSystemIcon);
		}
	}
	cd_message ("cIconName : %s", *cIconName);
	
	//*iVolumeID = g_file_info_get_attribute_uint32 (pFileInfo, G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE);
	//cd_message ("ID : %d\n", *iVolumeID);
	//g_object_unref (pFileInfo);
}
static gchar *_cairo_dock_generate_desktop_file_for_launcher (const gchar *cDesktopURI, const gchar *cDockName, double fOrder, GError **erreur)
{
	g_return_val_if_fail (cDesktopURI != NULL, NULL);
	GError *tmp_erreur = NULL;
	gchar *cFilePath = (*cDesktopURI == '/' ? g_strdup (cDesktopURI) : g_filename_from_uri (cDesktopURI, NULL, &tmp_erreur));
	if (tmp_erreur != NULL)
	{
		g_propagate_error (erreur, tmp_erreur);
		return NULL;
	}

	//\___________________ On supprime a la main les '%20' qui foutent le boxon (rare).
	cairo_dock_remove_html_spaces (cFilePath);

	//\___________________ On ouvre le patron.
	GKeyFile *pKeyFile = cairo_dock_open_key_file (cFilePath);
	if (pKeyFile == NULL)
		return NULL;

	//\___________________ On renseigne nos champs.
	g_key_file_set_double (pKeyFile, "Desktop Entry", "Order", fOrder);
	g_key_file_set_string (pKeyFile, "Desktop Entry", "Container", cDockName);
	
	//\___________________ On elimine les indesirables.
	g_key_file_remove_key (pKeyFile, "Desktop Entry", "X-Ubuntu-Gettext-Domain", NULL);
	gchar *cCommand = g_key_file_get_string (pKeyFile, "Desktop Entry", "Exec", &tmp_erreur);
	if (tmp_erreur != NULL)
	{
		g_propagate_error (erreur, tmp_erreur);
		g_key_file_free (pKeyFile);
		return NULL;
	}
	gchar *str = strchr (cCommand, '%');
	if (str != NULL)
	{
		*str = '\0';
		g_key_file_set_string (pKeyFile, "Desktop Entry", "Exec", cCommand);
	}
	g_free (cCommand);

	gchar *cIconName = g_key_file_get_string (pKeyFile, "Desktop Entry", "Icon", &tmp_erreur);
	if (tmp_erreur != NULL)
	{
		g_propagate_error (erreur, tmp_erreur);
		g_key_file_free (pKeyFile);
		return NULL;
	}
	if (*cIconName != '/' && (g_str_has_suffix (cIconName, ".svg") || g_str_has_suffix (cIconName, ".png") || g_str_has_suffix (cIconName, ".xpm")))
	{
		cIconName[strlen(cIconName) - 4] = '\0';
		g_key_file_set_string (pKeyFile, "Desktop Entry", "Icon", cIconName);
	}
	g_free (cIconName);

	//\___________________ On lui choisit un nom de fichier tel qu'il n'y ait pas de collision.
	gchar *cBaseName = g_path_get_basename (cFilePath);
	gchar *cNewDesktopFileName = cairo_dock_generate_desktop_filename (cBaseName, g_cCurrentLaunchersPath);
	g_free (cBaseName);

	//\___________________ On ecrit tout ca dans un fichier base sur le template.
	gchar *cNewDesktopFilePath = g_strdup_printf ("%s/%s", g_cCurrentLaunchersPath, cNewDesktopFileName);
	cairo_dock_flush_conf_file_full (pKeyFile, cNewDesktopFilePath, CAIRO_DOCK_SHARE_DATA_DIR, FALSE, CAIRO_DOCK_LAUNCHER_CONF_FILE);
	
	g_free (cNewDesktopFilePath);
	g_key_file_free (pKeyFile);
	g_free (cFilePath);

	return cNewDesktopFileName;
}