aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--embed/ephy-embed.c23
-rw-r--r--embed/ephy-embed.h32
-rw-r--r--embed/mozilla/mozilla-embed.cpp47
-rw-r--r--src/ephy-tab.c48
-rw-r--r--src/ephy-tab.h2
-rw-r--r--src/ephy-window.c31
-rw-r--r--src/epiphany.defs6
7 files changed, 100 insertions, 89 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
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 01eb2552a..d22a6abd5 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -97,7 +97,6 @@ struct _EphyTabPrivate
GSList *hidden_popups;
GSList *shown_popups;
EphyTabNavigationFlags nav_flags;
- EphyEmbedDocumentType document_type;
guint idle_resize_handler;
gint8 load_percent;
@@ -123,7 +122,6 @@ enum
{
PROP_0,
PROP_ADDRESS,
- PROP_DOCUMENT_TYPE,
PROP_ICON,
PROP_ICON_ADDRESS,
PROP_LOAD_PROGRESS,
@@ -237,7 +235,6 @@ ephy_tab_set_property (GObject *object,
ephy_tab_set_icon_address (tab, g_value_get_string (value));
break;
case PROP_ADDRESS:
- case PROP_DOCUMENT_TYPE:
case PROP_ICON:
case PROP_LOAD_PROGRESS:
case PROP_LOAD_STATUS:
@@ -265,9 +262,6 @@ ephy_tab_get_property (GObject *object,
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_ICON:
g_value_set_object (value, priv->icon);
break;
@@ -403,15 +397,6 @@ ephy_tab_class_init (EphyTabClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_install_property (object_class,
- PROP_DOCUMENT_TYPE,
- g_param_spec_enum ("document-type",
- "Document Type",
- "The tab'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));
-
- g_object_class_install_property (object_class,
PROP_ICON,
g_param_spec_object ("icon",
"Icon",
@@ -990,22 +975,6 @@ ephy_tab_set_load_status (EphyTab *tab, gboolean status)
}
/**
- * ephy_tab_get_document_type:
- * @tab: an #EphyTab
- *
- * Returns the type of the document loaded in @tab.
- *
- * Return value: the #EphyEmbedDocumentType
- **/
-EphyEmbedDocumentType
-ephy_tab_get_document_type (EphyTab *tab)
-{
- g_return_val_if_fail (EPHY_IS_TAB (tab), EPHY_EMBED_DOCUMENT_OTHER);
-
- return tab->priv->document_type;
-}
-
-/**
* ephy_tab_get_load_status:
* @tab: an #EphyTab
*
@@ -1596,19 +1565,6 @@ ephy_tab_content_change_cb (EphyEmbed *embed, const char *address, EphyTab *tab)
}
static void
-ephy_tab_document_type_cb (EphyEmbed *embed,
- EphyEmbedDocumentType type,
- EphyTab *tab)
-{
- if (tab->priv->document_type != type)
- {
- tab->priv->document_type = type;
-
- g_object_notify (G_OBJECT (tab), "document-type");
- }
-}
-
-static void
ephy_tab_zoom_changed_cb (EphyEmbed *embed, float zoom, EphyTab *tab)
{
char *address;
@@ -2085,7 +2041,6 @@ ephy_tab_init (EphyTab *tab)
tab->priv->height = -1;
tab->priv->load_percent = 0;
tab->priv->is_loading = FALSE;
- tab->priv->document_type = EPHY_EMBED_DOCUMENT_HTML;
tab->priv->zoom = 1.0;
priv->title = NULL;
priv->is_blank = TRUE;
@@ -2107,9 +2062,6 @@ ephy_tab_init (EphyTab *tab)
g_signal_connect_object (embed, "link_message",
G_CALLBACK (ephy_tab_link_message_cb),
tab, 0);
- g_signal_connect_object (embed, "ge_document_type",
- G_CALLBACK (ephy_tab_document_type_cb),
- tab, 0);
g_signal_connect_object (embed, "open_uri",
G_CALLBACK (ephy_tab_open_uri_cb),
tab, 0);
diff --git a/src/ephy-tab.h b/src/ephy-tab.h
index 425afc796..cb40338a7 100644
--- a/src/ephy-tab.h
+++ b/src/ephy-tab.h
@@ -75,8 +75,6 @@ EphyEmbed *ephy_tab_get_embed (EphyTab *tab);
EphyTab *ephy_tab_for_embed (EphyEmbed *embed);
-EphyEmbedDocumentType ephy_tab_get_document_type (EphyTab *tab);
-
GdkPixbuf *ephy_tab_get_icon (EphyTab *tab);
const char *ephy_tab_get_icon_address (EphyTab *tab);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 3ae490fc3..47c02f5be 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1388,7 +1388,7 @@ sync_tab_address (EphyTab *tab,
}
static void
-sync_tab_document_type (EphyTab *tab,
+sync_tab_document_type (EphyEmbed *embed,
GParamSpec *pspec,
EphyWindow *window)
{
@@ -1401,9 +1401,10 @@ sync_tab_document_type (EphyTab *tab,
if (priv->closing) return;
/* update zoom actions */
- sync_tab_zoom (tab, NULL, window);
+ /* FIXME: need to move zoom to embed to uncomment this
+ sync_tab_zoom (tab, NULL, window);*/
- type = ephy_tab_get_document_type (tab);
+ type = ephy_embed_get_document_type (embed);
can_find = (type != EPHY_EMBED_DOCUMENT_IMAGE);
is_image = type == EPHY_EMBED_DOCUMENT_IMAGE;
disable = (type != EPHY_EMBED_DOCUMENT_HTML);
@@ -1729,7 +1730,7 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
if (window->priv->closing) return;
zoom = ephy_tab_get_zoom (tab);
- type = ephy_tab_get_document_type (tab);
+ type = ephy_embed_get_document_type (ephy_tab_get_embed (tab));
can_zoom = (type != EPHY_EMBED_DOCUMENT_IMAGE);
if (zoom >= ZOOM_MAXIMAL)
@@ -2149,9 +2150,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
G_CALLBACK (sync_tab_address),
window);
g_signal_handlers_disconnect_by_func (old_tab,
- G_CALLBACK (sync_tab_document_type),
- window);
- g_signal_handlers_disconnect_by_func (old_tab,
G_CALLBACK (sync_tab_icon),
window);
g_signal_handlers_disconnect_by_func (old_tab,
@@ -2167,9 +2165,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
G_CALLBACK (sync_tab_navigation),
window);
g_signal_handlers_disconnect_by_func (old_tab,
- G_CALLBACK (sync_tab_security),
- window);
- g_signal_handlers_disconnect_by_func (old_tab,
G_CALLBACK (sync_tab_popup_windows),
window);
g_signal_handlers_disconnect_by_func (old_tab,
@@ -2183,6 +2178,14 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
window);
embed = ephy_tab_get_embed (old_tab);
+
+ g_signal_handlers_disconnect_by_func (embed,
+ G_CALLBACK (sync_tab_security),
+ window);
+ g_signal_handlers_disconnect_by_func (embed,
+ G_CALLBACK (sync_tab_document_type),
+ window);
+
g_signal_handlers_disconnect_by_func
(embed, G_CALLBACK (tab_context_menu_cb), window);
g_signal_handlers_disconnect_by_func
@@ -2197,9 +2200,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
embed = ephy_tab_get_embed (new_tab);
sync_tab_security (embed, NULL, window);
+ sync_tab_document_type (embed, NULL, window);
sync_tab_address (new_tab, NULL, window);
- sync_tab_document_type (new_tab, NULL, window);
sync_tab_icon (new_tab, NULL, window);
sync_tab_load_progress (new_tab, NULL, window);
sync_tab_load_status (new_tab, NULL, window);
@@ -2213,9 +2216,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
g_signal_connect_object (new_tab, "notify::address",
G_CALLBACK (sync_tab_address),
window, 0);
- g_signal_connect_object (new_tab, "notify::document-type",
- G_CALLBACK (sync_tab_document_type),
- window, 0);
g_signal_connect_object (new_tab, "notify::icon",
G_CALLBACK (sync_tab_icon),
window, 0);
@@ -2247,6 +2247,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
g_signal_connect_object (embed, "notify::security-level",
G_CALLBACK (sync_tab_security),
window, 0);
+ g_signal_connect_object (embed, "notify::document-type",
+ G_CALLBACK (sync_tab_document_type),
+ window, 0);
g_signal_connect_object (embed, "ge-context-menu",
G_CALLBACK (tab_context_menu_cb),
window, G_CONNECT_AFTER);
diff --git a/src/epiphany.defs b/src/epiphany.defs
index c7965760c..37ac91b24 100644
--- a/src/epiphany.defs
+++ b/src/epiphany.defs
@@ -3323,12 +3323,6 @@
)
)
-(define-method get_document_type
- (of-object "EphyTab")
- (c-name "ephy_tab_get_document_type")
- (return-type "EphyEmbedDocumentType")
-)
-
(define-method get_icon
(of-object "EphyTab")
(c-name "ephy_tab_get_icon")