Exemple #1
0
void fileops_confirm_trash ()
{
    GtkWidget* dialog;
    int result;

    dialog = gtk_message_dialog_new (NULL,
				     GTK_DIALOG_MODAL,
	                             GTK_MESSAGE_WARNING,
				     GTK_BUTTONS_CANCEL,
				     NULL);
    gtk_window_set_title (GTK_WINDOW (dialog), _("Empty Trash"));
    gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
    char* _icon = icon_name_to_path ("user-trash-full", 16);
    if (_icon != NULL)
    {
        gtk_window_set_icon_from_file (GTK_WINDOW (dialog), _icon, NULL);
        g_free (_icon);
    }
    g_object_set (dialog,
	          "text", _("Empty all items from Trash?"),
		  "secondary-text", _("All items in the Trash will be permanently deleted."),
		  NULL);

    gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("Empty _Trash"),
			    GTK_RESPONSE_OK, NULL);

    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);

    gtk_widget_add_events (dialog, GDK_FOCUS_CHANGE_MASK);
    g_signal_connect (dialog, "focus-in-event", G_CALLBACK(focus_cb), NULL);

    result = gtk_dialog_run (GTK_DIALOG (dialog));
    gtk_widget_destroy (dialog);

    if (result == GTK_RESPONSE_OK)
	fileops_empty_trash ();


}
Exemple #2
0
#include "desktop_test.h"

void test_fileops_trash()
{
#if 0
	extern void fileops_confirm_trash ();
	Test({
		fileops_confirm_trash();
	},"fileops_confirm_trash");
#endif

	extern void fileops_empty_trash ();
	Test({
		fileops_empty_trash();
	},"fileops_empty_trash");

    extern char* dentry_get_name(Entry* e);
	extern GFile* fileops_get_trash_entry();
	Test({
		GFile* f = fileops_get_trash_entry();
		// char* c = dentry_get_name(f);
		// g_message("%s",c);
		// g_object_unref(c);
        func_test_entry_char(dentry_get_name,f,"/");
		g_object_unref(f);
	},"fileops_get_trash_entry");

	extern double fileops_get_trash_count();
	Test({
		double d = fileops_get_trash_count();
		g_message("%f",d);