Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-properties-dialog.c
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /* this file is part of evince, a gnome document viewer
3  *
4  * Copyright (C) 2005 Red Hat, Inc
5  *
6  * Evince is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Evince is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24 
25 #include <glib/gi18n.h>
26 #include <gtk/gtk.h>
27 
28 #include "ev-document-fonts.h"
29 #include "ev-properties-dialog.h"
30 #include "ev-properties-fonts.h"
31 #include "ev-properties-view.h"
32 #include "ev-properties-license.h"
33 
35  GtkDialog base_instance;
36 
38  GtkWidget *notebook;
39  GtkWidget *general_page;
40  GtkWidget *fonts_page;
41  GtkWidget *license_page;
42 };
43 
45  GtkDialogClass base_class;
46 };
47 
48 G_DEFINE_TYPE (EvPropertiesDialog, ev_properties_dialog, GTK_TYPE_DIALOG)
49 
50 static void
52 {
53 }
54 
55 static void
57 {
58  GtkBox *content_area;
59 
60  content_area = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (properties)));
61  gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
62 
63  gtk_window_set_title (GTK_WINDOW (properties), _("Properties"));
64  gtk_window_set_destroy_with_parent (GTK_WINDOW (properties), TRUE);
65 
66  properties->notebook = gtk_notebook_new ();
67  gtk_notebook_set_show_border (GTK_NOTEBOOK (properties->notebook), FALSE);
68  gtk_box_pack_start (content_area, properties->notebook, TRUE, TRUE, 0);
69  gtk_widget_show (properties->notebook);
70 }
71 
72 void
74  const gchar *uri,
75  EvDocument *document)
76 {
77  GtkWidget *label;
78  const EvDocumentInfo *info;
79 
80  properties->document = document;
81 
82  info = ev_document_get_info (document);
83 
84  if (properties->general_page == NULL) {
85  label = gtk_label_new (_("General"));
86  properties->general_page = ev_properties_view_new (document);
87  gtk_notebook_append_page (GTK_NOTEBOOK (properties->notebook),
88  properties->general_page, label);
89  gtk_widget_show (properties->general_page);
90  }
91  ev_properties_view_set_info (EV_PROPERTIES_VIEW (properties->general_page), info);
92 
93  if (EV_IS_DOCUMENT_FONTS (document)) {
94  if (properties->fonts_page == NULL) {
95  label = gtk_label_new (_("Fonts"));
96  properties->fonts_page = ev_properties_fonts_new ();
97  gtk_notebook_append_page (GTK_NOTEBOOK (properties->notebook),
98  properties->fonts_page, label);
99  gtk_widget_show (properties->fonts_page);
100  }
101 
103  (EV_PROPERTIES_FONTS (properties->fonts_page), document);
104  }
105 
106  if (info->fields_mask & EV_DOCUMENT_INFO_LICENSE && info->license) {
107  if (properties->license_page == NULL) {
108  label = gtk_label_new (_("Document License"));
109  properties->license_page = ev_properties_license_new ();
110  gtk_notebook_append_page (GTK_NOTEBOOK (properties->notebook),
111  properties->license_page, label);
112  gtk_widget_show (properties->license_page);
113  }
114 
116  (EV_PROPERTIES_LICENSE (properties->license_page), info->license);
117  }
118 }
119 
120 GtkWidget *
122 {
124 
125  properties = g_object_new (EV_TYPE_PROPERTIES_DIALOG,
126  "use-header-bar", TRUE, NULL);
127 
128  return GTK_WIDGET (properties);
129 }