1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// This file was generated by gir (4b09025) from gir-files (71d73f0)
// DO NOT EDIT

use RecentFilterFlags;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;

glib_wrapper! {
    pub struct RecentFilter(Object<ffi::GtkRecentFilter>);

    match fn {
        get_type => || ffi::gtk_recent_filter_get_type(),
    }
}

impl RecentFilter {
    pub fn new() -> RecentFilter {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_none(ffi::gtk_recent_filter_new())
        }
    }
}

pub trait RecentFilterExt {
    fn add_age(&self, days: i32);

    fn add_application(&self, application: &str);

    //fn add_custom<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, needed: RecentFilterFlags, func: /*Unknown conversion*//*Unimplemented*/RecentFilterFunc, data: P, data_destroy: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    fn add_group(&self, group: &str);

    fn add_mime_type(&self, mime_type: &str);

    fn add_pattern(&self, pattern: &str);

    fn add_pixbuf_formats(&self);

    //fn filter(&self, filter_info: /*Ignored*/&RecentFilterInfo) -> bool;

    fn get_name(&self) -> Option<String>;

    fn get_needed(&self) -> RecentFilterFlags;

    fn set_name(&self, name: &str);
}

impl<O: IsA<RecentFilter>> RecentFilterExt for O {
    fn add_age(&self, days: i32) {
        unsafe {
            ffi::gtk_recent_filter_add_age(self.to_glib_none().0, days);
        }
    }

    fn add_application(&self, application: &str) {
        unsafe {
            ffi::gtk_recent_filter_add_application(self.to_glib_none().0, application.to_glib_none().0);
        }
    }

    //fn add_custom<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, needed: RecentFilterFlags, func: /*Unknown conversion*//*Unimplemented*/RecentFilterFunc, data: P, data_destroy: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gtk_recent_filter_add_custom() }
    //}

    fn add_group(&self, group: &str) {
        unsafe {
            ffi::gtk_recent_filter_add_group(self.to_glib_none().0, group.to_glib_none().0);
        }
    }

    fn add_mime_type(&self, mime_type: &str) {
        unsafe {
            ffi::gtk_recent_filter_add_mime_type(self.to_glib_none().0, mime_type.to_glib_none().0);
        }
    }

    fn add_pattern(&self, pattern: &str) {
        unsafe {
            ffi::gtk_recent_filter_add_pattern(self.to_glib_none().0, pattern.to_glib_none().0);
        }
    }

    fn add_pixbuf_formats(&self) {
        unsafe {
            ffi::gtk_recent_filter_add_pixbuf_formats(self.to_glib_none().0);
        }
    }

    //fn filter(&self, filter_info: /*Ignored*/&RecentFilterInfo) -> bool {
    //    unsafe { TODO: call ffi::gtk_recent_filter_filter() }
    //}

    fn get_name(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gtk_recent_filter_get_name(self.to_glib_none().0))
        }
    }

    fn get_needed(&self) -> RecentFilterFlags {
        unsafe {
            from_glib(ffi::gtk_recent_filter_get_needed(self.to_glib_none().0))
        }
    }

    fn set_name(&self, name: &str) {
        unsafe {
            ffi::gtk_recent_filter_set_name(self.to_glib_none().0, name.to_glib_none().0);
        }
    }
}