]> www.fi.muni.cz Git - evince.git/blob - shell/ev-sidebar-page.c
Include gdkx only for dbus support. See bug #339172.
[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 <gtk/gtk.h>
26
27 #include "ev-sidebar-page.h"
28
29 static void ev_sidebar_page_iface_init (gpointer iface);
30
31 GType
32 ev_sidebar_page_get_type (void)
33 {
34         static GType type = 0;
35
36         if (G_UNLIKELY (type == 0))
37         {
38                 const GTypeInfo sidebar_page_info =
39                 {
40                         sizeof (EvSidebarPageIface),
41                         NULL,
42                         NULL,
43                         (GClassInitFunc)ev_sidebar_page_iface_init,
44                 };
45
46                 type = g_type_register_static (G_TYPE_INTERFACE,
47                                                "EvSidebarPage",
48                                                &sidebar_page_info, (GTypeFlags)0);
49         }
50
51         return type;
52 }
53
54
55 gboolean 
56 ev_sidebar_page_support_document  (EvSidebarPage    *sidebar_page,
57                                    EvDocument *document)
58 {
59         EvSidebarPageIface *iface;
60
61         g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), FALSE);
62         g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
63
64         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
65
66         g_return_val_if_fail (iface->set_document, FALSE);
67         
68         return iface->support_document (sidebar_page, document);    
69 }
70
71 void 
72 ev_sidebar_page_set_document      (EvSidebarPage    *sidebar_page,
73                                    EvDocument *document)
74 {
75         EvSidebarPageIface *iface;
76
77         g_return_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page));
78         g_return_if_fail (EV_IS_DOCUMENT (document));
79
80         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
81
82         g_return_if_fail (iface->set_document);
83         
84         iface->set_document (sidebar_page, document);
85         
86         return;
87 }
88
89 const gchar*
90 ev_sidebar_page_get_label (EvSidebarPage    *sidebar_page)
91 {
92         EvSidebarPageIface *iface;
93
94         g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), NULL);
95
96         iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page);
97
98         g_return_val_if_fail (iface->get_label, NULL);
99         
100         return iface->get_label (sidebar_page);
101 }
102
103
104 static void ev_sidebar_page_iface_init (gpointer         iface)
105 {
106         g_object_interface_install_property (iface,
107                                              g_param_spec_object ("main-widget",
108                                                                   "Main Widget",
109                                                                   "Main page widget, used to handle focus",
110                                                                   GTK_TYPE_WIDGET,
111                                                                   G_PARAM_READABLE));
112 }