Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-properties-fonts.c
diff options
context:
space:
mode:
authorMartin Kretzschmar <martink@src.gnome.org>2005-07-24 19:00:45 (GMT)
committer Martin Kretzschmar <martink@src.gnome.org>2005-07-24 19:00:45 (GMT)
commitdccf9855895c5f35bb0899bbd9c093baef02efc7 (patch)
tree7c41d6bd3a72f549e001961ce7438ccbd525acd0 /shell/ev-properties-fonts.c
parentcb35b406df957dbadf93bcd8f90b55c2e4c1d7ac (diff)
Bug #311280
* pdf/ev-poppler.cc (font_type_to_string): new, returns user readable name for PopplerFontTypes (pdf_document_fonts_fill_model): add font type to the detail column * backend/ev-document-fonts.h: added EV_DOCUMENT_FONTS_COLUMN_DETAILS. * shell/ev-properties-fonts.c (font_cell_data_func): glue together font name and font details, add a little markup. (ev_properties_fonts_init): use the new cell data func, specify ypad property for the cell renderer. (ev_properties_fonts_set_document): add the details column.
Diffstat (limited to 'shell/ev-properties-fonts.c')
-rw-r--r--shell/ev-properties-fonts.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/shell/ev-properties-fonts.c b/shell/ev-properties-fonts.c
index d86e106..5a79207 100644
--- a/shell/ev-properties-fonts.c
+++ b/shell/ev-properties-fonts.c
@@ -68,6 +68,33 @@ ev_properties_fonts_class_init (EvPropertiesFontsClass *properties_class)
}
static void
+font_cell_data_func (GtkTreeViewColumn *col, GtkCellRenderer *renderer,
+ GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
+{
+ char *name;
+ char *details;
+ char *markup;
+
+ gtk_tree_model_get(model, iter,
+ EV_DOCUMENT_FONTS_COLUMN_NAME, &name,
+ EV_DOCUMENT_FONTS_COLUMN_DETAILS, &details,
+ -1);
+
+ if (details) {
+ markup = g_strdup_printf ("<b><big>%s</big></b>\n<small>%s</small>",
+ name, details);
+ } else {
+ markup = g_strdup_printf ("<b><big>%s</big></b>", name);
+ }
+
+ g_object_set (renderer, "markup", markup, NULL);
+
+ g_free (markup);
+ g_free (details);
+ g_free (name);
+}
+
+static void
ev_properties_fonts_init (EvPropertiesFonts *properties)
{
GladeXML *xml;
@@ -90,12 +117,13 @@ ev_properties_fonts_init (EvPropertiesFonts *properties)
gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (properties->fonts_treeview), column);
- renderer = gtk_cell_renderer_text_new ();
+ renderer = GTK_CELL_RENDERER (g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
+ "ypad", 6, NULL));
gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
- gtk_tree_view_column_set_title (GTK_TREE_VIEW_COLUMN (column), _("Name"));
- gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
- "text", EV_DOCUMENT_FONTS_COLUMN_NAME,
- NULL);
+ gtk_tree_view_column_set_title (GTK_TREE_VIEW_COLUMN (column), _("Font"));
+ gtk_tree_view_column_set_cell_data_func (column, renderer,
+ font_cell_data_func,
+ NULL, NULL);
}
static void
@@ -151,7 +179,7 @@ ev_properties_fonts_set_document (EvPropertiesFonts *properties,
properties->document = document;
list_store = gtk_list_store_new (EV_DOCUMENT_FONTS_COLUMN_NUM_COLUMNS,
- G_TYPE_STRING);
+ G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (list_store));
job = ev_job_fonts_new (properties->document);