X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=shell%2Fev-page-action.c;h=cc3615abf091164041f99d7d59607e9f1bdda7f7;hb=b59f53187ed898327f3f6a159d523c5fffaa2395;hp=0571b6d162d467fbce8b00b315d5e6c6281dcda4;hpb=72fc0a73ea845307d6a109678952a0d07f6a1af4;p=evince.git diff --git a/shell/ev-page-action.c b/shell/ev-page-action.c index 0571b6d1..cc3615ab 100644 --- a/shell/ev-page-action.c +++ b/shell/ev-page-action.c @@ -18,7 +18,15 @@ * */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif + +#include +#include + +#include +#include #include "ev-page-action.h" #include "ev-page-cache.h" @@ -27,14 +35,6 @@ #include "ev-page-action-widget.h" #include "ev-marshal.h" -#include -#include -#include -#include -#include -#include -#include - struct _EvPageActionPrivate { EvPageCache *page_cache; @@ -143,11 +143,27 @@ activate_cb (GtkWidget *entry, GtkAction *action) g_free (page_label); } +static gboolean page_scroll_cb(GtkWidget *widget, GdkEventScroll *event, EvPageAction* action) +{ + gint pageno; + + pageno = ev_page_cache_get_current_page (action->priv->page_cache); + if ((event->direction == GDK_SCROLL_DOWN) && + (pageno < ev_page_cache_get_n_pages(action->priv->page_cache) - 1)) + pageno++; + if ((event->direction == GDK_SCROLL_UP) && (pageno > 0)) + pageno--; + ev_page_cache_set_current_page (action->priv->page_cache, pageno); + + return TRUE; +} + static GtkWidget * create_tool_item (GtkAction *action) { EvPageActionWidget *proxy; GtkWidget *hbox; + AtkObject *obj; proxy = g_object_new (ev_page_action_widget_get_type (), NULL); gtk_container_set_border_width (GTK_CONTAINER (proxy), 6); @@ -157,6 +173,11 @@ create_tool_item (GtkAction *action) gtk_box_set_spacing (GTK_BOX (hbox), 6); proxy->entry = gtk_entry_new (); + obj = gtk_widget_get_accessible (proxy->entry); + atk_object_set_name (obj, "page-label-entry"); + + g_signal_connect(proxy->entry, "scroll-event",G_CALLBACK(page_scroll_cb),action); + gtk_widget_add_events(GTK_WIDGET(proxy->entry),GDK_BUTTON_MOTION_MASK); gtk_entry_set_width_chars (GTK_ENTRY (proxy->entry), 5); gtk_box_pack_start (GTK_BOX (hbox), proxy->entry, FALSE, FALSE, 0); gtk_widget_show (proxy->entry); @@ -344,7 +365,9 @@ ev_page_action_grab_focus (EvPageAction *page_action) EvPageActionWidget *proxy; proxy = EV_PAGE_ACTION_WIDGET (proxies->data); - gtk_widget_grab_focus (proxy->entry); + + if (GTK_WIDGET_MAPPED (GTK_WIDGET (proxy))) + gtk_widget_grab_focus (proxy->entry); } }