[gnome-keyring: 3/5] gcr: Document GcrListSelector



commit 73f773ba26bf25b27886885b30f41d3c7820959f
Author: Stef Walter <stefw collabora co uk>
Date:   Tue Jul 12 18:50:10 2011 +0200

    gcr: Document GcrListSelector

 docs/reference/gcr/Makefile.am              |    7 +++-
 docs/reference/gcr/gcr-docs.sgml            |    1 +
 docs/reference/gcr/gcr-sections.txt         |   20 ++++++++++++++
 docs/reference/gcr/gcr-visual-index.xml     |    3 ++
 docs/reference/gcr/gcr-widgets.c            |   39 +++++++++++++++++++++++++++
 docs/reference/gcr/images/list-selector.png |  Bin 0 -> 10123 bytes
 gcr/gcr-list-selector.c                     |    8 +++--
 7 files changed, 73 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/gcr/Makefile.am b/docs/reference/gcr/Makefile.am
index af742e0..8f61908 100644
--- a/docs/reference/gcr/Makefile.am
+++ b/docs/reference/gcr/Makefile.am
@@ -66,6 +66,7 @@ IGNORE_HFILES= \
 	gcr-icons.h \
 	gcr-import-dialog.h \
 	gcr-internal.h \
+	gcr-live-search.h \
 	gcr-marshal.h \
 	gcr-xxx.h \
 	gcr-zzz.h
@@ -76,7 +77,8 @@ HTML_IMAGES= \
 	$(srcdir)/images/certificate-widget.png \
 	$(srcdir)/images/key-widget.png \
 	$(srcdir)/images/combo-selector.png \
-	$(srcdir)/images/tree-selector.png
+	$(srcdir)/images/tree-selector.png \
+	$(srcdir)/images/list-selector.png
 
 # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
 # e.g. content_files=running.sgml building.sgml changes-2.0.sgml
@@ -120,7 +122,8 @@ WIDGETS = \
 	certificate-widget \
 	key-widget \
 	combo-selector \
-	tree-selector
+	tree-selector \
+	list-selector
 
 shots: gcr-shooter
 	mkdir -p $(builddir)/images
diff --git a/docs/reference/gcr/gcr-docs.sgml b/docs/reference/gcr/gcr-docs.sgml
index 6a8f182..33cd261 100644
--- a/docs/reference/gcr/gcr-docs.sgml
+++ b/docs/reference/gcr/gcr-docs.sgml
@@ -35,6 +35,7 @@
 		<xi:include href="xml/gcr-key-widget.xml"/>
 		<xi:include href="xml/gcr-column.xml"/>
 		<xi:include href="xml/gcr-combo-selector.xml"/>
+		<xi:include href="xml/gcr-list-selector.xml"/>
 		<xi:include href="xml/gcr-tree-selector.xml"/>
 		<xi:include href="xml/gcr-renderer.xml"/>
 		<xi:include href="xml/gcr-viewer.xml"/>
diff --git a/docs/reference/gcr/gcr-sections.txt b/docs/reference/gcr/gcr-sections.txt
index adbdb3f..98e95f4 100644
--- a/docs/reference/gcr/gcr-sections.txt
+++ b/docs/reference/gcr/gcr-sections.txt
@@ -300,6 +300,26 @@ GcrTreeSelectorPrivate
 </SECTION>
 
 <SECTION>
+<FILE>gcr-list-selector</FILE>
+GcrListSelector
+GcrListSelectorClass
+gcr_list_selector_new
+gcr_list_selector_get_collection
+gcr_list_selector_get_columns
+gcr_list_selector_get_selected
+gcr_list_selector_set_selected
+<SUBSECTION Standard>
+gcr_list_selector_get_type
+GcrListSelectorPrivate
+GCR_IS_LIST_SELECTOR
+GCR_IS_LIST_SELECTOR_CLASS
+GCR_LIST_SELECTOR
+GCR_LIST_SELECTOR_CLASS
+GCR_LIST_SELECTOR_GET_CLASS
+GCR_TYPE_LIST_SELECTOR
+</SECTION>
+
+<SECTION>
 <FILE>gcr-combo-selector</FILE>
 GcrComboSelector
 GcrComboSelectorClass
