fix a load of open line ends (cell_edited): modified patch from German Poo

Sat Jan 19 20:49:41 2002  Kristian Rietveld  <kris@gtk.org>

        * demos/gtk-demo/editable_cells.c: fix a load of open line ends
        (cell_edited): modified patch from German Poo Caaman~o
        to fix up old_text declaration and free the memory
        (do_editable_cells): unref the model after creating the treeview

        * demos/gtk-demo/list_store.c: fix a load of open line ends,
        (add_columns): set the sort column id, so we can sort

        * demos/gtk-demo/tree_store.c: fix a load of open line ends,
        (do_tree_store): unref the model after creating the treeview
This commit is contained in:
Kristian Rietveld 2002-01-19 20:15:56 +00:00 committed by Kristian Rietveld
parent 31283d57ca
commit 4aebf9326a
10 changed files with 150 additions and 51 deletions

View File

@ -1,3 +1,16 @@
Sat Jan 19 20:49:41 2002 Kristian Rietveld <kris@gtk.org>
* demos/gtk-demo/editable_cells.c: fix a load of open line ends
(cell_edited): modified patch from German Poo Caaman~o
to fix up old_text declaration and free the memory
(do_editable_cells): unref the model after creating the treeview
* demos/gtk-demo/list_store.c: fix a load of open line ends,
(add_columns): set the sort column id, so we can sort
* demos/gtk-demo/tree_store.c: fix a load of open line ends,
(do_tree_store): unref the model after creating the treeview
2002-01-19 Havoc Pennington <hp@pobox.com>
* gtk/gtkwindow.c: link to new X11 section in a lot of places when

View File

@ -1,3 +1,16 @@
Sat Jan 19 20:49:41 2002 Kristian Rietveld <kris@gtk.org>
* demos/gtk-demo/editable_cells.c: fix a load of open line ends
(cell_edited): modified patch from German Poo Caaman~o
to fix up old_text declaration and free the memory
(do_editable_cells): unref the model after creating the treeview
* demos/gtk-demo/list_store.c: fix a load of open line ends,
(add_columns): set the sort column id, so we can sort
* demos/gtk-demo/tree_store.c: fix a load of open line ends,
(do_tree_store): unref the model after creating the treeview
2002-01-19 Havoc Pennington <hp@pobox.com>
* gtk/gtkwindow.c: link to new X11 section in a lot of places when

View File

@ -1,3 +1,16 @@
Sat Jan 19 20:49:41 2002 Kristian Rietveld <kris@gtk.org>
* demos/gtk-demo/editable_cells.c: fix a load of open line ends
(cell_edited): modified patch from German Poo Caaman~o
to fix up old_text declaration and free the memory
(do_editable_cells): unref the model after creating the treeview
* demos/gtk-demo/list_store.c: fix a load of open line ends,
(add_columns): set the sort column id, so we can sort
* demos/gtk-demo/tree_store.c: fix a load of open line ends,
(do_tree_store): unref the model after creating the treeview
2002-01-19 Havoc Pennington <hp@pobox.com>
* gtk/gtkwindow.c: link to new X11 section in a lot of places when

View File

@ -1,3 +1,16 @@
Sat Jan 19 20:49:41 2002 Kristian Rietveld <kris@gtk.org>
* demos/gtk-demo/editable_cells.c: fix a load of open line ends
(cell_edited): modified patch from German Poo Caaman~o
to fix up old_text declaration and free the memory
(do_editable_cells): unref the model after creating the treeview
* demos/gtk-demo/list_store.c: fix a load of open line ends,
(add_columns): set the sort column id, so we can sort
* demos/gtk-demo/tree_store.c: fix a load of open line ends,
(do_tree_store): unref the model after creating the treeview
2002-01-19 Havoc Pennington <hp@pobox.com>
* gtk/gtkwindow.c: link to new X11 section in a lot of places when

View File

@ -1,3 +1,16 @@
Sat Jan 19 20:49:41 2002 Kristian Rietveld <kris@gtk.org>
* demos/gtk-demo/editable_cells.c: fix a load of open line ends
(cell_edited): modified patch from German Poo Caaman~o
to fix up old_text declaration and free the memory
(do_editable_cells): unref the model after creating the treeview
* demos/gtk-demo/list_store.c: fix a load of open line ends,
(add_columns): set the sort column id, so we can sort
* demos/gtk-demo/tree_store.c: fix a load of open line ends,
(do_tree_store): unref the model after creating the treeview
2002-01-19 Havoc Pennington <hp@pobox.com>
* gtk/gtkwindow.c: link to new X11 section in a lot of places when

