aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--embed/ephy-embed.c30
-rw-r--r--embed/ephy-embed.h18
-rw-r--r--embed/mozilla/mozilla-embed.cpp45
-rw-r--r--src/ephy-tab.c67
-rw-r--r--src/ephy-tab.h9
-rw-r--r--src/ephy-window.c30
-rw-r--r--src/epiphany.defs38
7 files changed, 121 insertions, 116 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
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 73c1e1c2f..87d4a01df 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -95,7 +95,6 @@ struct _EphyTabPrivate
int height;
GSList *hidden_popups;
GSList *shown_popups;
- EphyTabNavigationFlags nav_flags;
guint idle_resize_handler;
/* Flags */
@@ -121,7 +120,6 @@ enum
PROP_ICON,
PROP_ICON_ADDRESS,
PROP_MESSAGE,
- PROP_NAVIGATION,
PROP_HIDDEN_POPUP_COUNT,
PROP_POPUPS_ALLOWED,
PROP_TITLE,
@@ -148,8 +146,6 @@ static guint n_tabs = 0;
/* internal functions, accessible only from this file */
static void ephy_tab_set_link_message (EphyTab *tab,
char *message);
-static void ephy_tab_update_navigation_flags(EphyTab *tab,
- EphyEmbed *embed);
static void ephy_tab_set_title (EphyTab *tab,
EphyEmbed *embed,
char *new_title);
@@ -224,7 +220,6 @@ ephy_tab_set_property (GObject *object,
case PROP_ADDRESS:
case PROP_ICON:
case PROP_MESSAGE:
- case PROP_NAVIGATION:
case PROP_HIDDEN_POPUP_COUNT:
case PROP_TITLE:
/* read only */
@@ -255,9 +250,6 @@ ephy_tab_get_property (GObject *object,
case PROP_MESSAGE:
g_value_set_string (value, ephy_tab_get_status_message (tab));
break;
- case PROP_NAVIGATION:
- g_value_set_flags (value, priv->nav_flags);
- break;
case PROP_HIDDEN_POPUP_COUNT:
g_value_set_int (value, popup_blocker_n_hidden (tab));
break;
@@ -396,15 +388,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_NAVIGATION,
- g_param_spec_flags ("navigation",
- "Navigation flags",
- "The tab's navigation flags",
- EPHY_TYPE_TAB_NAVIGATION_FLAGS,
- 0,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property (object_class,
PROP_HIDDEN_POPUP_COUNT,
g_param_spec_int ("hidden-popup-count",
"Number of Blocked Popups",
@@ -1443,7 +1426,7 @@ ephy_tab_address_cb (EphyEmbed *embed,
ephy_tab_set_link_message (tab, NULL);
ephy_tab_set_icon_address (tab, NULL);
- ephy_tab_update_navigation_flags (tab, embed);
+ ephy_embed_update_navigation_flags (embed);
g_object_notify (object, "title");
@@ -1623,7 +1606,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed,
ephy_embed_set_load_percent (embed, 0);
ephy_embed_set_load_status (embed, TRUE);
- ephy_tab_update_navigation_flags (tab, embed);
+ ephy_embed_update_navigation_flags (embed);
ensure_page_info (tab, embed, uri);
@@ -1639,7 +1622,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed,
ephy_embed_set_load_percent (ephy_tab_get_embed (tab), 100);
ephy_embed_set_load_status (embed, FALSE);
- ephy_tab_update_navigation_flags (tab, embed);
+ ephy_embed_update_navigation_flags (embed);
g_free (priv->loading_title);
priv->loading_title = NULL;
@@ -1950,50 +1933,6 @@ ephy_tab_init (EphyTab *tab)
tab, 0);
}
-static void
-ephy_tab_update_navigation_flags (EphyTab *tab, EphyEmbed *embed)
-{
- EphyTabNavigationFlags flags = 0;
-
- if (ephy_embed_can_go_up (embed))
- {
- flags |= EPHY_TAB_NAV_UP;
- }
-
- if (ephy_embed_can_go_back (embed))
- {
- flags |= EPHY_TAB_NAV_BACK;
- }
-
- if (ephy_embed_can_go_forward (embed))
- {
- flags |= EPHY_TAB_NAV_FORWARD;
- }
-
- if (flags != tab->priv->nav_flags)
- {
- tab->priv->nav_flags = flags;
-
- g_object_notify (G_OBJECT (tab), "navigation");
- }
-}
-
-/**
- * ephy_tab_get_navigation_flags:
- * @tab: an #EphyTab
- *
- * Returns @tab's navigation flags.
- *
- * Return value: @tab's navigation flags
- **/
-EphyTabNavigationFlags
-ephy_tab_get_navigation_flags (EphyTab *tab)
-{
- g_return_val_if_fail (EPHY_IS_TAB (tab), 0);
-
- return tab->priv->nav_flags;
-}
-
/**
* ephy_tab_get_status_message:
* @tab: an #EphyTab
diff --git a/src/ephy-tab.h b/src/ephy-tab.h
index cb40338a7..4eac9757b 100644
--- a/src/ephy-tab.h
+++ b/src/ephy-tab.h
@@ -42,13 +42,6 @@ typedef struct _EphyTabPrivate EphyTabPrivate;
typedef enum
{
- EPHY_TAB_NAV_UP = 1 << 0,
- EPHY_TAB_NAV_BACK = 1 << 1,
- EPHY_TAB_NAV_FORWARD = 1 << 2
-} EphyTabNavigationFlags;
-
-typedef enum
-{
EPHY_TAB_ADDRESS_EXPIRE_NOW,
EPHY_TAB_ADDRESS_EXPIRE_NEXT,
EPHY_TAB_ADDRESS_EXPIRE_CURRENT
@@ -97,8 +90,6 @@ void ephy_tab_set_typed_address (EphyTab *tab,
const char *address,
EphyTabAddressExpire expire);
-EphyTabNavigationFlags ephy_tab_get_navigation_flags (EphyTab *tab);
-
EphyEmbedSecurityLevel ephy_tab_get_security_level (EphyTab *tab);
void ephy_tab_get_size (EphyTab *tab,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index e7c13c8b7..1f4b47555 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1468,30 +1468,29 @@ sync_tab_message (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
}
static void
-sync_tab_navigation (EphyTab *tab,
+sync_tab_navigation (EphyEmbed *embed,
GParamSpec *pspec,
EphyWindow *window)
{
- EphyTabNavigationFlags flags;
+ EphyEmbedNavigationFlags flags;
gboolean up = FALSE, back = FALSE, forward = FALSE;
- EphyEmbed *embed;
char *back_url = NULL, *forward_url = NULL;
char *back_title = NULL, *forward_title = NULL;
gint position;
if (window->priv->closing) return;
- flags = ephy_tab_get_navigation_flags (tab);
+ flags = ephy_embed_get_navigation_flags (embed);
- if (flags & EPHY_TAB_NAV_UP)
+ if (flags & EPHY_EMBED_NAV_UP)
{
up = TRUE;
}
- if (flags & EPHY_TAB_NAV_BACK)
+ if (flags & EPHY_EMBED_NAV_BACK)
{
back = TRUE;
}
- if (flags & EPHY_TAB_NAV_FORWARD)
+ if (flags & EPHY_EMBED_NAV_FORWARD)
{
forward = TRUE;
}
@@ -1499,9 +1498,6 @@ sync_tab_navigation (EphyTab *tab,
ephy_toolbar_set_navigation_actions (window->priv->toolbar,
back, forward, up);
- embed = ephy_tab_get_embed (tab);
- if (embed == NULL) return;
-
position = ephy_embed_shistory_get_pos (embed);
if (position > 0)
@@ -2155,9 +2151,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
G_CALLBACK (sync_tab_message),
window);
g_signal_handlers_disconnect_by_func (old_tab,
- G_CALLBACK (sync_tab_navigation),
- window);
- g_signal_handlers_disconnect_by_func (old_tab,
G_CALLBACK (sync_tab_popup_windows),
window);
g_signal_handlers_disconnect_by_func (old_tab,
@@ -2184,6 +2177,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
g_signal_handlers_disconnect_by_func (embed,
G_CALLBACK (sync_tab_load_status),
window);
+ g_signal_handlers_disconnect_by_func (embed,
+ G_CALLBACK (sync_tab_navigation),
+ window);
g_signal_handlers_disconnect_by_func
(embed, G_CALLBACK (tab_context_menu_cb), window);
@@ -2203,11 +2199,11 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
sync_tab_zoom (embed, NULL, window);
sync_tab_load_progress (embed, NULL, window);
sync_tab_load_status (embed, NULL, window);
+ sync_tab_navigation (embed, NULL, window);
sync_tab_address (new_tab, NULL, window);
sync_tab_icon (new_tab, NULL, window);
sync_tab_message (new_tab, NULL, window);
- sync_tab_navigation (new_tab, NULL, window);
sync_tab_popup_windows (new_tab, NULL, window);
sync_tab_popups_allowed (new_tab, NULL, window);
sync_tab_title (new_tab, NULL, window);
@@ -2221,9 +2217,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
g_signal_connect_object (new_tab, "notify::message",
G_CALLBACK (sync_tab_message),
window, 0);
- g_signal_connect_object (new_tab, "notify::navigation",
- G_CALLBACK (sync_tab_navigation),
- window, 0);
g_signal_connect_object (new_tab, "notify::hidden-popup-count",
G_CALLBACK (sync_tab_popup_windows),
window, 0);
@@ -2246,6 +2239,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
g_signal_connect_object (embed, "notify::load-status",
G_CALLBACK (sync_tab_load_status),
window, 0);
+ g_signal_connect_object (embed, "notify::navigation",
+ G_CALLBACK (sync_tab_navigation),
+ 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 394ef4dd0..02c5bfabd 100644
--- a/src/epiphany.defs
+++ b/src/epiphany.defs
@@ -217,6 +217,17 @@
;; Enumerations and flags ...
+(define-flags EmbedNavigationFlags
+ (in-module "Ephy")
+ (c-name "EphyEmbedNavigationFlags")
+ (gtype-id "EPHY_TYPE_EMBED_NAVIGATION_FLAGS")
+ (values
+ '("up" "EPHY_EMBED_NAV_UP")
+ '("back" "EPHY_EMBED_NAV_BACK")
+ '("forward" "EPHY_EMBED_NAV_FORWARD")
+ )
+)
+
(define-flags EmbedEventContext
(in-module "Ephy")
(c-name "EphyEmbedEventContext")
@@ -426,17 +437,6 @@
)
)
-(define-flags TabNavigationFlags
- (in-module "Ephy")
- (c-name "EphyTabNavigationFlags")
- (gtype-id "EPHY_TYPE_TAB_NAVIGATION_FLAGS")
- (values
- '("up" "EPHY_TAB_NAV_UP")
- '("back" "EPHY_TAB_NAV_BACK")
- '("forward" "EPHY_TAB_NAV_FORWARD")
- )
-)
-
(define-enum TabAddressExpire
(in-module "Ephy")
(c-name "EphyTabAddressExpire")
@@ -942,6 +942,11 @@
;; From ../embed/ephy-embed.h
+(define-function ephy_embed_navigation_flags_get_type
+ (c-name "ephy_embed_navigation_flags_get_type")
+ (return-type "GType")
+)
+
(define-function ephy_embed_net_state_get_type
(c-name "ephy_embed_net_state_get_type")
(return-type "GType")
@@ -3372,12 +3377,6 @@
)
)
-(define-method get_navigation_flags
- (of-object "EphyTab")
- (c-name "ephy_tab_get_navigation_flags")
- (return-type "EphyTabNavigationFlags")
-)
-
(define-method get_size
(of-object "EphyTab")
(c-name "ephy_tab_get_size")
@@ -3533,11 +3532,6 @@
(return-type "GType")
)
-(define-function ephy_tab_navigation_flags_get_type
- (c-name "ephy_tab_navigation_flags_get_type")
- (return-type "GType")
-)
-
(define-function ephy_tab_address_expire_get_type
(c-name "ephy_tab_address_expire_get_type")
(return-type "GType")