diff options
author | Xan Lopez <xan@src.gnome.org> | 2007-10-21 23:43:49 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2007-10-21 23:43:49 +0800 |
commit | 44f0f0b9e7f1de89a7c83a9c404ed50d6f3b57f0 (patch) | |
tree | 8ff34df1a47dc35a7524e6fa8e8dab887c5d8c48 /src | |
parent | a657333db5a36e5377bdb29157d9ac99e86ceefb (diff) | |
download | gsoc2013-epiphany-44f0f0b9e7f1de89a7c83a9c404ed50d6f3b57f0.tar gsoc2013-epiphany-44f0f0b9e7f1de89a7c83a9c404ed50d6f3b57f0.tar.gz gsoc2013-epiphany-44f0f0b9e7f1de89a7c83a9c404ed50d6f3b57f0.tar.bz2 gsoc2013-epiphany-44f0f0b9e7f1de89a7c83a9c404ed50d6f3b57f0.tar.lz gsoc2013-epiphany-44f0f0b9e7f1de89a7c83a9c404ed50d6f3b57f0.tar.xz gsoc2013-epiphany-44f0f0b9e7f1de89a7c83a9c404ed50d6f3b57f0.tar.zst gsoc2013-epiphany-44f0f0b9e7f1de89a7c83a9c404ed50d6f3b57f0.zip |
Move zoom from EphyTab to EphyEmbed.
svn path=/trunk/; revision=7542
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-tab.c | 119 | ||||
-rw-r--r-- | src/ephy-window.c | 26 | ||||
-rw-r--r-- | src/epiphany.defs | 8 |
3 files changed, 14 insertions, 139 deletions
diff --git a/src/ephy-tab.c b/src/ephy-tab.c index d22a6abd5..b7b4852ad 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -93,7 +93,6 @@ struct _EphyTabPrivate int total_requests; int width; int height; - float zoom; GSList *hidden_popups; GSList *shown_popups; EphyTabNavigationFlags nav_flags; @@ -103,7 +102,6 @@ struct _EphyTabPrivate /* Flags */ guint is_blank : 1; guint is_loading : 1; - guint is_setting_zoom : 1; EphyTabAddressExpire address_expire; /* guint address_expire : 2; ? */ @@ -131,8 +129,7 @@ enum PROP_HIDDEN_POPUP_COUNT, PROP_POPUPS_ALLOWED, PROP_TITLE, - PROP_TYPED_ADDRESS, - PROP_ZOOM + PROP_TYPED_ADDRESS }; typedef struct @@ -164,8 +161,6 @@ static void ephy_tab_update_navigation_flags(EphyTab *tab, static void ephy_tab_set_title (EphyTab *tab, EphyEmbed *embed, char *new_title); -static void ephy_tab_set_zoom (EphyTab *tab, - float zoom); static guint popup_blocker_n_hidden (EphyTab *tab); static gboolean ephy_tab_get_popups_allowed (EphyTab *tab); static void ephy_tab_set_popups_allowed (EphyTab *tab, @@ -242,7 +237,6 @@ ephy_tab_set_property (GObject *object, case PROP_NAVIGATION: case PROP_HIDDEN_POPUP_COUNT: case PROP_TITLE: - case PROP_ZOOM: /* read only */ break; } @@ -293,9 +287,6 @@ ephy_tab_get_property (GObject *object, case PROP_TYPED_ADDRESS: g_value_set_string (value, ephy_tab_get_typed_address (tab)); break; - case PROP_ZOOM: - g_value_set_float (value, priv->zoom); - break; } } @@ -481,16 +472,6 @@ ephy_tab_class_init (EphyTabClass *class) "", G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - g_object_class_install_property (object_class, - PROP_ZOOM, - g_param_spec_float ("zoom", - "Zoom", - "The tab's zoom", - ZOOM_MINIMAL, - ZOOM_MAXIMAL, - 1.0, - G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - g_type_class_add_private (object_class, sizeof (EphyTabPrivate)); } @@ -1530,78 +1511,11 @@ ephy_tab_address_cb (EphyEmbed *embed, static void ephy_tab_content_change_cb (EphyEmbed *embed, const char *address, EphyTab *tab) { - EphyTabPrivate *priv = tab->priv; - - /* restore zoom level */ - if (address_has_web_scheme (address)) - { - EphyHistory *history; - EphyNode *host; - GValue value = { 0, }; - float zoom = 1.0, current_zoom; - - history = EPHY_HISTORY - (ephy_embed_shell_get_global_history (embed_shell)); - host = ephy_history_get_host (history, address); - - if (host != NULL && ephy_node_get_property - (host, EPHY_NODE_HOST_PROP_ZOOM, &value)) - { - zoom = g_value_get_float (&value); - g_value_unset (&value); - } - - current_zoom = ephy_embed_get_zoom (embed); - if (zoom != current_zoom) - { - priv->is_setting_zoom = TRUE; - ephy_embed_set_zoom (embed, zoom); - priv->is_setting_zoom = FALSE; - } - } - popups_manager_reset (tab); g_object_notify (G_OBJECT (tab), "popups-allowed"); } static void -ephy_tab_zoom_changed_cb (EphyEmbed *embed, float zoom, EphyTab *tab) -{ - char *address; - - LOG ("ephy_tab_zoom_changed_cb tab %p zoom %f", tab, zoom); - - ephy_tab_set_zoom (tab, zoom); - - if (tab->priv->is_setting_zoom) - { - return; - } - - address = ephy_embed_get_location (embed, TRUE); - if (address_has_web_scheme (address)) - { - EphyHistory *history; - EphyNode *host; - history = EPHY_HISTORY - (ephy_embed_shell_get_global_history (embed_shell)); - host = ephy_history_get_host (history, address); - - if (host != NULL) - { - float zoom; - - zoom = ephy_embed_get_zoom (embed); - ephy_node_set_property_float (host, - EPHY_NODE_HOST_PROP_ZOOM, - zoom); - } - } - - g_free (address); -} - -static void ephy_tab_title_cb (EphyEmbed *embed, EphyTab *tab) { @@ -2041,7 +1955,6 @@ ephy_tab_init (EphyTab *tab) tab->priv->height = -1; tab->priv->load_percent = 0; tab->priv->is_loading = FALSE; - tab->priv->zoom = 1.0; priv->title = NULL; priv->is_blank = TRUE; priv->icon_address = NULL; @@ -2071,9 +1984,6 @@ ephy_tab_init (EphyTab *tab) g_signal_connect_object (embed, "title", G_CALLBACK (ephy_tab_title_cb), tab, 0); - g_signal_connect_object (embed, "ge_zoom_change", - G_CALLBACK (ephy_tab_zoom_changed_cb), - tab, 0); g_signal_connect_object (embed, "ge_net_state", G_CALLBACK (ephy_tab_net_state_cb), tab, 0); @@ -2395,33 +2305,6 @@ ephy_tab_set_typed_address (EphyTab *tab, g_object_notify (G_OBJECT (tab), "typed-address"); } -static void -ephy_tab_set_zoom (EphyTab *tab, float zoom) -{ - g_return_if_fail (EPHY_IS_TAB (tab)); - - tab->priv->zoom = zoom; - - g_object_notify (G_OBJECT (tab), "zoom"); -} - -/** - * ephy_tab_get_zoom: - * @tab: an #EphyTab - * - * Returns the zoom level of the web page loaded in @tab. A return value of - * 1.0 corresponds to 100% zoom (normal size). - * - * Return value: @tab's loaded page's zoom level - **/ -float -ephy_tab_get_zoom (EphyTab *tab) -{ - g_return_val_if_fail (EPHY_IS_TAB (tab), 1.0); - - return tab->priv->zoom; -} - /* private */ guint _ephy_tab_get_id (EphyTab *tab) diff --git a/src/ephy-window.c b/src/ephy-window.c index 47c02f5be..efeb48605 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -103,7 +103,7 @@ static void sync_tab_load_status (EphyTab *tab, static void sync_tab_security (EphyEmbed *embed, GParamSpec *pspec, EphyWindow *window); -static void sync_tab_zoom (EphyTab *tab, +static void sync_tab_zoom (EphyEmbed *embed, GParamSpec *pspec, EphyWindow *window); @@ -1401,8 +1401,7 @@ sync_tab_document_type (EphyEmbed *embed, if (priv->closing) return; /* update zoom actions */ - /* FIXME: need to move zoom to embed to uncomment this - sync_tab_zoom (tab, NULL, window);*/ + sync_tab_zoom (embed, NULL, window); type = ephy_embed_get_document_type (embed); can_find = (type != EPHY_EMBED_DOCUMENT_IMAGE); @@ -1719,7 +1718,7 @@ sync_tab_title (EphyTab *tab, } static void -sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) +sync_tab_zoom (EphyEmbed *embed, GParamSpec *pspec, EphyWindow *window) { GtkActionGroup *action_group; GtkAction *action; @@ -1729,8 +1728,8 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) if (window->priv->closing) return; - zoom = ephy_tab_get_zoom (tab); - type = ephy_embed_get_document_type (ephy_tab_get_embed (tab)); + zoom = ephy_embed_get_zoom (embed); + type = ephy_embed_get_document_type (embed); can_zoom = (type != EPHY_EMBED_DOCUMENT_IMAGE); if (zoom >= ZOOM_MAXIMAL) @@ -2173,9 +2172,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) g_signal_handlers_disconnect_by_func (old_tab, G_CALLBACK (sync_tab_title), window); - g_signal_handlers_disconnect_by_func (old_tab, - G_CALLBACK (sync_tab_zoom), - window); embed = ephy_tab_get_embed (old_tab); @@ -2185,6 +2181,10 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) g_signal_handlers_disconnect_by_func (embed, G_CALLBACK (sync_tab_document_type), window); + g_signal_handlers_disconnect_by_func (embed, + G_CALLBACK (sync_tab_zoom), + window); + g_signal_handlers_disconnect_by_func (embed, G_CALLBACK (tab_context_menu_cb), window); @@ -2201,6 +2201,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) sync_tab_security (embed, NULL, window); sync_tab_document_type (embed, NULL, window); + sync_tab_zoom (embed, NULL, window); sync_tab_address (new_tab, NULL, window); sync_tab_icon (new_tab, NULL, window); @@ -2211,7 +2212,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) sync_tab_popup_windows (new_tab, NULL, window); sync_tab_popups_allowed (new_tab, NULL, window); sync_tab_title (new_tab, NULL, window); - sync_tab_zoom (new_tab, NULL, window); g_signal_connect_object (new_tab, "notify::address", G_CALLBACK (sync_tab_address), @@ -2240,9 +2240,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) g_signal_connect_object (new_tab, "notify::title", G_CALLBACK (sync_tab_title), window, 0); - g_signal_connect_object (new_tab, "notify::zoom", - G_CALLBACK (sync_tab_zoom), - window, 0); g_signal_connect_object (embed, "notify::security-level", G_CALLBACK (sync_tab_security), @@ -2250,6 +2247,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) g_signal_connect_object (embed, "notify::document-type", G_CALLBACK (sync_tab_document_type), window, 0); + g_signal_connect_object (embed, "notify::zoom", + G_CALLBACK (sync_tab_zoom), + 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 37ac91b24..d9ea18035 100644 --- a/src/epiphany.defs +++ b/src/epiphany.defs @@ -3428,14 +3428,6 @@ (return-type "const-char*") ) -(define-method get_zoom - (of-object "EphyTab") - (c-name "ephy_tab_get_zoom") - (return-type "float") -) - - - ;; From ../../src/ephy-toolbar.h (define-function ephy_toolbar_get_type |