summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorGermán Poo-Caamaño <gpoo@gnome.org>2013-09-27 22:33:42 -0700
committerCarlos Garcia Campos <carlosgc@gnome.org>2013-10-04 12:55:46 +0200
commitff674f57a3587142165fd56aec089d9840ceda36 (patch)
treed4f9f55b8a055e7ec07f2cc6fd58e2a9714e27dd /glib
parent76d6e2d385e2cbad7f44bc8aee05147efd3970a4 (diff)
glib-demo: Merge columns Type and Color in annotations demo
Reduce the space used by both columns, makes the color pixbuf smaller enough to give a clue of the annotation color. https://bugs.freedesktop.org/show_bug.cgi?id=69978
Diffstat (limited to 'glib')
-rw-r--r--glib/demo/annots.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/glib/demo/annots.c b/glib/demo/annots.c
index 3ef2f699..247d5768 100644
--- a/glib/demo/annots.c
+++ b/glib/demo/annots.c
@@ -160,7 +160,12 @@ get_annot_color (PopplerAnnot *poppler_annot)
PopplerColor *poppler_color;
if ((poppler_color = poppler_annot_get_color (poppler_annot))) {
- GdkPixbuf *pixbuf = pgd_pixbuf_new_for_color (poppler_color);
+ GdkPixbuf *pixbuf_tmp, *pixbuf;
+
+ pixbuf_tmp = pgd_pixbuf_new_for_color (poppler_color);
+ pixbuf = gdk_pixbuf_scale_simple(pixbuf_tmp, 16, 16, GDK_INTERP_BILINEAR);
+ g_object_unref (pixbuf_tmp);
+
g_free (poppler_color);
return pixbuf;
@@ -930,6 +935,7 @@ pgd_annots_create_widget (PopplerDocument *document)
GtkWidget *swindow, *treeview;
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
gchar *str;
gint n_pages;
@@ -1020,19 +1026,17 @@ pgd_annots_create_widget (PopplerDocument *document)
"text", ANNOTS_Y2_COLUMN,
NULL);
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- ANNOTS_TYPE_COLUMN, "Type",
- renderer,
- "text", ANNOTS_TYPE_COLUMN,
- NULL);
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_set_title (column, "Type");
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- ANNOTS_COLOR_COLUMN, "Color",
- renderer,
- "pixbuf", ANNOTS_COLOR_COLUMN,
- NULL);
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_add_attribute (column, renderer, "pixbuf", ANNOTS_COLOR_COLUMN);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_add_attribute (column, renderer, "text", ANNOTS_TYPE_COLUMN);
renderer = gtk_cell_renderer_toggle_new ();
g_signal_connect (renderer, "toggled",