From fdacbe229e0defe6ef64068066a13369cce2ec27 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Thu, 25 Oct 2007 19:59:36 +0000 Subject: Move address and typed-address from EphyTab to EphyEmbed ephy-tab.c is totally broken now, will fix in next patches. svn path=/trunk/; revision=7557 --- src/ephy-lockdown.c | 4 +- src/ephy-shell.c | 4 +- src/ephy-tab.c | 154 +--------------------------------------------------- src/ephy-tab.h | 19 ------- src/ephy-toolbar.c | 4 +- src/epiphany.defs | 28 +++++----- 6 files changed, 23 insertions(+), 190 deletions(-) (limited to 'src') diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c index 543108b0e..47369cabc 100644 --- a/src/ephy-lockdown.c +++ b/src/ephy-lockdown.c @@ -108,8 +108,8 @@ update_location_editable (EphyWindow *window, address = ephy_embed_get_location (embed, TRUE); ephy_toolbar_set_location (EPHY_TOOLBAR (toolbar), address, NULL); - ephy_tab_set_typed_address (tab, NULL, - EPHY_TAB_ADDRESS_EXPIRE_CURRENT); + ephy_embed_set_typed_address (ephy_tab_get_embed (tab), NULL, + EPHY_EMBED_ADDRESS_EXPIRE_CURRENT); g_free (address); } } diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 1dae5309b..25872e432 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -533,8 +533,8 @@ ephy_shell_new_tab_full (EphyShell *shell, if (flags & EPHY_NEW_TAB_HOME_PAGE || flags & EPHY_NEW_TAB_NEW_PAGE) { - ephy_tab_set_typed_address (tab, "", - EPHY_TAB_ADDRESS_EXPIRE_NEXT); + ephy_embed_set_typed_address (embed, "", + EPHY_EMBED_ADDRESS_EXPIRE_NEXT); ephy_toolbar_activate_location (toolbar); is_empty = load_homepage (embed); } diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 87d4a01df..bcd109e20 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -83,8 +83,6 @@ struct _EphyTabPrivate char *status_message; char *link_message; - char *address; - char *typed_address; char *title; char *loading_title; char *icon_address; @@ -99,8 +97,6 @@ struct _EphyTabPrivate /* Flags */ guint is_blank : 1; - EphyTabAddressExpire address_expire; - /* guint address_expire : 2; ? */ /* File watch */ GnomeVFSMonitorHandle *monitor; @@ -116,14 +112,12 @@ static void ephy_tab_finalize (GObject *object); enum { PROP_0, - PROP_ADDRESS, PROP_ICON, PROP_ICON_ADDRESS, PROP_MESSAGE, PROP_HIDDEN_POPUP_COUNT, PROP_POPUPS_ALLOWED, - PROP_TITLE, - PROP_TYPED_ADDRESS + PROP_TITLE }; typedef struct @@ -207,17 +201,12 @@ ephy_tab_set_property (GObject *object, switch (prop_id) { - case PROP_TYPED_ADDRESS: - ephy_tab_set_typed_address (tab, g_value_get_string (value), - EPHY_TAB_ADDRESS_EXPIRE_NOW); - break; case PROP_POPUPS_ALLOWED: ephy_tab_set_popups_allowed (tab, g_value_get_boolean (value)); break; case PROP_ICON_ADDRESS: ephy_tab_set_icon_address (tab, g_value_get_string (value)); break; - case PROP_ADDRESS: case PROP_ICON: case PROP_MESSAGE: case PROP_HIDDEN_POPUP_COUNT: @@ -238,9 +227,6 @@ ephy_tab_get_property (GObject *object, switch (prop_id) { - case PROP_ADDRESS: - g_value_set_string (value, priv->address); - break; case PROP_ICON: g_value_set_object (value, priv->icon); break; @@ -260,9 +246,6 @@ ephy_tab_get_property (GObject *object, case PROP_TITLE: g_value_set_string (value, priv->title); break; - case PROP_TYPED_ADDRESS: - g_value_set_string (value, ephy_tab_get_typed_address (tab)); - break; } } @@ -355,14 +338,6 @@ ephy_tab_class_init (EphyTabClass *class) widget_class->map = ephy_tab_map; widget_class->grab_focus = ephy_tab_grab_focus; - g_object_class_install_property (object_class, - PROP_ADDRESS, - g_param_spec_string ("address", - "Address", - "The tab's address", - "", - 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", @@ -413,14 +388,6 @@ ephy_tab_class_init (EphyTabClass *class) _("Blank page"), G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - g_object_class_install_property (object_class, - PROP_TYPED_ADDRESS, - g_param_spec_string ("typed-address", - "Typed Address", - "The typed address", - "", - G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - g_type_class_add_private (object_class, sizeof (EphyTabPrivate)); } @@ -744,8 +711,6 @@ ephy_tab_finalize (GObject *object) g_free (priv->title); g_free (priv->loading_title); - g_free (priv->address); - g_free (priv->typed_address); g_free (priv->icon_address); g_free (priv->link_message); g_free (priv->status_message); @@ -849,36 +814,6 @@ ephy_tab_set_loading_title (EphyTab *tab, g_free (freeme); } -/* consumes |address| */ -static void -ephy_tab_set_address (EphyTab *tab, - char *address) -{ - EphyTabPrivate *priv = tab->priv; - GObject *object = G_OBJECT (tab); - gboolean is_loading; - - g_free (priv->address); - priv->address = address; - - priv->is_blank = address == NULL || - strcmp (address, "about:blank") == 0; - - is_loading = ephy_embed_get_load_status (ephy_tab_get_embed (tab)); - - if (is_loading && - priv->address_expire == EPHY_TAB_ADDRESS_EXPIRE_NOW && - priv->typed_address != NULL) - { - g_free (priv->typed_address); - priv->typed_address = NULL; - - g_object_notify (object, "typed-address"); - } - - g_object_notify (object, "address"); -} - /* Public functions */ /** @@ -1198,13 +1133,13 @@ ephy_file_monitor_reload_cb (EphyTab *tab) return TRUE; } - LOG ("Reloading file '%s'", priv->address); - priv->reload_scheduled_id = 0; embed = ephy_tab_get_embed (tab); if (embed == NULL) return FALSE; + LOG ("Reloading file '%s'", ephy_embed_get_address (embed)); + ephy_embed_reload (embed, TRUE); /* don't run again */ @@ -1883,10 +1818,8 @@ ephy_tab_init (EphyTab *tab) priv->icon_address = NULL; priv->icon = NULL; priv->address = NULL; - priv->typed_address = NULL; priv->title = NULL; priv->loading_title = NULL; - priv->address_expire = EPHY_TAB_ADDRESS_EXPIRE_NOW; priv->reload_delay_ticks = 0; embed = ephy_embed_factory_new_object (EPHY_TYPE_EMBED); @@ -2073,87 +2006,6 @@ ephy_tab_get_title (EphyTab *tab) return title != NULL ? title : ""; } -/** - * ephy_tab_get_address: - * @tab: an #EphyTab - * - * Returns the address of the currently loaded page. - * - * Return value: @tab's address. Will never be %NULL. - **/ -const char * -ephy_tab_get_address (EphyTab *tab) -{ - EphyTabPrivate *priv; - - g_return_val_if_fail (EPHY_IS_TAB (tab), ""); - - priv = tab->priv; - - return priv->address ? priv->address : "about:blank"; -} - -/** - * ephy_tab_get_typed_address: - * @tab: an #EphyTab - * - * Returns the text that @tab's #EphyWindow will display in its location toolbar - * entry when @tab is selected. - * - * This is not guaranteed to be the same as @tab's #EphyEmbed's location, - * available through ephy_embed_get_location(). As the user types a new address - * into the location entry, ephy_tab_get_location()'s returned string will - * change. - * - * Return value: @tab's #EphyWindow's location entry when @tab is selected - **/ -const char * -ephy_tab_get_typed_address (EphyTab *tab) -{ - EphyTabPrivate *priv; - - g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); - - priv = tab->priv; - - return priv->typed_address; -} - -/** - * ephy_tab_set_typed_address: - * @tab: an #EphyTab - * @address: the new typed address, or %NULL to clear it - * @expire: when to expire this address_expire - * - * Sets the text that @tab's #EphyWindow will display in its location toolbar - * entry when @tab is selected. - **/ -void -ephy_tab_set_typed_address (EphyTab *tab, - const char *address, - EphyTabAddressExpire expire) -{ - EphyTabPrivate *priv = tab->priv; - gboolean is_loading; - - g_free (priv->typed_address); - priv->typed_address = g_strdup (address); - - is_loading = ephy_embed_get_load_status (ephy_tab_get_embed (tab)); - - if (expire == EPHY_TAB_ADDRESS_EXPIRE_CURRENT && - !is_loading) - { - priv->address_expire = EPHY_TAB_ADDRESS_EXPIRE_NOW; - } - else - { - priv->address_expire = expire; - } - - g_object_notify (G_OBJECT (tab), "typed-address"); -} - /* private */ guint _ephy_tab_get_id (EphyTab *tab) diff --git a/src/ephy-tab.h b/src/ephy-tab.h index 4eac9757b..3af85fb80 100644 --- a/src/ephy-tab.h +++ b/src/ephy-tab.h @@ -40,13 +40,6 @@ typedef struct _EphyTabClass EphyTabClass; typedef struct _EphyTab EphyTab; typedef struct _EphyTabPrivate EphyTabPrivate; -typedef enum -{ - EPHY_TAB_ADDRESS_EXPIRE_NOW, - EPHY_TAB_ADDRESS_EXPIRE_NEXT, - EPHY_TAB_ADDRESS_EXPIRE_CURRENT -} EphyTabAddressExpire; - struct _EphyTab { GtkBin parent; @@ -80,18 +73,8 @@ gboolean ephy_tab_get_load_status (EphyTab *tab); const char *ephy_tab_get_link_message (EphyTab *tab); -int ephy_tab_get_load_percent (EphyTab *tab); - const char *ephy_tab_get_address (EphyTab *tab); -const char *ephy_tab_get_typed_address (EphyTab *tab); - -void ephy_tab_set_typed_address (EphyTab *tab, - const char *address, - EphyTabAddressExpire expire); - -EphyEmbedSecurityLevel ephy_tab_get_security_level (EphyTab *tab); - void ephy_tab_get_size (EphyTab *tab, int *width, int *height); @@ -106,8 +89,6 @@ const char *ephy_tab_get_title (EphyTab *tab); const char *ephy_tab_get_title_composite (EphyTab *tab); -float ephy_tab_get_zoom (EphyTab *tab); - /* private */ guint _ephy_tab_get_id (EphyTab *tab); diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c index beb5f9070..ccd03ece6 100644 --- a/src/ephy-toolbar.c +++ b/src/ephy-toolbar.c @@ -181,8 +181,8 @@ sync_user_input_cb (EphyLocationAction *action, address = ephy_location_action_get_address (action); priv->updating_address = TRUE; - ephy_tab_set_typed_address (tab, address, - EPHY_TAB_ADDRESS_EXPIRE_CURRENT); + ephy_embed_set_typed_address (ephy_tab_get_embed (tab), address, + EPHY_EMBED_ADDRESS_EXPIRE_CURRENT); priv->updating_address = FALSE; } diff --git a/src/epiphany.defs b/src/epiphany.defs index 02c5bfabd..d6904a4e4 100644 --- a/src/epiphany.defs +++ b/src/epiphany.defs @@ -437,14 +437,14 @@ ) ) -(define-enum TabAddressExpire +(define-enum EmbedAddressExpire (in-module "Ephy") - (c-name "EphyTabAddressExpire") - (gtype-id "EPHY_TYPE_TAB_ADDRESS_EXPIRE") + (c-name "EphyEmbedAddressExpire") + (gtype-id "EPHY_TYPE_EMBED_ADDRESS_EXPIRE") (values - '("now" "EPHY_TAB_ADDRESS_EXPIRE_NOW") - '("next" "EPHY_TAB_ADDRESS_EXPIRE_NEXT") - '("current" "EPHY_TAB_ADDRESS_EXPIRE_CURRENT") + '("now" "EPHY_EMBED_ADDRESS_EXPIRE_NOW") + '("next" "EPHY_EMBED_ADDRESS_EXPIRE_NEXT") + '("current" "EPHY_EMBED_ADDRESS_EXPIRE_CURRENT") ) ) @@ -947,6 +947,11 @@ (return-type "GType") ) +(define-function ephy_embed_address_expire_get_type + (c-name "ephy_embed_address_expire_get_type") + (return-type "GType") +) + (define-function ephy_embed_net_state_get_type (c-name "ephy_embed_net_state_get_type") (return-type "GType") @@ -3368,12 +3373,12 @@ ) (define-method set_typed_address - (of-object "EphyTab") - (c-name "ephy_tab_set_typed_address") + (of-object "EphyEmbed") + (c-name "ephy_embed_set_typed_address") (return-type "none") (parameters '("const-char*" "address") - '("EphyTabAddressExpire" "expire") + '("EphyEmbedAddressExpire" "expire") ) ) @@ -3532,11 +3537,6 @@ (return-type "GType") ) -(define-function ephy_tab_address_expire_get_type - (c-name "ephy_tab_address_expire_get_type") - (return-type "GType") -) - (define-function ephy_navigation_direction_get_type (c-name "ephy_navigation_direction_get_type") (return-type "GType") -- cgit v1.2.3