[Xfce4-commits] <xfce4-profile-manager:master> Fill the treeview with some example data
Stephan Arts
noreply at xfce.org
Sun Oct 9 15:26:02 CEST 2011
Updating branch refs/heads/master
to 23812cf0802b1e6e5f590bc9a1437c0d358ef291 (commit)
from e9a14be4ec179bab315cfbe07dcda83a69d6b87a (commit)
commit 23812cf0802b1e6e5f590bc9a1437c0d358ef291
Author: Stephan Arts <stephan at xfce.org>
Date: Sat Oct 8 19:14:42 2011 +0200
Fill the treeview with some example data
src/main_window.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 71 insertions(+), 1 deletions(-)
diff --git a/src/main_window.c b/src/main_window.c
index c11af9d..4dd37fa 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -62,7 +62,7 @@ struct _XfpmMainWindowPriv
static GtkActionEntry action_entries[] =
{
/* Profile Toolbar */
- { "apply", "document-open", N_ ("_Apply"), NULL, N_ ("Apply the selected profile"), G_CALLBACK (NULL) }
+ { "apply", GTK_STOCK_APPLY, N_ ("_Apply"), NULL, N_ ("Apply the selected profile"), G_CALLBACK (NULL) }
};
GType
@@ -106,6 +106,41 @@ xfpm_main_window_init (XfpmMainWindow *dialog)
GtkWidget *treeview;
GtkWidget *toolbar;
GtkAccelGroup *accel_group;
+ GtkTreeIter iter;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
+ GtkListStore *list_store = gtk_list_store_new (
+ 2,
+ G_TYPE_BOOLEAN,
+ G_TYPE_STRING );
+
+ gtk_list_store_append (
+ GTK_LIST_STORE (list_store),
+ &iter);
+
+ gtk_list_store_set (
+ GTK_LIST_STORE (list_store),
+ &iter,
+ 0,
+ TRUE,
+ 1,
+ "Custom",
+ -1);
+
+ gtk_list_store_append (
+ GTK_LIST_STORE (list_store),
+ &iter);
+
+ gtk_list_store_set (
+ GTK_LIST_STORE (list_store),
+ &iter,
+ 0,
+ FALSE,
+ 1,
+ "Economic",
+ -1);
+
dialog->priv = g_new0 (XfpmMainWindowPriv, 1);
dialog->priv->ui_manager = gtk_ui_manager_new ();
@@ -168,6 +203,40 @@ xfpm_main_window_init (XfpmMainWindow *dialog)
0 );
treeview = gtk_tree_view_new ();
+ gtk_tree_view_set_headers_visible (
+ GTK_TREE_VIEW (treeview),
+ FALSE );
+ gtk_tree_view_set_model (
+ GTK_TREE_VIEW (treeview),
+ GTK_TREE_MODEL (list_store));
+ renderer = gtk_cell_renderer_toggle_new ();
+ gtk_cell_renderer_toggle_set_radio (
+ GTK_CELL_RENDERER_TOGGLE (renderer),
+ TRUE );
+
+ column = gtk_tree_view_column_new_with_attributes (
+ "",
+ renderer,
+ "active",
+ 0,
+ NULL);
+
+ gtk_tree_view_append_column (
+ GTK_TREE_VIEW (treeview),
+ column);
+
+ renderer = gtk_cell_renderer_text_new ();
+
+ column = gtk_tree_view_column_new_with_attributes (
+ "",
+ renderer,
+ "text",
+ 1,
+ NULL);
+
+ gtk_tree_view_append_column (
+ GTK_TREE_VIEW (treeview),
+ column);
gtk_box_pack_end (
GTK_BOX (vbox),
@@ -175,6 +244,7 @@ xfpm_main_window_init (XfpmMainWindow *dialog)
TRUE,
TRUE,
0 );
+
/******************/
gtk_box_pack_start (
More information about the Xfce4-commits
mailing list