diff options
author | Carlos Garcia Campos <[email protected]> | 2013-06-19 11:57:57 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-09-06 18:25:34 +0200 |
commit | aa755794bed2475801a2e2cc00e759cf243f6101 (patch) | |
tree | b8f096c7e919da9455c0086e5740ff019184b288 /libview/ev-view.c | |
parent | 84264408cc7733e8b2cc4febd95d8309efca25b7 (diff) | |
download | atril-aa755794bed2475801a2e2cc00e759cf243f6101.tar.bz2 atril-aa755794bed2475801a2e2cc00e759cf243f6101.tar.xz |
libview: Rename EvView::binding-activated signal as EvView::scroll
EvView::binding-activated is too generic name for scroll key bindings.
Renamed as EvView::scroll and changed to use GtkOrientable instead of a
gboolean.
origin commit:
https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=b70e413
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r-- | libview/ev-view.c | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c index c68c5172..84ee1487 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -50,7 +50,7 @@ #define EV_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_VIEW, EvViewClass)) enum { - SIGNAL_BINDING_ACTIVATED, + SIGNAL_SCROLL, SIGNAL_HANDLE_LINK, SIGNAL_EXTERNAL_LINK, SIGNAL_POPUP_MENU, @@ -102,11 +102,6 @@ typedef struct { /*** Scrolling ***/ static void view_update_range_and_current_page (EvView *view); -static void add_scroll_binding_keypad (GtkBindingSet *binding_set, - guint keyval, - GdkModifierType modifiers, - GtkScrollType scroll, - gboolean horizontal); static void ensure_rectangle_is_visible (EvView *view, GdkRectangle *rect); @@ -850,18 +845,18 @@ add_scroll_binding_keypad (GtkBindingSet *binding_set, guint keyval, GdkModifierType modifiers, GtkScrollType scroll, - gboolean horizontal) + GtkOrientation orientation) { - guint keypad_keyval = keyval - GDK_KEY_Left + GDK_KEY_KP_Left; + guint keypad_keyval = keyval - GDK_KEY_Left + GDK_KEY_KP_Left; - gtk_binding_entry_add_signal (binding_set, keyval, modifiers, - "binding_activated", 2, - GTK_TYPE_SCROLL_TYPE, scroll, - G_TYPE_BOOLEAN, horizontal); - gtk_binding_entry_add_signal (binding_set, keypad_keyval, modifiers, - "binding_activated", 2, - GTK_TYPE_SCROLL_TYPE, scroll, - G_TYPE_BOOLEAN, horizontal); + gtk_binding_entry_add_signal (binding_set, keyval, modifiers, + "scroll", 2, + GTK_TYPE_SCROLL_TYPE, scroll, + GTK_TYPE_ORIENTATION, orientation); + gtk_binding_entry_add_signal (binding_set, keypad_keyval, modifiers, + "scroll", 2, + GTK_TYPE_SCROLL_TYPE, scroll, + GTK_TYPE_ORIENTATION, orientation); } static gdouble @@ -1033,6 +1028,14 @@ ev_view_scroll (EvView *view, gtk_adjustment_set_value (adjustment, value); } +static void +ev_view_scroll_internal (EvView *view, + GtkScrollType scroll, + GtkOrientation orientation) +{ + ev_view_scroll (view, scroll, orientation == GTK_ORIENTATION_HORIZONTAL); +} + #define MARGIN 5 static void @@ -5983,7 +5986,7 @@ ev_view_class_init (EvViewClass *class) container_class->remove = ev_view_remove; container_class->forall = ev_view_forall; - class->binding_activated = ev_view_scroll; + class->scroll = ev_view_scroll_internal; /* Scrollable interface */ g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment"); @@ -5991,15 +5994,15 @@ ev_view_class_init (EvViewClass *class) g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy"); g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy"); - signals[SIGNAL_BINDING_ACTIVATED] = g_signal_new ("binding_activated", + signals[SIGNAL_SCROLL] = g_signal_new ("scroll", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (EvViewClass, binding_activated), + G_STRUCT_OFFSET (EvViewClass, scroll), NULL, NULL, - ev_view_marshal_VOID__ENUM_BOOLEAN, + ev_view_marshal_VOID__ENUM_ENUM, G_TYPE_NONE, 2, GTK_TYPE_SCROLL_TYPE, - G_TYPE_BOOLEAN); + GTK_TYPE_ORIENTATION); signals[SIGNAL_HANDLE_LINK] = g_signal_new ("handle-link", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, @@ -6067,22 +6070,22 @@ ev_view_class_init (EvViewClass *class) binding_set = gtk_binding_set_by_class (class); - add_scroll_binding_keypad (binding_set, GDK_KEY_Left, 0, GTK_SCROLL_STEP_BACKWARD, TRUE); - add_scroll_binding_keypad (binding_set, GDK_KEY_Right, 0, GTK_SCROLL_STEP_FORWARD, TRUE); - add_scroll_binding_keypad (binding_set, GDK_KEY_Left, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, TRUE); - add_scroll_binding_keypad (binding_set, GDK_KEY_Right, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, TRUE); - add_scroll_binding_keypad (binding_set, GDK_KEY_Up, 0, GTK_SCROLL_STEP_BACKWARD, FALSE); - add_scroll_binding_keypad (binding_set, GDK_KEY_Down, 0, GTK_SCROLL_STEP_FORWARD, FALSE); - add_scroll_binding_keypad (binding_set, GDK_KEY_Up, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, FALSE); - add_scroll_binding_keypad (binding_set, GDK_KEY_Down, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_H, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, - GTK_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, TRUE); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_J, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, - GTK_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_K, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, - GTK_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_L, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, - GTK_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, TRUE); + add_scroll_binding_keypad (binding_set, GDK_KEY_Left, 0, GTK_SCROLL_STEP_BACKWARD, GTK_ORIENTATION_HORIZONTAL); + add_scroll_binding_keypad (binding_set, GDK_KEY_Right, 0, GTK_SCROLL_STEP_FORWARD, GTK_ORIENTATION_HORIZONTAL); + add_scroll_binding_keypad (binding_set, GDK_KEY_Left, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, GTK_ORIENTATION_HORIZONTAL); + add_scroll_binding_keypad (binding_set, GDK_KEY_Right, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, GTK_ORIENTATION_HORIZONTAL); + add_scroll_binding_keypad (binding_set, GDK_KEY_Up, 0, GTK_SCROLL_STEP_BACKWARD, GTK_ORIENTATION_VERTICAL); + add_scroll_binding_keypad (binding_set, GDK_KEY_Down, 0, GTK_SCROLL_STEP_FORWARD, GTK_ORIENTATION_VERTICAL); + add_scroll_binding_keypad (binding_set, GDK_KEY_Up, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, GTK_ORIENTATION_VERTICAL); + add_scroll_binding_keypad (binding_set, GDK_KEY_Down, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, GTK_ORIENTATION_VERTICAL); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_H, 0, "scroll", 2, GTK_TYPE_SCROLL_TYPE, + GTK_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, GTK_ORIENTATION_HORIZONTAL); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_J, 0, "scroll", 2, GTK_TYPE_SCROLL_TYPE, + GTK_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, GTK_ORIENTATION_VERTICAL); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_K, 0, "scroll", 2, GTK_TYPE_SCROLL_TYPE, + GTK_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, GTK_ORIENTATION_VERTICAL); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_L, 0, "scroll", 2, GTK_TYPE_SCROLL_TYPE, + GTK_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, GTK_ORIENTATION_HORIZONTAL); } static void |