2
* This file is part of GPaste.
4
* Copyright 2015 Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
6
* GPaste is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* GPaste is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with GPaste. If not, see <http://www.gnu.org/licenses/>.
20
#include "gpaste-keybinding-private.h"
22
#include <gpaste-gsettings-keys.h>
23
#include <gpaste-upload-keybinding.h>
25
struct _GPasteUploadKeybinding
27
GPasteKeybinding parent_instance;
33
} GPasteUploadKeybindingPrivate;
35
G_DEFINE_TYPE_WITH_PRIVATE (GPasteUploadKeybinding, g_paste_upload_keybinding, G_PASTE_TYPE_KEYBINDING)
38
g_paste_upload_keybinding_dispose (GObject *object)
40
GPasteUploadKeybindingPrivate *priv = g_paste_upload_keybinding_get_instance_private (G_PASTE_UPLOAD_KEYBINDING (object));
42
g_clear_object (&priv->daemon);
44
G_OBJECT_CLASS (g_paste_upload_keybinding_parent_class)->dispose (object);
48
g_paste_upload_keybinding_class_init (GPasteUploadKeybindingClass *klass)
50
G_OBJECT_CLASS (klass)->dispose = g_paste_upload_keybinding_dispose;
54
g_paste_upload_keybinding_init (GPasteUploadKeybinding *self G_GNUC_UNUSED)
59
upload (GPasteKeybinding *self,
60
gpointer data G_GNUC_UNUSED)
62
GPasteUploadKeybindingPrivate *priv = g_paste_upload_keybinding_get_instance_private (G_PASTE_UPLOAD_KEYBINDING (self));
64
g_paste_daemon_upload (priv->daemon, 0);
68
* g_paste_upload_keybinding_new:
69
* @daemon: a #GPasteDaemon instance
71
* Create a new instance of #GPasteUploadKeybinding
73
* Returns: a newly allocated #GPasteUploadKeybinding
74
* free it with g_object_unref
76
G_PASTE_VISIBLE GPasteKeybinding *
77
g_paste_upload_keybinding_new (GPasteDaemon *daemon)
79
g_return_val_if_fail (G_PASTE_IS_DAEMON (daemon), NULL);
81
GPasteKeybinding *self = _g_paste_keybinding_new (G_PASTE_TYPE_UPLOAD_KEYBINDING,
82
G_PASTE_UPLOAD_SETTING,
83
g_paste_settings_get_upload,
86
GPasteUploadKeybindingPrivate *priv = g_paste_upload_keybinding_get_instance_private (G_PASTE_UPLOAD_KEYBINDING (self));
88
priv->daemon = g_object_ref (daemon);