View File

@ -1,3 +1,16 @@
Sat Jan 19 20:49:41 2002 Kristian Rietveld <kris@gtk.org>
* demos/gtk-demo/editable_cells.c: fix a load of open line ends
(cell_edited): modified patch from German Poo Caaman~o
to fix up old_text declaration and free the memory
(do_editable_cells): unref the model after creating the treeview
* demos/gtk-demo/list_store.c: fix a load of open line ends,
(add_columns): set the sort column id, so we can sort
* demos/gtk-demo/tree_store.c: fix a load of open line ends,
(do_tree_store): unref the model after creating the treeview
2002-01-19 Havoc Pennington <hp@pobox.com>
* gtk/gtkwindow.c: link to new X11 section in a lot of places when

View File

@ -1,3 +1,16 @@
Sat Jan 19 20:49:41 2002 Kristian Rietveld <kris@gtk.org>
* demos/gtk-demo/editable_cells.c: fix a load of open line ends
(cell_edited): modified patch from German Poo Caaman~o
to fix up old_text declaration and free the memory
(do_editable_cells): unref the model after creating the treeview
* demos/gtk-demo/list_store.c: fix a load of open line ends,
(add_columns): set the sort column id, so we can sort
* demos/gtk-demo/tree_store.c: fix a load of open line ends,
(do_tree_store): unref the model after creating the treeview
2002-01-19 Havoc Pennington <hp@pobox.com>
* gtk/gtkwindow.c: link to new X11 section in a lot of places when

View File

@ -152,13 +152,11 @@ cell_edited (GtkCellRendererText *cell,
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
GtkTreeIter iter;
gchar old_text[256]; /* ugly? */
gint *column;
column = g_object_get_data (G_OBJECT (cell), "column");
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, column, old_text, -1);
switch ((gint) column)
{
@ -170,20 +168,24 @@ cell_edited (GtkCellRendererText *cell,
g_array_index (articles, Item, i).number = atoi (new_text);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, column,
atoi (new_text), -1);
g_array_index (articles, Item, i).number, -1);
}
break;
case COLUMN_PRODUCT:
{
gint i;
gchar *old_text;
gtk_tree_model_get (model, &iter, column, &old_text, -1);
g_free (old_text);
i = gtk_tree_path_get_indices (path)[0];
g_free (g_array_index (articles, Item, i).product);
g_array_index (articles, Item, i).product = g_strdup (new_text);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, column,
new_text, -1);
g_array_index (articles, Item, i).product, -1);
}
break;
}
@ -261,6 +263,7 @@ do_editable_cells (void)
/* create tree view */
treeview = gtk_tree_view_new_with_model (model);
g_object_unref (G_OBJECT (model));
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
GTK_SELECTION_SINGLE);

View File

@ -130,6 +130,7 @@ add_columns (GtkTreeView *treeview)
"text",
COLUMN_NUMBER,
NULL);
gtk_tree_view_column_set_sort_column_id (column, COLUMN_NUMBER);
gtk_tree_view_append_column (treeview, column);
/* column for severities */
@ -139,6 +140,7 @@ add_columns (GtkTreeView *treeview)
"text",
COLUMN_SEVERITY,
NULL);
gtk_tree_view_column_set_sort_column_id (column, COLUMN_SEVERITY);
gtk_tree_view_append_column (treeview, column);
/* column for description */
@ -148,6 +150,7 @@ add_columns (GtkTreeView *treeview)
"text",
COLUMN_DESCRIPTION,
NULL);
gtk_tree_view_column_set_sort_column_id (column, COLUMN_DESCRIPTION);
gtk_tree_view_append_column (treeview, column);
}

View File

@ -421,6 +421,7 @@ do_tree_store (void)
/* create tree view */
treeview = gtk_tree_view_new_with_model (model);
g_object_unref (G_OBJECT (model));
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
GTK_SELECTION_MULTIPLE);
@ -429,6 +430,7 @@ do_tree_store (void)
gtk_container_add (GTK_CONTAINER (sw), treeview);
/* expand all rows after the treeview widget has been realized */
g_signal_connect (G_OBJECT (treeview), "realize",
G_CALLBACK (gtk_tree_view_expand_all), NULL);
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);