mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org> Another feature to create truly ugly TreeViews!: style properties for the even/odd colors used for row hinting. (#71595, reported by Owen Taylor). * gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color and odd_row_color style properties. * gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case, (gtk_default_draw_flat_box): rework cell coloring code to support user-provided even/odd row colors. Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org> Cache signal IDs to speed up signal emission. This is a good speedup because GtkTreeModel emits a big number of signals. * gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned by g_signal_new, (gtk_tree_model_row_changed): use g_signal_emit instead of g_signal_emit_by_name, (gtk_tree_model_row_inserted): ditto, (gtk_tree_model_row_has_child_toggled): ditto, (gtk_tree_model_row_deleted): ditto, (gtk_tree_model_rows_reordered): ditto. Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtktreeselection.c (model_changed): new function, (gtk_tree_selection_selected_foreach): monitor changes in the model, bail out if the model has been changed from the foreach func. (#50263, reported by Havoc Pennington). * gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node): free anchor if applicable (#94868, reported and testcase provided by Daniel Elstner).
This commit is contained in:
parent
fbccc0848d
commit
ecb42dc789
38
ChangeLog
38
ChangeLog
@ -1,3 +1,41 @@
|
|||||||
|
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Another feature to create truly ugly TreeViews!: style properties
|
||||||
|
for the even/odd colors used for row hinting. (#71595, reported
|
||||||
|
by Owen Taylor).
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
|
||||||
|
and odd_row_color style properties.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
|
||||||
|
(gtk_default_draw_flat_box): rework cell coloring code to support
|
||||||
|
user-provided even/odd row colors.
|
||||||
|
|
||||||
|
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Cache signal IDs to speed up signal emission. This is a good speedup
|
||||||
|
because GtkTreeModel emits a big number of signals.
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
|
||||||
|
by g_signal_new,
|
||||||
|
(gtk_tree_model_row_changed): use g_signal_emit instead of
|
||||||
|
g_signal_emit_by_name,
|
||||||
|
(gtk_tree_model_row_inserted): ditto,
|
||||||
|
(gtk_tree_model_row_has_child_toggled): ditto,
|
||||||
|
(gtk_tree_model_row_deleted): ditto,
|
||||||
|
(gtk_tree_model_rows_reordered): ditto.
|
||||||
|
|
||||||
|
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (model_changed): new function,
|
||||||
|
(gtk_tree_selection_selected_foreach): monitor changes in the model,
|
||||||
|
bail out if the model has been changed from the foreach func.
|
||||||
|
(#50263, reported by Havoc Pennington).
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||||
|
free anchor if applicable (#94868, reported and testcase provided by
|
||||||
|
Daniel Elstner).
|
||||||
|
|
||||||
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
||||||
|
@ -1,3 +1,41 @@
|
|||||||
|
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Another feature to create truly ugly TreeViews!: style properties
|
||||||
|
for the even/odd colors used for row hinting. (#71595, reported
|
||||||
|
by Owen Taylor).
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
|
||||||
|
and odd_row_color style properties.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
|
||||||
|
(gtk_default_draw_flat_box): rework cell coloring code to support
|
||||||
|
user-provided even/odd row colors.
|
||||||
|
|
||||||
|
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Cache signal IDs to speed up signal emission. This is a good speedup
|
||||||
|
because GtkTreeModel emits a big number of signals.
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
|
||||||
|
by g_signal_new,
|
||||||
|
(gtk_tree_model_row_changed): use g_signal_emit instead of
|
||||||
|
g_signal_emit_by_name,
|
||||||
|
(gtk_tree_model_row_inserted): ditto,
|
||||||
|
(gtk_tree_model_row_has_child_toggled): ditto,
|
||||||
|
(gtk_tree_model_row_deleted): ditto,
|
||||||
|
(gtk_tree_model_rows_reordered): ditto.
|
||||||
|
|
||||||
|
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (model_changed): new function,
|
||||||
|
(gtk_tree_selection_selected_foreach): monitor changes in the model,
|
||||||
|
bail out if the model has been changed from the foreach func.
|
||||||
|
(#50263, reported by Havoc Pennington).
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||||
|
free anchor if applicable (#94868, reported and testcase provided by
|
||||||
|
Daniel Elstner).
|
||||||
|
|
||||||
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
||||||
|
@ -1,3 +1,41 @@
|
|||||||
|
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Another feature to create truly ugly TreeViews!: style properties
|
||||||
|
for the even/odd colors used for row hinting. (#71595, reported
|
||||||
|
by Owen Taylor).
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
|
||||||
|
and odd_row_color style properties.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
|
||||||
|
(gtk_default_draw_flat_box): rework cell coloring code to support
|
||||||
|
user-provided even/odd row colors.
|
||||||
|
|
||||||
|
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Cache signal IDs to speed up signal emission. This is a good speedup
|
||||||
|
because GtkTreeModel emits a big number of signals.
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
|
||||||
|
by g_signal_new,
|
||||||
|
(gtk_tree_model_row_changed): use g_signal_emit instead of
|
||||||
|
g_signal_emit_by_name,
|
||||||
|
(gtk_tree_model_row_inserted): ditto,
|
||||||
|
(gtk_tree_model_row_has_child_toggled): ditto,
|
||||||
|
(gtk_tree_model_row_deleted): ditto,
|
||||||
|
(gtk_tree_model_rows_reordered): ditto.
|
||||||
|
|
||||||
|
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (model_changed): new function,
|
||||||
|
(gtk_tree_selection_selected_foreach): monitor changes in the model,
|
||||||
|
bail out if the model has been changed from the foreach func.
|
||||||
|
(#50263, reported by Havoc Pennington).
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||||
|
free anchor if applicable (#94868, reported and testcase provided by
|
||||||
|
Daniel Elstner).
|
||||||
|
|
||||||
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
||||||
|
@ -1,3 +1,41 @@
|
|||||||
|
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Another feature to create truly ugly TreeViews!: style properties
|
||||||
|
for the even/odd colors used for row hinting. (#71595, reported
|
||||||
|
by Owen Taylor).
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
|
||||||
|
and odd_row_color style properties.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
|
||||||
|
(gtk_default_draw_flat_box): rework cell coloring code to support
|
||||||
|
user-provided even/odd row colors.
|
||||||
|
|
||||||
|
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Cache signal IDs to speed up signal emission. This is a good speedup
|
||||||
|
because GtkTreeModel emits a big number of signals.
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
|
||||||
|
by g_signal_new,
|
||||||
|
(gtk_tree_model_row_changed): use g_signal_emit instead of
|
||||||
|
g_signal_emit_by_name,
|
||||||
|
(gtk_tree_model_row_inserted): ditto,
|
||||||
|
(gtk_tree_model_row_has_child_toggled): ditto,
|
||||||
|
(gtk_tree_model_row_deleted): ditto,
|
||||||
|
(gtk_tree_model_rows_reordered): ditto.
|
||||||
|
|
||||||
|
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (model_changed): new function,
|
||||||
|
(gtk_tree_selection_selected_foreach): monitor changes in the model,
|
||||||
|
bail out if the model has been changed from the foreach func.
|
||||||
|
(#50263, reported by Havoc Pennington).
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||||
|
free anchor if applicable (#94868, reported and testcase provided by
|
||||||
|
Daniel Elstner).
|
||||||
|
|
||||||
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
||||||
|
@ -1,3 +1,41 @@
|
|||||||
|
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Another feature to create truly ugly TreeViews!: style properties
|
||||||
|
for the even/odd colors used for row hinting. (#71595, reported
|
||||||
|
by Owen Taylor).
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
|
||||||
|
and odd_row_color style properties.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
|
||||||
|
(gtk_default_draw_flat_box): rework cell coloring code to support
|
||||||
|
user-provided even/odd row colors.
|
||||||
|
|
||||||
|
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Cache signal IDs to speed up signal emission. This is a good speedup
|
||||||
|
because GtkTreeModel emits a big number of signals.
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
|
||||||
|
by g_signal_new,
|
||||||
|
(gtk_tree_model_row_changed): use g_signal_emit instead of
|
||||||
|
g_signal_emit_by_name,
|
||||||
|
(gtk_tree_model_row_inserted): ditto,
|
||||||
|
(gtk_tree_model_row_has_child_toggled): ditto,
|
||||||
|
(gtk_tree_model_row_deleted): ditto,
|
||||||
|
(gtk_tree_model_rows_reordered): ditto.
|
||||||
|
|
||||||
|
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (model_changed): new function,
|
||||||
|
(gtk_tree_selection_selected_foreach): monitor changes in the model,
|
||||||
|
bail out if the model has been changed from the foreach func.
|
||||||
|
(#50263, reported by Havoc Pennington).
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||||
|
free anchor if applicable (#94868, reported and testcase provided by
|
||||||
|
Daniel Elstner).
|
||||||
|
|
||||||
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
||||||
|
@ -1,3 +1,41 @@
|
|||||||
|
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Another feature to create truly ugly TreeViews!: style properties
|
||||||
|
for the even/odd colors used for row hinting. (#71595, reported
|
||||||
|
by Owen Taylor).
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
|
||||||
|
and odd_row_color style properties.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
|
||||||
|
(gtk_default_draw_flat_box): rework cell coloring code to support
|
||||||
|
user-provided even/odd row colors.
|
||||||
|
|
||||||
|
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Cache signal IDs to speed up signal emission. This is a good speedup
|
||||||
|
because GtkTreeModel emits a big number of signals.
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
|
||||||
|
by g_signal_new,
|
||||||
|
(gtk_tree_model_row_changed): use g_signal_emit instead of
|
||||||
|
g_signal_emit_by_name,
|
||||||
|
(gtk_tree_model_row_inserted): ditto,
|
||||||
|
(gtk_tree_model_row_has_child_toggled): ditto,
|
||||||
|
(gtk_tree_model_row_deleted): ditto,
|
||||||
|
(gtk_tree_model_rows_reordered): ditto.
|
||||||
|
|
||||||
|
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (model_changed): new function,
|
||||||
|
(gtk_tree_selection_selected_foreach): monitor changes in the model,
|
||||||
|
bail out if the model has been changed from the foreach func.
|
||||||
|
(#50263, reported by Havoc Pennington).
|
||||||
|
|
||||||
|
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
|
||||||
|
free anchor if applicable (#94868, reported and testcase provided by
|
||||||
|
Daniel Elstner).
|
||||||
|
|
||||||
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
2002-10-23 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
* gdk/linux-fb/gdkselection-fb.c (gdk_text_property_to_utf8_list_for_display):
|
||||||
|
108
gtk/gtkstyle.c
108
gtk/gtkstyle.c
@ -3340,7 +3340,7 @@ get_darkened_gc (GdkWindow *window,
|
|||||||
gint darken_count)
|
gint darken_count)
|
||||||
{
|
{
|
||||||
GdkColor src = *color;
|
GdkColor src = *color;
|
||||||
GdkColor shaded;
|
GdkColor shaded = *color;
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
|
|
||||||
gc = gdk_gc_new (window);
|
gc = gdk_gc_new (window);
|
||||||
@ -3410,27 +3410,115 @@ gtk_default_draw_flat_box (GtkStyle *style,
|
|||||||
* for that row.
|
* for that row.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* FIXME when we have style properties, clean this up.
|
|
||||||
*/
|
|
||||||
|
|
||||||
else if (!strcmp ("cell_even", detail) ||
|
else if (!strcmp ("cell_even", detail) ||
|
||||||
!strcmp ("cell_odd", detail) ||
|
!strcmp ("cell_odd", detail) ||
|
||||||
!strcmp ("cell_even_ruled", detail))
|
!strcmp ("cell_even_ruled", detail))
|
||||||
{
|
{
|
||||||
gc1 = style->base_gc[state_type];
|
GdkColor *color = NULL;
|
||||||
|
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"even_row_color", &color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
freeme = get_darkened_gc (window, color, 0);
|
||||||
|
gc1 = freeme;
|
||||||
|
|
||||||
|
gdk_color_free (color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gc1 = style->base_gc[state_type];
|
||||||
}
|
}
|
||||||
|
else if (!strcmp ("cell_odd_ruled", detail))
|
||||||
|
{
|
||||||
|
GdkColor *color;
|
||||||
|
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"odd_row_color", &color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
freeme = get_darkened_gc (window, color, 0);
|
||||||
|
gc1 = freeme;
|
||||||
|
|
||||||
|
gdk_color_free (color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"even_row_color", &color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
freeme = get_darkened_gc (window, color, 1);
|
||||||
|
gdk_color_free (color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
freeme = get_darkened_gc (window, &style->base[state_type], 1);
|
||||||
|
gc1 = freeme;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!strcmp ("cell_even_sorted", detail) ||
|
else if (!strcmp ("cell_even_sorted", detail) ||
|
||||||
!strcmp ("cell_odd_sorted", detail) ||
|
!strcmp ("cell_odd_sorted", detail) ||
|
||||||
!strcmp ("cell_odd_ruled", detail) ||
|
|
||||||
!strcmp ("cell_even_ruled_sorted", detail))
|
!strcmp ("cell_even_ruled_sorted", detail))
|
||||||
{
|
{
|
||||||
freeme = get_darkened_gc (window, &style->base[state_type], 1);
|
GdkColor *color = NULL;
|
||||||
gc1 = freeme;
|
|
||||||
|
if (!strcmp ("cell_odd_sorted", detail))
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"odd_row_color", &color,
|
||||||
|
NULL);
|
||||||
|
else
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"even_row_color", &color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
freeme = get_darkened_gc (window, color, 1);
|
||||||
|
gc1 = freeme;
|
||||||
|
|
||||||
|
gdk_color_free (color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
freeme = get_darkened_gc (window, &style->base[state_type], 1);
|
||||||
|
gc1 = freeme;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp ("cell_odd_ruled_sorted", detail))
|
else if (!strcmp ("cell_odd_ruled_sorted", detail))
|
||||||
{
|
{
|
||||||
freeme = get_darkened_gc (window, &style->base[state_type], 2);
|
GdkColor *color = NULL;
|
||||||
gc1 = freeme;
|
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"odd_row_color", &color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
freeme = get_darkened_gc (window, color, 1);
|
||||||
|
gc1 = freeme;
|
||||||
|
|
||||||
|
gdk_color_free (color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
|
"even_row_color", &color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
freeme = get_darkened_gc (window, color, 2);
|
||||||
|
gdk_color_free (color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
freeme = get_darkened_gc (window, &style->base[state_type], 2);
|
||||||
|
gc1 = freeme;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gc1 = style->bg_gc[state_type];
|
gc1 = style->bg_gc[state_type];
|
||||||
|
@ -37,6 +37,18 @@
|
|||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ROW_CHANGED,
|
||||||
|
ROW_INSERTED,
|
||||||
|
ROW_HAS_CHILD_TOGGLED,
|
||||||
|
ROW_DELETED,
|
||||||
|
ROWS_REORDERED,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint tree_model_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
|
||||||
struct _GtkTreePath
|
struct _GtkTreePath
|
||||||
{
|
{
|
||||||
gint depth;
|
gint depth;
|
||||||
@ -83,51 +95,56 @@ gtk_tree_model_base_init (gpointer g_class)
|
|||||||
|
|
||||||
if (! initialized)
|
if (! initialized)
|
||||||
{
|
{
|
||||||
g_signal_new ("row_changed",
|
tree_model_signals[ROW_CHANGED] =
|
||||||
GTK_TYPE_TREE_MODEL,
|
g_signal_new ("row_changed",
|
||||||
G_SIGNAL_RUN_LAST,
|
GTK_TYPE_TREE_MODEL,
|
||||||
G_STRUCT_OFFSET (GtkTreeModelIface, row_changed),
|
G_SIGNAL_RUN_LAST,
|
||||||
NULL, NULL,
|
G_STRUCT_OFFSET (GtkTreeModelIface, row_changed),
|
||||||
_gtk_marshal_VOID__BOXED_BOXED,
|
NULL, NULL,
|
||||||
G_TYPE_NONE, 2,
|
_gtk_marshal_VOID__BOXED_BOXED,
|
||||||
GTK_TYPE_TREE_PATH,
|
G_TYPE_NONE, 2,
|
||||||
GTK_TYPE_TREE_ITER);
|
GTK_TYPE_TREE_PATH,
|
||||||
g_signal_new ("row_inserted",
|
GTK_TYPE_TREE_ITER);
|
||||||
GTK_TYPE_TREE_MODEL,
|
tree_model_signals[ROW_INSERTED] =
|
||||||
G_SIGNAL_RUN_LAST,
|
g_signal_new ("row_inserted",
|
||||||
G_STRUCT_OFFSET (GtkTreeModelIface, row_inserted),
|
GTK_TYPE_TREE_MODEL,
|
||||||
NULL, NULL,
|
G_SIGNAL_RUN_LAST,
|
||||||
_gtk_marshal_VOID__BOXED_BOXED,
|
G_STRUCT_OFFSET (GtkTreeModelIface, row_inserted),
|
||||||
G_TYPE_NONE, 2,
|
NULL, NULL,
|
||||||
GTK_TYPE_TREE_PATH,
|
_gtk_marshal_VOID__BOXED_BOXED,
|
||||||
GTK_TYPE_TREE_ITER);
|
G_TYPE_NONE, 2,
|
||||||
g_signal_new ("row_has_child_toggled",
|
GTK_TYPE_TREE_PATH,
|
||||||
GTK_TYPE_TREE_MODEL,
|
GTK_TYPE_TREE_ITER);
|
||||||
G_SIGNAL_RUN_LAST,
|
tree_model_signals[ROW_HAS_CHILD_TOGGLED] =
|
||||||
G_STRUCT_OFFSET (GtkTreeModelIface, row_has_child_toggled),
|
g_signal_new ("row_has_child_toggled",
|
||||||
NULL, NULL,
|
GTK_TYPE_TREE_MODEL,
|
||||||
_gtk_marshal_VOID__BOXED_BOXED,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_TYPE_NONE, 2,
|
G_STRUCT_OFFSET (GtkTreeModelIface, row_has_child_toggled),
|
||||||
GTK_TYPE_TREE_PATH,
|
NULL, NULL,
|
||||||
GTK_TYPE_TREE_ITER);
|
_gtk_marshal_VOID__BOXED_BOXED,
|
||||||
g_signal_new ("row_deleted",
|
G_TYPE_NONE, 2,
|
||||||
GTK_TYPE_TREE_MODEL,
|
GTK_TYPE_TREE_PATH,
|
||||||
G_SIGNAL_RUN_LAST,
|
GTK_TYPE_TREE_ITER);
|
||||||
G_STRUCT_OFFSET (GtkTreeModelIface, row_deleted),
|
tree_model_signals[ROW_DELETED] =
|
||||||
NULL, NULL,
|
g_signal_new ("row_deleted",
|
||||||
_gtk_marshal_VOID__BOXED,
|
GTK_TYPE_TREE_MODEL,
|
||||||
G_TYPE_NONE, 1,
|
G_SIGNAL_RUN_LAST,
|
||||||
GTK_TYPE_TREE_PATH);
|
G_STRUCT_OFFSET (GtkTreeModelIface, row_deleted),
|
||||||
g_signal_new ("rows_reordered",
|
NULL, NULL,
|
||||||
GTK_TYPE_TREE_MODEL,
|
_gtk_marshal_VOID__BOXED,
|
||||||
G_SIGNAL_RUN_LAST,
|
G_TYPE_NONE, 1,
|
||||||
G_STRUCT_OFFSET (GtkTreeModelIface, rows_reordered),
|
GTK_TYPE_TREE_PATH);
|
||||||
NULL, NULL,
|
tree_model_signals[ROWS_REORDERED] =
|
||||||
_gtk_marshal_VOID__BOXED_BOXED_POINTER,
|
g_signal_new ("rows_reordered",
|
||||||
G_TYPE_NONE, 3,
|
GTK_TYPE_TREE_MODEL,
|
||||||
GTK_TYPE_TREE_PATH,
|
G_SIGNAL_RUN_LAST,
|
||||||
GTK_TYPE_TREE_ITER,
|
G_STRUCT_OFFSET (GtkTreeModelIface, rows_reordered),
|
||||||
G_TYPE_POINTER);
|
NULL, NULL,
|
||||||
|
_gtk_marshal_VOID__BOXED_BOXED_POINTER,
|
||||||
|
G_TYPE_NONE, 3,
|
||||||
|
GTK_TYPE_TREE_PATH,
|
||||||
|
GTK_TYPE_TREE_ITER,
|
||||||
|
G_TYPE_POINTER);
|
||||||
initialized = TRUE;
|
initialized = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1164,7 +1181,7 @@ gtk_tree_model_row_changed (GtkTreeModel *tree_model,
|
|||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (iter != NULL);
|
g_return_if_fail (iter != NULL);
|
||||||
|
|
||||||
g_signal_emit_by_name (tree_model, "row_changed", path, iter);
|
g_signal_emit (tree_model, tree_model_signals[ROW_CHANGED], NULL, path, iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1184,7 +1201,7 @@ gtk_tree_model_row_inserted (GtkTreeModel *tree_model,
|
|||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (iter != NULL);
|
g_return_if_fail (iter != NULL);
|
||||||
|
|
||||||
g_signal_emit_by_name (tree_model, "row_inserted", path, iter);
|
g_signal_emit (tree_model, tree_model_signals[ROW_INSERTED], NULL, path, iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1205,7 +1222,7 @@ gtk_tree_model_row_has_child_toggled (GtkTreeModel *tree_model,
|
|||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (iter != NULL);
|
g_return_if_fail (iter != NULL);
|
||||||
|
|
||||||
g_signal_emit_by_name (tree_model, "row_has_child_toggled", path, iter);
|
g_signal_emit (tree_model, tree_model_signals[ROW_HAS_CHILD_TOGGLED], NULL, path, iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1225,7 +1242,7 @@ gtk_tree_model_row_deleted (GtkTreeModel *tree_model,
|
|||||||
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
|
|
||||||
g_signal_emit_by_name (tree_model, "row_deleted", path);
|
g_signal_emit (tree_model, tree_model_signals[ROW_DELETED], NULL, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1249,7 +1266,7 @@ gtk_tree_model_rows_reordered (GtkTreeModel *tree_model,
|
|||||||
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
||||||
g_return_if_fail (new_order != NULL);
|
g_return_if_fail (new_order != NULL);
|
||||||
|
|
||||||
g_signal_emit_by_name (tree_model, "rows_reordered", path, iter, new_order);
|
g_signal_emit (tree_model, tree_model_signals[ROWS_REORDERED], NULL, path, iter, new_order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -580,6 +580,15 @@ gtk_tree_selection_count_selected_rows (GtkTreeSelection *selection)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* gtk_tree_selection_selected_foreach helper */
|
||||||
|
static void
|
||||||
|
model_changed (gpointer data)
|
||||||
|
{
|
||||||
|
gboolean *stop = (gboolean *)data;
|
||||||
|
|
||||||
|
*stop = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_tree_selection_selected_foreach:
|
* gtk_tree_selection_selected_foreach:
|
||||||
* @selection: A #GtkTreeSelection.
|
* @selection: A #GtkTreeSelection.
|
||||||
@ -600,6 +609,9 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
|
|||||||
GtkRBNode *node;
|
GtkRBNode *node;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
guint inserted_id, deleted_id, reordered_id;
|
||||||
|
gboolean stop = FALSE, has_next = FALSE, has_parent = FALSE;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
||||||
g_return_if_fail (selection->tree_view != NULL);
|
g_return_if_fail (selection->tree_view != NULL);
|
||||||
g_return_if_fail (selection->tree_view->priv->model != NULL);
|
g_return_if_fail (selection->tree_view->priv->model != NULL);
|
||||||
@ -628,6 +640,20 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
|
|||||||
while (node->left != tree->nil)
|
while (node->left != tree->nil)
|
||||||
node = node->left;
|
node = node->left;
|
||||||
|
|
||||||
|
/* connect to signals to monitor changes in treemodel */
|
||||||
|
inserted_id = g_signal_connect_swapped (selection->tree_view->priv->model,
|
||||||
|
"row_inserted",
|
||||||
|
G_CALLBACK (model_changed),
|
||||||
|
&stop);
|
||||||
|
deleted_id = g_signal_connect_swapped (selection->tree_view->priv->model,
|
||||||
|
"row_deleted",
|
||||||
|
G_CALLBACK (model_changed),
|
||||||
|
&stop);
|
||||||
|
reordered_id = g_signal_connect_swapped (selection->tree_view->priv->model,
|
||||||
|
"rows_reordered",
|
||||||
|
G_CALLBACK (model_changed),
|
||||||
|
&stop);
|
||||||
|
|
||||||
/* find the node internally */
|
/* find the node internally */
|
||||||
path = gtk_tree_path_new_first ();
|
path = gtk_tree_path_new_first ();
|
||||||
gtk_tree_model_get_iter (selection->tree_view->priv->model,
|
gtk_tree_model_get_iter (selection->tree_view->priv->model,
|
||||||
@ -637,6 +663,10 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
|
|||||||
{
|
{
|
||||||
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
|
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
|
||||||
(* func) (selection->tree_view->priv->model, path, &iter, data);
|
(* func) (selection->tree_view->priv->model, path, &iter, data);
|
||||||
|
|
||||||
|
if (stop)
|
||||||
|
goto out;
|
||||||
|
|
||||||
if (node->children)
|
if (node->children)
|
||||||
{
|
{
|
||||||
gboolean has_child;
|
gboolean has_child;
|
||||||
@ -649,8 +679,10 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
|
|||||||
tmp = iter;
|
tmp = iter;
|
||||||
has_child = gtk_tree_model_iter_children (selection->tree_view->priv->model, &iter, &tmp);
|
has_child = gtk_tree_model_iter_children (selection->tree_view->priv->model, &iter, &tmp);
|
||||||
gtk_tree_path_append_index (path, 0);
|
gtk_tree_path_append_index (path, 0);
|
||||||
/* Sanity Check! */
|
|
||||||
TREE_VIEW_INTERNAL_ASSERT_VOID (has_child);
|
/* we do the sanity check at the bottom of this function */
|
||||||
|
if (has_child)
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -678,21 +710,47 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
|
|||||||
tree = tree->parent_tree;
|
tree = tree->parent_tree;
|
||||||
if (tree == NULL)
|
if (tree == NULL)
|
||||||
{
|
{
|
||||||
gtk_tree_path_free (path);
|
|
||||||
/* we've run out of tree */
|
/* we've run out of tree */
|
||||||
/* We're done with this function */
|
/* We're done with this function */
|
||||||
return;
|
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
has_parent = gtk_tree_model_iter_parent (selection->tree_view->priv->model, &iter, &tmp_iter);
|
has_parent = gtk_tree_model_iter_parent (selection->tree_view->priv->model, &iter, &tmp_iter);
|
||||||
gtk_tree_path_up (path);
|
gtk_tree_path_up (path);
|
||||||
/* Sanity check */
|
|
||||||
TREE_VIEW_INTERNAL_ASSERT_VOID (has_parent);
|
/* we do the sanity check at the bottom of this function */
|
||||||
|
if (has_parent)
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (!done);
|
while (!done);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (TRUE);
|
while (TRUE);
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (path)
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
|
||||||
|
g_signal_handler_disconnect (selection->tree_view->priv->model,
|
||||||
|
inserted_id);
|
||||||
|
g_signal_handler_disconnect (selection->tree_view->priv->model,
|
||||||
|
deleted_id);
|
||||||
|
g_signal_handler_disconnect (selection->tree_view->priv->model,
|
||||||
|
reordered_id);
|
||||||
|
|
||||||
|
/* check if we have to spew a scary message */
|
||||||
|
if (has_next)
|
||||||
|
TREE_VIEW_INTERNAL_ASSERT_VOID (has_next);
|
||||||
|
if (has_parent)
|
||||||
|
TREE_VIEW_INTERNAL_ASSERT_VOID (has_parent);
|
||||||
|
if (stop)
|
||||||
|
g_warning
|
||||||
|
("The model has been modified from within gtk_tree_selection_foreach.\n"
|
||||||
|
"This function is for observing the selections of the tree only. If\n"
|
||||||
|
"you are trying to get all selected items from the tree, try using\n"
|
||||||
|
"gtk_tree_selection_get_selected_rows instead.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1281,6 +1339,9 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
|
|||||||
if (gtk_tree_selection_real_select_node (selection, tree, node, TRUE))
|
if (gtk_tree_selection_real_select_node (selection, tree, node, TRUE))
|
||||||
{
|
{
|
||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
|
if (selection->tree_view->priv->anchor)
|
||||||
|
gtk_tree_row_reference_free (selection->tree_view->priv->anchor);
|
||||||
|
|
||||||
selection->tree_view->priv->anchor =
|
selection->tree_view->priv->anchor =
|
||||||
gtk_tree_row_reference_new_proxy (G_OBJECT (selection->tree_view), selection->tree_view->priv->model, path);
|
gtk_tree_row_reference_new_proxy (G_OBJECT (selection->tree_view), selection->tree_view->priv->model, path);
|
||||||
}
|
}
|
||||||
|
@ -639,6 +639,20 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
|||||||
TRUE,
|
TRUE,
|
||||||
G_PARAM_READABLE));
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
|
g_param_spec_boxed ("even_row_color",
|
||||||
|
_("Even Row Color"),
|
||||||
|
_("Color to use for even rows"),
|
||||||
|
GDK_TYPE_COLOR,
|
||||||
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
|
g_param_spec_boxed ("odd_row_color",
|
||||||
|
_("Odd Row Color"),
|
||||||
|
_("Color to use for odd rows"),
|
||||||
|
GDK_TYPE_COLOR,
|
||||||
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
widget_class->set_scroll_adjustments_signal =
|
widget_class->set_scroll_adjustments_signal =
|
||||||
g_signal_new ("set_scroll_adjustments",
|
g_signal_new ("set_scroll_adjustments",
|
||||||
|
Loading…
Reference in New Issue
Block a user