aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/mozilla-history-item.cpp
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-12-30 00:59:00 +0800
committerXan Lopez <xan@src.gnome.org>2007-12-30 00:59:00 +0800
commiteeecbfedf3b0a9c1bdf3f17981dc885603d268af (patch)
tree234bcc4502a23b530fdb57805e1ca330716396e9 /embed/mozilla/mozilla-history-item.cpp
parent845fb8717fa53f67893f5f4b17bbdb711e11da2f (diff)
downloadgsoc2013-epiphany-eeecbfedf3b0a9c1bdf3f17981dc885603d268af.tar
gsoc2013-epiphany-eeecbfedf3b0a9c1bdf3f17981dc885603d268af.tar.gz
gsoc2013-epiphany-eeecbfedf3b0a9c1bdf3f17981dc885603d268af.tar.bz2
gsoc2013-epiphany-eeecbfedf3b0a9c1bdf3f17981dc885603d268af.tar.lz
gsoc2013-epiphany-eeecbfedf3b0a9c1bdf3f17981dc885603d268af.tar.xz
gsoc2013-epiphany-eeecbfedf3b0a9c1bdf3f17981dc885603d268af.tar.zst
gsoc2013-epiphany-eeecbfedf3b0a9c1bdf3f17981dc885603d268af.zip
Mozilla implementation of the embed history interfaces.
svn path=/trunk/; revision=7833
Diffstat (limited to 'embed/mozilla/mozilla-history-item.cpp')
-rw-r--r--embed/mozilla/mozilla-history-item.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/embed/mozilla/mozilla-history-item.cpp b/embed/mozilla/mozilla-history-item.cpp
new file mode 100644
index 000000000..b3c364e25
--- /dev/null
+++ b/embed/mozilla/mozilla-history-item.cpp
@@ -0,0 +1,69 @@
+#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);
+
+ g_object_set_data (G_OBJECT (item), HISTORY_ITEM_INDEX_KEY, GINT_TO_POINTER (index));
+
+ return item;
+}