diff --git a/docs/reference/gcr/gcr-visual-index.xml b/docs/reference/gcr/gcr-visual-index.xml
index e3136ec..ea9cd7c 100644
--- a/docs/reference/gcr/gcr-visual-index.xml
+++ b/docs/reference/gcr/gcr-visual-index.xml
@@ -15,4 +15,7 @@
   <link linkend="gcr-GcrTreeSelector">
     <inlinegraphic fileref="tree-selector.png" format="PNG"></inlinegraphic>
   </link>
+  <link linkend="gcr-GcrListSelector">
+    <inlinegraphic fileref="list-selector.png" format="PNG"></inlinegraphic>
+  </link>
 </para>
\ No newline at end of file
diff --git a/docs/reference/gcr/gcr-widgets.c b/docs/reference/gcr/gcr-widgets.c
index 9dbd89a..3f23bc5 100644
--- a/docs/reference/gcr/gcr-widgets.c
+++ b/docs/reference/gcr/gcr-widgets.c
@@ -140,6 +140,43 @@ create_tree_selector (const gchar *name)
 	return gcr_shooter_info_new (name, align, GCR_SHOOTER_MEDIUM);
 }
 
+static GcrShooterInfo *
+create_list_selector (const gchar *name)
+{
+	GcrListSelector *selector;
+	GcrCertificate *certificate;
+	GcrCollection *collection;
+	GtkWidget *align;
+	gchar *contents;
+	gsize length;
+	GList *selected = NULL;
+
+	collection = gcr_simple_collection_new ();
+	selector = gcr_list_selector_new (collection);
+
+	contents = load_gcr_test_file ("cacert.org.cer", &length);
+	certificate = gcr_simple_certificate_new (contents, length);
+	g_free (contents);
+	gcr_simple_collection_add (GCR_SIMPLE_COLLECTION (collection), G_OBJECT (certificate));
+	selected = g_list_append (selected, certificate);
+	gcr_list_selector_set_selected (selector, selected);
+	g_list_free (selected);
+	g_object_unref (certificate);
+
+	contents = load_gcr_test_file ("der-certificate-dsa.cer", &length);
+	certificate = gcr_simple_certificate_new (contents, length);
+	g_free (contents);
+	gcr_simple_collection_add (GCR_SIMPLE_COLLECTION (collection), G_OBJECT (certificate));
+	g_object_unref (certificate);
+
+	g_object_unref (collection);
+
+	align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+	gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (selector));
+
+	return gcr_shooter_info_new (name, align, GCR_SHOOTER_MEDIUM);
+}
+
 
 GcrShooterInfo*
 gcr_widgets_create (const gchar *name)
@@ -154,6 +191,8 @@ gcr_widgets_create (const gchar *name)
 		return create_combo_selector (name);
 	else if (g_str_equal (name, "tree-selector"))
 		return create_tree_selector (name);
+	else if (g_str_equal (name, "list-selector"))
+		return create_list_selector (name);
 
 	return NULL;
 }
diff --git a/docs/reference/gcr/images/list-selector.png b/docs/reference/gcr/images/list-selector.png
new file mode 100644
index 0000000..7f9c688
Binary files /dev/null and b/docs/reference/gcr/images/list-selector.png differ
diff --git a/gcr/gcr-list-selector.c b/gcr/gcr-list-selector.c
index bbc862d..20cf3a9 100644
--- a/gcr/gcr-list-selector.c
+++ b/gcr/gcr-list-selector.c
@@ -37,10 +37,10 @@
 /**
  * SECTION:gcr-list-selector
  * @title: GcrListSelector
- * @short_description: A selector widget to select a single certificate or key.
+ * @short_description: A selector widget to one or more certificates from a list.
  *
- * The #GcrListSelector can be used to select a certificate or key. It allows
- * the user to select one object from the selector at a time.
+ * The #GcrListSelector can be used to select one or more certificates or keys.
+ * Live search is available for quick filtering.
  */
 
 /**
@@ -218,6 +218,8 @@ gcr_list_selector_constructed (GObject *object)
 
 	G_OBJECT_CLASS (gcr_list_selector_parent_class)->constructed (object);
 
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (self), FALSE);
+
 	self->pv->model = gcr_collection_model_new (self->pv->collection,
 	                                            "icon", G_TYPE_ICON,
 	                                            "markup", G_TYPE_STRING,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]