static void
update_desktop_directory (CajaDesktopDirectory *desktop)
{
    char *desktop_path;
    char *desktop_uri;
    CajaDirectory *real_directory;

    real_directory = desktop->details->real_directory;
    if (real_directory != NULL)
    {
        g_hash_table_foreach_remove (desktop->details->callbacks, (GHRFunc) gtk_true, NULL);
        g_hash_table_foreach_remove (desktop->details->monitors, (GHRFunc) gtk_true, NULL);

        g_signal_handlers_disconnect_by_func (real_directory, done_loading_callback, desktop);
        g_signal_handlers_disconnect_by_func (real_directory, forward_files_added_cover, desktop);
        g_signal_handlers_disconnect_by_func (real_directory, forward_files_changed_cover, desktop);

        caja_directory_unref (real_directory);
    }

    desktop_path = caja_get_desktop_directory ();
    desktop_uri = g_filename_to_uri (desktop_path, NULL, NULL);
    real_directory = caja_directory_get_by_uri (desktop_uri);
    g_free (desktop_uri);
    g_free (desktop_path);

    g_signal_connect_object (real_directory, "done_loading",
                             G_CALLBACK (done_loading_callback), desktop, 0);
    g_signal_connect_object (real_directory, "files_added",
                             G_CALLBACK (forward_files_added_cover), desktop, 0);
    g_signal_connect_object (real_directory, "files_changed",
                             G_CALLBACK (forward_files_changed_cover), desktop, 0);

    desktop->details->real_directory = real_directory;
}
예제 #2
0
/**
 * caja_get_desktop_directory_uri:
 *
 * Get the uri for the directory containing files on the desktop.
 *
 * Return value: the directory path.
 **/
char *
caja_get_desktop_directory_uri (void)
{
    char *desktop_path;
    char *desktop_uri;

    desktop_path = caja_get_desktop_directory ();
    desktop_uri = g_filename_to_uri (desktop_path, NULL, NULL);
    g_free (desktop_path);

    return desktop_uri;
}