gtk example "tree.c"
- From: Dave Luttinen <DLuttinen comcast net>
- To: gtk-app-devel-list gnome org
- Subject: gtk example "tree.c"
- Date: Wed, 21 Jan 2009 19:51:50 +0000 (UTC)
Greetings,
First post. Wish me luck. :)
I compiled the examples in the gtk library and have been exploring them in order to learn how gtk+ works.
Subject: gtk+/gtk+-2.14.6/examples/tree/tree.c
(1) suggestion for improvement
Based on the declaration of
static gchar *itemnames[] = {"Foo", "Bar", "Baz", "Quux", "Maurice"};
is there any reason that the following can't be used to substitute for the constant 5 in the for loops?
const gint name_count = sizeof( itemnames ) / sizeof( itemnames[ 0 ] );
then , instead of
for (i = 0; i < 5; i++){...}
you would have
for (i = 0; i < name_count; i++){...} ?
That way if someone wants to add or remove items from the name list, one would not need to change the integer
values in each for loop that depends on the char arrays. (lower maintenance)
(2) single / double click ?
The " select_child " callback is called only when an item is double-clicked, when I would expect a
single-click would make a selection. Why? (Application called using Applications -> Accessories -> Terminal (
$ ./tree) because I wanted to see the g_print( ) output.
Thanks for your help.
Dave
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]