diff options
author | Havoc Pennington <hp@pobox.com> | 2000-12-17 23:50:00 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-12-17 23:50:00 +0000 |
commit | fde4fecfd2064bdf4f52a02e90e76b6e67d3e3c8 (patch) | |
tree | 0e665ed29938114bd9e88e1c97b354dc04d16385 | |
parent | e405f75c2b904698f71280348687254b91d8ff47 (diff) | |
download | gdk-pixbuf-fde4fecfd2064bdf4f52a02e90e76b6e67d3e3c8.tar.gz |
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
-rw-r--r-- | ChangeLog | 83 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 83 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 83 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 83 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 83 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 83 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 83 | ||||
-rw-r--r-- | gdk-pixbuf/ChangeLog | 9 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-animation.c | 58 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-loader.c | 166 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-loader.h | 21 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf.h | 4 | ||||
-rw-r--r-- | gdk/gdkevents.c | 83 | ||||
-rw-r--r-- | gdk/gdkevents.h | 11 | ||||
-rw-r--r-- | gtk/gdk-pixbuf-loader.c | 166 | ||||
-rw-r--r-- | gtk/gdk-pixbuf-loader.h | 21 | ||||
-rw-r--r-- | gtk/gtktreeprivate.h | 7 | ||||
-rw-r--r-- | gtk/gtktreeselection.h | 2 | ||||
-rw-r--r-- | gtk/gtktreeview.c | 464 | ||||
-rw-r--r-- | gtk/gtktreeviewcolumn.c | 14 | ||||
-rw-r--r-- | gtk/gtktreeviewcolumn.h | 1 |
21 files changed, 1208 insertions, 400 deletions
@@ -1,5 +1,88 @@ 2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: + Port to GObject, can go back in gdk-pixbuf after setting up + a gdk-pixbuf-marshal.h header over there. + + * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; + (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal + args + (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be + set + (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons + here, do it when we create the buttons later + (gtk_tree_view_realize_buttons): add some g_return_if_fail + (gtk_tree_view_map): paranoia checks that column->button is shown + and unmapped + (gtk_tree_view_size_request): only request visible children. + Move header size calculation in here, for cleanliness, and + to maintain invariants for child widgets if we eventually + let users set different children inside the buttons + (gtk_tree_view_map_buttons): factor out code to map buttons, + since it was being called several times + (gtk_tree_view_size_allocate_buttons): move_resize the drag + windows instead of just moving them; their height may change + if we allow random widgets in there, or the theme changes. + (gtk_tree_view_size_allocate): move button size allocation + above emitting the scroll signals, to ensure a sane state when we + hit user code + (gtk_tree_view_button_release): remove queue_resize after + tree_view_set_size(), set_size() will handle any resize queuing + that's needed + (gtk_tree_view_focus_in): just queue a draw, don't fool with + draw_focus goo + (gtk_tree_view_focus): use gtk_get_current_event() and + gdk_event_get_state() + (gtk_tree_view_deleted): don't queue_resize() after calling set_size() + (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove + semicolon + (gtk_tree_view_create_button): show the button here + (gtk_tree_view_button_clicked): actually emit the clicked signal + on the column + (_gtk_tree_view_set_size): return right away if the size is + unchanged, as a cheesy optimization + (gtk_tree_view_setup_model): rename set_model_realized to + setup_model to match the flag that indicates whether we've + called it + (gtk_tree_view_get_hadjustment): create adjustment if it doesn't + exist, because set_scroll_adjustment does that and it shouldn't + matter what order you call these in + (gtk_tree_view_get_vadjustment): ditto + (gtk_tree_view_set_headers_visible): canonicalize the bool, + for paranoia + (gtk_tree_view_set_headers_visible): call + gtk_tree_view_map_buttons() instead of using cut-and-paste code + (gtk_tree_view_append_column): clarify whether the return value + is the count of columns before or after, and do the increment + separately from the return statement so you can tell from the code. + (gtk_tree_view_remove_column): ditto + (gtk_tree_view_insert_column): ditto + (gtk_tree_view_get_column): remove g_return_if_fail for columns + outside the existing range, the docs say that outside-range + columns are allowed, so we handle them as documented. (Presumably + this allows a nice loop with column != NULL as test.) + (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments + mean (left/right/center etc.). + (gtk_tree_view_collapse_all): only queue a draw if we're mapped + (gtk_tree_view_expand_row): add docs + (gtk_tree_view_collapse_row): add docs + + * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new + function to emit the clicked signal on a column + + * gdk/gdkevents.c (gdk_event_get_state): new function, to get the + state of an event + (gdk_event_get_time): don't treat GDK_SCROLL + as a button event, remove default case from switch so gcc + will whine if we don't explicitly handle all event types + + * gtk/gtktreeselection.h: added some FIXME + + * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename + "columns" to "n_columns" and "column" to "columns" for clarity + +2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gtktextiter.c: General cleanup of the log attr iteration stuff. This should make e.g. the delete key work again in the text widget... diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 0ea91604e..bf4830e10 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,5 +1,88 @@ 2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: + Port to GObject, can go back in gdk-pixbuf after setting up + a gdk-pixbuf-marshal.h header over there. + + * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; + (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal + args + (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be + set + (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons + here, do it when we create the buttons later + (gtk_tree_view_realize_buttons): add some g_return_if_fail + (gtk_tree_view_map): paranoia checks that column->button is shown + and unmapped + (gtk_tree_view_size_request): only request visible children. + Move header size calculation in here, for cleanliness, and + to maintain invariants for child widgets if we eventually + let users set different children inside the buttons + (gtk_tree_view_map_buttons): factor out code to map buttons, + since it was being called several times + (gtk_tree_view_size_allocate_buttons): move_resize the drag + windows instead of just moving them; their height may change + if we allow random widgets in there, or the theme changes. + (gtk_tree_view_size_allocate): move button size allocation + above emitting the scroll signals, to ensure a sane state when we + hit user code + (gtk_tree_view_button_release): remove queue_resize after + tree_view_set_size(), set_size() will handle any resize queuing + that's needed + (gtk_tree_view_focus_in): just queue a draw, don't fool with + draw_focus goo + (gtk_tree_view_focus): use gtk_get_current_event() and + gdk_event_get_state() + (gtk_tree_view_deleted): don't queue_resize() after calling set_size() + (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove + semicolon + (gtk_tree_view_create_button): show the button here + (gtk_tree_view_button_clicked): actually emit the clicked signal + on the column + (_gtk_tree_view_set_size): return right away if the size is + unchanged, as a cheesy optimization + (gtk_tree_view_setup_model): rename set_model_realized to + setup_model to match the flag that indicates whether we've + called it + (gtk_tree_view_get_hadjustment): create adjustment if it doesn't + exist, because set_scroll_adjustment does that and it shouldn't + matter what order you call these in + (gtk_tree_view_get_vadjustment): ditto + (gtk_tree_view_set_headers_visible): canonicalize the bool, + for paranoia + (gtk_tree_view_set_headers_visible): call + gtk_tree_view_map_buttons() instead of using cut-and-paste code + (gtk_tree_view_append_column): clarify whether the return value + is the count of columns before or after, and do the increment + separately from the return statement so you can tell from the code. + (gtk_tree_view_remove_column): ditto + (gtk_tree_view_insert_column): ditto + (gtk_tree_view_get_column): remove g_return_if_fail for columns + outside the existing range, the docs say that outside-range + columns are allowed, so we handle them as documented. (Presumably + this allows a nice loop with column != NULL as test.) + (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments + mean (left/right/center etc.). + (gtk_tree_view_collapse_all): only queue a draw if we're mapped + (gtk_tree_view_expand_row): add docs + (gtk_tree_view_collapse_row): add docs + + * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new + function to emit the clicked signal on a column + + * gdk/gdkevents.c (gdk_event_get_state): new function, to get the + state of an event + (gdk_event_get_time): don't treat GDK_SCROLL + as a button event, remove default case from switch so gcc + will whine if we don't explicitly handle all event types + + * gtk/gtktreeselection.h: added some FIXME + + * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename + "columns" to "n_columns" and "column" to "columns" for clarity + +2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gtktextiter.c: General cleanup of the log attr iteration stuff. This should make e.g. the delete key work again in the text widget... diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0ea91604e..bf4830e10 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,88 @@ 2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: + Port to GObject, can go back in gdk-pixbuf after setting up + a gdk-pixbuf-marshal.h header over there. + + * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; + (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal + args + (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be + set + (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons + here, do it when we create the buttons later + (gtk_tree_view_realize_buttons): add some g_return_if_fail + (gtk_tree_view_map): paranoia checks that column->button is shown + and unmapped + (gtk_tree_view_size_request): only request visible children. + Move header size calculation in here, for cleanliness, and + to maintain invariants for child widgets if we eventually + let users set different children inside the buttons + (gtk_tree_view_map_buttons): factor out code to map buttons, + since it was being called several times + (gtk_tree_view_size_allocate_buttons): move_resize the drag + windows instead of just moving them; their height may change + if we allow random widgets in there, or the theme changes. + (gtk_tree_view_size_allocate): move button size allocation + above emitting the scroll signals, to ensure a sane state when we + hit user code + (gtk_tree_view_button_release): remove queue_resize after + tree_view_set_size(), set_size() will handle any resize queuing + that's needed + (gtk_tree_view_focus_in): just queue a draw, don't fool with + draw_focus goo + (gtk_tree_view_focus): use gtk_get_current_event() and + gdk_event_get_state() + (gtk_tree_view_deleted): don't queue_resize() after calling set_size() + (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove + semicolon + (gtk_tree_view_create_button): show the button here + (gtk_tree_view_button_clicked): actually emit the clicked signal + on the column + (_gtk_tree_view_set_size): return right away if the size is + unchanged, as a cheesy optimization + (gtk_tree_view_setup_model): rename set_model_realized to + setup_model to match the flag that indicates whether we've + called it + (gtk_tree_view_get_hadjustment): create adjustment if it doesn't + exist, because set_scroll_adjustment does that and it shouldn't + matter what order you call these in + (gtk_tree_view_get_vadjustment): ditto + (gtk_tree_view_set_headers_visible): canonicalize the bool, + for paranoia + (gtk_tree_view_set_headers_visible): call + gtk_tree_view_map_buttons() instead of using cut-and-paste code + (gtk_tree_view_append_column): clarify whether the return value + is the count of columns before or after, and do the increment + separately from the return statement so you can tell from the code. + (gtk_tree_view_remove_column): ditto + (gtk_tree_view_insert_column): ditto + (gtk_tree_view_get_column): remove g_return_if_fail for columns + outside the existing range, the docs say that outside-range + columns are allowed, so we handle them as documented. (Presumably + this allows a nice loop with column != NULL as test.) + (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments + mean (left/right/center etc.). + (gtk_tree_view_collapse_all): only queue a draw if we're mapped + (gtk_tree_view_expand_row): add docs + (gtk_tree_view_collapse_row): add docs + + * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new + function to emit the clicked signal on a column + + * gdk/gdkevents.c (gdk_event_get_state): new function, to get the + state of an event + (gdk_event_get_time): don't treat GDK_SCROLL + as a button event, remove default case from switch so gcc + will whine if we don't explicitly handle all event types + + * gtk/gtktreeselection.h: added some FIXME + + * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename + "columns" to "n_columns" and "column" to "columns" for clarity + +2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gtktextiter.c: General cleanup of the log attr iteration stuff. This should make e.g. the delete key work again in the text widget... diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 0ea91604e..bf4830e10 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,5 +1,88 @@ 2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: + Port to GObject, can go back in gdk-pixbuf after setting up + a gdk-pixbuf-marshal.h header over there. + + * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; + (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal + args + (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be + set + (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons + here, do it when we create the buttons later + (gtk_tree_view_realize_buttons): add some g_return_if_fail + (gtk_tree_view_map): paranoia checks that column->button is shown + and unmapped + (gtk_tree_view_size_request): only request visible children. + Move header size calculation in here, for cleanliness, and + to maintain invariants for child widgets if we eventually + let users set different children inside the buttons + (gtk_tree_view_map_buttons): factor out code to map buttons, + since it was being called several times + (gtk_tree_view_size_allocate_buttons): move_resize the drag + windows instead of just moving them; their height may change + if we allow random widgets in there, or the theme changes. + (gtk_tree_view_size_allocate): move button size allocation + above emitting the scroll signals, to ensure a sane state when we + hit user code + (gtk_tree_view_button_release): remove queue_resize after + tree_view_set_size(), set_size() will handle any resize queuing + that's needed + (gtk_tree_view_focus_in): just queue a draw, don't fool with + draw_focus goo + (gtk_tree_view_focus): use gtk_get_current_event() and + gdk_event_get_state() + (gtk_tree_view_deleted): don't queue_resize() after calling set_size() + (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove + semicolon + (gtk_tree_view_create_button): show the button here + (gtk_tree_view_button_clicked): actually emit the clicked signal + on the column + (_gtk_tree_view_set_size): return right away if the size is + unchanged, as a cheesy optimization + (gtk_tree_view_setup_model): rename set_model_realized to + setup_model to match the flag that indicates whether we've + called it + (gtk_tree_view_get_hadjustment): create adjustment if it doesn't + exist, because set_scroll_adjustment does that and it shouldn't + matter what order you call these in + (gtk_tree_view_get_vadjustment): ditto + (gtk_tree_view_set_headers_visible): canonicalize the bool, + for paranoia + (gtk_tree_view_set_headers_visible): call + gtk_tree_view_map_buttons() instead of using cut-and-paste code + (gtk_tree_view_append_column): clarify whether the return value + is the count of columns before or after, and do the increment + separately from the return statement so you can tell from the code. + (gtk_tree_view_remove_column): ditto + (gtk_tree_view_insert_column): ditto + (gtk_tree_view_get_column): remove g_return_if_fail for columns + outside the existing range, the docs say that outside-range + columns are allowed, so we handle them as documented. (Presumably + this allows a nice loop with column != NULL as test.) + (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments + mean (left/right/center etc.). + (gtk_tree_view_collapse_all): only queue a draw if we're mapped + (gtk_tree_view_expand_row): add docs + (gtk_tree_view_collapse_row): add docs + + * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new + function to emit the clicked signal on a column + + * gdk/gdkevents.c (gdk_event_get_state): new function, to get the + state of an event + (gdk_event_get_time): don't treat GDK_SCROLL + as a button event, remove default case from switch so gcc + will whine if we don't explicitly handle all event types + + * gtk/gtktreeselection.h: added some FIXME + + * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename + "columns" to "n_columns" and "column" to "columns" for clarity + +2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gtktextiter.c: General cleanup of the log attr iteration stuff. This should make e.g. the delete key work again in the text widget... diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 0ea91604e..bf4830e10 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,5 +1,88 @@ 2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: + Port to GObject, can go back in gdk-pixbuf after setting up + a gdk-pixbuf-marshal.h header over there. + + * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; + (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal + args + (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be + set + (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons + here, do it when we create the buttons later + (gtk_tree_view_realize_buttons): add some g_return_if_fail + (gtk_tree_view_map): paranoia checks that column->button is shown + and unmapped + (gtk_tree_view_size_request): only request visible children. + Move header size calculation in here, for cleanliness, and + to maintain invariants for child widgets if we eventually + let users set different children inside the buttons + (gtk_tree_view_map_buttons): factor out code to map buttons, + since it was being called several times + (gtk_tree_view_size_allocate_buttons): move_resize the drag + windows instead of just moving them; their height may change + if we allow random widgets in there, or the theme changes. + (gtk_tree_view_size_allocate): move button size allocation + above emitting the scroll signals, to ensure a sane state when we + hit user code + (gtk_tree_view_button_release): remove queue_resize after + tree_view_set_size(), set_size() will handle any resize queuing + that's needed + (gtk_tree_view_focus_in): just queue a draw, don't fool with + draw_focus goo + (gtk_tree_view_focus): use gtk_get_current_event() and + gdk_event_get_state() + (gtk_tree_view_deleted): don't queue_resize() after calling set_size() + (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove + semicolon + (gtk_tree_view_create_button): show the button here + (gtk_tree_view_button_clicked): actually emit the clicked signal + on the column + (_gtk_tree_view_set_size): return right away if the size is + unchanged, as a cheesy optimization + (gtk_tree_view_setup_model): rename set_model_realized to + setup_model to match the flag that indicates whether we've + called it + (gtk_tree_view_get_hadjustment): create adjustment if it doesn't + exist, because set_scroll_adjustment does that and it shouldn't + matter what order you call these in + (gtk_tree_view_get_vadjustment): ditto + (gtk_tree_view_set_headers_visible): canonicalize the bool, + for paranoia + (gtk_tree_view_set_headers_visible): call + gtk_tree_view_map_buttons() instead of using cut-and-paste code + (gtk_tree_view_append_column): clarify whether the return value + is the count of columns before or after, and do the increment + separately from the return statement so you can tell from the code. + (gtk_tree_view_remove_column): ditto + (gtk_tree_view_insert_column): ditto + (gtk_tree_view_get_column): remove g_return_if_fail for columns + outside the existing range, the docs say that outside-range + columns are allowed, so we handle them as documented. (Presumably + this allows a nice loop with column != NULL as test.) + (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments + mean (left/right/center etc.). + (gtk_tree_view_collapse_all): only queue a draw if we're mapped + (gtk_tree_view_expand_row): add docs + (gtk_tree_view_collapse_row): add docs + + * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new + function to emit the clicked signal on a column + + * gdk/gdkevents.c (gdk_event_get_state): new function, to get the + state of an event + (gdk_event_get_time): don't treat GDK_SCROLL + as a button event, remove default case from switch so gcc + will whine if we don't explicitly handle all event types + + * gtk/gtktreeselection.h: added some FIXME + + * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename + "columns" to "n_columns" and "column" to "columns" for clarity + +2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gtktextiter.c: General cleanup of the log attr iteration stuff. This should make e.g. the delete key work again in the text widget... diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 0ea91604e..bf4830e10 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,88 @@ 2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: + Port to GObject, can go back in gdk-pixbuf after setting up + a gdk-pixbuf-marshal.h header over there. + + * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; + (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal + args + (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be + set + (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons + here, do it when we create the buttons later + (gtk_tree_view_realize_buttons): add some g_return_if_fail + (gtk_tree_view_map): paranoia checks that column->button is shown + and unmapped + (gtk_tree_view_size_request): only request visible children. + Move header size calculation in here, for cleanliness, and + to maintain invariants for child widgets if we eventually + let users set different children inside the buttons + (gtk_tree_view_map_buttons): factor out code to map buttons, + since it was being called several times + (gtk_tree_view_size_allocate_buttons): move_resize the drag + windows instead of just moving them; their height may change + if we allow random widgets in there, or the theme changes. + (gtk_tree_view_size_allocate): move button size allocation + above emitting the scroll signals, to ensure a sane state when we + hit user code + (gtk_tree_view_button_release): remove queue_resize after + tree_view_set_size(), set_size() will handle any resize queuing + that's needed + (gtk_tree_view_focus_in): just queue a draw, don't fool with + draw_focus goo + (gtk_tree_view_focus): use gtk_get_current_event() and + gdk_event_get_state() + (gtk_tree_view_deleted): don't queue_resize() after calling set_size() + (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove + semicolon + (gtk_tree_view_create_button): show the button here + (gtk_tree_view_button_clicked): actually emit the clicked signal + on the column + (_gtk_tree_view_set_size): return right away if the size is + unchanged, as a cheesy optimization + (gtk_tree_view_setup_model): rename set_model_realized to + setup_model to match the flag that indicates whether we've + called it + (gtk_tree_view_get_hadjustment): create adjustment if it doesn't + exist, because set_scroll_adjustment does that and it shouldn't + matter what order you call these in + (gtk_tree_view_get_vadjustment): ditto + (gtk_tree_view_set_headers_visible): canonicalize the bool, + for paranoia + (gtk_tree_view_set_headers_visible): call + gtk_tree_view_map_buttons() instead of using cut-and-paste code + (gtk_tree_view_append_column): clarify whether the return value + is the count of columns before or after, and do the increment + separately from the return statement so you can tell from the code. + (gtk_tree_view_remove_column): ditto + (gtk_tree_view_insert_column): ditto + (gtk_tree_view_get_column): remove g_return_if_fail for columns + outside the existing range, the docs say that outside-range + columns are allowed, so we handle them as documented. (Presumably + this allows a nice loop with column != NULL as test.) + (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments + mean (left/right/center etc.). + (gtk_tree_view_collapse_all): only queue a draw if we're mapped + (gtk_tree_view_expand_row): add docs + (gtk_tree_view_collapse_row): add docs + + * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new + function to emit the clicked signal on a column + + * gdk/gdkevents.c (gdk_event_get_state): new function, to get the + state of an event + (gdk_event_get_time): don't treat GDK_SCROLL + as a button event, remove default case from switch so gcc + will whine if we don't explicitly handle all event types + + * gtk/gtktreeselection.h: added some FIXME + + * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename + "columns" to "n_columns" and "column" to "columns" for clarity + +2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gtktextiter.c: General cleanup of the log attr iteration stuff. This should make e.g. the delete key work again in the text widget... diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 0ea91604e..bf4830e10 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,88 @@ 2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: + Port to GObject, can go back in gdk-pixbuf after setting up + a gdk-pixbuf-marshal.h header over there. + + * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; + (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal + args + (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be + set + (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons + here, do it when we create the buttons later + (gtk_tree_view_realize_buttons): add some g_return_if_fail + (gtk_tree_view_map): paranoia checks that column->button is shown + and unmapped + (gtk_tree_view_size_request): only request visible children. + Move header size calculation in here, for cleanliness, and + to maintain invariants for child widgets if we eventually + let users set different children inside the buttons + (gtk_tree_view_map_buttons): factor out code to map buttons, + since it was being called several times + (gtk_tree_view_size_allocate_buttons): move_resize the drag + windows instead of just moving them; their height may change + if we allow random widgets in there, or the theme changes. + (gtk_tree_view_size_allocate): move button size allocation + above emitting the scroll signals, to ensure a sane state when we + hit user code + (gtk_tree_view_button_release): remove queue_resize after + tree_view_set_size(), set_size() will handle any resize queuing + that's needed + (gtk_tree_view_focus_in): just queue a draw, don't fool with + draw_focus goo + (gtk_tree_view_focus): use gtk_get_current_event() and + gdk_event_get_state() + (gtk_tree_view_deleted): don't queue_resize() after calling set_size() + (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove + semicolon + (gtk_tree_view_create_button): show the button here + (gtk_tree_view_button_clicked): actually emit the clicked signal + on the column + (_gtk_tree_view_set_size): return right away if the size is + unchanged, as a cheesy optimization + (gtk_tree_view_setup_model): rename set_model_realized to + setup_model to match the flag that indicates whether we've + called it + (gtk_tree_view_get_hadjustment): create adjustment if it doesn't + exist, because set_scroll_adjustment does that and it shouldn't + matter what order you call these in + (gtk_tree_view_get_vadjustment): ditto + (gtk_tree_view_set_headers_visible): canonicalize the bool, + for paranoia + (gtk_tree_view_set_headers_visible): call + gtk_tree_view_map_buttons() instead of using cut-and-paste code + (gtk_tree_view_append_column): clarify whether the return value + is the count of columns before or after, and do the increment + separately from the return statement so you can tell from the code. + (gtk_tree_view_remove_column): ditto + (gtk_tree_view_insert_column): ditto + (gtk_tree_view_get_column): remove g_return_if_fail for columns + outside the existing range, the docs say that outside-range + columns are allowed, so we handle them as documented. (Presumably + this allows a nice loop with column != NULL as test.) + (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments + mean (left/right/center etc.). + (gtk_tree_view_collapse_all): only queue a draw if we're mapped + (gtk_tree_view_expand_row): add docs + (gtk_tree_view_collapse_row): add docs + + * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new + function to emit the clicked signal on a column + + * gdk/gdkevents.c (gdk_event_get_state): new function, to get the + state of an event + (gdk_event_get_time): don't treat GDK_SCROLL + as a button event, remove default case from switch so gcc + will whine if we don't explicitly handle all event types + + * gtk/gtktreeselection.h: added some FIXME + + * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename + "columns" to "n_columns" and "column" to "columns" for clarity + +2000-12-16 Havoc Pennington <hp@pobox.com> + * gtk/gtktextiter.c: General cleanup of the log attr iteration stuff. This should make e.g. the delete key work again in the text widget... diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 750c1a04c..623274409 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,12 @@ +2000-12-16 Havoc Pennington <hp@pobox.com> + + * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): ref + the pixbuf in the frame, so we can use gdk_pixbuf_frame_free + (gdk_pixbuf_frame_copy): new function + (gdk_pixbuf_frame_free): new function + (gdk_pixbuf_frame_get_type): new function + (GDK_TYPE_PIXBUF_FRAME): macro to get type for GdkPixbufFrame + Tue Nov 14 11:51:26 2000 Owen Taylor <otaylor@redhat.com> * Makefile.am: Add -avoid-version for all modules. diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c index 9d221d5c3..d0f7768f2 100644 --- a/gdk-pixbuf/gdk-pixbuf-animation.c +++ b/gdk-pixbuf/gdk-pixbuf-animation.c @@ -193,6 +193,7 @@ gdk_pixbuf_animation_new_from_file (const char *filename, frame = g_new (GdkPixbufFrame, 1); frame->pixbuf = pixbuf; + g_object_ref (G_OBJECT (frame->pixbuf)); frame->x_offset = 0; frame->y_offset = 0; frame->delay_time = -1; @@ -406,3 +407,60 @@ gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame) return frame->action; } + +/** + * gdk_pixbuf_frame_copy: + * @src: a #GdkPixbufFrame to copy + * + * Copies a #GdkPixbufFrame. Free the result + * with gdk_pixbuf_frame_free(). + * + * Return value: a new #GdkPixbufFrame + **/ +GdkPixbufFrame* +gdk_pixbuf_frame_copy (GdkPixbufFrame *src) +{ + GdkPixbufFrame *frame; + + frame = g_new (GdkPixbufFrame, 1); + frame->pixbuf = src->pixbuf; + g_object_ref (G_OBJECT (frame->pixbuf)); + frame->x_offset = src->x_offset; + frame->y_offset = src->y_offset; + frame->delay_time = src->delay_time; + frame->action = src->action; + + return frame; +} + +/** + * gdk_pixbuf_frame_free: + * @frame: a #GdkPixbufFrame + * + * Frees a #GdkPixbufFrame. Don't do this with frames you got from + * #GdkPixbufAnimation, usually the animation owns those (it doesn't + * make a copy before returning the frame). + **/ +void +gdk_pixbuf_frame_free (GdkPixbufFrame *frame) +{ + g_return_if_fail (frame != NULL); + + g_object_unref (G_OBJECT (frame->pixbuf)); + g_free (frame); +} + +GType +gdk_pixbuf_frame_get_type (void) +{ + static GType our_type = 0; + + if (our_type == 0) + { + our_type = g_boxed_type_register_static ("GdkPixbufFrame", + gdk_pixbuf_frame_copy, + gdk_pixbuf_frame_free); + } + + return our_type; +} diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c index 06f2e1df3..34cb3899a 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.c +++ b/gdk-pixbuf/gdk-pixbuf-loader.c @@ -1,4 +1,4 @@ -/* GdkPixbuf library - Main header file +/* GdkPixbuf library - Progressive loader object * * Copyright (C) 1999 The Free Software Foundation * @@ -43,7 +43,6 @@ enum { static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *klass); static void gdk_pixbuf_loader_init (GdkPixbufLoader *loader); -static void gdk_pixbuf_loader_destroy (GtkObject *loader); static void gdk_pixbuf_loader_finalize (GObject *loader); static gpointer parent_class = NULL; @@ -75,25 +74,29 @@ typedef struct * * Return value: The type ID of the #GdkPixbufLoader class. **/ -GtkType +GType gdk_pixbuf_loader_get_type (void) { - static GtkType loader_type = 0; + static GType loader_type = 0; if (!loader_type) { - static const GtkTypeInfo loader_info = { - "GdkPixbufLoader", - sizeof (GdkPixbufLoader), - sizeof (GdkPixbufLoaderClass), - (GtkClassInitFunc) gdk_pixbuf_loader_class_init, - (GtkObjectInitFunc) gdk_pixbuf_loader_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + static const GTypeInfo loader_info = { + sizeof (GdkPixbufLoaderClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gdk_pixbuf_loader_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GdkPixbufLoader), + 0, /* n_preallocs */ + (GInstanceInitFunc) gdk_pixbuf_loader_init }; - loader_type = gtk_type_unique (GTK_TYPE_OBJECT, &loader_info); + loader_type = g_type_register_static (G_TYPE_OBJECT, + "GdkPixbufLoader", + &loader_info, + 0); } return loader_type; @@ -102,61 +105,63 @@ gdk_pixbuf_loader_get_type (void) static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) { - GObjectClass *gobject_class; - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) class; - gobject_class = (GObjectClass *) class; + object_class = (GObjectClass *) class; - parent_class = gtk_type_class (GTK_TYPE_OBJECT); + parent_class = g_type_class_peek_parent (class); - object_class->destroy = gdk_pixbuf_loader_destroy; - gobject_class->finalize = gdk_pixbuf_loader_finalize; + object_class->finalize = gdk_pixbuf_loader_finalize; pixbuf_loader_signals[AREA_PREPARED] = - gtk_signal_new ("area_prepared", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_newc ("area_prepared", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_prepared), + NULL, + gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); pixbuf_loader_signals[AREA_UPDATED] = - gtk_signal_new ("area_updated", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated), - gtk_marshal_VOID__INT_INT_INT_INT, - GTK_TYPE_NONE, 4, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_INT); + g_signal_newc ("area_updated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_updated), + NULL, + gtk_marshal_VOID__INT_INT_INT_INT, + G_TYPE_NONE, 4, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_INT); pixbuf_loader_signals[FRAME_DONE] = - gtk_signal_new ("frame_done", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done), - gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); + g_signal_newc ("frame_done", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, frame_done), + NULL, + gtk_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + GDK_TYPE_PIXBUF_FRAME); pixbuf_loader_signals[ANIMATION_DONE] = - gtk_signal_new ("animation_done", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_newc ("animation_done", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, animation_done), + NULL, + gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); pixbuf_loader_signals[CLOSED] = - gtk_signal_new ("closed", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_newc ("closed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, closed), + NULL, + gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -169,38 +174,23 @@ gdk_pixbuf_loader_init (GdkPixbufLoader *loader) } static void -gdk_pixbuf_loader_destroy (GtkObject *object) +gdk_pixbuf_loader_finalize (GObject *object) { GdkPixbufLoader *loader; GdkPixbufLoaderPrivate *priv = NULL; - g_return_if_fail (object != NULL); - g_return_if_fail (GDK_IS_PIXBUF_LOADER (object)); - loader = GDK_PIXBUF_LOADER (object); priv = loader->private; - + if (!priv->closed) gdk_pixbuf_loader_close (loader); if (priv->animation) gdk_pixbuf_animation_unref (priv->animation); + if (priv->pixbuf) gdk_pixbuf_unref (priv->pixbuf); - if (GTK_OBJECT_CLASS (parent_class)->destroy) - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -gdk_pixbuf_loader_finalize (GObject *object) -{ - GdkPixbufLoader *loader; - GdkPixbufLoaderPrivate *priv = NULL; - - loader = GDK_PIXBUF_LOADER (object); - priv = loader->private; - g_free (priv); if (G_OBJECT_CLASS (parent_class)->finalize) @@ -219,7 +209,7 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, g_assert (priv->pixbuf == NULL); priv->pixbuf = pixbuf; - gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]); + g_signal_emit (G_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED], 0); } static void @@ -234,12 +224,13 @@ gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, priv = GDK_PIXBUF_LOADER (loader)->private; - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[AREA_UPDATED], - x, y, - /* sanity check in here. Defend against an errant loader */ - MIN (width, gdk_pixbuf_get_width (priv->pixbuf)), - MIN (height, gdk_pixbuf_get_height (priv->pixbuf))); + g_signal_emit (G_OBJECT (loader), + pixbuf_loader_signals[AREA_UPDATED], + 0, + x, y, + /* sanity check in here. Defend against an errant loader */ + MIN (width, gdk_pixbuf_get_width (priv->pixbuf)), + MIN (height, gdk_pixbuf_get_height (priv->pixbuf))); } static void @@ -278,9 +269,10 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, priv->animation->frames = g_list_append (priv->animation->frames, frame); priv->animation->n_frames++; - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[FRAME_DONE], - frame); + g_signal_emit (GTK_OBJECT (loader), + pixbuf_loader_signals[FRAME_DONE], + 0, + frame); } static void @@ -312,7 +304,7 @@ gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, current = current->next; } - gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[ANIMATION_DONE]); + g_signal_emit (G_OBJECT (loader), pixbuf_loader_signals[ANIMATION_DONE], 0); } static gint @@ -605,7 +597,7 @@ gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader) * gdk_pixbuf_loader_close: * @loader: A pixbuf loader. * - * Informs a pixbuf loader that no further writes with gdk_pixbuf_load_write() + * Informs a pixbuf loader that no further writes with gdk_pixbuf_loader_write() * will occur, so that it can free its internal loading structures. **/ void @@ -630,5 +622,5 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader) priv->closed = TRUE; - gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[CLOSED]); + g_signal_emit (G_OBJECT (loader), pixbuf_loader_signals[CLOSED], 0); } diff --git a/gdk-pixbuf/gdk-pixbuf-loader.h b/gdk-pixbuf/gdk-pixbuf-loader.h index 402b69725..01532ad78 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.h +++ b/gdk-pixbuf/gdk-pixbuf-loader.h @@ -1,4 +1,4 @@ -/* GdkPixbuf library - Main header file +/* GdkPixbuf library - Progressive loader object * * Copyright (C) 1999 The Free Software Foundation * @@ -26,27 +26,24 @@ #ifndef GDK_PIXBUF_LOADER_H #define GDK_PIXBUF_LOADER_H -#include <gtk/gtkobject.h> #include <gdk-pixbuf/gdk-pixbuf.h> #ifdef __cplusplus extern "C" { #endif - - #define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ()) -#define GDK_PIXBUF_LOADER(obj) (GTK_CHECK_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader)) -#define GDK_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) -#define GDK_IS_PIXBUF_LOADER(obj) (GTK_CHECK_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER)) -#define GDK_IS_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER)) -#define GDK_PIXBUF_LOADER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) +#define GDK_PIXBUF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader)) +#define GDK_PIXBUF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) +#define GDK_IS_PIXBUF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER)) +#define GDK_IS_PIXBUF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER)) +#define GDK_PIXBUF_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) typedef struct _GdkPixbufLoader GdkPixbufLoader; struct _GdkPixbufLoader { - GtkObject object; + GObject parent_instance; /*< private >*/ gpointer private; @@ -55,7 +52,7 @@ struct _GdkPixbufLoader typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass; struct _GdkPixbufLoaderClass { - GtkObjectClass parent_class; + GObjectClass parent_class; void (*area_prepared) (GdkPixbufLoader *loader); void (*area_updated) (GdkPixbufLoader *loader, @@ -70,7 +67,7 @@ struct _GdkPixbufLoaderClass }; -GtkType gdk_pixbuf_loader_get_type (void) G_GNUC_CONST; +GType gdk_pixbuf_loader_get_type (void) G_GNUC_CONST; GdkPixbufLoader * gdk_pixbuf_loader_new (void); GdkPixbufLoader * gdk_pixbuf_loader_new_with_type (const char *image_type, GError **error); diff --git a/gdk-pixbuf/gdk-pixbuf.h b/gdk-pixbuf/gdk-pixbuf.h index ee87b82bb..f089dcf90 100644 --- a/gdk-pixbuf/gdk-pixbuf.h +++ b/gdk-pixbuf/gdk-pixbuf.h @@ -279,6 +279,10 @@ int gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame); int gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame); int gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame); GdkPixbufFrameAction gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame); +GdkPixbufFrame *gdk_pixbuf_frame_copy (GdkPixbufFrame *frame); +void gdk_pixbuf_frame_free (GdkPixbufFrame *frame); +GType gdk_pixbuf_frame_get_type (void) G_GNUC_CONST; +#define GDK_TYPE_PIXBUF_FRAME gdk_pixbuf_frame_get_type () /* General (presently empty) initialization hooks, primarily for gnome-libs */ diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 544e3dd1c..7823dbee3 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -421,8 +421,9 @@ gdk_event_get_time (GdkEvent *event) case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS: case GDK_BUTTON_RELEASE: - case GDK_SCROLL: return event->button.time; + case GDK_SCROLL: + return event->scroll.time; case GDK_KEY_PRESS: case GDK_KEY_RELEASE: return event->key.time; @@ -445,14 +446,90 @@ gdk_event_get_time (GdkEvent *event) case GDK_DROP_START: case GDK_DROP_FINISHED: return event->dnd.time; - default: /* use current time */ - break; + case GDK_CLIENT_EVENT: + case GDK_VISIBILITY_NOTIFY: + case GDK_NO_EXPOSE: + case GDK_CONFIGURE: + case GDK_FOCUS_CHANGE: + case GDK_NOTHING: + case GDK_DELETE: + case GDK_DESTROY: + case GDK_EXPOSE: + case GDK_MAP: + case GDK_UNMAP: + /* return current time */ + break; } return GDK_CURRENT_TIME; } /** + * gdk_event_get_state: + * @event: a #GdkEvent or NULL + * @state: return location for state + * + * If the event contains a "state" field, puts that field in @state. Otherwise + * stores an empty state (0). Returns %TRUE if there was a state field + * in the event. + * + * Return value: %TRUE if there was a state field in the event + **/ +gboolean +gdk_event_get_state (GdkEvent *event, + GdkModifierType *state) +{ + if (event) + switch (event->type) + { + case GDK_MOTION_NOTIFY: + return event->motion.state; + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_RELEASE: + return event->button.state; + case GDK_SCROLL: + return event->scroll.state; + case GDK_KEY_PRESS: + case GDK_KEY_RELEASE: + return event->key.state; + case GDK_ENTER_NOTIFY: + case GDK_LEAVE_NOTIFY: + return event->crossing.state; + case GDK_PROPERTY_NOTIFY: + return event->property.state; + case GDK_VISIBILITY_NOTIFY: + return event->visibility.state; + case GDK_CLIENT_EVENT: + case GDK_NO_EXPOSE: + case GDK_CONFIGURE: + case GDK_FOCUS_CHANGE: + case GDK_SELECTION_CLEAR: + case GDK_SELECTION_REQUEST: + case GDK_SELECTION_NOTIFY: + case GDK_PROXIMITY_IN: + case GDK_PROXIMITY_OUT: + case GDK_DRAG_ENTER: + case GDK_DRAG_LEAVE: + case GDK_DRAG_MOTION: + case GDK_DRAG_STATUS: + case GDK_DROP_START: + case GDK_DROP_FINISHED: + case GDK_NOTHING: + case GDK_DELETE: + case GDK_DESTROY: + case GDK_EXPOSE: + case GDK_MAP: + case GDK_UNMAP: + /* no state field */ + break; + } + + return 0; +} + +/** * gdk_event_get_axis: * @event: a #GdkEvent * @axis_use: the axis use to look for diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h index 04f1d7871..f49b156ec 100644 --- a/gdk/gdkevents.h +++ b/gdk/gdkevents.h @@ -408,10 +408,13 @@ void gdk_event_put (GdkEvent *event); GdkEvent* gdk_event_copy (GdkEvent *event); void gdk_event_free (GdkEvent *event); -guint32 gdk_event_get_time (GdkEvent *event); -gboolean gdk_event_get_axis (GdkEvent *event, - GdkAxisUse axis_use, - gdouble *value); + +guint32 gdk_event_get_time (GdkEvent *event); +gboolean gdk_event_get_state (GdkEvent *event, + GdkModifierType *state); +gboolean gdk_event_get_axis (GdkEvent *event, + GdkAxisUse axis_use, + gdouble *value); void gdk_event_handler_set (GdkEventFunc func, gpointer data, diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c index 06f2e1df3..34cb3899a 100644 --- a/gtk/gdk-pixbuf-loader.c +++ b/gtk/gdk-pixbuf-loader.c @@ -1,4 +1,4 @@ -/* GdkPixbuf library - Main header file +/* GdkPixbuf library - Progressive loader object * * Copyright (C) 1999 The Free Software Foundation * @@ -43,7 +43,6 @@ enum { static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *klass); static void gdk_pixbuf_loader_init (GdkPixbufLoader *loader); -static void gdk_pixbuf_loader_destroy (GtkObject *loader); static void gdk_pixbuf_loader_finalize (GObject *loader); static gpointer parent_class = NULL; @@ -75,25 +74,29 @@ typedef struct * * Return value: The type ID of the #GdkPixbufLoader class. **/ -GtkType +GType gdk_pixbuf_loader_get_type (void) { - static GtkType loader_type = 0; + static GType loader_type = 0; if (!loader_type) { - static const GtkTypeInfo loader_info = { - "GdkPixbufLoader", - sizeof (GdkPixbufLoader), - sizeof (GdkPixbufLoaderClass), - (GtkClassInitFunc) gdk_pixbuf_loader_class_init, - (GtkObjectInitFunc) gdk_pixbuf_loader_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + static const GTypeInfo loader_info = { + sizeof (GdkPixbufLoaderClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gdk_pixbuf_loader_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GdkPixbufLoader), + 0, /* n_preallocs */ + (GInstanceInitFunc) gdk_pixbuf_loader_init }; - loader_type = gtk_type_unique (GTK_TYPE_OBJECT, &loader_info); + loader_type = g_type_register_static (G_TYPE_OBJECT, + "GdkPixbufLoader", + &loader_info, + 0); } return loader_type; @@ -102,61 +105,63 @@ gdk_pixbuf_loader_get_type (void) static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) { - GObjectClass *gobject_class; - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) class; - gobject_class = (GObjectClass *) class; + object_class = (GObjectClass *) class; - parent_class = gtk_type_class (GTK_TYPE_OBJECT); + parent_class = g_type_class_peek_parent (class); - object_class->destroy = gdk_pixbuf_loader_destroy; - gobject_class->finalize = gdk_pixbuf_loader_finalize; + object_class->finalize = gdk_pixbuf_loader_finalize; pixbuf_loader_signals[AREA_PREPARED] = - gtk_signal_new ("area_prepared", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_newc ("area_prepared", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_prepared), + NULL, + gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); pixbuf_loader_signals[AREA_UPDATED] = - gtk_signal_new ("area_updated", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated), - gtk_marshal_VOID__INT_INT_INT_INT, - GTK_TYPE_NONE, 4, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_INT); + g_signal_newc ("area_updated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_updated), + NULL, + gtk_marshal_VOID__INT_INT_INT_INT, + G_TYPE_NONE, 4, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_INT); pixbuf_loader_signals[FRAME_DONE] = - gtk_signal_new ("frame_done", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done), - gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); + g_signal_newc ("frame_done", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, frame_done), + NULL, + gtk_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + GDK_TYPE_PIXBUF_FRAME); pixbuf_loader_signals[ANIMATION_DONE] = - gtk_signal_new ("animation_done", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_newc ("animation_done", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, animation_done), + NULL, + gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); pixbuf_loader_signals[CLOSED] = - gtk_signal_new ("closed", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed), - gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_newc ("closed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdkPixbufLoaderClass, closed), + NULL, + gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -169,38 +174,23 @@ gdk_pixbuf_loader_init (GdkPixbufLoader *loader) } static void -gdk_pixbuf_loader_destroy (GtkObject *object) +gdk_pixbuf_loader_finalize (GObject *object) { GdkPixbufLoader *loader; GdkPixbufLoaderPrivate *priv = NULL; - g_return_if_fail (object != NULL); - g_return_if_fail (GDK_IS_PIXBUF_LOADER (object)); - loader = GDK_PIXBUF_LOADER (object); priv = loader->private; - + if (!priv->closed) gdk_pixbuf_loader_close (loader); if (priv->animation) gdk_pixbuf_animation_unref (priv->animation); + if (priv->pixbuf) gdk_pixbuf_unref (priv->pixbuf); - if (GTK_OBJECT_CLASS (parent_class)->destroy) - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -gdk_pixbuf_loader_finalize (GObject *object) -{ - GdkPixbufLoader *loader; - GdkPixbufLoaderPrivate *priv = NULL; - - loader = GDK_PIXBUF_LOADER (object); - priv = loader->private; - g_free (priv); if (G_OBJECT_CLASS (parent_class)->finalize) @@ -219,7 +209,7 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, g_assert (priv->pixbuf == NULL); priv->pixbuf = pixbuf; - gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]); + g_signal_emit (G_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED], 0); } static void @@ -234,12 +224,13 @@ gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, priv = GDK_PIXBUF_LOADER (loader)->private; - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[AREA_UPDATED], - x, y, - /* sanity check in here. Defend against an errant loader */ - MIN (width, gdk_pixbuf_get_width (priv->pixbuf)), - MIN (height, gdk_pixbuf_get_height (priv->pixbuf))); + g_signal_emit (G_OBJECT (loader), + pixbuf_loader_signals[AREA_UPDATED], + 0, + x, y, + /* sanity check in here. Defend against an errant loader */ + MIN (width, gdk_pixbuf_get_width (priv->pixbuf)), + MIN (height, gdk_pixbuf_get_height (priv->pixbuf))); } static void @@ -278,9 +269,10 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, priv->animation->frames = g_list_append (priv->animation->frames, frame); priv->animation->n_frames++; - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[FRAME_DONE], - frame); + g_signal_emit (GTK_OBJECT (loader), + pixbuf_loader_signals[FRAME_DONE], + 0, + frame); } static void @@ -312,7 +304,7 @@ gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, current = current->next; } - gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[ANIMATION_DONE]); + g_signal_emit (G_OBJECT (loader), pixbuf_loader_signals[ANIMATION_DONE], 0); } static gint @@ -605,7 +597,7 @@ gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader) * gdk_pixbuf_loader_close: * @loader: A pixbuf loader. * - * Informs a pixbuf loader that no further writes with gdk_pixbuf_load_write() + * Informs a pixbuf loader that no further writes with gdk_pixbuf_loader_write() * will occur, so that it can free its internal loading structures. **/ void @@ -630,5 +622,5 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader) priv->closed = TRUE; - gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[CLOSED]); + g_signal_emit (G_OBJECT (loader), pixbuf_loader_signals[CLOSED], 0); } diff --git a/gtk/gdk-pixbuf-loader.h b/gtk/gdk-pixbuf-loader.h index 402b69725..01532ad78 100644 --- a/gtk/gdk-pixbuf-loader.h +++ b/gtk/gdk-pixbuf-loader.h @@ -1,4 +1,4 @@ -/* GdkPixbuf library - Main header file +/* GdkPixbuf library - Progressive loader object * * Copyright (C) 1999 The Free Software Foundation * @@ -26,27 +26,24 @@ #ifndef GDK_PIXBUF_LOADER_H #define GDK_PIXBUF_LOADER_H -#include <gtk/gtkobject.h> #include <gdk-pixbuf/gdk-pixbuf.h> #ifdef __cplusplus extern "C" { #endif - - #define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ()) -#define GDK_PIXBUF_LOADER(obj) (GTK_CHECK_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader)) -#define GDK_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) -#define GDK_IS_PIXBUF_LOADER(obj) (GTK_CHECK_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER)) -#define GDK_IS_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER)) -#define GDK_PIXBUF_LOADER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) +#define GDK_PIXBUF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader)) +#define GDK_PIXBUF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) +#define GDK_IS_PIXBUF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER)) +#define GDK_IS_PIXBUF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER)) +#define GDK_PIXBUF_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) typedef struct _GdkPixbufLoader GdkPixbufLoader; struct _GdkPixbufLoader { - GtkObject object; + GObject parent_instance; /*< private >*/ gpointer private; @@ -55,7 +52,7 @@ struct _GdkPixbufLoader typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass; struct _GdkPixbufLoaderClass { - GtkObjectClass parent_class; + GObjectClass parent_class; void (*area_prepared) (GdkPixbufLoader *loader); void (*area_updated) (GdkPixbufLoader *loader, @@ -70,7 +67,7 @@ struct _GdkPixbufLoaderClass }; -GtkType gdk_pixbuf_loader_get_type (void) G_GNUC_CONST; +GType gdk_pixbuf_loader_get_type (void) G_GNUC_CONST; GdkPixbufLoader * gdk_pixbuf_loader_new (void); GdkPixbufLoader * gdk_pixbuf_loader_new_with_type (const char *image_type, GError **error); diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h index 0274f3289..a7b932beb 100644 --- a/gtk/gtktreeprivate.h +++ b/gtk/gtktreeprivate.h @@ -29,7 +29,8 @@ extern "C" { #include <gtk/gtktreeselection.h> #include <gtk/gtkrbtree.h> -typedef enum { +typedef enum +{ GTK_TREE_VIEW_IS_LIST = 1 << 0, GTK_TREE_VIEW_SHOW_EXPANDERS = 1 << 1, GTK_TREE_VIEW_IN_COLUMN_RESIZE = 1 << 2, @@ -87,8 +88,8 @@ struct _GtkTreeViewPrivate GtkTreeSelection *selection; /* Header information */ - gint columns; - GList *column; + gint n_columns; + GList *columns; gint header_height; }; diff --git a/gtk/gtktreeselection.h b/gtk/gtktreeselection.h index 3f7201ec3..e6cc4aa43 100644 --- a/gtk/gtktreeselection.h +++ b/gtk/gtktreeselection.h @@ -67,6 +67,7 @@ struct _GtkTreeSelectionClass GtkType gtk_tree_selection_get_type (void); +/* FIXME return a GtkTreeSelection */ GtkObject *gtk_tree_selection_new (void); void gtk_tree_selection_set_type (GtkTreeSelection *selection, GtkTreeSelectionType type); @@ -102,6 +103,7 @@ void gtk_tree_selection_select_range (GtkTreeSelection /*< private >*/ +/* FIXME underscores, return GtkTreeSelection, rename from_tree_view */ GtkObject *gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view); void gtk_tree_selection_set_tree_view (GtkTreeSelection *selection, GtkTreeView *tree_view); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 01371b801..b83765457 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -35,8 +35,8 @@ #define TREE_VIEW_DRAG_WIDTH 6 #define TREE_VIEW_EXPANDER_WIDTH 14 #define TREE_VIEW_EXPANDER_HEIGHT 14 -#define TREE_VIEW_VERTICAL_SEPERATOR 2 -#define TREE_VIEW_HORIZONTAL_SEPERATOR 0 +#define TREE_VIEW_VERTICAL_SEPARATOR 2 +#define TREE_VIEW_HORIZONTAL_SEPARATOR 0 typedef struct _GtkTreeViewChild GtkTreeViewChild; @@ -53,7 +53,7 @@ static void gtk_tree_view_init (GtkTreeView *tree_view) static void gtk_tree_view_class_init (GtkTreeViewClass *klass); /* widget signals */ -static void gtk_tree_view_set_model_realized (GtkTreeView *tree_view); +static void gtk_tree_view_setup_model (GtkTreeView *tree_view); static void gtk_tree_view_realize (GtkWidget *widget); static void gtk_tree_view_unrealize (GtkWidget *widget); static void gtk_tree_view_map (GtkWidget *widget); @@ -224,7 +224,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) GTK_SIGNAL_OFFSET (GtkTreeViewClass, set_scroll_adjustments), gtk_marshal_VOID__POINTER_POINTER, GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_POINTER); + GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); } static void @@ -232,13 +232,12 @@ gtk_tree_view_init (GtkTreeView *tree_view) { tree_view->priv = g_new0 (GtkTreeViewPrivate, 1); - GTK_WIDGET_UNSET_FLAGS (tree_view, GTK_NO_WINDOW); GTK_WIDGET_SET_FLAGS (tree_view, GTK_CAN_FOCUS); tree_view->priv->flags = GTK_TREE_VIEW_IS_LIST | GTK_TREE_VIEW_SHOW_EXPANDERS | GTK_TREE_VIEW_DRAW_KEYFOCUS | GTK_TREE_VIEW_HEADERS_VISIBLE; tree_view->priv->tab_offset = TREE_VIEW_EXPANDER_WIDTH; - tree_view->priv->columns = 0; - tree_view->priv->column = NULL; + tree_view->priv->n_columns = 0; + tree_view->priv->columns = NULL; tree_view->priv->button_pressed_node = NULL; tree_view->priv->button_pressed_tree = NULL; tree_view->priv->prelight_node = NULL; @@ -264,9 +263,9 @@ gtk_tree_view_realize_buttons (GtkTreeView *tree_view) GdkWindowAttr attr; guint attributes_mask; - if (!GTK_WIDGET_REALIZED (tree_view) || tree_view->priv->header_window == NULL) - return; - + g_return_if_fail (GTK_WIDGET_REALIZED (tree_view)); + g_return_if_fail (tree_view->priv->header_window != NULL); + attr.window_type = GDK_WINDOW_CHILD; attr.wclass = GDK_INPUT_ONLY; attr.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view)); @@ -285,7 +284,7 @@ gtk_tree_view_realize_buttons (GtkTreeView *tree_view) attr.width = TREE_VIEW_DRAG_WIDTH; attr.height = tree_view->priv->header_height; - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) { column = list->data; if (column->button) @@ -294,10 +293,11 @@ gtk_tree_view_realize_buttons (GtkTreeView *tree_view) continue; gtk_widget_set_parent_window (column->button, tree_view->priv->header_window); - gtk_widget_show (column->button); attr.x = (column->button->allocation.x + column->button->allocation.width) - 3; + g_return_if_fail (column->window == NULL); + column->window = gdk_window_new (tree_view->priv->header_window, &attr, attributes_mask); gdk_window_set_user_data (column->window, tree_view); @@ -321,7 +321,7 @@ gtk_tree_view_realize (GtkWidget *widget) if (!GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_MODEL_SETUP) && tree_view->priv->model) - gtk_tree_view_set_model_realized (tree_view); + gtk_tree_view_setup_model (tree_view); gtk_tree_view_check_dirty (GTK_TREE_VIEW (widget)); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); @@ -416,6 +416,8 @@ gtk_tree_view_unrealize (GtkWidget *widget) tree_view = GTK_TREE_VIEW (widget); + /* FIXME where do we clear column->window for each column? */ + gdk_window_set_user_data (tree_view->priv->bin_window, NULL); gdk_window_destroy (tree_view->priv->bin_window); tree_view->priv->bin_window = NULL; @@ -425,17 +427,53 @@ gtk_tree_view_unrealize (GtkWidget *widget) tree_view->priv->header_window = NULL; gdk_gc_destroy (tree_view->priv->xor_gc); + + /* GtkWidget::unrealize destroys children and widget->window */ + if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); } static void +gtk_tree_view_map_buttons (GtkTreeView *tree_view) +{ + GList *list; + + g_return_if_fail (GTK_WIDGET_MAPPED (tree_view)); + + if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE)) + { + GtkTreeViewColumn *column; + + for (list = tree_view->priv->columns; list; list = list->next) + { + column = list->data; + if (GTK_WIDGET_VISIBLE (column->button) && + !GTK_WIDGET_MAPPED (column->button)) + gtk_widget_map (column->button); + } + for (list = tree_view->priv->columns; list; list = list->next) + { + column = list->data; + if (column->visible == FALSE) + continue; + if (column->column_type == GTK_TREE_VIEW_COLUMN_RESIZEABLE) + { + gdk_window_raise (column->window); + gdk_window_show (column->window); + } + else + gdk_window_hide (column->window); + } + gdk_window_show (tree_view->priv->header_window); + } +} + +static void gtk_tree_view_map (GtkWidget *widget) { GList *tmp_list; GtkTreeView *tree_view; - GList *list; - GtkTreeViewColumn *column; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TREE_VIEW (widget)); @@ -457,29 +495,34 @@ gtk_tree_view_map (GtkWidget *widget) } } gdk_window_show (tree_view->priv->bin_window); - if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE)) + + gtk_tree_view_map_buttons (tree_view); + + gdk_window_show (widget->window); +} + +static void +gtk_tree_view_size_request_buttons (GtkTreeView *tree_view) +{ + GList *list; + + tree_view->priv->header_height = 1; + + if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_MODEL_SETUP)) { - for (list = tree_view->priv->column; list; list = list->next) - { - column = list->data; - gtk_widget_map (column->button); - } - for (list = tree_view->priv->column; list; list = list->next) - { - column = list->data; - if (column->visible == FALSE) - continue; - if (column->column_type == GTK_TREE_VIEW_COLUMN_RESIZEABLE) - { - gdk_window_raise (column->window); - gdk_window_show (column->window); - } - else - gdk_window_hide (column->window); - } - gdk_window_show (tree_view->priv->header_window); + for (list = tree_view->priv->columns; list; list = list->next) + { + GtkRequisition requisition; + GtkTreeViewColumn *column; + + column = list->data; + + gtk_widget_size_request (column->button, &requisition); + + column->size = MAX (column->size, requisition.width); + tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height); + } } - gdk_window_show (widget->window); } static void @@ -506,8 +549,11 @@ gtk_tree_view_size_request (GtkWidget *widget, tmp_list = tmp_list->next; - gtk_widget_size_request (child->widget, &child_requisition); + if (GTK_WIDGET_VISIBLE (child->widget)) + gtk_widget_size_request (child->widget, &child_requisition); } + + gtk_tree_view_size_request_buttons (tree_view); } static void @@ -525,7 +571,7 @@ gtk_tree_view_size_allocate_buttons (GtkWidget *widget) allocation.y = 0; allocation.height = tree_view->priv->header_height; - for (last_column = g_list_last (tree_view->priv->column); + for (last_column = g_list_last (tree_view->priv->columns); last_column && !(GTK_TREE_VIEW_COLUMN (last_column->data)->visible); last_column = last_column->prev) ; @@ -533,7 +579,7 @@ gtk_tree_view_size_allocate_buttons (GtkWidget *widget) if (last_column == NULL) return; - for (list = tree_view->priv->column; list != last_column; list = list->next) + for (list = tree_view->priv->columns; list != last_column; list = list->next) { column = list->data; @@ -546,16 +592,19 @@ gtk_tree_view_size_allocate_buttons (GtkWidget *widget) gtk_widget_size_allocate (column->button, &allocation); if (column->window) - gdk_window_move (column->window, width - TREE_VIEW_DRAG_WIDTH/2, 0); + gdk_window_move_resize (column->window, + width - TREE_VIEW_DRAG_WIDTH/2, allocation.y, + TREE_VIEW_DRAG_WIDTH, allocation.height); } column = list->data; allocation.x = width; allocation.width = MAX (widget->allocation.width, tree_view->priv->width) - width; gtk_widget_size_allocate (column->button, &allocation); if (column->window) - gdk_window_move (column->window, - allocation.x +allocation.width - TREE_VIEW_DRAG_WIDTH/2, - 0); + gdk_window_move_resize (column->window, + allocation.x + allocation.width - TREE_VIEW_DRAG_WIDTH/2, + 0, + TREE_VIEW_DRAG_WIDTH, allocation.height); } static void @@ -602,6 +651,13 @@ gtk_tree_view_size_allocate (GtkWidget *widget, tree_view->priv->header_height); } + /* FIXME I don't think the invariant that the model must be setup + * before touching the buttons is maintained in most of the + * rest of the code, e.g. in realize, so something is wrong + */ + if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_MODEL_SETUP)) + gtk_tree_view_size_allocate_buttons (widget); + tree_view->priv->hadjustment->page_size = allocation->width; tree_view->priv->hadjustment->page_increment = allocation->width / 2; tree_view->priv->hadjustment->lower = 0; @@ -618,9 +674,6 @@ gtk_tree_view_size_allocate (GtkWidget *widget, gtk_adjustment_set_value (tree_view->priv->vadjustment, (gfloat) MAX (tree_view->priv->height - allocation->height, 0)); gtk_signal_emit_by_name (GTK_OBJECT (tree_view->priv->vadjustment), "changed"); - - if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_MODEL_SETUP)) - gtk_tree_view_size_allocate_buttons (widget); } /* Warning: Very scary function. @@ -703,8 +756,8 @@ gtk_tree_view_bin_expose (GtkWidget *widget, x_offset = -event->area.x; cell_offset = 0; - background_area.y = y_offset + event->area.y + TREE_VIEW_VERTICAL_SEPERATOR; - background_area.height = max_height - TREE_VIEW_VERTICAL_SEPERATOR; + background_area.y = y_offset + event->area.y + TREE_VIEW_VERTICAL_SEPARATOR; + background_area.height = max_height - TREE_VIEW_VERTICAL_SEPARATOR; flags = 0; if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PRELIT)) @@ -719,9 +772,9 @@ gtk_tree_view_bin_expose (GtkWidget *widget, GTK_WIDGET (tree_view)->style->bg_gc [GTK_STATE_SELECTED], TRUE, event->area.x, - background_area.y - (last_selected?TREE_VIEW_VERTICAL_SEPERATOR:0), + background_area.y - (last_selected?TREE_VIEW_VERTICAL_SEPARATOR:0), event->area.width, - background_area.height + (last_selected?TREE_VIEW_VERTICAL_SEPERATOR:0)); + background_area.height + (last_selected?TREE_VIEW_VERTICAL_SEPARATOR:0)); last_selected = TRUE; } else @@ -729,7 +782,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget, last_selected = FALSE; } - for (i = 0, list = tree_view->priv->column; i < tree_view->priv->columns; i++, list = list->next) + for (i = 0, list = tree_view->priv->columns; i < tree_view->priv->n_columns; i++, list = list->next) { GtkTreeViewColumn *column = list->data; @@ -876,7 +929,7 @@ gtk_tree_view_motion (GtkWidget *widget, g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE); tree_view = GTK_TREE_VIEW (widget); - + if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE)) { gint x; @@ -903,7 +956,7 @@ gtk_tree_view_motion (GtkWidget *widget, return FALSE; if (tree_view->priv->tree == NULL) return FALSE; - + if (tree_view->priv->prelight_node != NULL) { if ((((gint) event->y - TREE_VIEW_HEADER_HEIGHT (tree_view) < tree_view->priv->prelight_offset) || @@ -958,13 +1011,14 @@ gtk_tree_view_motion (GtkWidget *widget, tree_view->priv->prelight_offset = event->y+y_offset; GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_PRELIT); + /* FIXME */ gtk_widget_queue_draw (widget); return TRUE; } -/* Is this function necessary? Can I get an enter_notify event w/o either - * an expose event or a mouse motion event? +/* FIXME Is this function necessary? Can I get an enter_notify event + * w/o either an expose event or a mouse motion event? */ static gboolean gtk_tree_view_enter_notify (GtkWidget *widget, @@ -1016,6 +1070,7 @@ gtk_tree_view_enter_notify (GtkWidget *widget, tree_view->priv->prelight_offset = event->y+y_offset; GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_PRELIT); + /* FIXME */ gtk_widget_queue_draw (widget); return TRUE; @@ -1039,6 +1094,7 @@ gtk_tree_view_leave_notify (GtkWidget *widget, tree_view->priv->prelight_tree = NULL; tree_view->priv->prelight_offset = 0; GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_ARROW_PRELIT); + /* FIXME */ gtk_widget_queue_draw (widget); } return TRUE; @@ -1105,12 +1161,12 @@ gtk_tree_view_button_press (GtkWidget *widget, /* Get the path and the node */ path = _gtk_tree_view_find_path (tree_view, tree, node); depth = gtk_tree_path_get_depth (path); - background_area.y = y_offset + event->y + TREE_VIEW_VERTICAL_SEPERATOR; - background_area.height = GTK_RBNODE_GET_HEIGHT (node) - TREE_VIEW_VERTICAL_SEPERATOR; + background_area.y = y_offset + event->y + TREE_VIEW_VERTICAL_SEPARATOR; + background_area.height = GTK_RBNODE_GET_HEIGHT (node) - TREE_VIEW_VERTICAL_SEPARATOR; background_area.x = 0; /* Let the cell have a chance at selecting it. */ - for (i = 0, list = tree_view->priv->column; i < tree_view->priv->columns; i++, list = list->next) + for (i = 0, list = tree_view->priv->columns; i < tree_view->priv->n_columns; i++, list = list->next) { GtkTreeViewColumn *column = list->data; GtkCellRenderer *cell; @@ -1182,7 +1238,7 @@ gtk_tree_view_button_press (GtkWidget *widget, return TRUE; } - for (i = 0, list = tree_view->priv->column; list; list = list->next, i++) + for (i = 0, list = tree_view->priv->columns; list; list = list->next, i++) { column = list->data; if (event->window == column->window && @@ -1302,7 +1358,6 @@ gtk_tree_view_button_release (GtkWidget *widget, gtk_tree_path_free (path); _gtk_tree_view_set_size (GTK_TREE_VIEW (widget), -1, -1); - gtk_widget_queue_resize (widget); } tree_view->priv->button_pressed_node = NULL; @@ -1333,6 +1388,7 @@ gtk_tree_view_draw_focus (GtkWidget *widget) if (cursor == NULL) return; + /* FIXME need a style function appropriate for this */ gdk_draw_rectangle (tree_view->priv->bin_window, widget->style->fg_gc[GTK_STATE_NORMAL], FALSE, @@ -1357,7 +1413,8 @@ gtk_tree_view_focus_in (GtkWidget *widget, GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - gtk_widget_draw_focus (widget); + /* FIXME don't redraw so much */ + gtk_widget_queue_draw (widget); return FALSE; } @@ -1373,6 +1430,7 @@ gtk_tree_view_focus_out (GtkWidget *widget, GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); + /* FIXME don't redraw so much */ gtk_widget_queue_draw (widget); return FALSE; @@ -1400,14 +1458,14 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view, focus_child = GTK_CONTAINER (tree_view)->focus_child; container = GTK_CONTAINER (tree_view); - for (last_column = g_list_last (tree_view->priv->column); + for (last_column = g_list_last (tree_view->priv->columns); last_column && !(GTK_TREE_VIEW_COLUMN (last_column->data)->visible) && GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (last_column->data)->button); last_column = last_column->prev) ; - for (first_column = tree_view->priv->column; + for (first_column = tree_view->priv->columns; first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible) && GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (first_column->data)->button); @@ -1508,7 +1566,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view, /* We need to move the focus to the next button. */ if (focus_child) { - for (tmp_list = tree_view->priv->column; tmp_list; tmp_list = tmp_list->next) + for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next) if (GTK_TREE_VIEW_COLUMN (tmp_list->data)->button == focus_child) { if (gtk_container_focus (GTK_CONTAINER (GTK_TREE_VIEW_COLUMN (tmp_list->data)->button), dir)) @@ -1627,6 +1685,7 @@ gtk_tree_view_focus (GtkContainer *container, if (tree_view->priv->cursor) gtk_tree_selection_select_path (tree_view->priv->selection, tree_view->priv->cursor); + /* FIXME make this more efficient */ gtk_widget_queue_draw (GTK_WIDGET (tree_view)); return TRUE; } @@ -1656,6 +1715,7 @@ gtk_tree_view_focus (GtkContainer *container, if (tree_view->priv->cursor) gtk_tree_selection_select_path (tree_view->priv->selection, tree_view->priv->cursor); + /* FIXME make this more efficient */ gtk_widget_queue_draw (GTK_WIDGET (tree_view)); return TRUE; } @@ -1674,6 +1734,7 @@ gtk_tree_view_focus (GtkContainer *container, tree_view->priv->cursor); gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0.0); + /* FIXME make this more efficient */ gtk_widget_queue_draw (GTK_WIDGET (tree_view)); return TRUE; } @@ -1728,11 +1789,9 @@ gtk_tree_view_focus (GtkContainer *container, { GdkModifierType state = 0; - event = gdk_event_peek (); - if (event && event->type == GDK_KEY_PRESS) - /* FIXME: This doesn't seem to work. )-: - * I fear the event may already have been gotten */ - state = ((GdkEventKey *)event)->state; + event = gtk_get_current_event (); + if (event) + gdk_event_get_state (event, &state); if (event) gdk_event_free (event); @@ -1749,6 +1808,7 @@ gtk_tree_view_focus (GtkContainer *container, state); gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node); gtk_widget_grab_focus (GTK_WIDGET (tree_view)); + /* FIXME make this more efficient */ gtk_widget_queue_draw (GTK_WIDGET (tree_view)); return TRUE; } @@ -1827,7 +1887,7 @@ gtk_tree_view_forall (GtkContainer *container, if (include_internals == FALSE) return; - for (tmp_list = tree_view->priv->column; tmp_list; tmp_list = tmp_list->next) + for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next) { column = tmp_list->data; if (column->button) @@ -1835,7 +1895,7 @@ gtk_tree_view_forall (GtkContainer *container, } } -/* TreeModel Methods +/* TreeModel Callbacks */ static void @@ -1869,9 +1929,9 @@ gtk_tree_view_changed (GtkTreeModel *model, gtk_tree_path_get_depth (path), &height); - if (GTK_RBNODE_GET_HEIGHT (node) != height + TREE_VIEW_VERTICAL_SEPERATOR) + if (GTK_RBNODE_GET_HEIGHT (node) != height + TREE_VIEW_VERTICAL_SEPARATOR) { - _gtk_rbtree_node_set_height (tree, node, height + TREE_VIEW_VERTICAL_SEPERATOR); + _gtk_rbtree_node_set_height (tree, node, height + TREE_VIEW_VERTICAL_SEPARATOR); gtk_widget_queue_resize (GTK_WIDGET (data)); return; } @@ -1928,6 +1988,7 @@ gtk_tree_view_inserted (GtkTreeModel *model, } else if (!GTK_RBNODE_FLAG_SET (tmpnode, GTK_RBNODE_IS_PARENT)) { + /* FIXME enforce correct behavior on model, probably */ /* In theory, the model should have emitted child_toggled here. We * try to catch it anyway, just to be safe, in case the model hasn't. */ @@ -2036,7 +2097,7 @@ gtk_tree_view_child_toggled (GtkTreeModel *model, if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS)) { GList *list; - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) if (GTK_TREE_VIEW_COLUMN (list->data)->visible) { GTK_TREE_VIEW_COLUMN (list->data)->dirty = TRUE; @@ -2103,7 +2164,7 @@ gtk_tree_view_deleted (GtkTreeModel *model, } } - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) if (((GtkTreeViewColumn *)list->data)->visible && ((GtkTreeViewColumn *)list->data)->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE) ((GtkTreeViewColumn *)list->data)->dirty = TRUE; @@ -2114,7 +2175,6 @@ gtk_tree_view_deleted (GtkTreeModel *model, _gtk_rbtree_remove_node (tree, node); _gtk_tree_view_set_size (GTK_TREE_VIEW (data), -1, -1); - gtk_widget_queue_resize (data); } /* Internal tree functions */ @@ -2131,7 +2191,7 @@ gtk_tree_view_insert_iter_height (GtkTreeView *tree_view, gint max_height = 0; /* do stuff with node */ - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) { gint height = 0, width = 0; column = list->data; @@ -2148,7 +2208,7 @@ gtk_tree_view_insert_iter_height (GtkTreeView *tree_view, gtk_tree_view_column_set_cell_data (column, tree_view->priv->model, iter); gtk_cell_renderer_get_size (cell, GTK_WIDGET (tree_view), &width, &height); - max_height = MAX (max_height, TREE_VIEW_VERTICAL_SEPERATOR + height); + max_height = MAX (max_height, TREE_VIEW_VERTICAL_SEPARATOR + height); if (first == TRUE && TREE_VIEW_DRAW_EXPANDERS (tree_view)) column->size = MAX (column->size, depth * tree_view->priv->tab_offset + width); @@ -2187,7 +2247,7 @@ gtk_tree_view_build_tree (GtkTreeView *tree_view, { GtkTreeIter child; - if (gtk_tree_model_iter_children (tree_view->priv->model, &child, iter)); + if (gtk_tree_model_iter_children (tree_view->priv->model, &child, iter)) { temp->children = _gtk_rbtree_new (); temp->children->parent_tree = tree; @@ -2228,7 +2288,7 @@ gtk_tree_view_calc_size (GtkTreeView *tree_view, { max_height = 0; /* Do stuff with node */ - for (list = tree_view->priv->column, i = 0; i < tree_view->priv->columns; list = list->next, i++) + for (list = tree_view->priv->columns, i = 0; i < tree_view->priv->n_columns; list = list->next, i++) { gint height = 0, width = 0; column = list->data; @@ -2239,7 +2299,7 @@ gtk_tree_view_calc_size (GtkTreeView *tree_view, gtk_tree_view_column_set_cell_data (column, tree_view->priv->model, iter); cell = column->cell; gtk_cell_renderer_get_size (cell, GTK_WIDGET (tree_view), &width, &height); - max_height = MAX (max_height, TREE_VIEW_VERTICAL_SEPERATOR + height); + max_height = MAX (max_height, TREE_VIEW_VERTICAL_SEPARATOR + height); /* FIXME: I'm getting the width of all nodes here. )-: */ if (column->dirty == FALSE || column->column_type == GTK_TREE_VIEW_COLUMN_FIXED) @@ -2275,7 +2335,7 @@ gtk_tree_view_discover_dirty_iter (GtkTreeView *tree_view, if (height) *height = 0; - for (i = 0, list = tree_view->priv->column; list; list = list->next, i++) + for (i = 0, list = tree_view->priv->columns; list; list = list->next, i++) { gint width; column = list->data; @@ -2337,7 +2397,7 @@ gtk_tree_view_discover_dirty (GtkTreeView *tree_view, do { is_all_dirty = TRUE; - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) { column = list->data; if (column->dirty == FALSE) @@ -2371,7 +2431,7 @@ gtk_tree_view_check_dirty (GtkTreeView *tree_view) GList *list; GtkTreeViewColumn *column; - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) { column = list->data; if (column->dirty) @@ -2397,7 +2457,7 @@ gtk_tree_view_check_dirty (GtkTreeView *tree_view) _gtk_tree_view_set_size (tree_view, -1, -1); } - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) { column = list->data; column->dirty = FALSE; @@ -2411,7 +2471,7 @@ gtk_tree_view_create_button (GtkTreeView *tree_view, GtkWidget *button; GtkTreeViewColumn *column; - column = g_list_nth (tree_view->priv->column, i)->data; + column = g_list_nth (tree_view->priv->columns, i)->data; gtk_widget_push_composite_child (); button = column->button = gtk_button_new (); gtk_widget_pop_composite_child (); @@ -2421,6 +2481,8 @@ gtk_tree_view_create_button (GtkTreeView *tree_view, gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) gtk_tree_view_button_clicked, (gpointer) tree_view); + + gtk_widget_show (button); } static void @@ -2433,7 +2495,7 @@ gtk_tree_view_create_buttons (GtkTreeView *tree_view) GtkTreeViewColumn *column; gint i; - for (list = tree_view->priv->column, i = 0; list; list = list->next, i++) + for (list = tree_view->priv->columns, i = 0; list; list = list->next, i++) { column = list->data; @@ -2461,40 +2523,15 @@ gtk_tree_view_create_buttons (GtkTreeView *tree_view) gtk_widget_show (label); gtk_widget_show (alignment); - gtk_widget_size_request (column->button, &requisition); - - column->size = MAX (column->size, requisition.width); - tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height); } + + gtk_tree_view_size_request_buttons (tree_view); + if (GTK_WIDGET_REALIZED (tree_view)) - { - gtk_tree_view_realize_buttons (tree_view); - if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE)) - { - /* We need to do this twice, as we need to map - * all the buttons before we map the columns */ - for (list = tree_view->priv->column; list; list = list->next) - { - column = list->data; - if (column->visible == FALSE) - continue; - gtk_widget_map (column->button); - } - for (list = tree_view->priv->column; list; list = list->next) - { - column = list->data; - if (column->visible == FALSE) - continue; - if (column->column_type == GTK_TREE_VIEW_COLUMN_RESIZEABLE) - { - gdk_window_raise (column->window); - gdk_window_show (column->window); - } - else - gdk_window_hide (column->window); - } - } - } + gtk_tree_view_realize_buttons (tree_view); + + if (GTK_WIDGET_MAPPED (tree_view)) + gtk_tree_view_map_buttons (tree_view); } static void @@ -2509,13 +2546,13 @@ gtk_tree_view_button_clicked (GtkWidget *widget, tree_view = GTK_TREE_VIEW (data); - /* find the column who's button was pressed */ - for (list = tree_view->priv->column; list; list = list->next) + /* find the column whose button was pressed */ + for (list = tree_view->priv->columns; list; list = list->next) if (GTK_TREE_VIEW_COLUMN (list->data)->button == widget) break; - /* FIXME: - * gtk_signal_emit (GTK_OBJECT (clist), clist_signals[CLICK_COLUMN], i); */ + if (list) + gtk_tree_view_column_clicked (GTK_TREE_VIEW_COLUMN (list->data)); } /* Make sure the node is visible vertically */ @@ -2544,7 +2581,8 @@ gtk_tree_view_clamp_node_visible (GtkTreeView *tree_view, /* This function could be more efficient. * I'll optimize it if profiling seems to imply that - * it's important */ + * it's important + */ GtkTreePath * _gtk_tree_view_find_path (GtkTreeView *tree_view, GtkRBTree *tree, @@ -2640,9 +2678,9 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view, return; area.x = 0; - area.y = offset + TREE_VIEW_VERTICAL_SEPERATOR; + area.y = offset + TREE_VIEW_VERTICAL_SEPARATOR; area.width = tree_view->priv->tab_offset - 2; - area.height = GTK_RBNODE_GET_HEIGHT (node) - TREE_VIEW_VERTICAL_SEPERATOR; + area.height = GTK_RBNODE_GET_HEIGHT (node) - TREE_VIEW_VERTICAL_SEPARATOR; if (node == tree_view->priv->button_pressed_node) { @@ -2683,14 +2721,15 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view, points[2].y = points[0].y + TREE_VIEW_EXPANDER_HEIGHT/2; } + /* FIXME this should be in the theme engine */ + gdk_draw_polygon (tree_view->priv->bin_window, GTK_WIDGET (tree_view)->style->base_gc[state], TRUE, points, 3); gdk_draw_polygon (tree_view->priv->bin_window, GTK_WIDGET (tree_view)->style->fg_gc[state], FALSE, points, 3); - - + /* gtk_paint_arrow (GTK_WIDGET (tree_view)->style, */ /* tree_view->priv->bin_window, */ /* state, */ @@ -2706,13 +2745,17 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view, void _gtk_tree_view_set_size (GtkTreeView *tree_view, - gint width, - gint height) + gint width, + gint height) { GList *list; GtkTreeViewColumn *column; gint i; + if (width == tree_view->priv->width && + height == tree_view->priv->height) + return; + if (tree_view->priv->model == NULL) { tree_view->priv->width = 1; @@ -2722,7 +2765,7 @@ _gtk_tree_view_set_size (GtkTreeView *tree_view, if (width == -1) { width = 0; - for (list = tree_view->priv->column, i = 0; list; list = list->next, i++) + for (list = tree_view->priv->columns, i = 0; list; list = list->next, i++) { column = list->data; if (!column->visible) @@ -2731,7 +2774,7 @@ _gtk_tree_view_set_size (GtkTreeView *tree_view, } } if (height == -1) - height = tree_view->priv->tree->root->offset + TREE_VIEW_VERTICAL_SEPERATOR; + height = tree_view->priv->tree->root->offset + TREE_VIEW_VERTICAL_SEPARATOR; tree_view->priv->width = width; tree_view->priv->height = height; @@ -2758,7 +2801,8 @@ _gtk_tree_view_set_size (GtkTreeView *tree_view, /* this function returns the new width of the column being resized given * the column and x position of the cursor; the x cursor position is passed - * in as a pointer and automagicly corrected if it's beyond min/max limits */ + * in as a pointer and automagicly corrected if it's beyond min/max limits + */ static gint gtk_tree_view_new_column_width (GtkTreeView *tree_view, gint i, @@ -2768,9 +2812,10 @@ gtk_tree_view_new_column_width (GtkTreeView *tree_view, gint width; /* first translate the x position from widget->window - * to clist->clist_window */ + * to clist->clist_window + */ - column = g_list_nth (tree_view->priv->column, i)->data; + column = g_list_nth (tree_view->priv->columns, i)->data; width = *x - column->button->allocation.x; /* Clamp down the value */ @@ -2866,7 +2911,7 @@ gtk_tree_view_get_model (GtkTreeView *tree_view) } static void -gtk_tree_view_set_model_realized (GtkTreeView *tree_view) +gtk_tree_view_setup_model (GtkTreeView *tree_view) { GtkTreePath *path; GtkTreeIter iter; @@ -2890,7 +2935,7 @@ gtk_tree_view_set_model_realized (GtkTreeView *tree_view) gtk_tree_view_deleted, tree_view); - if (tree_view->priv->column == NULL) + if (tree_view->priv->columns == NULL) return; path = gtk_tree_path_new_root (); @@ -2926,7 +2971,7 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, if (tree_view->priv->model != NULL) { - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) { column = list->data; if (column->button) @@ -2953,8 +2998,8 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, _gtk_rbtree_free (tree_view->priv->tree); } - g_list_free (tree_view->priv->column); - tree_view->priv->column = NULL; + g_list_free (tree_view->priv->columns); + tree_view->priv->columns = NULL; GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_MODEL_SETUP); } @@ -2962,16 +3007,15 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, if (model == NULL) { tree_view->priv->tree = NULL; - tree_view->priv->columns = 0; - tree_view->priv->column = NULL; + tree_view->priv->n_columns = 0; + tree_view->priv->columns = NULL; if (GTK_WIDGET_REALIZED (tree_view)) _gtk_tree_view_set_size (tree_view, 0, 0); return; } - - if (GTK_WIDGET_REALIZED (tree_view)) + else if (GTK_WIDGET_REALIZED (tree_view)) { - gtk_tree_view_set_model_realized (tree_view); + gtk_tree_view_setup_model (tree_view); _gtk_tree_view_set_size (tree_view, -1, -1); } } @@ -3011,6 +3055,9 @@ gtk_tree_view_get_hadjustment (GtkTreeView *tree_view) g_return_val_if_fail (tree_view != NULL, NULL); g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL); + if (tree_view->priv->hadjustment == NULL) + gtk_tree_view_set_hadjustment (tree_view, NULL); + return tree_view->priv->hadjustment; } @@ -3048,6 +3095,9 @@ gtk_tree_view_get_vadjustment (GtkTreeView *tree_view) g_return_val_if_fail (tree_view != NULL, NULL); g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL); + if (tree_view->priv->vadjustment == NULL) + gtk_tree_view_set_vadjustment (tree_view, NULL); + return tree_view->priv->vadjustment; } @@ -3175,6 +3225,8 @@ gtk_tree_view_set_headers_visible (GtkTreeView *tree_view, g_return_if_fail (tree_view != NULL); g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); + headers_visible = !! headers_visible; + if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE) == headers_visible) return; @@ -3189,31 +3241,15 @@ gtk_tree_view_set_headers_visible (GtkTreeView *tree_view, if (headers_visible) { gdk_window_move_resize (tree_view->priv->bin_window, x, y, tree_view->priv->width, tree_view->priv->height + TREE_VIEW_HEADER_HEIGHT (tree_view)); - for (list = tree_view->priv->column; list; list = list->next) - { - column = list->data; - gtk_widget_map (column->button); - } - - for (list = tree_view->priv->column; list; list = list->next) - { - column = list->data; - if (column->visible == FALSE) - continue; - if (column->column_type == GTK_TREE_VIEW_COLUMN_RESIZEABLE) - { - gdk_window_raise (column->window); - gdk_window_show (column->window); - } - else - gdk_window_hide (column->window); - } - gdk_window_show (tree_view->priv->header_window); + + if (GTK_WIDGET_MAPPED (tree_view)) + gtk_tree_view_map_buttons (tree_view); } else { gdk_window_move_resize (tree_view->priv->bin_window, x, y, tree_view->priv->width, tree_view->priv->height); - for (list = tree_view->priv->column; list; list = list->next) + + for (list = tree_view->priv->columns; list; list = list->next) { column = list->data; gtk_widget_unmap (column->button); @@ -3248,7 +3284,7 @@ gtk_tree_view_columns_autosize (GtkTreeView *tree_view) g_return_if_fail (tree_view != NULL); g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) { column = list->data; if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE) @@ -3261,6 +3297,9 @@ gtk_tree_view_columns_autosize (GtkTreeView *tree_view) gtk_widget_queue_resize (GTK_WIDGET (tree_view)); } +/* FIXME let's rename this to be "interactive" or something, + * "active" is confusing since it also is a widget state + */ /** * gtk_tree_view_set_headers_active: * @tree_view: A #GtkTreeView. @@ -3278,7 +3317,7 @@ gtk_tree_view_set_headers_active (GtkTreeView *tree_view, g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); g_return_if_fail (tree_view->priv->model != NULL); - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) gtk_tree_view_column_set_header_active (GTK_TREE_VIEW_COLUMN (list->data), active); } @@ -3289,7 +3328,7 @@ gtk_tree_view_set_headers_active (GtkTreeView *tree_view, * * Appends @column to the list of columns. * - * Return value: The number of columns in @tree_view. + * Return value: The number of columns in @tree_view after appending. **/ gint gtk_tree_view_append_column (GtkTreeView *tree_view, @@ -3302,10 +3341,15 @@ gtk_tree_view_append_column (GtkTreeView *tree_view, g_return_val_if_fail (column->tree_view == NULL, -1); g_object_ref (G_OBJECT (column)); - tree_view->priv->column = g_list_append (tree_view->priv->column, - column); + tree_view->priv->columns = g_list_append (tree_view->priv->columns, + column); column->tree_view = GTK_WIDGET (tree_view); - return tree_view->priv->columns++; + + tree_view->priv->n_columns++; + + /* FIXME create header for the new column! */ + + return tree_view->priv->n_columns; } @@ -3316,7 +3360,7 @@ gtk_tree_view_append_column (GtkTreeView *tree_view, * * Removes @column from @tree_view. * - * Return value: The number of columns in @tree_view. + * Return value: The number of columns in @tree_view after removing. **/ gint gtk_tree_view_remove_column (GtkTreeView *tree_view, @@ -3328,14 +3372,17 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view, g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1); g_return_val_if_fail (column->tree_view == GTK_WIDGET (tree_view), -1); - tree_view->priv->column = g_list_remove (tree_view->priv->column, + tree_view->priv->columns = g_list_remove (tree_view->priv->columns, column); column->tree_view = NULL; g_object_unref (G_OBJECT (column)); - return tree_view->priv->columns--; -} + tree_view->priv->n_columns--; + /* FIXME destroy header for the column! */ + + return tree_view->priv->n_columns; +} /** * gtk_tree_view_insert_column: @@ -3345,7 +3392,7 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view, * * This inserts the @column into the @tree_view at @position. * - * Return value: The number of columns in @tree_view. + * Return value: The number of columns in @tree_view after insertion. **/ gint gtk_tree_view_insert_column (GtkTreeView *tree_view, @@ -3359,10 +3406,15 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view, g_return_val_if_fail (column->tree_view == NULL, -1); g_object_ref (G_OBJECT (column)); - tree_view->priv->column = g_list_insert (tree_view->priv->column, + tree_view->priv->columns = g_list_insert (tree_view->priv->columns, column, position); column->tree_view = GTK_WIDGET (tree_view); - return tree_view->priv->columns++; + + tree_view->priv->n_columns++; + + /* FIXME create header for the column! */ + + return tree_view->priv->n_columns; } /** @@ -3382,12 +3434,14 @@ gtk_tree_view_get_column (GtkTreeView *tree_view, g_return_val_if_fail (tree_view != NULL, NULL); g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL); g_return_val_if_fail (tree_view->priv->model != NULL, NULL); - g_return_val_if_fail (n >= 0 || n < tree_view->priv->columns, NULL); - if (tree_view->priv->column == NULL) + if (n < 0 || n >= tree_view->priv->n_columns) + return NULL; + + if (tree_view->priv->columns == NULL) return NULL; - return GTK_TREE_VIEW_COLUMN (g_list_nth (tree_view->priv->column, n)->data); + return GTK_TREE_VIEW_COLUMN (g_list_nth (tree_view->priv->columns, n)->data); } /** @@ -3398,12 +3452,14 @@ gtk_tree_view_get_column (GtkTreeView *tree_view, * @row_align: The vertical alignment of the row specified by @path. * @col_align: The horizontal alignment of the column specified by @column. * - * Moves the alignments of @tree_view to the position specified by @column and - * @path. If @column is NULL, then the first visible column is assumed, and the - * @tree_view is left justified. Likewise, if @path is NULL the first row is - * assumed, and the @tree_view is top justified. @row_align determines where - * the @row is placed, and @col_align determines where @column is placed. Both - * are expected to be between 0.0 and 1.0. + * Moves the alignments of @tree_view to the position specified by + * @column and @path. If @column is NULL, then the first visible + * column is assumed, and the @tree_view is left justified. Likewise, + * if @path is NULL the first row is assumed, and the @tree_view is + * top justified. @row_align determines where the row is placed, and + * @col_align determines where @column is placed. Both are expected + * to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means + * right/bottom alignment, 0.5 means center. **/ void gtk_tree_view_move_to (GtkTreeView *tree_view, @@ -3490,7 +3546,7 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view, GtkTreeViewColumn *last_column = NULL; GList *list; - for (list = tree_view->priv->column; list; list = list->next) + for (list = tree_view->priv->columns; list; list = list->next) { tmp_column = list->data; @@ -3636,10 +3692,25 @@ gtk_tree_view_collapse_all (GtkTreeView *tree_view) gtk_tree_view_collapse_all_helper, tree_view); - if (GTK_WIDGET_REALIZED (tree_view)) + if (GTK_WIDGET_MAPPED (tree_view)) gtk_widget_queue_draw (GTK_WIDGET (tree_view)); } +/* FIXME the bool return values for expand_row and collapse_row are + * not analagous; they should be TRUE if the row had children and + * was not already in the requested state. + */ + +/** + * gtk_tree_view_expand_row: + * @tree_view: a #GtkTreeView + * @path: path to a row + * @open_all: whether to recursively expand, or just expand immediate children + * + * Opens the row so its children are visible + * + * Return value: %TRUE if the row existed and had children + **/ gboolean gtk_tree_view_expand_row (GtkTreeView *tree_view, GtkTreePath *path, @@ -3677,12 +3748,21 @@ gtk_tree_view_expand_row (GtkTreeView *tree_view, open_all, GTK_WIDGET_REALIZED (tree_view)); - if (GTK_WIDGET_REALIZED (tree_view)) + if (GTK_WIDGET_MAPPED (tree_view)) gtk_widget_queue_draw (GTK_WIDGET (tree_view)); return TRUE; } +/** + * gtk_tree_view_collapse_row: + * @tree_view: a #GtkTreeView + * @path: path to a row in the @tree_view + * + * Collapses a row (hides its child rows). + * + * Return value: %TRUE if the row was expanded + **/ gboolean gtk_tree_view_collapse_row (GtkTreeView *tree_view, GtkTreePath *path) @@ -3712,7 +3792,7 @@ gtk_tree_view_collapse_row (GtkTreeView *tree_view, gtk_tree_path_get_depth (path)); _gtk_rbtree_remove (node->children); - if (GTK_WIDGET_REALIZED (tree_view)) + if (GTK_WIDGET_MAPPED (tree_view)) gtk_widget_queue_draw (GTK_WIDGET (tree_view)); return TRUE; diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index be5b21374..11cd71939 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -607,6 +607,20 @@ gtk_tree_view_column_get_max_width (GtkTreeViewColumn *tree_column) } /** + * gtk_tree_view_column_clicked: + * @tree_column: a #GtkTreeViewColumn + * + * Emits the "clicked" signal on the column. + **/ +void +gtk_tree_view_column_clicked (GtkTreeViewColumn *tree_column) +{ + g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column)); + + gtk_signal_emit (GTK_OBJECT (tree_column), tree_column_signals[CLICKED]); +} + +/** * gtk_tree_view_column_set_title: * @tree_column: A #GtkTreeViewColumn. * @title: The title of the @tree_column. diff --git a/gtk/gtktreeviewcolumn.h b/gtk/gtktreeviewcolumn.h index 148c488ac..8a66a9179 100644 --- a/gtk/gtktreeviewcolumn.h +++ b/gtk/gtktreeviewcolumn.h @@ -114,6 +114,7 @@ void gtk_tree_view_column_set_max_width (GtkTreeViewColumn gint gtk_tree_view_column_get_max_width (GtkTreeViewColumn *tree_column); +void gtk_tree_view_column_clicked (GtkTreeViewColumn *tree_column); /* Options for manipulating the column headers */ |