aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-10-27 02:58:50 +0800
committerXan Lopez <xan@src.gnome.org>2007-10-27 02:58:50 +0800
commit0987a1d045308fd0284d4410e80ea85f331a5832 (patch)
treeb96c064846e21b773ff184c58bf762c8c3c3cbd7 /embed
parenta0677fc29ac5e82760e4c820078b822af4970a97 (diff)
downloadgsoc2013-epiphany-0987a1d045308fd0284d4410e80ea85f331a5832.tar
gsoc2013-epiphany-0987a1d045308fd0284d4410e80ea85f331a5832.tar.gz
gsoc2013-epiphany-0987a1d045308fd0284d4410e80ea85f331a5832.tar.bz2
gsoc2013-epiphany-0987a1d045308fd0284d4410e80ea85f331a5832.tar.lz
gsoc2013-epiphany-0987a1d045308fd0284d4410e80ea85f331a5832.tar.xz
gsoc2013-epiphany-0987a1d045308fd0284d4410e80ea85f331a5832.tar.zst
gsoc2013-epiphany-0987a1d045308fd0284d4410e80ea85f331a5832.zip
Add placeholders for all the new properties in embed.
The backend now compiles and runs. svn path=/trunk/; revision=7573
Diffstat (limited to 'embed')
-rw-r--r--embed/webkit/webkit-embed.cpp207
1 files changed, 192 insertions, 15 deletions
diff --git a/embed/webkit/webkit-embed.cpp b/embed/webkit/webkit-embed.cpp
index 8b1421148..3cd8dc40a 100644
--- a/embed/webkit/webkit-embed.cpp
+++ b/embed/webkit/webkit-embed.cpp
@@ -27,6 +27,8 @@
#include "ephy-string.h"
#include "ephy-embed-event.h"
+#include <libgnomevfs/gnome-vfs.h>
+
#include <webkitgtkframe.h>
#include <webkitgtkpage.h>
#include <webkitgtkglobal.h>
@@ -41,6 +43,10 @@ static void webkit_embed_destroy (GtkObject *object);
static void webkit_embed_finalize (GObject *object);
static void ephy_embed_iface_init (EphyEmbedIface *iface);
+static void impl_set_typed_address (EphyEmbed *embed,
+ const char *address,
+ EphyEmbedAddressExpire expire);
+
#define WEBKIT_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED, WebKitEmbedPrivate))
typedef enum
@@ -57,27 +63,52 @@ struct WebKitEmbedPrivate
WebKitEmbedLoadState load_state;
char *loading_uri;
+ EphyEmbedAddressExpire address_expire;
+ /* guint address_expire : 2; ? */
EphyEmbedSecurityLevel security_level;
/* guint security_level : 3; ? */
EphyEmbedDocumentType document_type;
EphyEmbedNavigationFlags nav_flags;
float zoom;
-
+
/* Flags */
+ guint is_blank : 1;
guint is_loading : 1;
guint is_setting_zoom : 1;
gint8 load_percent;
+ char *address;
+ char *typed_address;
+ char *title;
+ char *loading_title;
+ int cur_requests;
+ int total_requests;
+ char *status_message;
+ char *link_message;
+ char *icon_address;
+ GdkPixbuf *icon;
+
+ /* File watch */
+ GnomeVFSMonitorHandle *monitor;
+ guint reload_scheduled_id;
+ guint reload_delay_ticks;
};
enum
{
PROP_0,
+ PROP_ADDRESS,
PROP_DOCUMENT_TYPE,
+ PROP_ICON,
+ PROP_ICON_ADDRESS,
+ PROP_LINK_MESSAGE,
PROP_LOAD_PROGRESS,
PROP_LOAD_STATUS,
PROP_NAVIGATION,
PROP_SECURITY,
+ PROP_STATUS_MESSAGE,
+ PROP_TITLE,
+ PROP_TYPED_ADDRESS,
PROP_ZOOM
};
@@ -219,15 +250,21 @@ webkit_embed_get_property (GObject *object,
WebKitEmbedPrivate *priv = embed->priv;
switch (prop_id)
- {
+ {
+ case PROP_ADDRESS:
+ g_value_set_string (value, priv->address);
+ break;
case PROP_DOCUMENT_TYPE:
g_value_set_enum (value, priv->document_type);
break;
- case PROP_SECURITY:
- g_value_set_enum (value, priv->security_level);
+ case PROP_ICON:
+ g_value_set_object (value, priv->icon);
break;
- case PROP_ZOOM:
- g_value_set_float (value, priv->zoom);
+ case PROP_ICON_ADDRESS:
+ g_value_set_string (value, priv->icon_address);
+ break;
+ case PROP_LINK_MESSAGE:
+ g_value_set_string (value, priv->link_message);
break;
case PROP_LOAD_PROGRESS:
g_value_set_int (value, priv->load_percent);
@@ -238,10 +275,25 @@ webkit_embed_get_property (GObject *object,
case PROP_NAVIGATION:
g_value_set_flags (value, priv->nav_flags);
break;
+ case PROP_SECURITY:
+ g_value_set_enum (value, priv->security_level);
+ break;
+ case PROP_STATUS_MESSAGE:
+ g_value_set_string (value, priv->status_message);
+ break;
+ case PROP_TITLE:
+ g_value_set_string (value, priv->title);
+ break;
+ case PROP_TYPED_ADDRESS:
+ g_value_set_string (value, priv->typed_address);
+ break;
+ case PROP_ZOOM:
+ g_value_set_float (value, priv->zoom);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
- }
+ }
}
static void
@@ -251,19 +303,32 @@ webkit_embed_set_property (GObject *object,
GParamSpec *pspec)
{
switch (prop_id)
- {
+ {
+ case PROP_ICON_ADDRESS:
+#if 0
+ webkit_embed_set_icon_address (WEBKIT_EMBED (object), g_value_get_string (value));
+#endif
+ break;
+ case PROP_TYPED_ADDRESS:
+ impl_set_typed_address (EPHY_EMBED (object), g_value_get_string (value),
+ EPHY_EMBED_ADDRESS_EXPIRE_NOW);
+ break;
+ case PROP_ADDRESS:
case PROP_DOCUMENT_TYPE:
+ case PROP_ICON:
case PROP_LOAD_PROGRESS:
case PROP_LOAD_STATUS:
+ case PROP_LINK_MESSAGE:
case PROP_NAVIGATION:
case PROP_SECURITY:
+ case PROP_STATUS_MESSAGE:
case PROP_ZOOM:
/* read only */
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
- }
+ }
}
static void
@@ -288,6 +353,13 @@ webkit_embed_class_init (WebKitEmbedClass *klass)
g_object_class_override_property (object_class, PROP_SECURITY, "security-level");
g_object_class_override_property (object_class, PROP_ZOOM, "zoom");
g_object_class_override_property (object_class, PROP_NAVIGATION, "navigation");
+ g_object_class_override_property (object_class, PROP_ADDRESS, "address");
+ g_object_class_override_property (object_class, PROP_TYPED_ADDRESS, "typed-address");
+ g_object_class_override_property (object_class, PROP_TITLE, "title");
+ g_object_class_override_property (object_class, PROP_STATUS_MESSAGE, "status-message");
+ g_object_class_override_property (object_class, PROP_LINK_MESSAGE, "link-message");
+ g_object_class_override_property (object_class, PROP_ICON, "icon");
+ g_object_class_override_property (object_class, PROP_ICON_ADDRESS, "icon-address");
g_type_class_add_private (object_class, sizeof(WebKitEmbedPrivate));
}
@@ -340,6 +412,13 @@ webkit_embed_finalize (GObject *object)
WebKitEmbed *wembed = WEBKIT_EMBED (object);
g_free (wembed->priv->loading_uri);
+ g_free (wembed->priv->icon_address);
+ g_free (wembed->priv->address);
+ g_free (wembed->priv->typed_address);
+ g_free (wembed->priv->title);
+ g_free (wembed->priv->loading_title);
+ g_free (wembed->priv->status_message);
+ g_free (wembed->priv->link_message);
G_OBJECT_CLASS (webkit_embed_parent_class)->finalize (object);
}
@@ -437,12 +516,6 @@ impl_get_title (EphyEmbed *embed)
return webkit_frame_get_title (frame);
}
-static const char *
-impl_get_link_message (EphyEmbed *embed)
-{
- return NULL;
-}
-
static char *
impl_get_js_status (EphyEmbed *embed)
{
@@ -677,6 +750,102 @@ impl_update_navigation_flags (EphyEmbed *embed)
}
}
+static const char*
+impl_get_typed_address (EphyEmbed *embed)
+{
+ return WEBKIT_EMBED (embed)->priv->typed_address;
+}
+
+static void
+impl_set_typed_address (EphyEmbed *embed,
+ const char *address,
+ EphyEmbedAddressExpire expire)
+{
+ WebKitEmbedPrivate *priv = WEBKIT_EMBED (embed)->priv;
+
+ g_free (priv->typed_address);
+ priv->typed_address = g_strdup (address);
+
+ if (expire == EPHY_EMBED_ADDRESS_EXPIRE_CURRENT &&
+ !priv->is_loading)
+ {
+ priv->address_expire = EPHY_EMBED_ADDRESS_EXPIRE_NOW;
+ }
+ else
+ {
+ priv->address_expire = expire;
+ }
+
+ g_object_notify (G_OBJECT (embed), "typed-address");
+}
+
+static const char*
+impl_get_address (EphyEmbed *embed)
+{
+ WebKitEmbedPrivate *priv = WEBKIT_EMBED (embed)->priv;
+
+ return priv->address ? priv->address : "about:blank";
+}
+
+static const char*
+impl_get_status_message (EphyEmbed *embed)
+{
+ WebKitEmbedPrivate *priv = WEBKIT_EMBED (embed)->priv;
+
+ if (priv->link_message && priv->link_message[0] != '\0')
+ {
+ return priv->link_message;
+ }
+ else if (priv->status_message)
+ {
+ return priv->status_message;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+static const char*
+impl_get_link_message (EphyEmbed *embed)
+{
+ WebKitEmbedPrivate *priv = WEBKIT_EMBED (embed)->priv;
+
+ return priv->link_message;
+}
+
+static gboolean
+impl_get_is_blank (EphyEmbed *embed)
+{
+ WebKitEmbedPrivate *priv = WEBKIT_EMBED (embed)->priv;
+
+ return priv->is_blank;
+}
+
+static const char*
+impl_get_loading_title (EphyEmbed *embed)
+{
+ WebKitEmbedPrivate *priv = WEBKIT_EMBED (embed)->priv;
+
+ return priv->loading_title;
+}
+
+static const char*
+impl_get_icon_address (EphyEmbed *embed)
+{
+ WebKitEmbedPrivate *priv = WEBKIT_EMBED (embed)->priv;
+
+ return priv->icon_address;
+}
+
+static GdkPixbuf*
+impl_get_icon (EphyEmbed *embed)
+{
+ WebKitEmbedPrivate *priv = WEBKIT_EMBED (embed)->priv;
+
+ return priv->icon;
+}
+
static void
ephy_embed_iface_init (EphyEmbedIface *iface)
{
@@ -720,4 +889,12 @@ ephy_embed_iface_init (EphyEmbedIface *iface)
iface->get_load_status = impl_get_load_status;
iface->get_document_type = impl_get_document_type;
iface->get_navigation_flags = impl_get_navigation_flags;
+ iface->get_typed_address = impl_get_typed_address;
+ iface->set_typed_address = impl_set_typed_address;
+ iface->get_address = impl_get_address;
+ iface->get_status_message = impl_get_status_message;
+ iface->get_is_blank = impl_get_is_blank;
+ iface->get_loading_title = impl_get_loading_title;
+ iface->get_icon = impl_get_icon;
+ iface->get_icon_address = impl_get_icon_address;
}