blob: 570b2fbe0cef56a19456b0a68c0905e5d4f1d2fc (
plain) (
blame)
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
|
#include "mozilla-history-item.h"
#include "ephy-history-item.h"
static void mozilla_history_item_finalize (GObject *object);
static const char*
impl_get_url (EphyHistoryItem *item)
{
return MOZILLA_HISTORY_ITEM (item)->url;
}
static const char*
impl_get_title (EphyHistoryItem *item)
{
return MOZILLA_HISTORY_ITEM (item)->title;
}
static void
mozilla_history_item_iface_init (EphyHistoryItemIface *iface)
{
iface->get_url = impl_get_url;
iface->get_title = impl_get_title;
}
G_DEFINE_TYPE_WITH_CODE (MozillaHistoryItem, mozilla_history_item, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (EPHY_TYPE_HISTORY_ITEM,
mozilla_history_item_iface_init))
static void
mozilla_history_item_class_init (MozillaHistoryItemClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *)klass;
gobject_class->finalize = mozilla_history_item_finalize;
}
static void
mozilla_history_item_init (MozillaHistoryItem *self)
{
}
static void
mozilla_history_item_finalize (GObject *object)
{
MozillaHistoryItem *self = (MozillaHistoryItem *)object;
g_free (self->url);
g_free (self->title);
G_OBJECT_CLASS (mozilla_history_item_parent_class)->finalize (object);
}
MozillaHistoryItem*
mozilla_history_item_new (const char *url, const char *title, int index)
{
MozillaHistoryItem *item;
g_return_val_if_fail (url != NULL, NULL);
g_return_val_if_fail (title != NULL, NULL);
item = (MozillaHistoryItem*) g_object_new (MOZILLA_TYPE_HISTORY_ITEM, NULL);
item->url = g_strdup (url);
item->title = g_strdup (title);
item->nth = index;
return item;
}
|