From 59a54ea5a028455e92e3715277721f2d37131359 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 19 Feb 2010 12:11:52 -0500 Subject: Coding style and whitespace cleanup. --- plugins/image-inline/image-inline.c | 38 +++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'plugins/image-inline/image-inline.c') diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c index 12568eecca..5ea1070afb 100644 --- a/plugins/image-inline/image-inline.c +++ b/plugins/image-inline/image-inline.c @@ -259,19 +259,45 @@ size_allocate_cb (GtkHTMLEmbedded *embedded, } static void -mouse_wheel_scroll_cb (GtkWidget *img_view, GdkScrollDirection direction, ImageInlinePObject *image_object) +mouse_wheel_scroll_cb (GtkWidget *image_view, + GdkScrollDirection direction, + ImageInlinePObject *image_object) { + GtkOrientation orientation; + GtkScrollType scroll_type; GtkHTML *html; gint steps = 2; - g_return_if_fail (image_object != NULL); - g_return_if_fail (image_object->object.format != NULL); - g_return_if_fail (image_object->object.format->html != NULL); - html = image_object->object.format->html; + switch (direction) { + case GDK_SCROLL_UP: + orientation = GTK_ORIENTATION_VERTICAL; + scroll_type = GTK_SCROLL_STEP_BACKWARD; + break; + + case GDK_SCROLL_DOWN: + orientation = GTK_ORIENTATION_VERTICAL; + scroll_type = GTK_SCROLL_STEP_FORWARD; + break; + + case GDK_SCROLL_LEFT: + orientation = GTK_ORIENTATION_HORIZONTAL; + scroll_type = GTK_SCROLL_STEP_BACKWARD; + break; + + case GDK_SCROLL_RIGHT: + orientation = GTK_ORIENTATION_HORIZONTAL; + scroll_type = GTK_SCROLL_STEP_FORWARD; + break; + + default: + g_return_if_reached (); + } + while (steps > 0) { - g_signal_emit_by_name (html, "scroll", (direction == GDK_SCROLL_DOWN || direction == GDK_SCROLL_UP) ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, (direction == GDK_SCROLL_DOWN || direction == GDK_SCROLL_RIGHT) ? GTK_SCROLL_STEP_FORWARD : GTK_SCROLL_STEP_BACKWARD, 2.0, NULL); + g_signal_emit_by_name ( + html, "scroll", orientation, scroll_type, 2.0, NULL); steps--; } } -- cgit v1.2.3