2005-07-13 05:44:22 +00:00
/* testtreesort.c
* Copyright ( C ) 2001 Red Hat , Inc
* Author : Jonathan Blandford
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation ; either
* version 2 of the License , or ( at your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Library General Public License for more details .
*
* You should have received a copy of the GNU Library General Public
2012-02-27 13:01:10 +00:00
* License along with this library . If not , see < http : //www.gnu.org/licenses/>.
2005-07-13 05:44:22 +00:00
*/
2008-06-22 14:28:52 +00:00
# include "config.h"
2001-03-28 01:54:14 +00:00
# include <gtk/gtk.h>
typedef struct _ListSort ListSort ;
struct _ListSort
{
const gchar * word_1 ;
const gchar * word_2 ;
const gchar * word_3 ;
const gchar * word_4 ;
2002-01-04 00:47:29 +00:00
gint number_1 ;
2001-03-28 01:54:14 +00:00
} ;
static ListSort data [ ] =
{
2002-01-04 00:47:29 +00:00
{ " Apples " , " Transmogrify long word to demonstrate weirdness " , " Exculpatory " , " Gesundheit " , 30 } ,
{ " Oranges " , " Wicker " , " Adamantine " , " Convivial " , 10 } ,
{ " Bovine Spongiform Encephilopathy " , " Sleazebucket " , " Mountaineer " , " Pander " , 40 } ,
{ " Foot and Mouth " , " Lampshade " , " Skim Milk \n Full Milk " , " Viewless " , 20 } ,
{ " Blood, \n sweat, \n tears " , " The Man " , " Horses " , " Muckety-Muck " , 435 } ,
{ " Rare Steak " , " Siam " , " Watchdog " , " Xantippe " , 99999 } ,
{ " SIGINT " , " Rabbit Breath " , " Alligator " , " Bloodstained " , 4123 } ,
{ " Google " , " Chrysanthemums " , " Hobnob " , " Leapfrog " , 1 } ,
{ " Technology fibre optic " , " Turtle " , " Academe " , " Lonely " , 3 } ,
{ " Freon " , " Harpes " , " Quidditch " , " Reagan " , 6 } ,
{ " Transposition " , " Fruit Basket " , " Monkey Wort " , " Glogg " , 54 } ,
{ " Fern " , " Glasnost and Perestroika " , " Latitude " , " Bomberman!!! " , 2 } ,
2001-03-28 01:54:14 +00:00
{ NULL , }
} ;
2001-09-02 21:47:12 +00:00
static ListSort childdata [ ] =
{
2002-01-04 00:47:29 +00:00
{ " Heineken " , " Nederland " , " Wanda de vis " , " Electronische post " , 2 } ,
{ " Hottentottententententoonstelling " , " Rotterdam " , " Ionentransport " , " Palm " , 45 } ,
{ " Fruitvlieg " , " Eigenfrequentie " , " Supernoodles " , " Ramen " , 2002 } ,
{ " Gereedschapskist " , " Stelsel van lineaire vergelijkingen " , " Tulpen " , " Badlaken " , 1311 } ,
{ " Stereoinstallatie " , " Rood tapijt " , " Het periodieke systeem der elementen " , " Laaste woord " , 200 } ,
2001-09-02 21:47:12 +00:00
{ NULL , }
} ;
2001-03-28 01:54:14 +00:00
enum
{
2001-03-29 21:30:05 +00:00
WORD_COLUMN_1 = 0 ,
2001-03-28 01:54:14 +00:00
WORD_COLUMN_2 ,
WORD_COLUMN_3 ,
WORD_COLUMN_4 ,
2002-01-04 00:47:29 +00:00
NUMBER_COLUMN_1 ,
2001-03-28 01:54:14 +00:00
NUM_COLUMNS
} ;
2006-01-24 10:49:29 +00:00
static void
switch_search_method ( GtkWidget * button ,
gpointer tree_view )
{
if ( ! gtk_tree_view_get_search_entry ( GTK_TREE_VIEW ( tree_view ) ) )
{
2020-03-06 17:05:43 +00:00
gpointer search_entry = g_object_get_data ( tree_view , " my-search-entry " ) ;
gtk_tree_view_set_search_entry ( GTK_TREE_VIEW ( tree_view ) , GTK_EDITABLE ( search_entry ) ) ;
2006-01-24 10:49:29 +00:00
}
else
gtk_tree_view_set_search_entry ( GTK_TREE_VIEW ( tree_view ) , NULL ) ;
}
2020-02-10 03:24:47 +00:00
static void
quit_cb ( GtkWidget * widget ,
2020-03-06 17:05:43 +00:00
gpointer user_data )
2020-02-10 03:24:47 +00:00
{
2020-03-06 17:05:43 +00:00
gboolean * done = user_data ;
2020-02-10 03:24:47 +00:00
* done = TRUE ;
g_main_context_wakeup ( NULL ) ;
}
2001-03-28 01:54:14 +00:00
int
main ( int argc , char * argv [ ] )
{
GtkWidget * window ;
GtkWidget * vbox ;
GtkWidget * scrolled_window ;
GtkWidget * tree_view ;
2001-09-02 21:47:12 +00:00
GtkTreeStore * model ;
2001-10-24 18:36:50 +00:00
GtkTreeModel * smodel = NULL ;
2001-09-02 21:47:12 +00:00
GtkTreeModel * ssmodel = NULL ;
2001-03-28 01:54:14 +00:00
GtkCellRenderer * renderer ;
GtkTreeViewColumn * column ;
GtkTreeIter iter ;
2001-10-24 18:36:50 +00:00
gint i ;
2001-03-28 01:54:14 +00:00
2006-01-24 10:49:29 +00:00
GtkWidget * entry , * button ;
2001-09-02 21:47:12 +00:00
GtkWidget * window2 , * vbox2 , * scrolled_window2 , * tree_view2 ;
GtkWidget * window3 , * vbox3 , * scrolled_window3 , * tree_view3 ;
2020-02-10 03:24:47 +00:00
gboolean done = FALSE ;
2001-09-02 21:47:12 +00:00
2016-12-28 13:53:22 +00:00
gtk_init ( ) ;
2001-03-28 01:54:14 +00:00
2001-09-02 21:47:12 +00:00
/**
* First window - Just a GtkTreeStore
*/
2020-02-14 19:55:36 +00:00
window = gtk_window_new ( ) ;
2001-09-02 21:47:12 +00:00
gtk_window_set_title ( GTK_WINDOW ( window ) , " Words, words, words - Window 1 " ) ;
2020-02-10 03:24:47 +00:00
g_signal_connect ( window , " destroy " , G_CALLBACK ( quit_cb ) , & done ) ;
2010-10-31 17:07:20 +00:00
vbox = gtk_box_new ( GTK_ORIENTATION_VERTICAL , 8 ) ;
2018-12-26 07:20:34 +00:00
gtk_container_add ( GTK_CONTAINER ( vbox ) , gtk_label_new ( " Jonathan and Kristian's list of cool words. (And Anders' cool list of numbers) \n \n This is just a GtkTreeStore " ) ) ;
2001-03-28 01:54:14 +00:00
gtk_container_add ( GTK_CONTAINER ( window ) , vbox ) ;
2006-01-24 10:49:29 +00:00
entry = gtk_entry_new ( ) ;
2018-12-26 07:20:34 +00:00
gtk_container_add ( GTK_CONTAINER ( vbox ) , entry ) ;
2006-01-24 10:49:29 +00:00
button = gtk_button_new_with_label ( " Switch search method " ) ;
2018-12-26 07:20:34 +00:00
gtk_container_add ( GTK_CONTAINER ( vbox ) , button ) ;
2006-01-24 10:49:29 +00:00
2001-03-28 01:54:14 +00:00
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 ) ;
2017-04-21 16:59:59 +00:00
gtk_widget_set_vexpand ( scrolled_window , TRUE ) ;
2018-12-26 07:20:34 +00:00
gtk_container_add ( GTK_CONTAINER ( vbox ) , scrolled_window ) ;
2001-03-28 01:54:14 +00:00
2002-01-04 00:47:29 +00:00
model = gtk_tree_store_new ( NUM_COLUMNS , G_TYPE_STRING , G_TYPE_STRING , G_TYPE_STRING , G_TYPE_STRING , G_TYPE_INT ) ;
2001-10-24 18:36:50 +00:00
/*
2001-09-02 21:47:12 +00:00
smodel = gtk_tree_model_sort_new_with_model ( GTK_TREE_MODEL ( model ) ) ;
ssmodel = gtk_tree_model_sort_new_with_model ( GTK_TREE_MODEL ( smodel ) ) ;
2001-10-24 18:36:50 +00:00
*/
2001-09-02 21:47:12 +00:00
tree_view = gtk_tree_view_new_with_model ( GTK_TREE_MODEL ( model ) ) ;
2006-01-24 10:49:29 +00:00
2019-02-17 23:18:20 +00:00
gtk_tree_view_set_search_entry ( GTK_TREE_VIEW ( tree_view ) , GTK_EDITABLE ( entry ) ) ;
2006-01-24 10:49:29 +00:00
g_object_set_data ( G_OBJECT ( tree_view ) , " my-search-entry " , entry ) ;
g_signal_connect ( button , " clicked " ,
G_CALLBACK ( switch_search_method ) , tree_view ) ;
/* gtk_tree_selection_set_select_function (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)), select_func, NULL, NULL);*/
2001-10-24 18:36:50 +00:00
/* 12 iters now, 12 later... */
for ( i = 0 ; data [ i ] . word_1 ! = NULL ; i + + )
{
gint k ;
2001-10-26 14:44:27 +00:00
GtkTreeIter child_iter ;
2001-10-24 18:36:50 +00:00
gtk_tree_store_prepend ( GTK_TREE_STORE ( model ) , & iter , NULL ) ;
gtk_tree_store_set ( GTK_TREE_STORE ( model ) , & iter ,
WORD_COLUMN_1 , data [ i ] . word_1 ,
WORD_COLUMN_2 , data [ i ] . word_2 ,
WORD_COLUMN_3 , data [ i ] . word_3 ,
WORD_COLUMN_4 , data [ i ] . word_4 ,
2002-01-04 00:47:29 +00:00
NUMBER_COLUMN_1 , data [ i ] . number_1 ,
2001-10-24 18:36:50 +00:00
- 1 ) ;
2001-10-26 14:44:27 +00:00
gtk_tree_store_append ( GTK_TREE_STORE ( model ) , & child_iter , & iter ) ;
gtk_tree_store_set ( GTK_TREE_STORE ( model ) , & child_iter ,
WORD_COLUMN_1 , data [ i ] . word_1 ,
WORD_COLUMN_2 , data [ i ] . word_2 ,
WORD_COLUMN_3 , data [ i ] . word_3 ,
WORD_COLUMN_4 , data [ i ] . word_4 ,
2002-01-04 00:47:29 +00:00
NUMBER_COLUMN_1 , data [ i ] . number_1 ,
2001-10-26 14:44:27 +00:00
- 1 ) ;
2002-01-04 00:47:29 +00:00
2001-10-24 18:36:50 +00:00
for ( k = 0 ; childdata [ k ] . word_1 ! = NULL ; k + + )
{
gtk_tree_store_append ( GTK_TREE_STORE ( model ) , & child_iter , & iter ) ;
gtk_tree_store_set ( GTK_TREE_STORE ( model ) , & child_iter ,
WORD_COLUMN_1 , childdata [ k ] . word_1 ,
WORD_COLUMN_2 , childdata [ k ] . word_2 ,
WORD_COLUMN_3 , childdata [ k ] . word_3 ,
WORD_COLUMN_4 , childdata [ k ] . word_4 ,
2002-01-04 00:47:29 +00:00
NUMBER_COLUMN_1 , childdata [ k ] . number_1 ,
2001-10-24 18:36:50 +00:00
- 1 ) ;
2002-01-04 00:47:29 +00:00
2001-10-24 18:36:50 +00:00
}
2002-01-04 00:47:29 +00:00
2001-10-24 18:36:50 +00:00
}
2001-09-02 21:47:12 +00:00
smodel = gtk_tree_model_sort_new_with_model ( GTK_TREE_MODEL ( model ) ) ;
ssmodel = gtk_tree_model_sort_new_with_model ( GTK_TREE_MODEL ( smodel ) ) ;
2002-10-13 23:22:33 +00:00
g_object_unref ( model ) ;
2001-10-24 18:36:50 +00:00
2001-03-28 01:54:14 +00:00
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " First Word " , renderer ,
2001-03-29 21:30:05 +00:00
" text " , WORD_COLUMN_1 ,
2001-03-28 01:54:14 +00:00
NULL ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ) , column ) ;
2001-03-29 21:30:05 +00:00
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_1 ) ;
2001-03-28 01:54:14 +00:00
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Second Word " , renderer ,
" text " , WORD_COLUMN_2 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_2 ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ) , column ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Third Word " , renderer ,
" text " , WORD_COLUMN_3 ,
NULL ) ;
2001-04-12 16:11:54 +00:00
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_3 ) ;
2001-03-28 01:54:14 +00:00
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ) , column ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Fourth Word " , renderer ,
" text " , WORD_COLUMN_4 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_4 ) ;
2002-01-04 00:47:29 +00:00
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ) , column ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " First Number " , renderer ,
" text " , NUMBER_COLUMN_1 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , NUMBER_COLUMN_1 ) ;
2001-03-28 01:54:14 +00:00
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view ) , column ) ;
2001-10-24 18:36:50 +00:00
2001-10-29 18:56:00 +00:00
/* gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (smodel),
2001-09-02 21:47:12 +00:00
WORD_COLUMN_1 ,
2001-10-29 18:56:00 +00:00
GTK_SORT_ASCENDING ) ; */
2001-10-24 18:36:50 +00:00
2001-03-28 01:54:14 +00:00
gtk_container_add ( GTK_CONTAINER ( scrolled_window ) , tree_view ) ;
2001-03-29 21:30:05 +00:00
gtk_window_set_default_size ( GTK_WINDOW ( window ) , 400 , 400 ) ;
2017-01-19 09:02:04 +00:00
gtk_widget_show ( window ) ;
2001-09-02 21:47:12 +00:00
/**
* Second window - GtkTreeModelSort wrapping the GtkTreeStore
*/
2001-10-24 18:36:50 +00:00
if ( smodel )
{
2020-02-14 19:55:36 +00:00
window2 = gtk_window_new ( ) ;
2001-10-24 18:36:50 +00:00
gtk_window_set_title ( GTK_WINDOW ( window2 ) ,
" Words, words, words - window 2 " ) ;
2020-02-10 03:24:47 +00:00
g_signal_connect ( window2 , " destroy " , G_CALLBACK ( quit_cb ) , & done ) ;
2010-10-31 17:07:20 +00:00
vbox2 = gtk_box_new ( GTK_ORIENTATION_VERTICAL , 8 ) ;
2018-12-26 07:20:34 +00:00
gtk_container_add ( GTK_CONTAINER ( vbox2 ) ,
2017-04-21 20:34:36 +00:00
gtk_label_new ( " Jonathan and Kristian's list of words. \n \n A GtkTreeModelSort wrapping the GtkTreeStore of window 1 " ) ) ;
2001-10-24 18:36:50 +00:00
gtk_container_add ( GTK_CONTAINER ( window2 ) , vbox2 ) ;
scrolled_window2 = gtk_scrolled_window_new ( NULL , NULL ) ;
gtk_scrolled_window_set_shadow_type ( GTK_SCROLLED_WINDOW ( scrolled_window2 ) ,
GTK_SHADOW_ETCHED_IN ) ;
gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window2 ) ,
GTK_POLICY_AUTOMATIC ,
GTK_POLICY_AUTOMATIC ) ;
2017-04-21 16:59:59 +00:00
gtk_widget_set_vexpand ( scrolled_window2 , TRUE ) ;
2018-12-26 07:20:34 +00:00
gtk_container_add ( GTK_CONTAINER ( vbox2 ) , scrolled_window2 ) ;
2016-10-02 15:37:22 +00:00
2001-10-24 18:36:50 +00:00
tree_view2 = gtk_tree_view_new_with_model ( smodel ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " First Word " , renderer ,
" text " , WORD_COLUMN_1 ,
NULL ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view2 ) , column ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_1 ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Second Word " , renderer ,
" text " , WORD_COLUMN_2 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_2 ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view2 ) , column ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Third Word " , renderer ,
" text " , WORD_COLUMN_3 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_3 ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view2 ) , column ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Fourth Word " , renderer ,
" text " , WORD_COLUMN_4 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_4 ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view2 ) , column ) ;
2001-10-29 18:56:00 +00:00
/* gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (smodel),
2001-10-24 18:36:50 +00:00
( GtkTreeIterCompareFunc ) gtk_tree_data_list_compare_func ,
NULL , NULL ) ;
gtk_tree_sortable_set_sort_column_id ( GTK_TREE_SORTABLE ( smodel ) ,
WORD_COLUMN_1 ,
2001-10-29 18:56:00 +00:00
GTK_SORT_DESCENDING ) ; */
2001-10-24 18:36:50 +00:00
gtk_container_add ( GTK_CONTAINER ( scrolled_window2 ) , tree_view2 ) ;
gtk_window_set_default_size ( GTK_WINDOW ( window2 ) , 400 , 400 ) ;
2017-01-19 09:02:04 +00:00
gtk_widget_show ( window2 ) ;
2001-10-24 18:36:50 +00:00
}
2001-09-02 21:47:12 +00:00
/**
* Third window - GtkTreeModelSort wrapping the GtkTreeModelSort which
* is wrapping the GtkTreeStore .
*/
2001-10-24 18:36:50 +00:00
if ( ssmodel )
{
2020-02-14 19:55:36 +00:00
window3 = gtk_window_new ( ) ;
2001-10-24 18:36:50 +00:00
gtk_window_set_title ( GTK_WINDOW ( window3 ) ,
" Words, words, words - Window 3 " ) ;
2020-02-10 03:24:47 +00:00
g_signal_connect ( window3 , " destroy " , G_CALLBACK ( quit_cb ) , & done ) ;
2010-10-31 17:07:20 +00:00
vbox3 = gtk_box_new ( GTK_ORIENTATION_VERTICAL , 8 ) ;
2018-12-26 07:20:34 +00:00
gtk_container_add ( GTK_CONTAINER ( vbox3 ) ,
2017-04-21 20:34:36 +00:00
gtk_label_new ( " Jonathan and Kristian's list of words. \n \n A GtkTreeModelSort wrapping the GtkTreeModelSort of window 2 " ) ) ;
2001-10-24 18:36:50 +00:00
gtk_container_add ( GTK_CONTAINER ( window3 ) , vbox3 ) ;
scrolled_window3 = gtk_scrolled_window_new ( NULL , NULL ) ;
gtk_scrolled_window_set_shadow_type ( GTK_SCROLLED_WINDOW ( scrolled_window3 ) ,
GTK_SHADOW_ETCHED_IN ) ;
gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window3 ) ,
GTK_POLICY_AUTOMATIC ,
GTK_POLICY_AUTOMATIC ) ;
2017-04-21 16:59:59 +00:00
gtk_widget_set_vexpand ( scrolled_window3 , TRUE ) ;
2018-12-26 07:20:34 +00:00
gtk_container_add ( GTK_CONTAINER ( vbox3 ) , scrolled_window3 ) ;
2016-10-02 15:37:22 +00:00
2001-10-24 18:36:50 +00:00
tree_view3 = gtk_tree_view_new_with_model ( ssmodel ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " First Word " , renderer ,
" text " , WORD_COLUMN_1 ,
NULL ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view3 ) , column ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_1 ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Second Word " , renderer ,
" text " , WORD_COLUMN_2 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_2 ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view3 ) , column ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Third Word " , renderer ,
" text " , WORD_COLUMN_3 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_3 ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view3 ) , column ) ;
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Fourth Word " , renderer ,
" text " , WORD_COLUMN_4 ,
NULL ) ;
gtk_tree_view_column_set_sort_column_id ( column , WORD_COLUMN_4 ) ;
gtk_tree_view_append_column ( GTK_TREE_VIEW ( tree_view3 ) , column ) ;
2001-10-29 18:56:00 +00:00
/* gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (ssmodel),
2001-10-24 18:36:50 +00:00
( GtkTreeIterCompareFunc ) gtk_tree_data_list_compare_func ,
NULL , NULL ) ;
gtk_tree_sortable_set_sort_column_id ( GTK_TREE_SORTABLE ( ssmodel ) ,
WORD_COLUMN_1 ,
2001-10-29 18:56:00 +00:00
GTK_SORT_ASCENDING ) ; */
2001-10-24 18:36:50 +00:00
gtk_container_add ( GTK_CONTAINER ( scrolled_window3 ) , tree_view3 ) ;
gtk_window_set_default_size ( GTK_WINDOW ( window3 ) , 400 , 400 ) ;
2017-01-19 09:02:04 +00:00
gtk_widget_show ( window3 ) ;
2001-10-24 18:36:50 +00:00
}
2002-01-04 00:47:29 +00:00
2001-10-24 18:36:50 +00:00
for ( i = 0 ; data [ i ] . word_1 ! = NULL ; i + + )
{
gint k ;
gtk_tree_store_prepend ( GTK_TREE_STORE ( model ) , & iter , NULL ) ;
gtk_tree_store_set ( GTK_TREE_STORE ( model ) , & iter ,
WORD_COLUMN_1 , data [ i ] . word_1 ,
WORD_COLUMN_2 , data [ i ] . word_2 ,
WORD_COLUMN_3 , data [ i ] . word_3 ,
WORD_COLUMN_4 , data [ i ] . word_4 ,
- 1 ) ;
for ( k = 0 ; childdata [ k ] . word_1 ! = NULL ; k + + )
{
GtkTreeIter child_iter ;
gtk_tree_store_append ( GTK_TREE_STORE ( model ) , & child_iter , & iter ) ;
gtk_tree_store_set ( GTK_TREE_STORE ( model ) , & child_iter ,
WORD_COLUMN_1 , childdata [ k ] . word_1 ,
WORD_COLUMN_2 , childdata [ k ] . word_2 ,
WORD_COLUMN_3 , childdata [ k ] . word_3 ,
WORD_COLUMN_4 , childdata [ k ] . word_4 ,
- 1 ) ;
}
}
2002-01-04 00:47:29 +00:00
2020-02-10 03:24:47 +00:00
while ( ! done )
g_main_context_iteration ( NULL , TRUE ) ;
2001-10-24 18:36:50 +00:00
2001-03-28 01:54:14 +00:00
return 0 ;
}