aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-10-22 06:23:35 +0800
committerXan Lopez <xan@src.gnome.org>2007-10-22 06:23:35 +0800
commit21970860f6d87a62764bdafadae76f4d2f9a1691 (patch)
treebefb7c5925ba0cfa93c2a45a061f801caf949a0b /embed
parent20abb0405c42012e470173fc82dba03d7d4fe268 (diff)
downloadgsoc2013-epiphany-21970860f6d87a62764bdafadae76f4d2f9a1691.tar
gsoc2013-epiphany-21970860f6d87a62764bdafadae76f4d2f9a1691.tar.gz
gsoc2013-epiphany-21970860f6d87a62764bdafadae76f4d2f9a1691.tar.bz2
gsoc2013-epiphany-21970860f6d87a62764bdafadae76f4d2f9a1691.tar.lz
gsoc2013-epiphany-21970860f6d87a62764bdafadae76f4d2f9a1691.tar.xz
gsoc2013-epiphany-21970860f6d87a62764bdafadae76f4d2f9a1691.tar.zst
gsoc2013-epiphany-21970860f6d87a62764bdafadae76f4d2f9a1691.zip
Move navigation property from EphyTab to EphyEmbed.
svn path=/trunk/; revision=7549
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.c30
-rw-r--r--embed/ephy-embed.h18
-rw-r--r--embed/mozilla/mozilla-embed.cpp45
3 files changed, 89 insertions, 4 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 03b1500c7..99e194ecb 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -460,8 +460,13 @@ ephy_embed_base_init (gpointer g_class)
"The embed's load status",
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
-
+ g_object_interface_install_property (g_class,
+ g_param_spec_flags ("navigation",
+ "Navigation flags",
+ "The embed's navigation flags",
+ EPHY_TYPE_EMBED_NAVIGATION_FLAGS,
+ 0,
+ G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
initialized = TRUE;
}
@@ -1125,4 +1130,25 @@ ephy_embed_set_load_status (EphyEmbed *embed, gboolean status)
return iface->set_load_status (embed, status);
}
+/**
+ * ephy_embed_get_navigation_flags:
+ * @embed: an #EphyEmbed
+ *
+ * Returns @embed's navigation flags.
+ *
+ * Return value: @embed's navigation flags
+ **/
+EphyEmbedNavigationFlags
+ephy_embed_get_navigation_flags (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_navigation_flags (embed);
+}
+
+void
+ephy_embed_update_navigation_flags (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->update_navigation_flags (embed);
+}
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 394e778f6..2c64234e9 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -101,6 +101,13 @@ typedef enum
EPHY_EMBED_DOCUMENT_OTHER
} EphyEmbedDocumentType;
+typedef enum
+{
+ EPHY_EMBED_NAV_UP = 1 << 0,
+ EPHY_EMBED_NAV_BACK = 1 << 1,
+ EPHY_EMBED_NAV_FORWARD = 1 << 2
+} EphyEmbedNavigationFlags;
+
struct _EphyEmbedIface
{
GTypeInterface base_iface;
@@ -233,6 +240,8 @@ struct _EphyEmbedIface
void (* set_load_percent) (EphyEmbed *embed, int percent);
gboolean (* get_load_status) (EphyEmbed *embed);
void (* set_load_status) (EphyEmbed *embed, gboolean percent);
+ void (* update_navigation_flags) (EphyEmbed *embed);
+ EphyEmbedNavigationFlags (* get_navigation_flags) (EphyEmbed *embed);
};
GType ephy_embed_net_state_get_type (void);
@@ -333,8 +342,13 @@ int ephy_embed_get_load_percent (EphyEmbed *embed);
void ephy_embed_set_load_percent (EphyEmbed *embed, int percent); /* FIXME: remove me */
/* Load status */
-gboolean ephy_embed_get_load_status (EphyEmbed *embed);
-void ephy_embed_set_load_status (EphyEmbed *embed, gboolean status); /* FIXME: remove me */
+gboolean ephy_embed_get_load_status (EphyEmbed *embed);
+void ephy_embed_set_load_status (EphyEmbed *embed, gboolean status); /* FIXME: remove me */
+
+/* Navigation flags */
+
+void ephy_embed_update_navigation_flags (EphyEmbed *embed); /* FIXME: remove me */
+EphyEmbedNavigationFlags ephy_embed_get_navigation_flags (EphyEmbed *embed);
/* Encoding */
char *ephy_embed_get_encoding (EphyEmbed *embed);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 3693f4e95..f2c990849 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -104,6 +104,7 @@ struct MozillaEmbedPrivate
EphyEmbedSecurityLevel security_level;
/* guint security_level : 3; ? */
EphyEmbedDocumentType document_type;
+ EphyEmbedNavigationFlags nav_flags;
float zoom;
/* Flags */
@@ -121,6 +122,7 @@ enum
PROP_DOCUMENT_TYPE,
PROP_LOAD_PROGRESS,
PROP_LOAD_STATUS,
+ PROP_NAVIGATION,
PROP_SECURITY,
PROP_ZOOM
};
@@ -241,6 +243,9 @@ mozilla_embed_get_property (GObject *object,
case PROP_LOAD_STATUS:
g_value_set_boolean (value, priv->is_loading);
break;
+ case PROP_NAVIGATION:
+ g_value_set_flags (value, priv->nav_flags);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -259,6 +264,7 @@ mozilla_embed_set_property (GObject *object,
case PROP_DOCUMENT_TYPE:
case PROP_LOAD_PROGRESS:
case PROP_LOAD_STATUS:
+ case PROP_NAVIGATION:
case PROP_SECURITY:
case PROP_ZOOM:
/* read only */
@@ -293,6 +299,7 @@ mozilla_embed_class_init (MozillaEmbedClass *klass)
g_object_class_override_property (object_class, PROP_ZOOM, "zoom");
g_object_class_override_property (object_class, PROP_LOAD_PROGRESS, "load-progress");
g_object_class_override_property (object_class, PROP_LOAD_STATUS, "load-status");
+ g_object_class_override_property (object_class, PROP_NAVIGATION, "navigation");
g_type_class_add_private (object_class, sizeof(MozillaEmbedPrivate));
}
@@ -961,6 +968,42 @@ impl_set_load_status (EphyEmbed *embed, gboolean status)
}
static void
+impl_update_navigation_flags (EphyEmbed *embed)
+{
+ MozillaEmbedPrivate *priv = MOZILLA_EMBED (embed)->priv;
+ guint flags = 0;
+
+ if (ephy_embed_can_go_up (embed))
+ {
+ flags |= EPHY_EMBED_NAV_UP;
+ }
+
+ if (ephy_embed_can_go_back (embed))
+ {
+ flags |= EPHY_EMBED_NAV_BACK;
+ }
+
+ if (ephy_embed_can_go_forward (embed))
+ {
+ flags |= EPHY_EMBED_NAV_FORWARD;
+ }
+
+ if (priv->nav_flags != (EphyEmbedNavigationFlags)flags)
+ {
+ priv->nav_flags = (EphyEmbedNavigationFlags)flags;
+
+ g_object_notify (G_OBJECT (embed), "navigation");
+ }
+}
+
+static EphyEmbedNavigationFlags
+impl_get_navigation_flags (EphyEmbed *embed)
+{
+ MozillaEmbedPrivate *priv = MOZILLA_EMBED (embed)->priv;
+ return priv->nav_flags;
+}
+
+static void
mozilla_embed_location_changed_cb (GtkMozEmbed *embed,
MozillaEmbed *membed)
{
@@ -1421,6 +1464,8 @@ ephy_embed_iface_init (EphyEmbedIface *iface)
iface->set_load_percent = impl_set_load_percent;
iface->get_load_status = impl_get_load_status;
iface->set_load_status = impl_set_load_status;
+ iface->update_navigation_flags = impl_update_navigation_flags;
+ iface->get_navigation_flags = impl_get_navigation_flags;
}
static void