Merge lp:~bratsche/oif/eog-rotate-gesture-2 into lp:~oif-team/oif/eog-gestures-trunk

Proposed by Cody Russell
Status: Merged
Merged at revision: 117
Proposed branch: lp:~bratsche/oif/eog-rotate-gesture-2
Merge into: lp:~oif-team/oif/eog-gestures-trunk
Diff against target: 93 lines (+43/-1)
2 files modified
debian/control (+1/-1)
src/eog-window.c (+42/-0)
To merge this branch: bzr merge lp:~bratsche/oif/eog-rotate-gesture-2
Reviewer Review Type Date Requested Status
Henrik Rydberg (community) Needs Fixing
Stephen M. Webb (community) Approve
Review via email: mp+45433@code.launchpad.net

Description of the change

Aha, it was trying to merge into the wrong branch. That's what was causing these ridiculous diffs. Sorry. :)

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote :

I would suggest using a constant instead of hard-coded 1.0 in "rotate->angle >= 1.0" and "rotate->angle <= -1.0" so they can be tweaked a little easier when we figure out better threshold values, and so they can be a little more self-documenting.

Other than that, this change looks clean.

review: Approve
Revision history for this message
Henrik Rydberg (rydberg) wrote :

I agree with Stephens comments, but would rather put that as needs fixing.

review: Needs Fixing
117. By Cody Russell

Add #define for the angles.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2011-01-05 16:12:48 +0000
3+++ debian/control 2011-01-07 15:29:26 +0000
4@@ -20,7 +20,7 @@
5 gnome-doc-utils,
6 libgtk2.0-dev (>= 2.18),
7 libglib2.0-dev (>= 2.25.9),
8- libgrip-0.1-0-dev (>= 0.1.1),
9+ libgrip-0.1-dev (>= 0.1.1),
10 librsvg2-dev,
11 libgnome-desktop-dev (>= 2.25.1),
12 libgconf2-dev (>= 2.6.1-2),
13
14=== modified file 'src/eog-window.c'
15--- src/eog-window.c 2010-09-20 13:04:27 +0000
16+++ src/eog-window.c 2011-01-07 15:29:26 +0000
17@@ -67,6 +67,7 @@
18 #include <gio/gdesktopappinfo.h>
19 #include <gtk/gtk.h>
20 #include <gconf/gconf-client.h>
21+#include <libgrip/gripgesturemanager.h>
22 #include <launchpad-integration.h>
23
24 #if HAVE_LCMS
25@@ -98,6 +99,9 @@
26
27 #define EOG_WALLPAPER_FILENAME "eog-wallpaper"
28
29+#define EOG_GESTURE_ROTATE_CW_ANGLE 1.0
30+#define EOG_GESTURE_ROTATE_CCW_ANGLE -1.0
31+
32 #define is_rtl (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
33
34 typedef enum {
35@@ -4504,6 +4508,34 @@
36 }
37
38 static void
39+eog_window_gesture_event (GtkWidget *widget,
40+ GripTimeType time_type,
41+ GripGestureEvent *event,
42+ gpointer user_data)
43+{
44+ if (time_type == GRIP_TIME_END) {
45+ switch (event->type) {
46+ case GRIP_GESTURE_ROTATE: {
47+ GripEventGestureRotate *rotate = (GripEventGestureRotate *)event;
48+
49+ if (rotate->angle >= EOG_GESTURE_ROTATE_CW_ANGLE) {
50+ apply_transformation (EOG_WINDOW (user_data),
51+ eog_transform_rotate_new (90));
52+ } else if (rotate->angle <= EOG_GESTURE_ROTATE_CCW_ANGLE) {
53+ apply_transformation (EOG_WINDOW (user_data),
54+ eog_transform_rotate_new (270));
55+ }
56+
57+ break;
58+ }
59+
60+ default:
61+ break;
62+ }
63+ }
64+}
65+
66+static void
67 eog_window_construct_ui (EogWindow *window)
68 {
69 EogWindowPrivate *priv;
70@@ -4518,6 +4550,8 @@
71
72 GConfEntry *entry;
73
74+ GripGestureManager *manager;
75+
76 g_return_if_fail (EOG_IS_WINDOW (window));
77
78 priv = window->priv;
79@@ -4710,6 +4744,14 @@
80 G_CALLBACK (view_zoom_changed_cb),
81 window);
82
83+ manager = grip_gesture_manager_get ();
84+ grip_gesture_manager_register_window (manager,
85+ priv->view,
86+ GRIP_GESTURE_ROTATE,
87+ 2,
88+ eog_window_gesture_event,
89+ window, NULL);
90+
91 view_popup = gtk_ui_manager_get_widget (priv->ui_mgr, "/ViewPopup");
92 eog_scroll_view_set_popup (EOG_SCROLL_VIEW (priv->view),
93 GTK_MENU (view_popup));

Subscribers

People subscribed via source and target branches