+2005-06-04 Marco Pesenti Gritti <mpg@redhat.com>
+
+ * backend/Makefile.am:
+ * backend/ev-document-fonts.c: (ev_document_fonts_get_type),
+ (ev_document_fonts_get_fonts_model):
+ * backend/ev-document-fonts.h:
+ * data/evince-properties.glade:
+ * pdf/ev-poppler.cc:
+ * shell/ev-properties.c: (setup_fonts_view), (ev_properties_new):
+ * shell/ev-properties.h:
+ * shell/ev-window.c: (ev_window_cmd_file_properties):
+
+ Implement fonts list. Defined out for now, since it depends
+ on a not yet committed poppler patch.
+
Fri Jun 3 21:07:57 2005 Jonathan Blandford <jrb@redhat.com>
* shell/ev-view.c (get_page_extents): other_page isn't necessarily
ev-document.h \
ev-document-thumbnails.c \
ev-document-thumbnails.h \
+ ev-document-fonts.c \
+ ev-document-fonts.h \
ev-document-links.c \
ev-document-links.h \
ev-document-security.c \
--- /dev/null
+/* ev-document-fonts.h
+ * this file is part of evince, a gnome document_fonts viewer
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ *
+ * Author:
+ * Marco Pesenti Gritti <mpg@redhat.com>
+ *
+ * Evince is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "ev-document-fonts.h"
+#include "ev-job-queue.h"
+
+GType
+ev_document_fonts_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0))
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EvDocumentFontsIface),
+ NULL,
+ NULL,
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "EvDocumentFonts",
+ &our_info, (GTypeFlags)0);
+ }
+
+ return type;
+}
+
+GtkTreeModel *
+ev_document_fonts_get_fonts_model (EvDocumentFonts *document_fonts)
+{
+ EvDocumentFontsIface *iface = EV_DOCUMENT_FONTS_GET_IFACE (document_fonts);
+ GtkTreeModel *retval;
+
+ retval = iface->get_fonts_model (document_fonts);
+
+ return retval;
+}
--- /dev/null
+/* ev-document-fonts.h
+ * this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ *
+ * Author:
+ * Marco Pesenti Gritti <mpg@redhat.com>
+ *
+ * Evince is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EV_DOCUMENT_FONTS_H
+#define EV_DOCUMENT_FONTS_H
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "ev-document.h"
+#include "ev-link.h"
+
+G_BEGIN_DECLS
+
+
+#define EV_TYPE_DOCUMENT_FONTS (ev_document_fonts_get_type ())
+#define EV_DOCUMENT_FONTS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_FONTS, EvDocumentFonts))
+#define EV_DOCUMENT_FONTS_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_FONTS, EvDocumentFontsIface))
+#define EV_IS_DOCUMENT_FONTS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT_FONTS))
+#define EV_IS_DOCUMENT_FONTS_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT_FONTS))
+#define EV_DOCUMENT_FONTS_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT_FONTS, EvDocumentFontsIface))
+
+typedef struct _EvDocumentFonts EvDocumentFonts;
+typedef struct _EvDocumentFontsIface EvDocumentFontsIface;
+
+enum {
+ EV_DOCUMENT_FONTS_COLUMN_NAME,
+ EV_DOCUMENT_FONTS_COLUMN_NUM_COLUMNS
+};
+
+struct _EvDocumentFontsIface
+{
+ GTypeInterface base_iface;
+
+ /* Methods */
+ GtkTreeModel *(* get_fonts_model) (EvDocumentFonts *document_fonts);
+};
+
+GType ev_document_fonts_get_type (void);
+GtkTreeModel *ev_document_fonts_get_fonts_model (EvDocumentFonts *document_fonts);
+
+G_END_DECLS
+
+#endif
<child>
<widget class="GtkLabel" id="pdf_properties_label">
<property name="visible">True</property>
- <property name="label" translatable="yes">PDF Properties</property>
+ <property name="label" translatable="yes">General</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="fonts_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
+ <property name="hover_selection">False</property>
+ <property name="hover_expand">False</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Fonts</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
#include "ev-document-find.h"
#include "ev-document-misc.h"
#include "ev-document-links.h"
+#include "ev-document-fonts.h"
#include "ev-document-security.h"
#include "ev-document-thumbnails.h"
static void pdf_document_security_iface_init (EvDocumentSecurityIface *iface);
static void pdf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
static void pdf_document_document_links_iface_init (EvDocumentLinksIface *iface);
+static void pdf_document_document_fonts_iface_init (EvDocumentFontsIface *iface);
static void pdf_document_find_iface_init (EvDocumentFindIface *iface);
static void pdf_document_ps_exporter_iface_init (EvPSExporterIface *iface);
static void pdf_document_thumbnails_get_dimensions (EvDocumentThumbnails *document_thumbnails,
pdf_document_document_thumbnails_iface_init);
G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_LINKS,
pdf_document_document_links_iface_init);
+ G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_FONTS,
+ pdf_document_document_fonts_iface_init);
G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_FIND,
pdf_document_find_iface_init);
G_IMPLEMENT_INTERFACE (EV_TYPE_PS_EXPORTER,
iface->set_password = pdf_document_set_password;
}
+static void
+build_fonts_list (PdfDocument *pdf_document,
+ GtkTreeModel *model,
+ GtkTreeIter *parent,
+ PopplerFontsIter *iter)
+{
+#ifdef POPPLER_FONT_INFO
+ do {
+ GtkTreeIter list_iter;
+ PopplerIndexIter *child;
+ char *name;
+
+ name = poppler_fonts_iter_get_name (iter);
+ gtk_list_store_append (GTK_LIST_STORE (model), &list_iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &list_iter,
+ EV_DOCUMENT_FONTS_COLUMN_NAME, name,
+ -1);
+ g_free (name);
+ } while (poppler_fonts_iter_next (iter));
+#endif
+}
+
+static GtkTreeModel *
+pdf_document_fonts_get_fonts_model (EvDocumentFonts *document_fonts)
+{
+ PdfDocument *pdf_document = PDF_DOCUMENT (document_fonts);
+ GtkTreeModel *model = NULL;
+ PopplerFontsIter *iter;
+
+ g_return_val_if_fail (PDF_IS_DOCUMENT (document_fonts), NULL);
+
+ iter = poppler_fonts_iter_new (pdf_document->document);
+ /* Create the model iff we have items*/
+ if (iter != NULL) {
+ model = (GtkTreeModel *) gtk_list_store_new (EV_DOCUMENT_FONTS_COLUMN_NUM_COLUMNS,
+ G_TYPE_STRING);
+ build_fonts_list (pdf_document, model, NULL, iter);
+ poppler_fonts_iter_free (iter);
+ }
+
+ return model;
+}
+
+static void
+pdf_document_document_fonts_iface_init (EvDocumentFontsIface *iface)
+{
+ iface->get_fonts_model = pdf_document_fonts_get_fonts_model;
+}
+
static gboolean
pdf_document_links_has_document_links (EvDocumentLinks *document_links)
{
return link;
}
-
static void
build_tree (PdfDocument *pdf_document,
GtkTreeModel *model,
return model;
}
-
static void
pdf_document_document_links_iface_init (EvDocumentLinksIface *iface)
{
iface->get_links_model = pdf_document_links_get_links_model;
}
-
static GdkPixbuf *
make_thumbnail_for_size (PdfDocument *pdf_document,
gint page,
#endif
#include "ev-properties.h"
+#include "ev-document-fonts.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
gtk_label_set_text (GTK_LABEL (widget), text ? text : "");
}
+static void
+setup_fonts_view (GladeXML *xml, GtkTreeModel *fonts)
+{
+ GtkWidget *widget;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
+ widget = glade_xml_get_widget (xml, "fonts_treeview");
+ gtk_tree_view_set_model (GTK_TREE_VIEW (widget), fonts);
+
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
+ gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
+ "text", EV_DOCUMENT_FONTS_COLUMN_NAME,
+ NULL);
+}
+
GtkDialog *
-ev_properties_new (EvDocumentInfo *info)
+ev_properties_new (EvDocumentInfo *info, GtkTreeModel *fonts)
{
GladeXML *xml;
GtkWidget *dialog;
set_property (xml, SECURITY_PROPERTY, info->security);
}
+ if (fonts) {
+ setup_fonts_view (xml, fonts);
+ }
+
return GTK_DIALOG (dialog);
}
#define __EV_PROPERTIES_H__
#include "ev-document.h"
-#include "ev-window.h"
#include <gtk/gtkdialog.h>
+#include <gtk/gtktreemodel.h>
G_BEGIN_DECLS
-GtkDialog *ev_properties_new (EvDocumentInfo *info);
+GtkDialog *ev_properties_new (EvDocumentInfo *info,
+ GtkTreeModel *fonts);
G_END_DECLS
#include "ev-properties.h"
#include "ev-document-thumbnails.h"
#include "ev-document-links.h"
+#include "ev-document-fonts.h"
#include "ev-document-types.h"
#include "ev-document-find.h"
#include "ev-document-security.h"
static void
ev_window_cmd_file_properties (GtkAction *action, EvWindow *ev_window)
{
+ EvDocument *document = ev_window->priv->document;
EvDocumentInfo *info;
GtkDialog *dialog;
+ GtkTreeModel *fonts;
- info = ev_document_get_info (ev_window->priv->document);
- dialog = ev_properties_new (info);
+ if (EV_IS_DOCUMENT_FONTS (document)) {
+ fonts = ev_document_fonts_get_fonts_model (EV_DOCUMENT_FONTS (document));
+ } else {
+ fonts = NULL;
+ }
+
+ info = ev_document_get_info (document);
+ dialog = ev_properties_new (info, fonts);
gtk_dialog_run (dialog);
gtk_widget_destroy (GTK_WIDGET (dialog));
ev_document_info_free (info);