aboutsummaryrefslogtreecommitdiffstats
path: root/src/clipboard_store.rs
blob: d334dd63d59a7179fd266750cc37426c3f7e569c (plain)
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
extern crate clipboard;

use std::error::Error;

use clipboard::ClipboardContext;

pub struct ClipboardStore {
    context: ClipboardContext,
    original: String,
}

impl ClipboardStore {
    pub fn new() -> Result<ClipboardStore, Box<Error>> {
        let context = try!(ClipboardContext::new());

        return Ok(
            ClipboardStore {
                context: context,
                original: String::new(),
            }
        )
    }

    pub fn set_contents(&mut self, data: String) -> Result<(), Box<Error>> {
        if self.original.is_empty() {
            self.original = try!(self.context.get_contents())
        }

        // Set new clipboard contents
        // self.context.set_contents(data)
        Ok(())
    }

    pub fn reset() {
    }
}