aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-10-21 23:43:38 +0800
committerXan Lopez <xan@src.gnome.org>2007-10-21 23:43:38 +0800
commita657333db5a36e5377bdb29157d9ac99e86ceefb (patch)
tree860ae63c12931790fbc5499ccc091e36b9f04df5 /embed
parent2be42c2960138a7997af6d8363235c9db90abe0b (diff)
downloadgsoc2013-epiphany-a657333db5a36e5377bdb29157d9ac99e86ceefb.tar
gsoc2013-epiphany-a657333db5a36e5377bdb29157d9ac99e86ceefb.tar.gz
gsoc2013-epiphany-a657333db5a36e5377bdb29157d9ac99e86ceefb.tar.bz2
gsoc2013-epiphany-a657333db5a36e5377bdb29157d9ac99e86ceefb.tar.lz
gsoc2013-epiphany-a657333db5a36e5377bdb29157d9ac99e86ceefb.tar.xz
gsoc2013-epiphany-a657333db5a36e5377bdb29157d9ac99e86ceefb.tar.zst
gsoc2013-epiphany-a657333db5a36e5377bdb29157d9ac99e86ceefb.zip
Move document-type property from EphyTab to EphyEmbed.
svn path=/trunk/; revision=7541
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.c23
-rw-r--r--embed/ephy-embed.h32
-rw-r--r--embed/mozilla/mozilla-embed.cpp47
3 files changed, 83 insertions, 19 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index dd3358078..c9a839e2b 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -430,6 +430,14 @@ ephy_embed_base_init (gpointer g_class)
EPHY_TYPE_EMBED_SECURITY_LEVEL,
EPHY_EMBED_STATE_IS_UNKNOWN,
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_enum ("document-type",
+ "Document Type",
+ "The embed's documen type",
+ EPHY_TYPE_EMBED_DOCUMENT_TYPE,
+ EPHY_EMBED_DOCUMENT_HTML,
+ G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
initialized = TRUE;
}
@@ -1023,3 +1031,18 @@ ephy_embed_has_modified_forms (EphyEmbed *embed)
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
return iface->has_modified_forms (embed);
}
+
+/**
+ * ephy_embed_get_document_type:
+ * @embed: an #EphyEmbed
+ *
+ * Returns the type of document loaded in the @embed
+ *
+ * Return value: the #EphyEmbedDocumentType
+ **/
+EphyEmbedDocumentType
+ephy_embed_get_document_type (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_document_type (embed);
+}
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 58784c7f4..599174c51 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -66,7 +66,7 @@ typedef enum
typedef enum
{
EPHY_EMBED_LOAD_FLAGS_NONE = 1 << 0,
- EPHY_EMBED_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 1 << 1,
+ EPHY_EMBED_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 1 << 1,
} EphyEmbedLoadFlags;
#define EPHY_EMBED_CHROME_ALL (EPHY_EMBED_CHROME_MENUBAR | \
@@ -107,12 +107,12 @@ struct _EphyEmbedIface
/* Signals that we inherit from gtkmozembed
*
- * void (* net_stop) (GtkMozEmbed *embed);
- * void (* title) (EphyEmbed *embed);
- * void (* visibility) (EphyEmbed *embed,
+ * void (* net_stop) (GtkMozEmbed *embed);
+ * void (* title) (EphyEmbed *embed);
+ * void (* visibility) (EphyEmbed *embed,
* gboolean visibility);
* void (* destroy_brsr) (EphyEmbed *embed);
- * void (* size_to) (EphyEmbed *embed,
+ * void (* size_to) (EphyEmbed *embed,
* int width,
* int height);
* gint (* open_uri) (EphyEmbed *embed,
@@ -140,7 +140,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,
@@ -202,8 +202,8 @@ struct _EphyEmbedIface
gboolean copy_forward,
gboolean copy_current);
void (* get_security_level) (EphyEmbed *embed,
- EphyEmbedSecurityLevel *level,
- char **description);
+ EphyEmbedSecurityLevel *level,
+ char **description);
void (* show_page_certificate) (EphyEmbed *embed);
void (* set_zoom) (EphyEmbed *embed,
float zoom);
@@ -211,7 +211,7 @@ struct _EphyEmbedIface
void (* scroll_lines) (EphyEmbed *embed,
int num_lines);
void (* scroll_pages) (EphyEmbed *embed,
- int num_pages);
+ int num_pages);
void (* scroll_pixels) (EphyEmbed *embed,
int dx,
int dy);
@@ -228,14 +228,15 @@ struct _EphyEmbedIface
int page);
gboolean (* has_modified_forms) (EphyEmbed *embed);
void (* close) (EphyEmbed *embed);
+ EphyEmbedDocumentType (* get_document_type) (EphyEmbed *embed);
};
-GType ephy_embed_net_state_get_type (void);
+GType ephy_embed_net_state_get_type (void);
GType ephy_embed_chrome_get_type (void);
-GType ephy_embed_ppv_navigation_get_type (void);
+GType ephy_embed_ppv_navigation_get_type (void);
GType ephy_embed_security_level_get_type (void);
@@ -256,7 +257,7 @@ void ephy_embed_stop_load (EphyEmbed *embed);
void ephy_embed_reload (EphyEmbed *embed,
gboolean force);
-char *ephy_embed_get_title (EphyEmbed *embed);
+char *ephy_embed_get_title (EphyEmbed *embed);
char *ephy_embed_get_location (EphyEmbed *embed,
gboolean toplevel);
@@ -272,7 +273,7 @@ gboolean ephy_embed_can_go_forward (EphyEmbed *embed);
gboolean ephy_embed_can_go_up (EphyEmbed *embed);
-GSList *ephy_embed_get_go_up_list (EphyEmbed *embed);
+GSList *ephy_embed_get_go_up_list (EphyEmbed *embed);
void ephy_embed_go_back (EphyEmbed *embed);
@@ -301,7 +302,7 @@ void ephy_embed_shistory_copy (EphyEmbed *source,
void ephy_embed_get_security_level (EphyEmbed *embed,
EphyEmbedSecurityLevel *level,
- char **description);
+ char **description);
void ephy_embed_show_page_certificate (EphyEmbed *embed);
@@ -321,6 +322,9 @@ void ephy_embed_page_scroll (EphyEmbed *embed,
void ephy_embed_scroll_pixels (EphyEmbed *embed,
int dx,
int dy);
+/* Document type */
+
+EphyEmbedDocumentType ephy_embed_get_document_type (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 b9444a0a6..2d6271db5 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -76,6 +76,10 @@ static void mozilla_embed_security_change_cb (GtkMozEmbed *embed,
gpointer request,
PRUint32 state,
MozillaEmbed *membed);
+static void mozilla_embed_document_type_cb (EphyEmbed *embed,
+ EphyEmbedDocumentType type,
+ MozillaEmbed *membed);
+
static EphyEmbedSecurityLevel mozilla_embed_security_level (PRUint32 state);
#define MOZILLA_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED, MozillaEmbedPrivate))
@@ -95,6 +99,7 @@ struct MozillaEmbedPrivate
EphyEmbedSecurityLevel security_level;
/* guint security_level : 3; ? */
+ EphyEmbedDocumentType document_type;
};
#define WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1"
@@ -102,6 +107,7 @@ struct MozillaEmbedPrivate
enum
{
PROP_0,
+ PROP_DOCUMENT_TYPE,
PROP_SECURITY
};
@@ -135,10 +141,10 @@ ephy_command_manager_iface_init (EphyCommandManagerIface *iface)
}
G_DEFINE_TYPE_WITH_CODE (MozillaEmbed, mozilla_embed, GTK_TYPE_MOZ_EMBED,
- G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED,
- ephy_embed_iface_init)
- G_IMPLEMENT_INTERFACE (EPHY_TYPE_COMMAND_MANAGER,
- ephy_command_manager_iface_init))
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED,
+ ephy_embed_iface_init)
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_COMMAND_MANAGER,
+ ephy_command_manager_iface_init))
static void
mozilla_embed_grab_focus (GtkWidget *widget)
@@ -192,7 +198,7 @@ mozilla_embed_constructor (GType type, guint n_construct_properties,
ephy_embed_shell_get_embed_single (embed_shell);
return G_OBJECT_CLASS (mozilla_embed_parent_class)->constructor (type, n_construct_properties,
- construct_params);
+ construct_params);
}
static void
@@ -206,6 +212,9 @@ mozilla_embed_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_DOCUMENT_TYPE:
+ g_value_set_enum (value, priv->document_type);
+ break;
case PROP_SECURITY:
g_value_set_enum (value, priv->security_level);
break;
@@ -224,6 +233,7 @@ mozilla_embed_set_property (GObject *object,
{
switch (prop_id)
{
+ case PROP_DOCUMENT_TYPE:
case PROP_SECURITY:
/* read only */
break;
@@ -252,6 +262,7 @@ mozilla_embed_class_init (MozillaEmbedClass *klass)
widget_class->grab_focus = mozilla_embed_grab_focus;
widget_class->realize = mozilla_embed_realize;
+ g_object_class_override_property (object_class, PROP_DOCUMENT_TYPE, "document-type");
g_object_class_override_property (object_class, PROP_SECURITY, "security-level");
g_type_class_add_private (object_class, sizeof(MozillaEmbedPrivate));
@@ -284,7 +295,11 @@ mozilla_embed_init (MozillaEmbed *embed)
g_signal_connect_object (embed, "security_change",
G_CALLBACK (mozilla_embed_security_change_cb),
embed, (GConnectFlags) 0);
+ g_signal_connect_object (embed, "ge_document_type",
+ G_CALLBACK (mozilla_embed_document_type_cb),
+ embed, (GConnectFlags) 0);
+ embed->priv->document_type = EPHY_EMBED_DOCUMENT_HTML;
embed->priv->security_level = EPHY_EMBED_STATE_IS_UNKNOWN;
}
@@ -856,6 +871,14 @@ impl_has_modified_forms (EphyEmbed *embed)
return NS_SUCCEEDED (rv) ? modified : FALSE;
}
+static EphyEmbedDocumentType
+impl_get_document_type (EphyEmbed *embed)
+{
+ MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
+
+ return mpriv->document_type;
+}
+
static void
mozilla_embed_location_changed_cb (GtkMozEmbed *embed,
MozillaEmbed *membed)
@@ -1135,6 +1158,19 @@ mozilla_embed_security_change_cb (GtkMozEmbed *embed,
mozilla_embed_set_security_level (membed, mozilla_embed_security_level (state));
}
+static void
+mozilla_embed_document_type_cb (EphyEmbed *embed,
+ EphyEmbedDocumentType type,
+ MozillaEmbed *membed)
+{
+ if (membed->priv->document_type != type)
+ {
+ membed->priv->document_type = type;
+
+ g_object_notify (G_OBJECT (membed), "document-type");
+ }
+}
+
static EphyEmbedSecurityLevel
mozilla_embed_security_level (PRUint32 state)
{
@@ -1206,6 +1242,7 @@ ephy_embed_iface_init (EphyEmbedIface *iface)
iface->print_preview_n_pages = impl_print_preview_n_pages;
iface->print_preview_navigate = impl_print_preview_navigate;
iface->has_modified_forms = impl_has_modified_forms;
+ iface->get_document_type = impl_get_document_type;
}
static void