Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-window.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2005-01-04 11:39:08 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-01-04 11:39:08 (GMT)
commitd1e23d13d52f06f2aba2ece7ff17091110d8a3bb (patch)
tree41c445f49721f45efb7b2fa0897830031174ae4a /shell/ev-window.c
parent44a5ea12157e001973538d01e4620b4be80c82c9 (diff)
Change the layout to match clarkbw design.
2005-01-04 Marco Pesenti Gritti <marco@gnome.org> * data/evince-ui.xml: Change the layout to match clarkbw design. * shell/Makefile.am: * shell/ev-navigation-action.c: (build_menu), (menu_activated_cb), (set_tooltip_cb), (connect_proxy), (ev_navigation_action_init), (ev_navigation_action_finalize), (ev_navigation_action_set_property), (ev_navigation_action_get_property), (ev_navigation_action_class_init): * shell/ev-navigation-action.h: Implement clarkbw toolbar navigation controls (incomplete) * shell/ev-page-action.c: (update_label), (update_spin), (value_changed_cb), (create_tool_item), (connect_proxy), (ev_page_action_init), (ev_page_action_finalize), (ev_page_action_set_property), (ev_page_action_get_property), (ev_page_action_set_current_page), (ev_page_action_set_total_pages), (ev_page_action_class_init): * shell/ev-page-action.h: Implement a page switcher in the toolbar * shell/ev-view.c: (ev_view_scroll_view): * shell/ev-window.c: (update_total_pages), (ev_window_open), (update_current_page), (view_page_changed_cb), (goto_page_cb), (register_custom_actions), (ev_window_init): Change page on PageUp/Down.
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r--shell/ev-window.c77
1 files changed, 76 insertions, 1 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index a1e8654..1128214 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -29,6 +29,8 @@
#endif
#include "ev-window.h"
+#include "ev-navigation-action.h"
+#include "ev-page-action.h"
#include "ev-sidebar.h"
#include "ev-sidebar-bookmarks.h"
#include "ev-sidebar-thumbnails.h"
@@ -73,6 +75,7 @@ struct _EvWindowPrivate {
guint help_message_cid;
GtkWidget *exit_fullscreen_popup;
char *uri;
+ GtkAction *page_action;
EvDocument *document;
@@ -270,6 +273,17 @@ update_window_title (EvDocument *document, GParamSpec *pspec, EvWindow *ev_windo
g_free (title);
}
+static void
+update_total_pages (EvWindow *ev_window)
+{
+ EvPageAction *page_action;
+ int pages;
+
+ pages = ev_document_get_n_pages (ev_window->priv->document);
+ page_action = EV_PAGE_ACTION (ev_window->priv->page_action);
+ ev_page_action_set_total_pages (page_action, pages);
+}
+
void
ev_window_open (EvWindow *ev_window, const char *uri)
{
@@ -308,8 +322,8 @@ ev_window_open (EvWindow *ev_window, const char *uri)
ev_sidebar_set_document (EV_SIDEBAR (ev_window->priv->sidebar),
document);
+ update_total_pages (ev_window);
update_action_sensitivity (ev_window);
-
} else {
g_assert (error != NULL);
g_object_unref (document);
@@ -923,9 +937,21 @@ disconnect_proxy_cb (GtkUIManager *ui_manager, GtkAction *action,
}
static void
+update_current_page (EvWindow *ev_window)
+{
+ EvPageAction *page_action;
+ int page;
+
+ page = ev_view_get_page (EV_VIEW (ev_window->priv->view));
+ page_action = EV_PAGE_ACTION (ev_window->priv->page_action);
+ ev_page_action_set_current_page (page_action, page);
+}
+
+static void
view_page_changed_cb (EvView *view,
EvWindow *ev_window)
{
+ update_current_page (ev_window);
update_action_sensitivity (ev_window);
}
@@ -1167,6 +1193,53 @@ static GtkToggleActionEntry toggle_entries[] = {
};
static void
+goto_page_cb (GtkAction *action, int page_number, EvWindow *ev_window)
+{
+
+ ev_view_set_page (EV_VIEW (ev_window->priv->view), page_number);
+}
+
+static void
+register_custom_actions (EvWindow *window, GtkActionGroup *group)
+{
+ GtkAction *action;
+
+ action = g_object_new (EV_TYPE_NAVIGATION_ACTION,
+ "name", "NavigationBack",
+ "label", _("Back"),
+ "stock_id", GTK_STOCK_GO_BACK,
+ "tooltip", _("Go back"),
+ "arrow-tooltip", _("Back history"),
+ "direction", EV_NAVIGATION_DIRECTION_BACK,
+ "is_important", TRUE,
+ NULL);
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EV_TYPE_NAVIGATION_ACTION,
+ "name", "NavigationForward",
+ "label", _("Forward"),
+ "stock_id", GTK_STOCK_GO_FORWARD,
+ "tooltip", _("Go forward"),
+ "arrow-tooltip", _("Forward history"),
+ "direction", EV_NAVIGATION_DIRECTION_FORWARD,
+ NULL);
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EV_TYPE_PAGE_ACTION,
+ "name", "PageSelector",
+ "label", _("Page"),
+ "tooltip", _("Select Page"),
+ NULL);
+ g_signal_connect (action, "goto_page",
+ G_CALLBACK (goto_page_cb), window);
+ window->priv->page_action = action;
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
+}
+
+static void
ev_window_init (EvWindow *ev_window)
{
GtkActionGroup *action_group;
@@ -1194,6 +1267,8 @@ ev_window_init (EvWindow *ev_window)
G_N_ELEMENTS (toggle_entries),
ev_window);
+ register_custom_actions (ev_window, action_group);
+
ev_window->priv->ui_manager = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (ev_window->priv->ui_manager,
action_group, 0);