]> www.fi.muni.cz Git - evince.git/blob - shell/ev-sidebar-page.c
Autoraise toolbar on GoToPage action and fix keyboard accelerators in sidebar
[evince.git] / shell / ev-sidebar-page.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /*
3  *  Copyright (C) 2005 Marco Pesenti Gritti
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  */
20
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24
25 #include "ev-sidebar-page.h"
26 #include <gtk/gtk.h>
27
28 static void ev_sidebar_page_iface_init (gpointer iface);
29
30 GType
31 ev_sidebar_page_get_type (void)
32 {
33         static GType type = 0;
34
35         if (G_UNLIKELY (type == 0))
36         {
37                 static const GTypeInfo sidebar_page_info =
38                 {
39                         sizeof (EvSidebarPageIface),
40                         NULL,
41                         NULL,
42                         (GClassInitFunc)ev_sidebar_page_iface_init,
43                 };
44
45                 type = g_type_register_static (G_TYPE_INTERFACE,
46                                                "EvSidebarPage",
47                                                &sidebar_page_info, (GTypeFlags)0);
48         }
49
50         return type;
51 }
52
53
54 gboolean 
55 ev_sidebar_page_support_document  (EvSidebarPage    *sidebar_page,
56                                    EvDocument *document)
57 {
58         EvSidebarPageIface *iface;
59
60         g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), FALSE);
61         g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
62
63         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
64
65         g_return_val_if_fail (iface->set_document, FALSE);
66         
67         return iface->support_document (sidebar_page, document);    
68 }
69
70 void 
71 ev_sidebar_page_set_document      (EvSidebarPage    *sidebar_page,
72                                    EvDocument *document)
73 {
74         EvSidebarPageIface *iface;
75
76         g_return_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page));
77         g_return_if_fail (EV_IS_DOCUMENT (document));
78
79         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
80
81         g_return_if_fail (iface->set_document);
82         
83         iface->set_document (sidebar_page, document);
84         
85         return;
86 }
87
88 const gchar*
89 ev_sidebar_page_get_label (EvSidebarPage    *sidebar_page)
90 {
91         EvSidebarPageIface *iface;
92
93         g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), NULL);
94
95         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
96
97         g_return_val_if_fail (iface->get_label, NULL);
98         
99         return iface->get_label (sidebar_page);
100 }
101
102
103 static void ev_sidebar_page_iface_init (gpointer         iface)
104 {
105         g_object_interface_install_property (iface,
106                                              g_param_spec_object ("main-widget",
107                                                                   "Main Widget",
108                                                                   "Main page widget, used to handle focus",
109                                                                   GTK_TYPE_WIDGET,
110                                                                   G_PARAM_READABLE));
111 }