diff options
author | Jonathan Blandford <jrb@redhat.com> | 2001-03-16 23:22:46 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2001-03-16 23:22:46 +0000 |
commit | 73dc88d241772539391233b1d444d7426cd54846 (patch) | |
tree | 1dbd74c4a3941b7d265ee197a05b52b4fe549e04 /demos/gtk-demo/main.c | |
parent | 4d4af2941ea53aea1b2246a1e2e4091f05867e21 (diff) | |
download | gdk-pixbuf-73dc88d241772539391233b1d444d7426cd54846.tar.gz |
modified to use "row_activated" signal.
Fri Mar 16 18:24:53 2001 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c (row_activated_cb): modified to use
"row_activated" signal.
* gtk/gtktreeview.c (gtk_tree_view_row_activated): oh, the
stupidity. Lets actually pass in the row with this signal...
Diffstat (limited to 'demos/gtk-demo/main.c')
-rw-r--r-- | demos/gtk-demo/main.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index 16b4ff6f3..110c62567 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -299,6 +299,47 @@ button_press_event_cb (GtkTreeView *tree_view, return FALSE; } +gboolean +row_activated_cb (GtkTreeView *tree_view, + GtkTreePath *path, + GtkTreeViewColumn *column, + GtkTreeModel *model) +{ + GtkTreeIter iter; + gboolean italic; + GDoDemoFunc func; + GtkWidget *window; + + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (GTK_TREE_MODEL (model), + &iter, + FUNC_COLUMN, &func, + ITALIC_COLUMN, &italic, + -1); + gtk_tree_store_set (GTK_TREE_STORE (model), + &iter, + ITALIC_COLUMN, !italic, + -1); + window = (func) (); + if (window != NULL) + { + CallbackData *cbdata; + + cbdata = g_new (CallbackData, 1); + cbdata->model = model; + cbdata->path = gtk_tree_path_copy (path); + + gtk_signal_connect (GTK_OBJECT (window), + "destroy", + window_closed_cb, + cbdata); + } + else + { + gtk_tree_path_free (path); + } +} + static void selection_cb (GtkTreeSelection *selection, GtkTreeModel *model) @@ -400,7 +441,7 @@ create_tree (void) GTK_TREE_VIEW_COLUMN (column)); gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model); - gtk_signal_connect (GTK_OBJECT (tree_view), "button_press_event", GTK_SIGNAL_FUNC (button_press_event_cb), model); + gtk_signal_connect (GTK_OBJECT (tree_view), "row_activated", GTK_SIGNAL_FUNC (row_activated_cb), model); return tree_view; } |