]> www.fi.muni.cz Git - evince.git/blob - shell/ev-sidebar-page.c
[dualscreen] fix crash on ctrl+w and fix control window closing
[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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  */
20
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24
25 #include <gtk/gtk.h>
26
27 #include "ev-sidebar-page.h"
28
29 G_DEFINE_INTERFACE (EvSidebarPage, ev_sidebar_page, 0)
30
31 gboolean 
32 ev_sidebar_page_support_document (EvSidebarPage *sidebar_page,
33                                   EvDocument    *document)
34 {
35         EvSidebarPageInterface *iface;
36
37         g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), FALSE);
38         g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
39
40         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
41
42         g_return_val_if_fail (iface->support_document, FALSE);
43         
44         return iface->support_document (sidebar_page, document);    
45 }
46
47 void
48 ev_sidebar_page_set_model (EvSidebarPage   *sidebar_page,
49                            EvDocumentModel *model)
50 {
51         EvSidebarPageInterface *iface;
52
53         g_return_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page));
54         g_return_if_fail (EV_IS_DOCUMENT_MODEL (model));
55
56         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
57
58         g_assert (iface->set_model);
59
60         iface->set_model (sidebar_page, model);
61 }
62
63 const gchar *
64 ev_sidebar_page_get_label (EvSidebarPage *sidebar_page)
65 {
66         EvSidebarPageInterface *iface;
67
68         g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), NULL);
69
70         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
71
72         g_assert (iface->get_label);
73         
74         return iface->get_label (sidebar_page);
75 }
76
77
78 static void
79 ev_sidebar_page_default_init (EvSidebarPageInterface *iface)
80 {
81         static gboolean initialized = FALSE;
82  
83         if (!initialized) {
84                 g_object_interface_install_property (iface,
85                                                      g_param_spec_object ("main-widget",
86                                                                           "Main Widget",
87                                                                           "Main page widget, used to handle focus",
88                                                                           GTK_TYPE_WIDGET,
89                                                                           G_PARAM_READABLE));
90                 initialized = TRUE;
91         }
92 }