diff options
author | Xan Lopez <xan@src.gnome.org> | 2009-01-23 10:20:34 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2009-01-23 10:20:34 +0800 |
commit | 56d9b5384def19d10010096a6397e6a5e57b46d0 (patch) | |
tree | d569969e3d443b1a2bee4d6c5a0d9f72bd1bdd62 | |
parent | 61a9d4ce3f9f73f18de3243771ec5dcba70bed8f (diff) | |
download | gsoc2013-epiphany-56d9b5384def19d10010096a6397e6a5e57b46d0.tar gsoc2013-epiphany-56d9b5384def19d10010096a6397e6a5e57b46d0.tar.gz gsoc2013-epiphany-56d9b5384def19d10010096a6397e6a5e57b46d0.tar.bz2 gsoc2013-epiphany-56d9b5384def19d10010096a6397e6a5e57b46d0.tar.lz gsoc2013-epiphany-56d9b5384def19d10010096a6397e6a5e57b46d0.tar.xz gsoc2013-epiphany-56d9b5384def19d10010096a6397e6a5e57b46d0.tar.zst gsoc2013-epiphany-56d9b5384def19d10010096a6397e6a5e57b46d0.zip |
Implement scrolling in EphyFindToolbar.
svn path=/trunk/; revision=8720
-rw-r--r-- | doc/reference/tmpl/ephy-embed.sgml | 3 | ||||
-rw-r--r-- | embed/ephy-embed.c | 53 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.c | 31 | ||||
-rw-r--r-- | src/ephy-find-toolbar.c | 50 |
4 files changed, 23 insertions, 114 deletions
diff --git a/doc/reference/tmpl/ephy-embed.sgml b/doc/reference/tmpl/ephy-embed.sgml index 34dbefa2c..c7236b853 100644 --- a/doc/reference/tmpl/ephy-embed.sgml +++ b/doc/reference/tmpl/ephy-embed.sgml @@ -255,9 +255,6 @@ be done by casting). @shistory_copy: @get_security_level: @show_page_certificate: -@scroll_lines: -@scroll_pages: -@scroll_pixels: @get_encoding: @has_automatic_encoding: @set_encoding: diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 53cebb5c3..140d7cb98 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -503,59 +503,6 @@ ephy_embed_get_js_status (EphyEmbed *embed) } /** - * ephy_embed_scroll: - * @embed: an #EphyEmbed - * @num_lines: The number of lines to scroll by - * - * Scrolls the view by lines. Positive numbers scroll down, negative - * numbers scroll up - * - **/ -void -ephy_embed_scroll (EphyEmbed *embed, - int num_lines) -{ - EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed); - iface->scroll_lines (embed, num_lines); -} - -/** - * ephy_embed_page_scroll: - * @embed: an #EphyEmbed - * @num_lines: The number of pages to scroll by - * - * Scrolls the view by pages. Positive numbers scroll down, negative - * numbers scroll up - * - **/ -void -ephy_embed_page_scroll (EphyEmbed *embed, - int num_pages) -{ - EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed); - iface->scroll_pages (embed, num_pages); -} - -/** - * ephy_embed_scroll_pixels: - * @embed: an #EphyEmbed - * @dx: the number of pixels to scroll in X direction - * @dy: the number of pixels to scroll in Y direction - * - * Scrolls the view by pixels. Positive numbers scroll down resp. right, - * negative numbers scroll up resp. left. - * - **/ -void -ephy_embed_scroll_pixels (EphyEmbed *embed, - int dx, - int dy) -{ - EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed); - iface->scroll_pixels (embed, dx, dy); -} - -/** * ephy_embed_shistory_copy: * @source: the #EphyEmbed to copy the history from * @dest: the #EphyEmbed to copy the history to diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c index 02caa26d4..e3d407338 100644 --- a/embed/webkit/webkit-embed.c +++ b/embed/webkit/webkit-embed.c @@ -508,34 +508,6 @@ impl_get_location (EphyEmbed *embed, } static void -impl_scroll_lines (EphyEmbed *embed, - int num_lines) -{ -} - -static void -impl_scroll_pages (EphyEmbed *embed, - int num_pages) -{ -} - -static void -impl_scroll_pixels (EphyEmbed *embed, - int dx, - int dy) -{ - GtkAdjustment *hadj; - GtkAdjustment *vadj; - WebKitEmbed *wembed = WEBKIT_EMBED (embed); - - hadj = gtk_scrolled_window_get_hadjustment (wembed->priv->scrolled_window); - vadj = gtk_scrolled_window_get_vadjustment (wembed->priv->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 void impl_shistory_copy (EphyEmbed *source, EphyEmbed *dest, gboolean copy_back, @@ -609,9 +581,6 @@ ephy_embed_iface_init (EphyEmbedIface *iface) iface->go_up = impl_go_up; iface->get_location = impl_get_location; iface->get_js_status = impl_get_js_status; - iface->scroll_lines = impl_scroll_lines; - iface->scroll_pages = impl_scroll_pages; - iface->scroll_pixels = impl_scroll_pixels; iface->shistory_copy = impl_shistory_copy; iface->show_page_certificate = impl_show_page_certificate; iface->set_encoding = impl_set_encoding; diff --git a/src/ephy-find-toolbar.c b/src/ephy-find-toolbar.c index c118e8527..d214f616c 100644 --- a/src/ephy-find-toolbar.c +++ b/src/ephy-find-toolbar.c @@ -82,38 +82,34 @@ static guint signals[LAST_SIGNAL]; /* private functions */ static void -impl_scroll_lines (WebKitWebView *web_view, - int num_lines) +scroll_lines (WebKitWebView *web_view, + int num_lines) { - /* FIXME: implement! */ -} + GtkScrolledWindow *scrolled_window; + GtkAdjustment *vadj; + gdouble value; -static void -impl_scroll_pages (WebKitWebView *web_view, - int num_pages) -{ - /* FIXME: implement! */ + scrolled_window = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (web_view))); + vadj = gtk_scrolled_window_get_vadjustment (scrolled_window); + + value = vadj->value + (num_lines * vadj->step_increment); + gtk_adjustment_set_value (vadj, value); } -#if 0 static void -impl_scroll_pixels (WebKitWebView *web_view, - int dx, - int dy) +scroll_pages (WebKitWebView *web_view, + int num_pages) { - GtkAdjustment *hadj; - GtkAdjustment *vadj; - GtkScrolledWindow *scrolled_window; - - scrolled_window = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (web_view))); + GtkScrolledWindow *scrolled_window; + GtkAdjustment *vadj; + gdouble value; - hadj = gtk_scrolled_window_get_hadjustment (scrolled_window); - vadj = gtk_scrolled_window_get_vadjustment (scrolled_window); + scrolled_window = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (web_view))); + 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)); + value = vadj->value + (num_pages * vadj->page_increment); + gtk_adjustment_set_value (vadj, value); } -#endif static gboolean set_status_notfound_cb (EphyFindToolbar *toolbar) @@ -337,19 +333,19 @@ entry_key_press_event_cb (GtkEntry *entry, { case GDK_Up: case GDK_KP_Up: - impl_scroll_lines (priv->web_view, -1); + scroll_lines (priv->web_view, -1); break; case GDK_Down: case GDK_KP_Down: - impl_scroll_lines (priv->web_view, 1); + scroll_lines (priv->web_view, 1); break; case GDK_Page_Up: case GDK_KP_Page_Up: - impl_scroll_pages (priv->web_view, -1); + scroll_pages (priv->web_view, -1); break; case GDK_Page_Down: case GDK_KP_Page_Down: - impl_scroll_pages (priv->web_view, 1); + scroll_pages (priv->web_view, 1); break; case GDK_Escape: /* Hide the toolbar when ESC is pressed */ |