1/*
2 * Copyright (C) 2008 Collabora Ltd.
3 * Copyright (C) 2009 Martin Robinson
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include "config.h"
21#include "GRefPtrGtk.h"
22
23#include <glib.h>
24#include <gtk/gtk.h>
25
26#if USE(LIBSECRET)
27#define SECRET_WITH_UNSTABLE 1
28#define SECRET_API_SUBJECT_TO_CHANGE 1
29#include <libsecret/secret.h>
30#endif
31
32namespace WTF {
33
34template <> GtkTargetList* refGPtr(GtkTargetList* ptr)
35{
36 if (ptr)
37 gtk_target_list_ref(ptr);
38 return ptr;
39}
40
41template <> void derefGPtr(GtkTargetList* ptr)
42{
43 if (ptr)
44 gtk_target_list_unref(ptr);
45}
46
47#if USE(LIBSECRET)
48template <> SecretValue* refGPtr(SecretValue* ptr)
49{
50 if (ptr)
51 secret_value_ref(ptr);
52 return ptr;
53}
54
55template <> void derefGPtr(SecretValue* ptr)
56{
57 if (ptr)
58 secret_value_unref(ptr);
59}
60#endif
61
62#ifdef GTK_API_VERSION_2
63template <> GdkCursor* refGPtr(GdkCursor* ptr)
64{
65 if (ptr)
66 gdk_cursor_ref(ptr);
67 return ptr;
68}
69
70template <> void derefGPtr(GdkCursor* ptr)
71{
72 if (ptr)
73 gdk_cursor_unref(ptr);
74}
75
76#else
77
78template <> GtkWidgetPath* refGPtr(GtkWidgetPath* ptr)
79{
80 if (ptr)
81 gtk_widget_path_ref(ptr);
82 return ptr;
83}
84
85template <> void derefGPtr(GtkWidgetPath* ptr)
86{
87 if (ptr)
88 gtk_widget_path_unref(ptr);
89}
90
91#endif
92
93}
94