diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 11 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 11 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 11 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 11 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 11 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 11 | ||||
-rw-r--r-- | gtk/gtktreemodel.c | 1 | ||||
-rw-r--r-- | tests/.cvsignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/testtreecolumns.c | 6 | ||||
-rw-r--r-- | tests/testtreefocus.c | 283 |
12 files changed, 369 insertions, 9 deletions
@@ -1,3 +1,14 @@ +Thu Mar 8 16:36:00 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_model_get_type): add prerequesite + on gobjects. + + * tests/testtreefocus.c (main): New test file. + + * tests/testtreeview.c: update to latest glib changes. + + * tests/testtreecolumns.c: update to latest glib changes. + Thu Mar 8 18:13:20 2001 Tim Janik <timj@gtk.org> * gtk/testgtk.c: re-enabled event watcher emission hooks. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b397d00f47..a8657af51a 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,14 @@ +Thu Mar 8 16:36:00 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_model_get_type): add prerequesite + on gobjects. + + * tests/testtreefocus.c (main): New test file. + + * tests/testtreeview.c: update to latest glib changes. + + * tests/testtreecolumns.c: update to latest glib changes. + Thu Mar 8 18:13:20 2001 Tim Janik <timj@gtk.org> * gtk/testgtk.c: re-enabled event watcher emission hooks. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b397d00f47..a8657af51a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Thu Mar 8 16:36:00 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_model_get_type): add prerequesite + on gobjects. + + * tests/testtreefocus.c (main): New test file. + + * tests/testtreeview.c: update to latest glib changes. + + * tests/testtreecolumns.c: update to latest glib changes. + Thu Mar 8 18:13:20 2001 Tim Janik <timj@gtk.org> * gtk/testgtk.c: re-enabled event watcher emission hooks. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b397d00f47..a8657af51a 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,14 @@ +Thu Mar 8 16:36:00 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_model_get_type): add prerequesite + on gobjects. + + * tests/testtreefocus.c (main): New test file. + + * tests/testtreeview.c: update to latest glib changes. + + * tests/testtreecolumns.c: update to latest glib changes. + Thu Mar 8 18:13:20 2001 Tim Janik <timj@gtk.org> * gtk/testgtk.c: re-enabled event watcher emission hooks. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b397d00f47..a8657af51a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Thu Mar 8 16:36:00 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_model_get_type): add prerequesite + on gobjects. + + * tests/testtreefocus.c (main): New test file. + + * tests/testtreeview.c: update to latest glib changes. + + * tests/testtreecolumns.c: update to latest glib changes. + Thu Mar 8 18:13:20 2001 Tim Janik <timj@gtk.org> * gtk/testgtk.c: re-enabled event watcher emission hooks. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b397d00f47..a8657af51a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Thu Mar 8 16:36:00 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_model_get_type): add prerequesite + on gobjects. + + * tests/testtreefocus.c (main): New test file. + + * tests/testtreeview.c: update to latest glib changes. + + * tests/testtreecolumns.c: update to latest glib changes. + Thu Mar 8 18:13:20 2001 Tim Janik <timj@gtk.org> * gtk/testgtk.c: re-enabled event watcher emission hooks. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b397d00f47..a8657af51a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Thu Mar 8 16:36:00 2001 Jonathan Blandford <jrb@redhat.com> + + * gtk/gtktreemodel.c (gtk_tree_model_get_type): add prerequesite + on gobjects. + + * tests/testtreefocus.c (main): New test file. + + * tests/testtreeview.c: update to latest glib changes. + + * tests/testtreecolumns.c: update to latest glib changes. + Thu Mar 8 18:13:20 2001 Tim Janik <timj@gtk.org> * gtk/testgtk.c: re-enabled event watcher emission hooks. diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c index beab330d63..3bfc45b44a 100644 --- a/gtk/gtktreemodel.c +++ b/gtk/gtktreemodel.c @@ -58,6 +58,7 @@ gtk_tree_model_get_type (void) }; tree_model_type = g_type_register_static (G_TYPE_INTERFACE, "GtkTreeModel", &tree_model_info, 0); + g_type_interface_add_prerequisite (tree_model_type, G_TYPE_OBJECT); } return tree_model_type; diff --git a/tests/.cvsignore b/tests/.cvsignore index 357cb951cb..0186a11be5 100644 --- a/tests/.cvsignore +++ b/tests/.cvsignore @@ -8,3 +8,4 @@ testtreeview testtreecolumns testsocket testsocket_child +testtreefocus diff --git a/tests/Makefile.am b/tests/Makefile.am index 24f1b293d5..673df78590 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,20 +34,18 @@ noinst_PROGRAMS = \ testsocket \ testsocket_child \ testtreeview \ + testtreefocus \ testtreecolumns testsocket_DEPENDENCIES = $(DEPS) testsocket_child_DEPENDENCIES = $(DEPS) testtreeview_DEPENDENCIES = $(DEPS) +testtreefocus_DEPENDENCIES = $(DEPS) +testtreecolumns_DEPENDENCIES = $(DEPS) testsocket_LDADD = $(LDADDS) testsocket_child_LDADD = $(LDADDS) testtreeview_LDADD = $(LDADDS) - -testtreeview_SOURCES = testtreeview.c - -testtreecolumns_DEPENDENCIES = $(DEPS) - +testtreefocus_LDADD = $(LDADDS) testtreecolumns_LDADD = $(LDADDS) -testtreecolumns_SOURCES = testtreecolumns.c diff --git a/tests/testtreecolumns.c b/tests/testtreecolumns.c index 7626b71525..93c6dab2e9 100644 --- a/tests/testtreecolumns.c +++ b/tests/testtreecolumns.c @@ -198,7 +198,7 @@ main (int argc, char *argv[]) gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (left_tree_view), -1, "Unattached Columns", cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); - g_signal_connect (G_OBJECT (cell), "toggled", set_visible, left_tree_view); + g_signal_connect_data (G_OBJECT (cell), "toggled", set_visible, left_tree_view, NULL, FALSE, FALSE); column = gtk_tree_view_column_new_with_attributes ("Visible", cell, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (left_tree_view), column); g_object_unref (G_OBJECT (column)); @@ -259,7 +259,7 @@ main (int argc, char *argv[]) gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (top_right_tree_view), -1, NULL, cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); - g_signal_connect (G_OBJECT (cell), "toggled", set_visible, top_right_tree_view); + g_signal_connect_data (G_OBJECT (cell), "toggled", set_visible, top_right_tree_view, NULL, FALSE, FALSE); column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL); gtk_tree_view_column_set_cell_data_func (column, get_visible, NULL, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (top_right_tree_view), column); @@ -274,7 +274,7 @@ main (int argc, char *argv[]) gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (bottom_right_tree_view), -1, NULL, cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); - g_signal_connect (G_OBJECT (cell), "toggled", set_visible, bottom_right_tree_view); + g_signal_connect_data (G_OBJECT (cell), "toggled", set_visible, bottom_right_tree_view, NULL, FALSE, FALSE); column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL); gtk_tree_view_column_set_cell_data_func (column, get_visible, NULL, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (bottom_right_tree_view), column); diff --git a/tests/testtreefocus.c b/tests/testtreefocus.c new file mode 100644 index 0000000000..1d906ba50b --- /dev/null +++ b/tests/testtreefocus.c @@ -0,0 +1,283 @@ +#include <gtk/gtk.h> + + +typedef struct _TreeStruct TreeStruct; +struct _TreeStruct +{ + const gchar *label; + gboolean havoc; + gboolean owen; + TreeStruct *children; +}; + +static TreeStruct january[] = +{ + {"New Years Day", TRUE, TRUE, NULL}, + {"Presidential Inauguration", TRUE, TRUE, NULL}, + {"Martin Luther King Jr. day", TRUE, TRUE, NULL}, + { NULL } +}; + +static TreeStruct february[] = +{ + { "Presidents' Day", TRUE, TRUE, NULL }, + { "Groundhog Day", FALSE, FALSE, NULL }, + { "Valentine's Day", FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeStruct march[] = +{ + { "National Tree Planting Day", FALSE, FALSE, NULL }, + { "St Patrick's Day", FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeStruct april[] = +{ + { "April Fools' Day", FALSE, FALSE, NULL }, + { "Army Day", FALSE, FALSE, NULL }, + { "Earth Day", FALSE, FALSE, NULL }, + { "Administrative Professionals' Day", FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeStruct may[] = +{ + { "Nurses' Day", FALSE, FALSE, NULL }, + { "National Day of Prayer", FALSE, FALSE, NULL }, + { "Mothers' Day", FALSE, FALSE, NULL }, + { "Armed Forces Day", FALSE, FALSE, NULL }, + { "Memorial Day", TRUE, TRUE, NULL }, + { NULL } +}; + +static TreeStruct june[] = +{ + { "June Fathers' Day", FALSE, FALSE, NULL }, + { "Juneteenth (Liberation of Slaves)", FALSE, FALSE, NULL }, + { "Flag Day", TRUE, TRUE, NULL }, + { NULL } +}; + +static TreeStruct july[] = +{ + { "Parents' Day", FALSE, FALSE, NULL }, + { "Independence Day", TRUE, TRUE, NULL }, + { NULL } +}; + +static TreeStruct august[] = +{ + { "Air Force Day", FALSE, FALSE, NULL }, + { "Coast Guard Day", FALSE, FALSE, NULL }, + { "Friendship Day", FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeStruct september[] = +{ + { "Grandparents' Day", FALSE, FALSE, NULL }, + { "Citizenship Day or Constitution Day", FALSE, FALSE, NULL }, + { "Labor Day", TRUE, TRUE, NULL }, + { NULL } +}; + +static TreeStruct october[] = +{ + { "National Children's Day", FALSE, FALSE, NULL }, + { "Bosses' Day", FALSE, FALSE, NULL }, + { "Sweetest Day", FALSE, FALSE, NULL }, + { "Mother-in-Law's Day", FALSE, FALSE, NULL }, + { "Navy Day", FALSE, FALSE, NULL }, + { "Columbus Day", TRUE, TRUE, NULL }, + { "Halloween", FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeStruct november[] = +{ + { "Marine Corps Day", FALSE, FALSE, NULL }, + { "Veterans' Day", TRUE, TRUE, NULL }, + { "Thanksgiving", TRUE, TRUE, NULL }, + { NULL } +}; + +static TreeStruct december[] = +{ + { "Pearl Harbor Remembrance Day", FALSE, FALSE, NULL }, + { "Christmas", TRUE, TRUE, NULL }, + { "Kwanzaa", FALSE, FALSE, NULL }, + { NULL } +}; + + +static TreeStruct toplevel[] = +{ + {"January", FALSE, FALSE, january}, + {"February", FALSE, FALSE, february}, + {"March", FALSE, FALSE, march}, + {"April", FALSE, FALSE, april}, + {"May", FALSE, FALSE, may}, + {"June", FALSE, FALSE, june}, + {"July", FALSE, FALSE, july}, + {"August", FALSE, FALSE, august}, + {"September", FALSE, FALSE, september}, + {"October", FALSE, FALSE, october}, + {"November", FALSE, FALSE, november}, + {"December", FALSE, FALSE, december}, + {NULL} +}; + + +enum +{ + HOLIDAY_COLUMN = 0, + HAVOC_COLUMN, + OWEN_COLUMN, + VISIBLE_COLUMN, + NUM_COLUMNS +}; + +static GtkTreeModel * +make_model (void) +{ + GtkTreeStore *model; + TreeStruct *month = toplevel; + GtkTreeIter iter; + + model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); + + while (month->label) + { + TreeStruct *holiday = month->children; + + gtk_tree_store_append (model, &iter, NULL); + gtk_tree_store_set (model, &iter, + HOLIDAY_COLUMN, month->label, + HAVOC_COLUMN, FALSE, + OWEN_COLUMN, FALSE, + VISIBLE_COLUMN, FALSE, + -1); + while (holiday->label) + { + GtkTreeIter child_iter; + + gtk_tree_store_append (model, &child_iter, &iter); + gtk_tree_store_set (model, &child_iter, + HOLIDAY_COLUMN, holiday->label, + HAVOC_COLUMN, holiday->havoc, + OWEN_COLUMN, holiday->owen, + VISIBLE_COLUMN, TRUE, + -1); + + holiday ++; + } + month ++; + } + + return GTK_TREE_MODEL (model); +} + +static void +havoc_toggled (GtkCellRendererToggle *cell, + gchar *path_str, + gpointer data) +{ + GtkTreeModel *model = (GtkTreeModel *) data; + GtkTreeIter iter; + GtkTreePath *path = gtk_tree_path_new_from_string (path_str); + gboolean havoc; + + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (model, &iter, HAVOC_COLUMN, &havoc, -1); + + havoc = !havoc; + gtk_tree_store_set (GTK_TREE_STORE (model), &iter, HAVOC_COLUMN, havoc, -1); + + gtk_tree_path_free (path); +} + +static void +owen_toggled (GtkCellRendererToggle *cell, + gchar *path_str, + gpointer data) +{ + GtkTreeModel *model = (GtkTreeModel *) data; + GtkTreeIter iter; + GtkTreePath *path = gtk_tree_path_new_from_string (path_str); + gboolean owen; + + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (model, &iter, OWEN_COLUMN, &owen, -1); + + owen = !owen; + gtk_tree_store_set (GTK_TREE_STORE (model), &iter, OWEN_COLUMN, owen, -1); + + gtk_tree_path_free (path); +} + +int +main (int argc, char *argv[]) +{ + GtkWidget *window; + GtkWidget *vbox; + GtkWidget *scrolled_window; + GtkWidget *tree_view; + GtkTreeModel *model; + GtkCellRenderer *renderer; + + gtk_init (&argc, &argv); + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_signal_connect (GTK_OBJECT (window), "destroy", gtk_main_quit, NULL); + vbox = gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); + gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Jonathan's Holiday Card Planning Sheet"), FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER (window), vbox); + + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0); + + model = make_model (); + tree_view = gtk_tree_view_new (); + g_object_set (G_OBJECT (tree_view), "model", model, NULL); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE); + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), + -1, "Holiday", + renderer, + "text", HOLIDAY_COLUMN, NULL); + g_object_unref (renderer); + renderer = gtk_cell_renderer_toggle_new (); + g_signal_connect_data (G_OBJECT (renderer), "toggled", havoc_toggled, model, NULL, FALSE, FALSE); + + g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), + -1, "Havoc", + renderer, + "active", HAVOC_COLUMN, + "visible", VISIBLE_COLUMN, + NULL); + g_object_unref (renderer); + renderer = gtk_cell_renderer_toggle_new (); + g_signal_connect_data (G_OBJECT (renderer), "toggled", owen_toggled, model, NULL, FALSE, FALSE); + g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), + -1, "Owen", + renderer, + "active", OWEN_COLUMN, + "visible", VISIBLE_COLUMN, + NULL); + g_object_unref (renderer); + gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view); + + + gtk_widget_show_all (window); + gtk_main (); + + return 0; +} + |