aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-12-30 00:58:41 +0800
committerXan Lopez <xan@src.gnome.org>2007-12-30 00:58:41 +0800
commit845fb8717fa53f67893f5f4b17bbdb711e11da2f (patch)
tree40fdb192f2025e51e85eac83be3fa725a694d6b0 /embed
parent9c053200d3fbc1f8d7b6a0a70dab807d7461b716 (diff)
downloadgsoc2013-epiphany-845fb8717fa53f67893f5f4b17bbdb711e11da2f.tar
gsoc2013-epiphany-845fb8717fa53f67893f5f4b17bbdb711e11da2f.tar.gz
gsoc2013-epiphany-845fb8717fa53f67893f5f4b17bbdb711e11da2f.tar.bz2
gsoc2013-epiphany-845fb8717fa53f67893f5f4b17bbdb711e11da2f.tar.lz
gsoc2013-epiphany-845fb8717fa53f67893f5f4b17bbdb711e11da2f.tar.xz
gsoc2013-epiphany-845fb8717fa53f67893f5f4b17bbdb711e11da2f.tar.zst
gsoc2013-epiphany-845fb8717fa53f67893f5f4b17bbdb711e11da2f.zip
Add new embed history interfaces.
svn path=/trunk/; revision=7832
Diffstat (limited to 'embed')
-rw-r--r--embed/Makefile.am4
-rw-r--r--embed/ephy-embed.c79
-rw-r--r--embed/ephy-embed.h171
-rw-r--r--embed/ephy-history-item.c56
-rw-r--r--embed/ephy-history-item.h53
5 files changed, 282 insertions, 81 deletions
diff --git a/embed/Makefile.am b/embed/Makefile.am
index ed9349ce8..3deefb9bd 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -17,7 +17,8 @@ NOINST_H_FILES = \
ephy-embed-dialog.h \
ephy-embed-find.h \
ephy-encodings.h \
- ephy-favicon-cache.h
+ ephy-favicon-cache.h \
+ ephy-history-item.h
INST_H_FILES = \
ephy-adblock.h \
@@ -62,6 +63,7 @@ libephyembed_la_SOURCES = \
ephy-encodings.c \
ephy-favicon-cache.c \
ephy-history.c \
+ ephy-history-item.c \
ephy-password-manager.c \
ephy-permission-manager.c \
$(INST_H_FILES) \
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 042e323e0..48fcee4e9 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -1138,7 +1138,7 @@ ephy_embed_get_loading_title (EphyEmbed *embed)
* Returns whether the @embed's toplevel is visible or not. Used
* mostly for popup visibility management.
*
- * Return value; %TRUE if @embed's "visibility" property is set
+ * Return value: %TRUE if @embed's "visibility" property is set
**/
gboolean
ephy_embed_get_visibility (EphyEmbed *embed)
@@ -1146,3 +1146,80 @@ ephy_embed_get_visibility (EphyEmbed *embed)
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
return iface->get_visibility (embed);
}
+
+/**
+ * ephy_embed_get_backward_history:
+ * @embed: an #EphyEmbed
+ *
+ * Returns a #GList of #EphyHistoryItem compromising the
+ * history items preceding the current location.
+ *
+ * Return value: a #GList with the preceding history items
+ **/
+GList*
+ephy_embed_get_backward_history (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_backward_history (embed);
+}
+
+/**
+ * ephy_embed_get_forward_history:
+ * @embed: an #EphyEmbed
+ *
+ * Returns a #GList of #EphyHistoryItem compromising the
+ * history items succeeding the current location.
+ *
+ * Return value: a #GList with the succeeding history items
+ **/
+GList*
+ephy_embed_get_forward_history (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_forward_history (embed);
+}
+
+/**
+ * ephy_embed_get_previous_history_item:
+ * @embed: an #EphyEmbed
+ *
+ * Returns the preceding #EphyHistoryItem in the history list.
+ *
+ * Return value: the preceding #EphyHistoryItem
+ **/
+EphyHistoryItem*
+ephy_embed_get_previous_history_item (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_previous_history_item (embed);
+}
+
+/**
+ * ephy_embed_get_next_history_item:
+ * @embed: an #EphyEmbed
+ *
+ * Returns the succeeding #EphyHistoryItem in the history list.
+ *
+ * Return value: the succeeding #EphyHistoryItem
+ **/
+EphyHistoryItem*
+ephy_embed_get_next_history_item (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_next_history_item (embed);
+}
+
+/**
+ * ephy_embed_go_to_history_item:
+ * @embed: an #EphyEmbed
+ * @history_item: an #EphyHistoryItem
+ *
+ * Opens the webpage specified by @history_item in @embed's history.
+ *
+ **/
+void
+ephy_embed_go_to_history_item (EphyEmbed *embed, EphyHistoryItem *history_item)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ iface->go_to_history_item (embed, history_item);
+}
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 3539b7649..35f28240e 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -22,6 +22,7 @@
#define EPHY_EMBED_H
#include "ephy-embed-event.h"
+#include "ephy-history-item.h"
#include <glib-object.h>
#include <glib.h>
@@ -135,7 +136,7 @@ struct _EphyEmbedIface
EphyEmbedEvent *event);
gboolean (* dom_mouse_down) (EphyEmbed *embed,
EphyEmbedEvent *event);
- void (* dom_content_loaded) (EphyEmbed *embed,
+ void (* dom_content_loaded) (EphyEmbed *embed,
gpointer event);
void (* popup_blocked) (EphyEmbed *embed,
const char *address,
@@ -146,7 +147,7 @@ struct _EphyEmbedIface
void (* content_blocked) (EphyEmbed *embed,
const char *uri);
gboolean (* modal_alert) (EphyEmbed *embed);
- void (* modal_alert_closed) (EphyEmbed *embed);
+ void (* modal_alert_closed) (EphyEmbed *embed);
void (* document_type) (EphyEmbed *embed,
EphyEmbedDocumentType type);
void (* new_window) (EphyEmbed *embed,
@@ -156,84 +157,89 @@ struct _EphyEmbedIface
gboolean (* close_request) (EphyEmbed *embed);
/* Methods */
- void (* load_url) (EphyEmbed *embed,
- const char *url);
- void (* load) (EphyEmbed *embed,
- const char *url,
- EphyEmbedLoadFlags flags,
- EphyEmbed *referring_embed);
- void (* stop_load) (EphyEmbed *embed);
- void (* reload) (EphyEmbed *embed,
- gboolean force);
- gboolean (* can_go_back) (EphyEmbed *embed);
- gboolean (* can_go_forward) (EphyEmbed *embed);
- gboolean (* can_go_up) (EphyEmbed *embed);
- GSList * (* get_go_up_list) (EphyEmbed *embed);
- void (* go_back) (EphyEmbed *embed);
- void (* go_forward) (EphyEmbed *embed);
- void (* go_up) (EphyEmbed *embed);
-
- const char * (* get_title) (EphyEmbed *embed);
- char * (* get_location) (EphyEmbed *embed,
- gboolean toplevel);
- const char * (* get_link_message) (EphyEmbed *embed);
- char * (* get_js_status) (EphyEmbed *embed);
- int (* shistory_n_items) (EphyEmbed *embed);
- void (* shistory_get_nth) (EphyEmbed *embed,
- int nth,
- gboolean is_relative,
- char **url,
- char **title);
- int (* shistory_get_pos) (EphyEmbed *embed);
- void (* shistory_go_nth) (EphyEmbed *embed,
- int nth);
- void (* shistory_copy) (EphyEmbed *source,
- EphyEmbed *dest,
- gboolean copy_back,
- gboolean copy_forward,
- gboolean copy_current);
- void (* get_security_level) (EphyEmbed *embed,
- EphyEmbedSecurityLevel *level,
- char **description);
- void (* show_page_certificate) (EphyEmbed *embed);
- void (* set_zoom) (EphyEmbed *embed,
- float zoom);
- float (* get_zoom) (EphyEmbed *embed);
- void (* scroll_lines) (EphyEmbed *embed,
- int num_lines);
- void (* scroll_pages) (EphyEmbed *embed,
- int num_pages);
- void (* scroll_pixels) (EphyEmbed *embed,
- int dx,
- int dy);
- char * (* get_encoding) (EphyEmbed *embed);
- gboolean (* has_automatic_encoding) (EphyEmbed *embed);
- void (* set_encoding) (EphyEmbed *embed,
- const char *encoding);
- void (* print) (EphyEmbed *embed);
- void (* set_print_preview_mode) (EphyEmbed *embed,
- gboolean mode);
- int (* print_preview_n_pages) (EphyEmbed *embed);
- void (* print_preview_navigate) (EphyEmbed *embed,
- EphyEmbedPrintPreviewNavType type,
- int page);
- gboolean (* has_modified_forms) (EphyEmbed *embed);
- void (* close) (EphyEmbed *embed);
- EphyEmbedDocumentType (* get_document_type) (EphyEmbed *embed);
- int (* get_load_percent) (EphyEmbed *embed);
- gboolean (* get_load_status) (EphyEmbed *embed);
+ void (* load_url) (EphyEmbed *embed,
+ const char *url);
+ void (* load) (EphyEmbed *embed,
+ const char *url,
+ EphyEmbedLoadFlags flags,
+ EphyEmbed *referring_embed);
+ void (* stop_load) (EphyEmbed *embed);
+ void (* reload) (EphyEmbed *embed,
+ gboolean force);
+ gboolean (* can_go_back) (EphyEmbed *embed);
+ gboolean (* can_go_forward) (EphyEmbed *embed);
+ gboolean (* can_go_up) (EphyEmbed *embed);
+ GSList * (* get_go_up_list) (EphyEmbed *embed);
+ void (* go_back) (EphyEmbed *embed);
+ void (* go_forward) (EphyEmbed *embed);
+ void (* go_up) (EphyEmbed *embed);
+ const char * (* get_title) (EphyEmbed *embed);
+ char * (* get_location) (EphyEmbed *embed,
+ gboolean toplevel);
+ const char * (* get_link_message) (EphyEmbed *embed);
+ char * (* get_js_status) (EphyEmbed *embed);
+ int (* shistory_n_items) (EphyEmbed *embed);
+ void (* shistory_get_nth) (EphyEmbed *embed,
+ int nth,
+ gboolean is_relative,
+ char **url,
+ char **title);
+ int (* shistory_get_pos) (EphyEmbed *embed);
+ void (* shistory_go_nth) (EphyEmbed *embed,
+ int nth);
+ void (* shistory_copy) (EphyEmbed *source,
+ EphyEmbed *dest,
+ gboolean copy_back,
+ gboolean copy_forward,
+ gboolean copy_current);
+ void (* get_security_level) (EphyEmbed *embed,
+ EphyEmbedSecurityLevel *level,
+ char **description);
+ void (* show_page_certificate) (EphyEmbed *embed);
+ void (* set_zoom) (EphyEmbed *embed,
+ float zoom);
+ float (* get_zoom) (EphyEmbed *embed);
+ void (* scroll_lines) (EphyEmbed *embed,
+ int num_lines);
+ void (* scroll_pages) (EphyEmbed *embed,
+ int num_pages);
+ void (* scroll_pixels) (EphyEmbed *embed,
+ int dx,
+ int dy);
+ char * (* get_encoding) (EphyEmbed *embed);
+ gboolean (* has_automatic_encoding) (EphyEmbed *embed);
+ void (* set_encoding) (EphyEmbed *embed,
+ const char *encoding);
+ void (* print) (EphyEmbed *embed);
+ void (* set_print_preview_mode) (EphyEmbed *embed,
+ gboolean mode);
+ int (* print_preview_n_pages) (EphyEmbed *embed);
+ void (* print_preview_navigate) (EphyEmbed *embed,
+ EphyEmbedPrintPreviewNavType type,
+ int page);
+ gboolean (* has_modified_forms) (EphyEmbed *embed);
+ void (* close) (EphyEmbed *embed);
+ EphyEmbedDocumentType (* get_document_type) (EphyEmbed *embed);
+ int (* get_load_percent) (EphyEmbed *embed);
+ gboolean (* get_load_status) (EphyEmbed *embed);
EphyEmbedNavigationFlags (* get_navigation_flags) (EphyEmbed *embed);
- const char * (* get_typed_address) (EphyEmbed *embed);
- void (* set_typed_address) (EphyEmbed *embed,
- const char *address,
- EphyEmbedAddressExpire expire);
- const char * (* get_address) (EphyEmbed *embed);
- const char * (* get_status_message) (EphyEmbed *embed);
- GdkPixbuf * (* get_icon) (EphyEmbed *embed);
- const char * (* get_icon_address) (EphyEmbed *embed);
- gboolean (* get_is_blank) (EphyEmbed *embed);
- const char * (* get_loading_title) (EphyEmbed *embed);
- gboolean (* get_visibility) (EphyEmbed *embed);
+ const char * (* get_typed_address) (EphyEmbed *embed);
+ void (* set_typed_address) (EphyEmbed *embed,
+ const char *address,
+ EphyEmbedAddressExpire expire);
+ const char * (* get_address) (EphyEmbed *embed);
+ const char * (* get_status_message) (EphyEmbed *embed);
+ GdkPixbuf * (* get_icon) (EphyEmbed *embed);
+ const char * (* get_icon_address) (EphyEmbed *embed);
+ gboolean (* get_is_blank) (EphyEmbed *embed);
+ const char * (* get_loading_title) (EphyEmbed *embed);
+ gboolean (* get_visibility) (EphyEmbed *embed);
+ GList * (* get_backward_history) (EphyEmbed *embed);
+ GList * (* get_forward_history) (EphyEmbed *embed);
+ EphyHistoryItem * (* get_next_history_item) (EphyEmbed *embed);
+ EphyHistoryItem * (* get_previous_history_item) (EphyEmbed *embed);
+ void (* go_to_history_item) (EphyEmbed *embed,
+ EphyHistoryItem *history_item);
};
GType ephy_embed_net_state_get_type (void);
@@ -385,6 +391,13 @@ void ephy_embed_close (EphyEmbed *embed);
gboolean ephy_embed_has_modified_forms (EphyEmbed *embed);
+/* History */
+GList *ephy_embed_get_backward_history (EphyEmbed *embed);
+GList *ephy_embed_get_forward_history (EphyEmbed *embed);
+EphyHistoryItem *ephy_embed_get_next_history_item (EphyEmbed *embed);
+EphyHistoryItem *ephy_embed_get_previous_history_item (EphyEmbed *embed);
+void ephy_embed_go_to_history_item (EphyEmbed *embed, EphyHistoryItem *history_item);
+
G_END_DECLS
#endif
diff --git a/embed/ephy-history-item.c b/embed/ephy-history-item.c
new file mode 100644
index 000000000..83703943c
--- /dev/null
+++ b/embed/ephy-history-item.c
@@ -0,0 +1,56 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/*
+ * Copyright © 2007 Xan Lopez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "ephy-history-item.h"
+
+GType
+ephy_history_item_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo our_info =
+ {
+ sizeof (EphyHistoryItemIface),
+ NULL,
+ NULL,
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "EphyHistoryItem",
+ &our_info, (GTypeFlags)0);
+ }
+
+ return type;
+}
+
+const char*
+ephy_history_item_get_url (EphyHistoryItem *item)
+{
+ EphyHistoryItemIface *iface = EPHY_HISTORY_ITEM_GET_IFACE (item);
+ return iface->get_url (item);
+}
+
+const char*
+ephy_history_item_get_title (EphyHistoryItem *item)
+{
+ EphyHistoryItemIface *iface = EPHY_HISTORY_ITEM_GET_IFACE (item);
+ return iface->get_title (item);
+}
diff --git a/embed/ephy-history-item.h b/embed/ephy-history-item.h
new file mode 100644
index 000000000..153dcb745
--- /dev/null
+++ b/embed/ephy-history-item.h
@@ -0,0 +1,53 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/*
+ * Copyright © 2007 Xan Lopez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef __EPHY_HISTORY_ITEM_H__
+#define __EPHY_HISTORY_ITEM_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_HISTORY_ITEM (ephy_history_item_get_type ())
+#define EPHY_HISTORY_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_HISTORY_ITEM, EphyHistoryItem))
+#define EPHY_HISTORY_ITEM_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_HISTORY_ITEM, EphyHistoryItemIface))
+#define EPHY_IS_HISTORY_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_HISTORY_ITEM))
+#define EPHY_IS_HISTORY_ITEM_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_HISTORY_ITEM))
+#define EPHY_HISTORY_ITEM_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_HISTORY_ITEM, EphyHistoryItemIface))
+
+typedef struct _EphyHistoryItem EphyHistoryItem;
+typedef struct _EphyHistoryItemIface EphyHistoryItemIface;
+
+struct _EphyHistoryItemIface
+{
+ GTypeInterface base_iface;
+
+ const char * (* get_url) (EphyHistoryItem *item);
+ const char * (* get_title) (EphyHistoryItem *item);
+};
+
+GType ephy_history_item_get_type (void);
+const char* ephy_history_item_get_url (EphyHistoryItem *item);
+const char* ephy_history_item_get_title (EphyHistoryItem *item);
+
+G_END_DECLS
+
+#endif /* __EPHY_HISTORY_ITEM_H__ */