[gnome-documents/wip/ui-changes: 6/25] list-view: use a GtkCellRendererToggle to render selections
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/ui-changes: 6/25] list-view: use a GtkCellRendererToggle to render selections
- Date: Sat, 3 Mar 2012 00:26:42 +0000 (UTC)
commit 48a6388fcc9a7da7a331a976d8e63cbc4aff6d22
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Feb 27 19:30:04 2012 -0500
list-view: use a GtkCellRendererToggle to render selections
src/lib/gd-main-list-view.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/src/lib/gd-main-list-view.c b/src/lib/gd-main-list-view.c
index 18e4242..14aa4f0 100644
--- a/src/lib/gd-main-list-view.c
+++ b/src/lib/gd-main-list-view.c
@@ -28,6 +28,7 @@
struct _GdMainListViewPrivate {
GtkTreeViewColumn *tree_col;
+ GtkCellRenderer *selection_cell;
};
static void gd_main_view_generic_iface_init (GdMainViewGenericIface *iface);
@@ -61,12 +62,20 @@ gd_main_list_view_constructed (GObject *obj)
NULL);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self));
- g_signal_connect (selection, "changed",
- G_CALLBACK (on_tree_selection_changed), self);
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
self->priv->tree_col = gtk_tree_view_column_new ();
gtk_tree_view_append_column (GTK_TREE_VIEW (self), self->priv->tree_col);
+ self->priv->selection_cell = cell = gtk_cell_renderer_toggle_new ();
+ g_object_set (cell,
+ "visible", FALSE,
+ "xpad", 12,
+ NULL);
+ gtk_tree_view_column_pack_start (self->priv->tree_col, cell, FALSE);
+ gtk_tree_view_column_add_attribute (self->priv->tree_col, cell,
+ "active", GD_MAIN_COLUMN_SELECTED);
+
cell = gtk_cell_renderer_pixbuf_new ();
g_object_set (cell,
"xalign", 0.5,
@@ -130,12 +139,14 @@ gd_main_list_view_get_path_at_pos (GdMainViewGeneric *mv,
static void
gd_main_list_view_set_selection_mode (GdMainViewGeneric *mv,
- GtkSelectionMode mode)
+ gboolean selection_mode)
{
- GtkTreeSelection *selection;
+ GdMainListView *self = GD_MAIN_LIST_VIEW (mv);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (mv));
- gtk_tree_selection_set_mode (selection, mode);
+ g_object_set (self->priv->selection_cell,
+ "visible", selection_mode,
+ NULL);
+ gtk_tree_view_column_queue_resize (self->priv->tree_col);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]