Blame plugins/housekeeping/gsd-purge-temp-test.c

Packit 9ca0cf
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
Packit 9ca0cf
 * vim: set et sw=8 ts=8:
Packit 9ca0cf
 *
Packit 9ca0cf
 * Copyright (c) 2008, Novell, Inc.
Packit 9ca0cf
 *
Packit 9ca0cf
 * Authors: Vincent Untz <vuntz@gnome.org>
Packit 9ca0cf
 *
Packit 9ca0cf
 * This program is free software; you can redistribute it and/or modify
Packit 9ca0cf
 * it under the terms of the GNU General Public License as published by
Packit 9ca0cf
 * the Free Software Foundation; either version 2 of the License, or
Packit 9ca0cf
 * (at your option) any later version.
Packit 9ca0cf
 *
Packit 9ca0cf
 * This program is distributed in the hope that it will be useful,
Packit 9ca0cf
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 9ca0cf
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 9ca0cf
 * GNU General Public License for more details.
Packit 9ca0cf
 *
Packit 9ca0cf
 * You should have received a copy of the GNU General Public License
Packit 9ca0cf
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
Packit 9ca0cf
 *
Packit 9ca0cf
 */
Packit 9ca0cf
Packit 9ca0cf
#include "config.h"
Packit 9ca0cf
#include <gtk/gtk.h>
Packit 9ca0cf
#include <libnotify/notify.h>
Packit 9ca0cf
#include "gsd-disk-space.h"
Packit 9ca0cf
Packit 9ca0cf
int
Packit 9ca0cf
main (int    argc,
Packit 9ca0cf
      char **argv)
Packit 9ca0cf
{
Packit 9ca0cf
        GFile *file;
Packit 9ca0cf
        DeleteData *data;
Packit 9ca0cf
        GDateTime *old;
Packit 9ca0cf
        GMainLoop *loop;
Packit 9ca0cf
Packit 9ca0cf
        g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
Packit 9ca0cf
Packit 9ca0cf
        gtk_init (&argc, &argv);
Packit 9ca0cf
        notify_init ("gsd-purge-temp-test");
Packit 9ca0cf
        loop = g_main_loop_new (NULL, FALSE);
Packit 9ca0cf
Packit 9ca0cf
        file = g_file_new_for_path ("/tmp/gsd-purge-temp-test");
Packit 9ca0cf
        if (!g_file_query_exists (file, NULL)) {
Packit 9ca0cf
                g_warning ("Create /tmp/gsd-purge-temp-test and add some files to it to test deletion by date");
Packit 9ca0cf
                g_object_unref (file);
Packit 9ca0cf
                return 1;
Packit 9ca0cf
        }
Packit 9ca0cf
Packit 9ca0cf
        old = g_date_time_new_now_local ();
Packit 9ca0cf
        data = delete_data_new (file, NULL, old, FALSE, FALSE, 0);
Packit 9ca0cf
        delete_recursively_by_age (data);
Packit 9ca0cf
        delete_data_unref (data);
Packit 9ca0cf
        g_object_unref (file);
Packit 9ca0cf
Packit 9ca0cf
        g_main_loop_run (loop);
Packit 9ca0cf
Packit 9ca0cf
        return 0;
Packit 9ca0cf
}
Packit 9ca0cf