From dbe299f7b2412d318f0eda7c401feba68c8663e3 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 11 Jan 2005 11:21:52 +0000 Subject: Implement history dropdowns 2005-01-11 Marco Pesenti Gritti * shell/ev-history.c: (ev_history_get_property), (ev_history_set_property), (ev_history_class_init), (ev_history_add_page), (ev_history_set_current_index): * shell/ev-navigation-action.c: (ev_navigation_action_set_history), (activate_menu_item_cb), (new_history_menu_item), (build_menu), (ev_navigation_action_finalize): * shell/ev-navigation-action.h: * shell/ev-view.c: (ev_view_set_document), (ev_view_go_back), (ev_view_go_forward), (ev_view_get_find_status_message), (history_index_changed_cb), (ev_view_set_history): * shell/ev-view.h: * shell/ev-window.c: (update_total_pages), (ev_window_open), (update_current_page), (register_custom_actions): Implement history dropdowns --- (limited to 'shell/ev-view.c') diff --git a/shell/ev-view.c b/shell/ev-view.c index cf2c469..4750b4d 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -28,7 +28,6 @@ #include "ev-marshal.h" #include "ev-view.h" #include "ev-document-find.h" -#include "ev-history.h" #define EV_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_VIEW, EvViewClass)) #define EV_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_VIEW)) @@ -905,12 +904,6 @@ ev_view_set_document (EvView *view, if (old_page != ev_view_get_page (view)) g_signal_emit (view, page_changed_signal, 0); - - if (view->history) { - g_object_unref (view->history); - } - view->history = ev_history_new (); - ev_history_add_page (view->history, ev_view_get_page (view)); } } @@ -975,7 +968,6 @@ ev_view_go_back (EvView *view) if (n > 0) { index = MAX (0, index - 1); ev_history_set_current_index (view->history, index); - go_to_index (view, index); } } @@ -992,7 +984,6 @@ ev_view_go_forward (EvView *view) if (n > 0) { index = MIN (n - 1, index + 1); ev_history_set_current_index (view->history, index); - go_to_index (view, index); } } @@ -1117,3 +1108,30 @@ ev_view_get_find_status_message (EvView *view) view->results_on_this_page); } } + +static void +history_index_changed_cb (EvHistory *history, + GParamSpec *pspec, + EvView *view) +{ + int index; + + index = ev_history_get_current_index (history); + go_to_index (view, index); +} + +void +ev_view_set_history (EvView *view, + EvHistory *history) +{ + if (view->history) { + g_object_unref (view->history); + } + + view->history = g_object_ref (history); + ev_history_add_page (view->history, ev_view_get_page (view)); + + g_signal_connect (view->history, "notify::index", + G_CALLBACK (history_index_changed_cb), + view); +} -- cgit v0.9.1