aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2009-01-23 10:20:34 +0800
committerXan Lopez <xan@src.gnome.org>2009-01-23 10:20:34 +0800
commit56d9b5384def19d10010096a6397e6a5e57b46d0 (patch)
treed569969e3d443b1a2bee4d6c5a0d9f72bd1bdd62 /src
parent61a9d4ce3f9f73f18de3243771ec5dcba70bed8f (diff)
downloadgsoc2013-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
Diffstat (limited to 'src')
-rw-r--r--src/ephy-find-toolbar.c50
1 files changed, 23 insertions, 27 deletions
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 */