diff options
author | Xan Lopez <xan@src.gnome.org> | 2008-06-28 21:59:25 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2008-06-28 21:59:25 +0800 |
commit | 591c29f4e3a1915be8843e6907278e983bf9f6be (patch) | |
tree | bcad4d54bf7e980ebfb02d6d51446b697fc2b630 /src/ephy-find-toolbar.c | |
parent | 4c7481550ace75a5ee93aa5afdcc3ae789fad6d2 (diff) | |
download | gsoc2013-epiphany-591c29f4e3a1915be8843e6907278e983bf9f6be.tar.gz gsoc2013-epiphany-591c29f4e3a1915be8843e6907278e983bf9f6be.tar.zst gsoc2013-epiphany-591c29f4e3a1915be8843e6907278e983bf9f6be.zip |
ephy-find-toolbar: copy over embed scroll functionality.
Only used here.
svn path=/trunk/; revision=8298
Diffstat (limited to 'src/ephy-find-toolbar.c')
-rw-r--r-- | src/ephy-find-toolbar.c | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/src/ephy-find-toolbar.c b/src/ephy-find-toolbar.c index 367567dc5..82a3e8828 100644 --- a/src/ephy-find-toolbar.c +++ b/src/ephy-find-toolbar.c @@ -37,7 +37,6 @@ struct _EphyFindToolbarPrivate { EphyWindow *window; - EphyEmbed *embed; WebKitWebView *web_view; GtkWidget *entry; GtkWidget *label; @@ -84,6 +83,38 @@ static guint signals[LAST_SIGNAL]; /* private functions */ +static void +impl_scroll_lines (WebKitWebView *web_view, + int num_lines) +{ + /* FIXME: implement! */ +} + +static void +impl_scroll_pages (WebKitWebView *web_view, + int num_pages) +{ + /* FIXME: implement! */ +} + +static void +impl_scroll_pixels (WebKitWebView *web_view, + int dx, + int dy) +{ + GtkAdjustment *hadj; + GtkAdjustment *vadj; + GtkScrolledWindow *scrolled_window; + + scrolled_window = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (web_view))); + + hadj = gtk_scrolled_window_get_hadjustment (scrolled_window); + vadj = gtk_scrolled_window_get_vadjustment (scrolled_window); + + gtk_adjustment_set_value (hadj, CLAMP (hadj->value + dx, hadj->lower, hadj->upper - hadj->page_size)); + gtk_adjustment_set_value (vadj, CLAMP (vadj->value + dy, vadj->lower, vadj->upper - vadj->page_size)); +} + static gboolean set_status_notfound_cb (EphyFindToolbar *toolbar) { @@ -151,6 +182,7 @@ clear_status (EphyFindToolbar *toolbar) priv->links_only ? _("Find links:") : _("Find:")); } +#if 0 /* Code adapted from gtktreeview.c:gtk_tree_view_key_press() and * gtk_tree_view_real_start_interactive_seach() */ @@ -184,6 +216,7 @@ tab_search_key_press_cb (EphyEmbed *embed, return FALSE; } +#endif static void find_next_cb (EphyFindToolbar *toolbar) @@ -304,19 +337,19 @@ entry_key_press_event_cb (GtkEntry *entry, { case GDK_Up: case GDK_KP_Up: - ephy_embed_scroll (priv->embed, -1); + impl_scroll_lines (priv->web_view, -1); break; case GDK_Down: case GDK_KP_Down: - ephy_embed_scroll (priv->embed, 1); + impl_scroll_lines (priv->web_view, 1); break; case GDK_Page_Up: case GDK_KP_Page_Up: - ephy_embed_page_scroll (priv->embed, -1); + impl_scroll_pages (priv->web_view, -1); break; case GDK_Page_Down: case GDK_KP_Page_Down: - ephy_embed_page_scroll (priv->embed, 1); + impl_scroll_pages (priv->web_view, 1); break; case GDK_Escape: /* Hide the toolbar when ESC is pressed */ @@ -712,24 +745,26 @@ ephy_find_toolbar_set_embed (EphyFindToolbar *toolbar, EphyFindToolbarPrivate *priv = toolbar->priv; WebKitWebView *web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED(embed); - if (priv->embed == embed) return; + if (priv->web_view == web_view) return; - if (priv->embed != NULL) + if (priv->web_view != NULL) { + /* g_signal_handlers_disconnect_matched (embed, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, toolbar); + */ } - priv->embed = embed; - if (embed != NULL) + priv->web_view = web_view; + if (web_view != NULL) { clear_status (toolbar); - /* FIXME: this is never emitted */ + /* FIXME: this is never emitted g_signal_connect_object (embed, "ge-search-key-press", G_CALLBACK (tab_search_key_press_cb), toolbar, 0); - priv->web_view = web_view; + */ } } |