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...
This commit is contained in:
Jonathan Blandford 2001-03-16 23:22:46 +00:00 committed by Jonathan Blandford
parent 4d4af2941e
commit 73dc88d241
10 changed files with 177 additions and 80 deletions

View File

@ -1,3 +1,11 @@
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...
Fri Mar 16 18:01:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.[ch]: s/GTK_TREE_COLUMN/GTK_TREE_VIEW_COLUMN

View File

@ -1,3 +1,11 @@
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...
Fri Mar 16 18:01:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.[ch]: s/GTK_TREE_COLUMN/GTK_TREE_VIEW_COLUMN

View File

@ -1,3 +1,11 @@
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...
Fri Mar 16 18:01:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.[ch]: s/GTK_TREE_COLUMN/GTK_TREE_VIEW_COLUMN

View File

@ -1,3 +1,11 @@
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...
Fri Mar 16 18:01:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.[ch]: s/GTK_TREE_COLUMN/GTK_TREE_VIEW_COLUMN

View File

@ -1,3 +1,11 @@
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...
Fri Mar 16 18:01:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.[ch]: s/GTK_TREE_COLUMN/GTK_TREE_VIEW_COLUMN

View File

@ -1,3 +1,11 @@
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...
Fri Mar 16 18:01:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.[ch]: s/GTK_TREE_COLUMN/GTK_TREE_VIEW_COLUMN

View File

@ -1,3 +1,11 @@
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...
Fri Mar 16 18:01:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.[ch]: s/GTK_TREE_COLUMN/GTK_TREE_VIEW_COLUMN

View File

@ -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;
}

View File

@ -245,6 +245,7 @@ static gboolean gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_v
GdkEventMotion *event);
static void _gtk_tree_view_update_col_width (GtkTreeView *tree_view);
static void gtk_tree_view_row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column);
static GtkContainerClass *parent_class = NULL;
@ -399,8 +400,9 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
GTK_RUN_LAST | GTK_RUN_ACTION,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTreeViewClass, row_activated),
gtk_marshal_VOID__OBJECT,
GTK_TYPE_NONE, 1,
gtk_marshal_VOID__BOXED_OBJECT,
GTK_TYPE_NONE, 2,
GTK_TYPE_TREE_PATH,
GTK_TYPE_TREE_VIEW_COLUMN);
}
@ -1904,12 +1906,11 @@ gtk_tree_view_button_press (GtkWidget *widget,
tree,
path,
event->state);
gtk_tree_path_free (path);
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
{
gtk_tree_view_row_activated (tree_view, column );
}
gtk_tree_view_row_activated (tree_view, path, column);
gtk_tree_path_free (path);
return TRUE;
}
@ -2688,14 +2689,15 @@ gtk_tree_view_forall (GtkContainer *container,
}
}
static void
void
gtk_tree_view_row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column)
{
g_return_if_fail (tree_view != NULL);
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_signal_emit (G_OBJECT(tree_view), tree_view_signals[ROW_ACTIVATED], 0, column);
g_signal_emit (G_OBJECT(tree_view), tree_view_signals[ROW_ACTIVATED], 0, path, column);
}
/* TreeModel Callbacks

View File

@ -78,7 +78,6 @@ struct _GtkTreeViewClass
GtkType gtk_tree_view_get_type (void);
GtkWidget *gtk_tree_view_new (void);
GtkWidget *gtk_tree_view_new_with_model (GtkTreeModel *model);
GtkTreeModel *gtk_tree_view_get_model (GtkTreeView *tree_view);
void gtk_tree_view_set_model (GtkTreeView *tree_view,
GtkTreeModel *model);
@ -107,20 +106,17 @@ gint gtk_tree_view_insert_column_with_attributes (GtkTreeView
gchar *title,
GtkCellRenderer *cell,
...);
GtkTreeViewColumn *gtk_tree_view_get_column (GtkTreeView *tree_view,
gint n);
void gtk_tree_view_set_expander_column (GtkTreeView *tree_view,
gint col);
gint gtk_tree_view_get_expander_column (GtkTreeView *tree_view);
/* Actions */
void gtk_tree_view_scroll_to_point (GtkTreeView *tree_view,
gint tree_x,
gint tree_y);
void gtk_tree_view_scroll_to_cell (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
@ -142,7 +138,6 @@ void gtk_tree_view_get_background_area (GtkTreeView *tr
GtkTreePath *path,
GtkTreeViewColumn *column,
GdkRectangle *rect);
void gtk_tree_view_expand_all (GtkTreeView *tree_view);
void gtk_tree_view_collapse_all (GtkTreeView *tree_view);
gboolean gtk_tree_view_expand_row (GtkTreeView *tree_view,
@ -150,6 +145,9 @@ gboolean gtk_tree_view_expand_row (GtkTreeView *tr
gboolean open_all);
gboolean gtk_tree_view_collapse_row (GtkTreeView *tree_view,
GtkTreePath *path);
void gtk_tree_view_row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column);
void gtk_tree_view_get_visible_rect (GtkTreeView *tree_view,
GdkRectangle *visible_rect);