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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/*
* Copyright © 2023 Benjamin Otte
*
* 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.1 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/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#include "config.h"
#include "gtklistheaderbaseprivate.h"
typedef struct _GtkListHeaderBasePrivate GtkListHeaderBasePrivate;
struct _GtkListHeaderBasePrivate
{
GObject *item;
guint start;
guint end;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkListHeaderBase, gtk_list_header_base, GTK_TYPE_WIDGET)
static void
gtk_list_header_base_default_update (GtkListHeaderBase *self,
gpointer item,
guint start,
guint end)
{
GtkListHeaderBasePrivate *priv = gtk_list_header_base_get_instance_private (self);
g_set_object (&priv->item, item);
priv->start = start;
priv->end = end;
}
static void
gtk_list_header_base_dispose (GObject *object)
{
GtkListHeaderBase *self = GTK_LIST_HEADER_BASE (object);
GtkListHeaderBasePrivate *priv = gtk_list_header_base_get_instance_private (self);
g_clear_object (&priv->item);
G_OBJECT_CLASS (gtk_list_header_base_parent_class)->dispose (object);
}
static void
gtk_list_header_base_class_init (GtkListHeaderBaseClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
klass->update = gtk_list_header_base_default_update;
gobject_class->dispose = gtk_list_header_base_dispose;
}
static void
gtk_list_header_base_init (GtkListHeaderBase *self)
{
}
void
gtk_list_header_base_update (GtkListHeaderBase *self,
gpointer item,
guint start,
guint end)
{
GtkListHeaderBasePrivate *priv = gtk_list_header_base_get_instance_private (self);
if (priv->item == item &&
priv->start == start &&
priv->end == end)
return;
GTK_LIST_HEADER_BASE_GET_CLASS (self)->update (self, item, start, end);
}
guint
gtk_list_header_base_get_start (GtkListHeaderBase *self)
{
GtkListHeaderBasePrivate *priv = gtk_list_header_base_get_instance_private (self);
return priv->start;
}
guint
gtk_list_header_base_get_end (GtkListHeaderBase *self)
{
GtkListHeaderBasePrivate *priv = gtk_list_header_base_get_instance_private (self);
return priv->end;
}
gpointer
gtk_list_header_base_get_item (GtkListHeaderBase *self)
{
GtkListHeaderBasePrivate *priv = gtk_list_header_base_get_instance_private (self);
return priv->item;
}
|