]> www.fi.muni.cz Git - evince.git/blob - shell/ev-sidebar-bookmarks.c
Construct an actual sidebar.
[evince.git] / shell / ev-sidebar-bookmarks.c
1 /* this file is part of evince, a gnome document viewer
2  *
3  *  Copyright (C) 2004 Red Hat, Inc.
4  *
5  *  Author:
6  *    Jonathan Blandford <jrb@alum.mit.edu>
7  *
8  * Evince is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Evince is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 #include <string.h>
28 #include <gtk/gtk.h>
29
30 #include "ev-sidebar-bookmarks.h"
31
32 struct _EvSidebarBookmarksPrivate {
33         GtkWidget *tree_view;
34 };
35
36 enum {
37         BOOKMARKS_COLUMN_MARKUP,
38         BOOKMARKS_COLUMN_OUTLINE,
39         BOOKMARKS_COLUMN_PAGE_NUM,
40         BOOKMARKS_COLUMN_PAGE_VALID,
41         NUM_COLUMNS
42 };
43
44 G_DEFINE_TYPE (EvSidebarBookmarks, ev_sidebar_bookmarks, GTK_TYPE_VBOX)
45
46 #define EV_SIDEBAR_BOOKMARKS_GET_PRIVATE(object) \
47         (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR_BOOKMARKS, EvSidebarBookmarksPrivate))
48
49 static void
50 ev_sidebar_bookmarks_class_init (EvSidebarBookmarksClass *ev_sidebar_bookmarks_class)
51 {
52         GObjectClass *g_object_class;
53
54         g_object_class = G_OBJECT_CLASS (ev_sidebar_bookmarks_class);
55
56         g_type_class_add_private (g_object_class, sizeof (EvSidebarBookmarksPrivate));
57
58 }
59
60
61 static void
62 ev_sidebar_bookmarks_construct (EvSidebarBookmarks *ev_sidebar_bookmarks)
63 {
64         EvSidebarBookmarksPrivate *priv;
65         GtkWidget *swindow;
66
67         priv = ev_sidebar_bookmarks->priv;
68         swindow = gtk_scrolled_window_new (NULL, NULL);
69
70         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
71                                         GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
72         gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
73                                              GTK_SHADOW_IN);
74
75         /* Create tree view */
76         priv->tree_view = gtk_tree_view_new ();
77         gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree_view), FALSE);
78         gtk_container_add (GTK_CONTAINER (swindow), priv->tree_view);
79
80         gtk_box_pack_start (GTK_BOX (ev_sidebar_bookmarks), swindow, TRUE, TRUE, 0);
81         gtk_widget_show_all (GTK_WIDGET (ev_sidebar_bookmarks));
82 }
83
84 static void
85 ev_sidebar_bookmarks_init (EvSidebarBookmarks *ev_sidebar_bookmarks)
86 {
87         ev_sidebar_bookmarks->priv = EV_SIDEBAR_BOOKMARKS_GET_PRIVATE (ev_sidebar_bookmarks);
88
89         ev_sidebar_bookmarks_construct (ev_sidebar_bookmarks);
90 }
91
92 GtkWidget *
93 ev_sidebar_bookmarks_new (void)
94 {
95         GtkWidget *ev_sidebar_bookmarks;
96
97         ev_sidebar_bookmarks = g_object_new (EV_TYPE_SIDEBAR_BOOKMARKS, NULL);
98
99         return ev_sidebar_bookmarks;
100 }