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
/* CTK - The GIMP Toolkit
 * Copyright (C) 2018, Red Hat, Inc
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#include "config.h"

#include "ctkcolorpickerprivate.h"
#include "ctkcolorpickerportalprivate.h"
#include "ctkcolorpickershellprivate.h"
#include "ctkcolorpickerkwinprivate.h"
#include <gio/gio.h>


G_DEFINE_INTERFACE_WITH_CODE (CtkColorPicker, ctk_color_picker, G_TYPE_OBJECT,<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_INTERFACE_WITH_CODE is a macro then please configure it.
                              g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_INITABLE);)

static void
ctk_color_picker_default_init (CtkColorPickerInterface *iface G_GNUC_UNUSED)
{
}

void
ctk_color_picker_pick (CtkColorPicker      *picker,
                       GAsyncReadyCallback  callback,
                       gpointer             user_data)
{
  CTK_COLOR_PICKER_GET_INTERFACE (picker)->pick (picker, callback, user_data);
}

CdkRGBA *
ctk_color_picker_pick_finish (CtkColorPicker  *picker,
                              GAsyncResult    *res,
                              GError         **error)
{
  return CTK_COLOR_PICKER_GET_INTERFACE (picker)->pick_finish (picker, res, error);
}

CtkColorPicker *
ctk_color_picker_new (void)
{
  CtkColorPicker *picker;

  picker = ctk_color_picker_portal_new ();
  if (!picker)
    picker = ctk_color_picker_shell_new ();
  if (!picker)
    picker = ctk_color_picker_kwin_new ();

  if (!picker)
    g_debug ("No suitable CtkColorPicker implementation");
  else
    g_debug ("Using %s for picking colors", G_OBJECT_TYPE_NAME (picker));

  return picker;
}