[poppler] glib/demo

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Wed Oct 7 08:13:00 PDT 2009


 glib/demo/annots.c |   35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

New commits:
commit 388196df1fb05fb2d88ae82bd81e823a23588ec1
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Wed Oct 7 17:11:58 2009 +0200

    [glib-demo] Show some of the annot flags in annots treeview

diff --git a/glib/demo/annots.c b/glib/demo/annots.c
index 7865f1d..c9aecb3 100644
--- a/glib/demo/annots.c
+++ b/glib/demo/annots.c
@@ -29,6 +29,9 @@ enum {
     ANNOTS_Y2_COLUMN,
     ANNOTS_TYPE_COLUMN,
     ANNOTS_COLOR_COLUMN,
+    ANNOTS_FLAG_INVISIBLE_COLUMN,
+    ANNOTS_FLAG_HIDDEN_COLUMN,
+    ANNOTS_FLAG_PRINT_COLUMN,
     ANNOTS_COLUMN,
     N_COLUMNS
 };
@@ -478,6 +481,7 @@ pgd_annots_get_annots (GtkWidget     *button,
         GtkTreeIter          iter;
         gchar               *x1, *y1, *x2, *y2;
         GdkPixbuf           *pixbuf;
+	PopplerAnnotFlag     flags;
 
         amapping = (PopplerAnnotMapping *) l->data;
 
@@ -487,15 +491,19 @@ pgd_annots_get_annots (GtkWidget     *button,
         y2 = g_strdup_printf ("%.2f", amapping->area.y2);
 
         pixbuf = get_annot_color (amapping->annot);
+	flags = poppler_annot_get_flags (amapping->annot);
 
         gtk_list_store_append (demo->model, &iter);
         gtk_list_store_set (demo->model, &iter,
-                            ANNOTS_X1_COLUMN, x1, 
+                            ANNOTS_X1_COLUMN, x1,
                             ANNOTS_Y1_COLUMN, y1,
                             ANNOTS_X2_COLUMN, x2,
                             ANNOTS_Y2_COLUMN, y2,
                             ANNOTS_TYPE_COLUMN, get_annot_type (amapping->annot),
                             ANNOTS_COLOR_COLUMN, pixbuf,
+			    ANNOTS_FLAG_INVISIBLE_COLUMN, (flags & POPPLER_ANNOT_FLAG_INVISIBLE),
+			    ANNOTS_FLAG_HIDDEN_COLUMN, (flags & POPPLER_ANNOT_FLAG_HIDDEN),
+			    ANNOTS_FLAG_PRINT_COLUMN, (flags & POPPLER_ANNOT_FLAG_PRINT),
                             ANNOTS_COLUMN, amapping->annot,
                            -1);
 
@@ -606,7 +614,9 @@ pgd_annots_create_widget (PopplerDocument *document)
     demo->model = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING,
                                       G_TYPE_STRING, G_TYPE_STRING,
                                       G_TYPE_STRING, G_TYPE_STRING,
-                                      GDK_TYPE_PIXBUF, G_TYPE_OBJECT);
+                                      GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN,
+				      G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
+				      G_TYPE_OBJECT);
     treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (demo->model));
 
     renderer = gtk_cell_renderer_text_new ();
@@ -648,6 +658,27 @@ pgd_annots_create_widget (PopplerDocument *document)
                                                  "pixbuf", ANNOTS_COLOR_COLUMN,
                                                  NULL);
 
+    renderer = gtk_cell_renderer_toggle_new ();
+    gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
+                                                 ANNOTS_FLAG_INVISIBLE_COLUMN, "Invisible",
+                                                 renderer,
+                                                 "active", ANNOTS_FLAG_INVISIBLE_COLUMN,
+                                                 NULL);
+
+    renderer = gtk_cell_renderer_toggle_new ();
+    gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
+                                                 ANNOTS_FLAG_HIDDEN_COLUMN, "Hidden",
+                                                 renderer,
+                                                 "active", ANNOTS_FLAG_HIDDEN_COLUMN,
+                                                 NULL);
+
+    renderer = gtk_cell_renderer_toggle_new ();
+    gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
+                                                 ANNOTS_FLAG_PRINT_COLUMN, "Print",
+                                                 renderer,
+                                                 "active", ANNOTS_FLAG_PRINT_COLUMN,
+                                                 NULL);
+
     selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
     g_signal_connect (G_OBJECT (selection), "changed",
                       G_CALLBACK (pgd_annots_selection_changed),


More information about the poppler mailing list