From: Carlos Garcia Campos Date: Sun, 7 Sep 2008 17:20:27 +0000 (+0000) Subject: Use GtkScrollType instead of EvScrollType. X-Git-Tag: EVINCE_2_23_92~7 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=5f7d46028f2345a1e4d1690fc8d2228fc1a9c506;p=evince.git Use GtkScrollType instead of EvScrollType. 2008-09-07 Carlos Garcia Campos * shell/ev-view-private.h: * shell/ev-view.[ch]: (add_scroll_binding_keypad), (ev_view_scroll), (ev_view_class_init): * shell/ev-view-accessible.c: (ev_view_accessible_action_do_action): * shell/ev-window.c: (ev_window_cmd_scroll_forward), (ev_window_cmd_scroll_backward): Use GtkScrollType instead of EvScrollType. svn path=/trunk/; revision=3162 --- diff --git a/ChangeLog b/ChangeLog index 9c16b3ee..4949510c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-09-07 Carlos Garcia Campos + + * shell/ev-view-private.h: + * shell/ev-view.[ch]: (add_scroll_binding_keypad), + (ev_view_scroll), (ev_view_class_init): + * shell/ev-view-accessible.c: + (ev_view_accessible_action_do_action): + * shell/ev-window.c: (ev_window_cmd_scroll_forward), + (ev_window_cmd_scroll_backward): + + Use GtkScrollType instead of EvScrollType. + 2008-09-07 Nickolay V. Shmyrev * shell/ev-page-cache.c (ev_page_cache_set_page_label): diff --git a/shell/ev-view-accessible.c b/shell/ev-view-accessible.c index 25a3ac2b..3bf28d9b 100644 --- a/shell/ev-view-accessible.c +++ b/shell/ev-view-accessible.c @@ -54,7 +54,7 @@ typedef struct { /* Action */ gchar *action_descriptions[LAST_ACTION]; guint action_idle_handler; - EvScrollType idle_scroll; + GtkScrollType idle_scroll; } EvViewAccessiblePriv; typedef GtkAccessibleClass EvViewAccessibleClass; @@ -390,10 +390,10 @@ ev_view_accessible_action_do_action (AtkAction *action, switch (i) { case ACTION_SCROLL_UP: - priv->idle_scroll = EV_SCROLL_PAGE_BACKWARD; + priv->idle_scroll = GTK_SCROLL_PAGE_BACKWARD; break; case ACTION_SCROLL_DOWN: - priv->idle_scroll = EV_SCROLL_PAGE_FORWARD; + priv->idle_scroll = GTK_SCROLL_PAGE_FORWARD; break; default: return FALSE; diff --git a/shell/ev-view-private.h b/shell/ev-view-private.h index 547d1654..0643fa87 100644 --- a/shell/ev-view-private.h +++ b/shell/ev-view-private.h @@ -186,7 +186,7 @@ struct _EvViewClass { GtkLayoutClass parent_class; void (*binding_activated) (EvView *view, - EvScrollType scroll, + GtkScrollType scroll, gboolean horizontal); void (*zoom_invalid) (EvView *view); void (*handle_link) (EvView *view, diff --git a/shell/ev-view.c b/shell/ev-view.c index da895804..1685aee8 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -124,7 +124,7 @@ static void set_scroll_adjustment (EvView static void add_scroll_binding_keypad (GtkBindingSet *binding_set, guint keyval, GdkModifierType modifiers, - EvScrollType scroll, + GtkScrollType scroll, gboolean horizontal); static void ensure_rectangle_is_visible (EvView *view, GdkRectangle *rect); @@ -574,25 +574,25 @@ static void add_scroll_binding_keypad (GtkBindingSet *binding_set, guint keyval, GdkModifierType modifiers, - EvScrollType scroll, + GtkScrollType scroll, gboolean horizontal) { guint keypad_keyval = keyval - GDK_Left + GDK_KP_Left; gtk_binding_entry_add_signal (binding_set, keyval, modifiers, "binding_activated", 2, - EV_TYPE_SCROLL_TYPE, scroll, + GTK_TYPE_SCROLL_TYPE, scroll, G_TYPE_BOOLEAN, horizontal); gtk_binding_entry_add_signal (binding_set, keypad_keyval, modifiers, "binding_activated", 2, - EV_TYPE_SCROLL_TYPE, scroll, + GTK_TYPE_SCROLL_TYPE, scroll, G_TYPE_BOOLEAN, horizontal); } void ev_view_scroll (EvView *view, - EvScrollType scroll, - gboolean horizontal) + GtkScrollType scroll, + gboolean horizontal) { GtkAdjustment *adjustment; double value, increment; @@ -603,12 +603,12 @@ ev_view_scroll (EvView *view, if (view->presentation || view->sizing_mode == EV_SIZING_BEST_FIT) { switch (scroll) { - case EV_SCROLL_PAGE_BACKWARD: - case EV_SCROLL_STEP_BACKWARD: + case GTK_SCROLL_PAGE_BACKWARD: + case GTK_SCROLL_STEP_BACKWARD: ev_view_previous_page (view); break; - case EV_SCROLL_PAGE_FORWARD: - case EV_SCROLL_STEP_FORWARD: + case GTK_SCROLL_PAGE_FORWARD: + case GTK_SCROLL_STEP_FORWARD: ev_view_next_page (view); break; default: @@ -629,7 +629,7 @@ ev_view_scroll (EvView *view, last_page = TRUE; switch (scroll) { - case EV_SCROLL_PAGE_BACKWARD: + case GTK_SCROLL_PAGE_BACKWARD: /* Do not jump backwards if at the first page */ if (value == (adjustment->lower) && first_page) { /* Do nothing */ @@ -642,7 +642,7 @@ ev_view_scroll (EvView *view, value = MAX (value - increment, adjustment->lower); } break; - case EV_SCROLL_PAGE_FORWARD: + case GTK_SCROLL_PAGE_FORWARD: /* Do not jump forward if at the last page */ if (value == (adjustment->upper - adjustment->page_size) && last_page) { /* Do nothing */ @@ -655,16 +655,16 @@ ev_view_scroll (EvView *view, value = MIN (value + increment, adjustment->upper - adjustment->page_size); } break; - case EV_SCROLL_STEP_BACKWARD: + case GTK_SCROLL_STEP_BACKWARD: value -= adjustment->step_increment; break; - case EV_SCROLL_STEP_FORWARD: + case GTK_SCROLL_STEP_FORWARD: value += adjustment->step_increment; break; - case EV_SCROLL_STEP_DOWN: + case GTK_SCROLL_STEP_DOWN: value -= adjustment->step_increment / 10; break; - case EV_SCROLL_STEP_UP: + case GTK_SCROLL_STEP_UP: value += adjustment->step_increment / 10; break; default: @@ -4152,22 +4152,22 @@ ev_view_class_init (EvViewClass *class) binding_set = gtk_binding_set_by_class (class); - add_scroll_binding_keypad (binding_set, GDK_Left, 0, EV_SCROLL_STEP_BACKWARD, TRUE); - add_scroll_binding_keypad (binding_set, GDK_Right, 0, EV_SCROLL_STEP_FORWARD, TRUE); - add_scroll_binding_keypad (binding_set, GDK_Left, GDK_MOD1_MASK, EV_SCROLL_STEP_DOWN, TRUE); - add_scroll_binding_keypad (binding_set, GDK_Right, GDK_MOD1_MASK, EV_SCROLL_STEP_UP, TRUE); - add_scroll_binding_keypad (binding_set, GDK_Up, 0, EV_SCROLL_STEP_BACKWARD, FALSE); - add_scroll_binding_keypad (binding_set, GDK_Down, 0, EV_SCROLL_STEP_FORWARD, FALSE); - add_scroll_binding_keypad (binding_set, GDK_Up, GDK_MOD1_MASK, EV_SCROLL_STEP_DOWN, FALSE); - add_scroll_binding_keypad (binding_set, GDK_Down, GDK_MOD1_MASK, EV_SCROLL_STEP_UP, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_H, 0, "binding_activated", 2, EV_TYPE_SCROLL_TYPE, - EV_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, TRUE); - gtk_binding_entry_add_signal (binding_set, GDK_J, 0, "binding_activated", 2, EV_TYPE_SCROLL_TYPE, - EV_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_K, 0, "binding_activated", 2, EV_TYPE_SCROLL_TYPE, - EV_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, FALSE); - gtk_binding_entry_add_signal (binding_set, GDK_L, 0, "binding_activated", 2, EV_TYPE_SCROLL_TYPE, - EV_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, TRUE); + add_scroll_binding_keypad (binding_set, GDK_Left, 0, GTK_SCROLL_STEP_BACKWARD, TRUE); + add_scroll_binding_keypad (binding_set, GDK_Right, 0, GTK_SCROLL_STEP_FORWARD, TRUE); + add_scroll_binding_keypad (binding_set, GDK_Left, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, TRUE); + add_scroll_binding_keypad (binding_set, GDK_Right, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, TRUE); + add_scroll_binding_keypad (binding_set, GDK_Up, 0, GTK_SCROLL_STEP_BACKWARD, FALSE); + add_scroll_binding_keypad (binding_set, GDK_Down, 0, GTK_SCROLL_STEP_FORWARD, FALSE); + add_scroll_binding_keypad (binding_set, GDK_Up, GDK_MOD1_MASK, GTK_SCROLL_STEP_DOWN, FALSE); + add_scroll_binding_keypad (binding_set, GDK_Down, GDK_MOD1_MASK, GTK_SCROLL_STEP_UP, FALSE); + gtk_binding_entry_add_signal (binding_set, GDK_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_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_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_L, 0, "binding_activated", 2, GTK_TYPE_SCROLL_TYPE, + GTK_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, TRUE); } @@ -5917,25 +5917,6 @@ ev_sizing_mode_get_type (void) return etype; } -GType -ev_scroll_type_get_type (void) -{ - static GType etype = 0; - if (etype == 0) { - static const GEnumValue values[] = { - { EV_SCROLL_PAGE_FORWARD, "EV_SCROLL_PAGE_FORWARD", "scroll-page-forward" }, - { EV_SCROLL_PAGE_BACKWARD, "EV_SCROLL_PAGE_BACKWARD", "scroll-page-backward" }, - { EV_SCROLL_STEP_FORWARD, "EV_SCROLL_STEP_FORWARD", "scroll-step-forward" }, - { EV_SCROLL_STEP_FORWARD, "EV_SCROLL_STEP_FORWARD", "scroll-step-forward" }, - { EV_SCROLL_STEP_UP, "EV_SCROLL_STEP_UP", "scroll-step-up" }, - { EV_SCROLL_STEP_DOWN, "EV_SCROLL_STEP_DOWN", "scroll-step-down" }, - { 0, NULL, NULL } - }; - etype = g_enum_register_static ("EvScrollType", values); - } - return etype; -} - void ev_view_update_view_size (EvView *view, GtkScrolledWindow * scrolled_window) { diff --git a/shell/ev-view.h b/shell/ev-view.h index b6e5e820..424cecc9 100644 --- a/shell/ev-view.h +++ b/shell/ev-view.h @@ -35,9 +35,6 @@ G_BEGIN_DECLS #define EV_TYPE_SIZING_MODE (ev_sizing_mode_get_type()) #define EV_SIZING_MODE_CLASS (g_type_class_peek (EV_TYPE_SIZING_MODE)) -#define EV_TYPE_SCROLL_TYPE (ev_scroll_type_get_type()) -#define EV_SCROLL_TYPE_CLASS (g_type_class_peek (EV_TYPE_SCROLL_TYPE)) - typedef struct _EvView EvView; typedef struct _EvViewClass EvViewClass; @@ -53,18 +50,8 @@ typedef enum { EV_VIEW_SELECTION_RECTANGLE, } EvViewSelectionMode; -typedef enum { - EV_SCROLL_PAGE_FORWARD, - EV_SCROLL_PAGE_BACKWARD, - EV_SCROLL_STEP_BACKWARD, - EV_SCROLL_STEP_FORWARD, - EV_SCROLL_STEP_DOWN, - EV_SCROLL_STEP_UP, -} EvScrollType; - GType ev_view_get_type (void) G_GNUC_CONST; GType ev_sizing_mode_get_type (void) G_GNUC_CONST; -GType ev_scroll_type_get_type (void) G_GNUC_CONST; GtkWidget* ev_view_new (void); void ev_view_set_document (EvView *view, @@ -133,7 +120,7 @@ void ev_view_show_cursor (EvView *view); /* Navigation */ void ev_view_scroll (EvView *view, - EvScrollType scroll, + GtkScrollType scroll, gboolean horizontal); void ev_view_handle_link (EvView *view, EvLink *link); @@ -141,7 +128,8 @@ gboolean ev_view_next_page (EvView *view); gboolean ev_view_previous_page (EvView *view); gchar* ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest); -void ev_view_update_view_size (EvView *view, GtkScrolledWindow *scrolled_window); +void ev_view_update_view_size (EvView *view, + GtkScrolledWindow *scrolled_window); void ev_view_autoscroll_start (EvView *view); void ev_view_autoscroll_stop (EvView *view); diff --git a/shell/ev-window.c b/shell/ev-window.c index df3c17ce..9f27479c 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2624,13 +2624,13 @@ ev_window_cmd_focus_page_selector (GtkAction *act, EvWindow *window) static void ev_window_cmd_scroll_forward (GtkAction *action, EvWindow *window) { - ev_view_scroll (EV_VIEW (window->priv->view), EV_SCROLL_PAGE_FORWARD, FALSE); + ev_view_scroll (EV_VIEW (window->priv->view), GTK_SCROLL_PAGE_FORWARD, FALSE); } static void ev_window_cmd_scroll_backward (GtkAction *action, EvWindow *window) { - ev_view_scroll (EV_VIEW (window->priv->view), EV_SCROLL_PAGE_BACKWARD, FALSE); + ev_view_scroll (EV_VIEW (window->priv->view), GTK_SCROLL_PAGE_BACKWARD, FALSE); } static void @@ -4143,7 +4143,9 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar, } static void -find_bar_scroll(EggFindBar *find_bar, GtkScrollType scroll, EvWindow* ev_window) +find_bar_scroll (EggFindBar *find_bar, + GtkScrollType scroll, + EvWindow *ev_window) { ev_view_scroll (EV_VIEW (ev_window->priv->view), scroll, FALSE); }