gf-clipboard.c 1.64 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright (C) 2019 Alberts Muktupāvels
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include "config.h"
#include "gf-clipboard.h"

21
22
#include "gsd-clipboard-manager.h"

23
24
struct _GfClipboard
{
25
26
27
  GObject              parent;

  GsdClipboardManager *manager;
28
29
30
31
};

G_DEFINE_TYPE (GfClipboard, gf_clipboard, G_TYPE_OBJECT)

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
static void
gf_clipboard_dispose (GObject *object)
{
  GfClipboard *self;

  self = GF_CLIPBOARD (object);

  if (self->manager != NULL)
    {
      gsd_clipboard_manager_stop (self->manager);
      g_clear_object (&self->manager);
    }

  G_OBJECT_CLASS (gf_clipboard_parent_class)->dispose (object);
}

48
49
50
static void
gf_clipboard_class_init (GfClipboardClass *self_class)
{
51
52
53
54
55
  GObjectClass *object_class;

  object_class = G_OBJECT_CLASS (self_class);

  object_class->dispose = gf_clipboard_dispose;
56
57
58
59
60
}

static void
gf_clipboard_init (GfClipboard *self)
{
61
62
63
  self->manager = gsd_clipboard_manager_new ();

  gsd_clipboard_manager_start (self->manager, NULL);
64
65
66
67
68
69
70
}

GfClipboard *
gf_clipboard_new (void)
{
  return g_object_new (GF_TYPE_CLIPBOARD, NULL);
}