forked from AuroraMiddleware/gtk
hack on this a bit
2001-01-05 Havoc Pennington <hp@redhat.com> * tests/testtreeview.c: hack on this a bit * gtk/gtktextlayout.c (gtk_text_layout_class_init): s/GTK_RUN_LAST/G_SIGNAL_RUN_LAST * gtk/gtktreemodelsimple.h (GTK_IS_TREE_MODEL_SIMPLE_CLASS): was spelled incorrectly (GTK_IS_TREE_MODEL_SIMPLE): ditto * gtk/gtktreeview.c (gtk_tree_view_set_headers_clickable): rename from gtk_tree_view_set_headers_active * gtk/gtktexttag.c: (gtk_text_tag_get_property): handle PROP_DIRECTION (gtk_text_tag_set_property): g_object_notify when we toggle the _set properties, bug 40235 * gtk/gtktextiter.c (gtk_text_iter_forward_to_delimiters): rename forward_to_line_end
This commit is contained in:
parent
eb2fdbb176
commit
5c37906778
24
ChangeLog
24
ChangeLog
@ -1,7 +1,29 @@
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* tests/testtreeview.c: hack on this a bit
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_class_init):
|
||||
s/GTK_RUN_LAST/G_SIGNAL_RUN_LAST
|
||||
|
||||
* gtk/gtktreemodelsimple.h (GTK_IS_TREE_MODEL_SIMPLE_CLASS):
|
||||
was spelled incorrectly
|
||||
(GTK_IS_TREE_MODEL_SIMPLE): ditto
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_set_headers_clickable): rename
|
||||
from gtk_tree_view_set_headers_active
|
||||
|
||||
* gtk/gtktexttag.c:
|
||||
(gtk_text_tag_get_property): handle PROP_DIRECTION
|
||||
(gtk_text_tag_set_property): g_object_notify when we toggle the _set
|
||||
properties, bug 40235
|
||||
|
||||
* gtk/gtktextiter.c (gtk_text_iter_forward_to_delimiters): rename
|
||||
forward_to_line_end
|
||||
|
||||
Fri Jan 5 16:16:29 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/{gtkcalender.c,gtkfilesel.c,gtkimcontext.c},
|
||||
modules/input/gtkimcontextxim.c: Adopt to new prototypes
|
||||
modules/input/gtkimcontextxim.c: Adapt to new prototypes
|
||||
for unicode,locale,filename conversion functions.
|
||||
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
@ -1,7 +1,29 @@
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* tests/testtreeview.c: hack on this a bit
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_class_init):
|
||||
s/GTK_RUN_LAST/G_SIGNAL_RUN_LAST
|
||||
|
||||
* gtk/gtktreemodelsimple.h (GTK_IS_TREE_MODEL_SIMPLE_CLASS):
|
||||
was spelled incorrectly
|
||||
(GTK_IS_TREE_MODEL_SIMPLE): ditto
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_set_headers_clickable): rename
|
||||
from gtk_tree_view_set_headers_active
|
||||
|
||||
* gtk/gtktexttag.c:
|
||||
(gtk_text_tag_get_property): handle PROP_DIRECTION
|
||||
(gtk_text_tag_set_property): g_object_notify when we toggle the _set
|
||||
properties, bug 40235
|
||||
|
||||
* gtk/gtktextiter.c (gtk_text_iter_forward_to_delimiters): rename
|
||||
forward_to_line_end
|
||||
|
||||
Fri Jan 5 16:16:29 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/{gtkcalender.c,gtkfilesel.c,gtkimcontext.c},
|
||||
modules/input/gtkimcontextxim.c: Adopt to new prototypes
|
||||
modules/input/gtkimcontextxim.c: Adapt to new prototypes
|
||||
for unicode,locale,filename conversion functions.
|
||||
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
@ -1,7 +1,29 @@
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* tests/testtreeview.c: hack on this a bit
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_class_init):
|
||||
s/GTK_RUN_LAST/G_SIGNAL_RUN_LAST
|
||||
|
||||
* gtk/gtktreemodelsimple.h (GTK_IS_TREE_MODEL_SIMPLE_CLASS):
|
||||
was spelled incorrectly
|
||||
(GTK_IS_TREE_MODEL_SIMPLE): ditto
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_set_headers_clickable): rename
|
||||
from gtk_tree_view_set_headers_active
|
||||
|
||||
* gtk/gtktexttag.c:
|
||||
(gtk_text_tag_get_property): handle PROP_DIRECTION
|
||||
(gtk_text_tag_set_property): g_object_notify when we toggle the _set
|
||||
properties, bug 40235
|
||||
|
||||
* gtk/gtktextiter.c (gtk_text_iter_forward_to_delimiters): rename
|
||||
forward_to_line_end
|
||||
|
||||
Fri Jan 5 16:16:29 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/{gtkcalender.c,gtkfilesel.c,gtkimcontext.c},
|
||||
modules/input/gtkimcontextxim.c: Adopt to new prototypes
|
||||
modules/input/gtkimcontextxim.c: Adapt to new prototypes
|
||||
for unicode,locale,filename conversion functions.
|
||||
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
@ -1,7 +1,29 @@
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* tests/testtreeview.c: hack on this a bit
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_class_init):
|
||||
s/GTK_RUN_LAST/G_SIGNAL_RUN_LAST
|
||||
|
||||
* gtk/gtktreemodelsimple.h (GTK_IS_TREE_MODEL_SIMPLE_CLASS):
|
||||
was spelled incorrectly
|
||||
(GTK_IS_TREE_MODEL_SIMPLE): ditto
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_set_headers_clickable): rename
|
||||
from gtk_tree_view_set_headers_active
|
||||
|
||||
* gtk/gtktexttag.c:
|
||||
(gtk_text_tag_get_property): handle PROP_DIRECTION
|
||||
(gtk_text_tag_set_property): g_object_notify when we toggle the _set
|
||||
properties, bug 40235
|
||||
|
||||
* gtk/gtktextiter.c (gtk_text_iter_forward_to_delimiters): rename
|
||||
forward_to_line_end
|
||||
|
||||
Fri Jan 5 16:16:29 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/{gtkcalender.c,gtkfilesel.c,gtkimcontext.c},
|
||||
modules/input/gtkimcontextxim.c: Adopt to new prototypes
|
||||
modules/input/gtkimcontextxim.c: Adapt to new prototypes
|
||||
for unicode,locale,filename conversion functions.
|
||||
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
@ -1,7 +1,29 @@
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* tests/testtreeview.c: hack on this a bit
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_class_init):
|
||||
s/GTK_RUN_LAST/G_SIGNAL_RUN_LAST
|
||||
|
||||
* gtk/gtktreemodelsimple.h (GTK_IS_TREE_MODEL_SIMPLE_CLASS):
|
||||
was spelled incorrectly
|
||||
(GTK_IS_TREE_MODEL_SIMPLE): ditto
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_set_headers_clickable): rename
|
||||
from gtk_tree_view_set_headers_active
|
||||
|
||||
* gtk/gtktexttag.c:
|
||||
(gtk_text_tag_get_property): handle PROP_DIRECTION
|
||||
(gtk_text_tag_set_property): g_object_notify when we toggle the _set
|
||||
properties, bug 40235
|
||||
|
||||
* gtk/gtktextiter.c (gtk_text_iter_forward_to_delimiters): rename
|
||||
forward_to_line_end
|
||||
|
||||
Fri Jan 5 16:16:29 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/{gtkcalender.c,gtkfilesel.c,gtkimcontext.c},
|
||||
modules/input/gtkimcontextxim.c: Adopt to new prototypes
|
||||
modules/input/gtkimcontextxim.c: Adapt to new prototypes
|
||||
for unicode,locale,filename conversion functions.
|
||||
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
@ -1,7 +1,29 @@
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* tests/testtreeview.c: hack on this a bit
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_class_init):
|
||||
s/GTK_RUN_LAST/G_SIGNAL_RUN_LAST
|
||||
|
||||
* gtk/gtktreemodelsimple.h (GTK_IS_TREE_MODEL_SIMPLE_CLASS):
|
||||
was spelled incorrectly
|
||||
(GTK_IS_TREE_MODEL_SIMPLE): ditto
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_set_headers_clickable): rename
|
||||
from gtk_tree_view_set_headers_active
|
||||
|
||||
* gtk/gtktexttag.c:
|
||||
(gtk_text_tag_get_property): handle PROP_DIRECTION
|
||||
(gtk_text_tag_set_property): g_object_notify when we toggle the _set
|
||||
properties, bug 40235
|
||||
|
||||
* gtk/gtktextiter.c (gtk_text_iter_forward_to_delimiters): rename
|
||||
forward_to_line_end
|
||||
|
||||
Fri Jan 5 16:16:29 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/{gtkcalender.c,gtkfilesel.c,gtkimcontext.c},
|
||||
modules/input/gtkimcontextxim.c: Adopt to new prototypes
|
||||
modules/input/gtkimcontextxim.c: Adapt to new prototypes
|
||||
for unicode,locale,filename conversion functions.
|
||||
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
@ -1,7 +1,29 @@
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* tests/testtreeview.c: hack on this a bit
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_class_init):
|
||||
s/GTK_RUN_LAST/G_SIGNAL_RUN_LAST
|
||||
|
||||
* gtk/gtktreemodelsimple.h (GTK_IS_TREE_MODEL_SIMPLE_CLASS):
|
||||
was spelled incorrectly
|
||||
(GTK_IS_TREE_MODEL_SIMPLE): ditto
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_set_headers_clickable): rename
|
||||
from gtk_tree_view_set_headers_active
|
||||
|
||||
* gtk/gtktexttag.c:
|
||||
(gtk_text_tag_get_property): handle PROP_DIRECTION
|
||||
(gtk_text_tag_set_property): g_object_notify when we toggle the _set
|
||||
properties, bug 40235
|
||||
|
||||
* gtk/gtktextiter.c (gtk_text_iter_forward_to_delimiters): rename
|
||||
forward_to_line_end
|
||||
|
||||
Fri Jan 5 16:16:29 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/{gtkcalender.c,gtkfilesel.c,gtkimcontext.c},
|
||||
modules/input/gtkimcontextxim.c: Adopt to new prototypes
|
||||
modules/input/gtkimcontextxim.c: Adapt to new prototypes
|
||||
for unicode,locale,filename conversion functions.
|
||||
|
||||
2001-01-05 Havoc Pennington <hp@redhat.com>
|
||||
|
@ -2962,7 +2962,7 @@ gtk_text_iter_forward_to_end (GtkTextIter *iter)
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_text_iter_forward_to_delimiters:
|
||||
* gtk_text_iter_forward_to_line_end:
|
||||
* @iter: a #GtkTextIter
|
||||
*
|
||||
* Moves the iterator to point to the paragraph delimiter characters,
|
||||
@ -2975,7 +2975,7 @@ gtk_text_iter_forward_to_end (GtkTextIter *iter)
|
||||
* Return value: %TRUE if we moved and the new location is not the end iterator
|
||||
**/
|
||||
gboolean
|
||||
gtk_text_iter_forward_to_delimiters (GtkTextIter *iter)
|
||||
gtk_text_iter_forward_to_line_end (GtkTextIter *iter)
|
||||
{
|
||||
gint current_offset;
|
||||
gint new_offset;
|
||||
@ -3001,7 +3001,7 @@ gtk_text_iter_forward_to_delimiters (GtkTextIter *iter)
|
||||
* empty lines.
|
||||
*/
|
||||
if (!gtk_text_iter_ends_line (iter))
|
||||
gtk_text_iter_forward_to_delimiters (iter);
|
||||
gtk_text_iter_forward_to_line_end (iter);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -185,7 +185,7 @@ void gtk_text_iter_set_line_offset (GtkTextIter *iter,
|
||||
void gtk_text_iter_set_line_index (GtkTextIter *iter,
|
||||
gint byte_on_line);
|
||||
void gtk_text_iter_forward_to_end (GtkTextIter *iter);
|
||||
gboolean gtk_text_iter_forward_to_delimiters (GtkTextIter *iter);
|
||||
gboolean gtk_text_iter_forward_to_line_end (GtkTextIter *iter);
|
||||
|
||||
|
||||
/* returns TRUE if a toggle was found; NULL for the tag pointer
|
||||
|
@ -174,7 +174,7 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
|
||||
signals[INVALIDATED] =
|
||||
g_signal_newc ("invalidated",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
GTK_RUN_LAST,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkTextLayoutClass, invalidated),
|
||||
NULL,
|
||||
gtk_marshal_VOID__VOID,
|
||||
@ -184,7 +184,7 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
|
||||
signals[CHANGED] =
|
||||
g_signal_newc ("changed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
GTK_RUN_LAST,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkTextLayoutClass, changed),
|
||||
NULL,
|
||||
gtk_marshal_VOID__INT_INT_INT,
|
||||
@ -197,7 +197,7 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
|
||||
signals[ALLOCATE_CHILD] =
|
||||
g_signal_newc ("allocate_child",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
GTK_RUN_LAST,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkTextLayoutClass, allocate_child),
|
||||
NULL,
|
||||
gtk_marshal_VOID__OBJECT_INT_INT,
|
||||
@ -1956,7 +1956,7 @@ line_display_index_to_iter (GtkTextLayout *layout,
|
||||
iter, display->line, 0);
|
||||
|
||||
if (!gtk_text_iter_ends_line (iter))
|
||||
gtk_text_iter_forward_to_delimiters (iter);
|
||||
gtk_text_iter_forward_to_line_end (iter);
|
||||
}
|
||||
|
||||
/* FIXME should this be cursor positions? */
|
||||
|
103
gtk/gtktexttag.c
103
gtk/gtktexttag.c
@ -558,7 +558,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
||||
ADD_SET_PROP ("justify_set", PROP_JUSTIFY_SET,
|
||||
_("Justification set"),
|
||||
_("Whether this tag affects paragraph justification"));
|
||||
|
||||
|
||||
ADD_SET_PROP ("language_set", PROP_LANGUAGE_SET,
|
||||
_("Language set"),
|
||||
_("Whether this tag affects the language the text is rendered as"));
|
||||
@ -683,12 +683,21 @@ set_bg_color (GtkTextTag *tag, GdkColor *color)
|
||||
{
|
||||
if (color)
|
||||
{
|
||||
tag->bg_color_set = TRUE;
|
||||
if (!tag->bg_color_set)
|
||||
{
|
||||
tag->bg_color_set = TRUE;
|
||||
g_object_notify (G_OBJECT (tag), "bg_color_set");
|
||||
}
|
||||
|
||||
tag->values->appearance.bg_color = *color;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag->bg_color_set = FALSE;
|
||||
if (tag->bg_color_set)
|
||||
{
|
||||
tag->bg_color_set = FALSE;
|
||||
g_object_notify (G_OBJECT (tag), "bg_color_set");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -697,12 +706,20 @@ set_fg_color (GtkTextTag *tag, GdkColor *color)
|
||||
{
|
||||
if (color)
|
||||
{
|
||||
tag->fg_color_set = TRUE;
|
||||
if (!tag->fg_color_set)
|
||||
{
|
||||
tag->fg_color_set = TRUE;
|
||||
g_object_notify (G_OBJECT (tag), "fg_color_set");
|
||||
}
|
||||
tag->values->appearance.fg_color = *color;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag->fg_color_set = FALSE;
|
||||
if (tag->fg_color_set)
|
||||
{
|
||||
tag->fg_color_set = FALSE;
|
||||
g_object_notify (G_OBJECT (tag), "fg_color_set");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -734,13 +751,37 @@ set_font_description (GtkTextTag *text_tag,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
text_tag->family_set = FALSE;
|
||||
text_tag->style_set = FALSE;
|
||||
text_tag->variant_set = FALSE;
|
||||
text_tag->weight_set = FALSE;
|
||||
text_tag->stretch_set = FALSE;
|
||||
text_tag->size_set = FALSE;
|
||||
{
|
||||
if (text_tag->family_set)
|
||||
{
|
||||
text_tag->family_set = FALSE;
|
||||
g_object_notify (G_OBJECT (text_tag), "family_set");
|
||||
}
|
||||
if (text_tag->style_set)
|
||||
{
|
||||
text_tag->style_set = FALSE;
|
||||
g_object_notify (G_OBJECT (text_tag), "style_set");
|
||||
}
|
||||
if (text_tag->variant_set)
|
||||
{
|
||||
text_tag->variant_set = FALSE;
|
||||
g_object_notify (G_OBJECT (text_tag), "variant_set");
|
||||
}
|
||||
if (text_tag->weight_set)
|
||||
{
|
||||
text_tag->weight_set = FALSE;
|
||||
g_object_notify (G_OBJECT (text_tag), "weight_set");
|
||||
}
|
||||
if (text_tag->stretch_set)
|
||||
{
|
||||
text_tag->stretch_set = FALSE;
|
||||
g_object_notify (G_OBJECT (text_tag), "stretch_set");
|
||||
}
|
||||
if (text_tag->size_set)
|
||||
{
|
||||
text_tag->size_set = FALSE;
|
||||
g_object_notify (G_OBJECT (text_tag), "size_set");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -806,7 +847,8 @@ gtk_text_tag_set_property (GObject *object,
|
||||
GdkBitmap *bitmap = g_value_get_as_pointer (value);
|
||||
|
||||
text_tag->bg_stipple_set = TRUE;
|
||||
|
||||
g_object_notify (G_OBJECT (text_tag), "bg_stipple_set");
|
||||
|
||||
if (text_tag->values->appearance.bg_stipple != bitmap)
|
||||
{
|
||||
if (bitmap != NULL)
|
||||
@ -825,6 +867,7 @@ gtk_text_tag_set_property (GObject *object,
|
||||
GdkBitmap *bitmap = g_value_get_as_pointer (value);
|
||||
|
||||
text_tag->fg_stipple_set = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "fg_stipple_set");
|
||||
|
||||
if (text_tag->values->appearance.fg_stipple != bitmap)
|
||||
{
|
||||
@ -875,77 +918,90 @@ gtk_text_tag_set_property (GObject *object,
|
||||
g_free (text_tag->values->font.family_name);
|
||||
text_tag->values->font.family_name = g_strdup (g_value_get_string (value));
|
||||
text_tag->family_set = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "family_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_STYLE:
|
||||
text_tag->values->font.style = g_value_get_enum (value);
|
||||
text_tag->style_set = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "style_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_VARIANT:
|
||||
text_tag->values->font.variant = g_value_get_enum (value);
|
||||
text_tag->variant_set = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "variant_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_WEIGHT:
|
||||
text_tag->values->font.weight = g_value_get_int (value);
|
||||
text_tag->weight_set = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "weight_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_STRETCH:
|
||||
text_tag->values->font.stretch = g_value_get_enum (value);
|
||||
text_tag->stretch_set = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "stretch_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_SIZE:
|
||||
text_tag->values->font.size = g_value_get_int (value);
|
||||
text_tag->size_set = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "size_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_SIZE_POINTS:
|
||||
text_tag->values->font.size = g_value_get_double (value) * PANGO_SCALE;
|
||||
text_tag->size_set = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "size_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_PIXELS_ABOVE_LINES:
|
||||
text_tag->pixels_above_lines_set = TRUE;
|
||||
text_tag->values->pixels_above_lines = g_value_get_int (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "pixels_above_lines_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_PIXELS_BELOW_LINES:
|
||||
text_tag->pixels_below_lines_set = TRUE;
|
||||
text_tag->values->pixels_below_lines = g_value_get_int (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "pixels_below_lines_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_PIXELS_INSIDE_WRAP:
|
||||
text_tag->pixels_inside_wrap_set = TRUE;
|
||||
text_tag->values->pixels_inside_wrap = g_value_get_int (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "pixels_inside_wrap_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_EDITABLE:
|
||||
text_tag->editable_set = TRUE;
|
||||
text_tag->values->editable = g_value_get_boolean (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "editable_set");
|
||||
break;
|
||||
|
||||
case PROP_WRAP_MODE:
|
||||
text_tag->wrap_mode_set = TRUE;
|
||||
text_tag->values->wrap_mode = g_value_get_enum (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "wrap_mode_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_JUSTIFY:
|
||||
text_tag->justify_set = TRUE;
|
||||
text_tag->values->justify = g_value_get_enum (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "justify_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
@ -956,45 +1012,53 @@ gtk_text_tag_set_property (GObject *object,
|
||||
case PROP_LEFT_MARGIN:
|
||||
text_tag->left_margin_set = TRUE;
|
||||
text_tag->values->left_margin = g_value_get_int (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "left_margin_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_INDENT:
|
||||
text_tag->indent_set = TRUE;
|
||||
text_tag->values->indent = g_value_get_int (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "indent_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_STRIKETHROUGH:
|
||||
text_tag->strikethrough_set = TRUE;
|
||||
text_tag->values->appearance.strikethrough = g_value_get_boolean (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "strikethrough_set");
|
||||
break;
|
||||
|
||||
case PROP_RIGHT_MARGIN:
|
||||
text_tag->right_margin_set = TRUE;
|
||||
text_tag->values->right_margin = g_value_get_int (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "right_margin_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE:
|
||||
text_tag->underline_set = TRUE;
|
||||
text_tag->values->appearance.underline = g_value_get_enum (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "underline_set");
|
||||
break;
|
||||
|
||||
case PROP_RISE:
|
||||
text_tag->rise_set = TRUE;
|
||||
text_tag->values->appearance.rise = g_value_get_int (value);
|
||||
size_changed = TRUE;
|
||||
g_object_notify (G_OBJECT (text_tag), "rise_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_BG_FULL_HEIGHT:
|
||||
text_tag->bg_full_height_set = TRUE;
|
||||
text_tag->values->bg_full_height = g_value_get_boolean (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "bg_full_height_set");
|
||||
break;
|
||||
|
||||
case PROP_LANGUAGE:
|
||||
text_tag->language_set = TRUE;
|
||||
text_tag->values->language = g_strdup (g_value_get_string (value));
|
||||
g_object_notify (G_OBJECT (text_tag), "language_set");
|
||||
break;
|
||||
|
||||
case PROP_TABS:
|
||||
@ -1007,12 +1071,15 @@ gtk_text_tag_set_property (GObject *object,
|
||||
text_tag->values->tabs =
|
||||
pango_tab_array_copy (g_value_get_as_pointer (value));
|
||||
|
||||
g_object_notify (G_OBJECT (text_tag), "tabs_set");
|
||||
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_INVISIBLE:
|
||||
text_tag->invisible_set = TRUE;
|
||||
text_tag->values->invisible = g_value_get_boolean (value);
|
||||
g_object_notify (G_OBJECT (text_tag), "invisible_set");
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
@ -1106,7 +1173,7 @@ gtk_text_tag_set_property (GObject *object,
|
||||
text_tag->justify_set = g_value_get_boolean (value);
|
||||
size_changed = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case PROP_LEFT_MARGIN_SET:
|
||||
text_tag->left_margin_set = g_value_get_boolean (value);
|
||||
size_changed = TRUE;
|
||||
@ -1300,6 +1367,10 @@ gtk_text_tag_get_property (GObject *object,
|
||||
g_value_set_enum (value, tag->values->justify);
|
||||
break;
|
||||
|
||||
case PROP_DIRECTION:
|
||||
g_value_set_enum (value, tag->values->direction);
|
||||
break;
|
||||
|
||||
case PROP_LEFT_MARGIN:
|
||||
g_value_set_int (value, tag->values->left_margin);
|
||||
break;
|
||||
@ -1406,7 +1477,7 @@ gtk_text_tag_get_property (GObject *object,
|
||||
case PROP_JUSTIFY_SET:
|
||||
g_value_set_boolean (value, tag->justify_set);
|
||||
break;
|
||||
|
||||
|
||||
case PROP_LEFT_MARGIN_SET:
|
||||
g_value_set_boolean (value, tag->left_margin_set);
|
||||
break;
|
||||
|
@ -3317,7 +3317,7 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
||||
|
||||
case GTK_MOVEMENT_PARAGRAPH_ENDS:
|
||||
if (count > 0)
|
||||
gtk_text_iter_forward_to_delimiters (&newplace);
|
||||
gtk_text_iter_forward_to_line_end (&newplace);
|
||||
else if (count < 0)
|
||||
gtk_text_iter_set_line_offset (&newplace, 0);
|
||||
break;
|
||||
@ -3521,7 +3521,7 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view,
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
if (!gtk_text_iter_forward_to_delimiters (&end))
|
||||
if (!gtk_text_iter_forward_to_line_end (&end))
|
||||
break;
|
||||
|
||||
--count;
|
||||
@ -3535,12 +3535,12 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view,
|
||||
if (count > 0)
|
||||
{
|
||||
gtk_text_iter_set_line_offset (&start, 0);
|
||||
gtk_text_iter_forward_to_delimiters (&end);
|
||||
gtk_text_iter_forward_to_line_end (&end);
|
||||
|
||||
/* Do the lines beyond the first. */
|
||||
while (count > 1)
|
||||
{
|
||||
gtk_text_iter_forward_to_delimiters (&end);
|
||||
gtk_text_iter_forward_to_line_end (&end);
|
||||
|
||||
--count;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ gtk_tree_model_simple_changed (GtkTreeModelSimple *simple,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
g_return_if_fail (simple != NULL);
|
||||
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_SIMPLE (simple));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (simple), "changed", path, iter);
|
||||
@ -463,7 +463,7 @@ gtk_tree_model_simple_inserted (GtkTreeModelSimple *simple,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
g_return_if_fail (simple != NULL);
|
||||
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_SIMPLE (simple));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (simple), "inserted", path, iter);
|
||||
@ -475,7 +475,7 @@ gtk_tree_model_simple_child_toggled (GtkTreeModelSimple *simple,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
g_return_if_fail (simple != NULL);
|
||||
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_SIMPLE (simple));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (simple), "child_toggled", path, iter);
|
||||
@ -487,7 +487,7 @@ gtk_tree_model_simple_iter_deleted (GtkTreeModelSimple *simple,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
g_return_if_fail (simple != NULL);
|
||||
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_SIMPLE (simple));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (simple), "iter_deleted", path, iter);
|
||||
|
@ -30,8 +30,8 @@ extern "C" {
|
||||
#define GTK_TYPE_MODEL_SIMPLE (gtk_tree_model_simple_get_type ())
|
||||
#define GTK_TREE_MODEL_SIMPLE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MODEL_SIMPLE, GtkTreeModelSimple))
|
||||
#define GTK_TREE_MODEL_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MODEL_SIMPLE, GtkTreeModelSimpleClass))
|
||||
#define GTK_IS_MODEL_SIMPLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MODEL_SIMPLE))
|
||||
#define GTK_IS_MODEL_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_MODEL_SIMPLE))
|
||||
#define GTK_IS_TREE_MODEL_SIMPLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MODEL_SIMPLE))
|
||||
#define GTK_IS_TREE_MODEL_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_MODEL_SIMPLE))
|
||||
|
||||
typedef struct _GtkTreeModelSimple GtkTreeModelSimple;
|
||||
typedef struct _GtkTreeModelSimpleClass GtkTreeModelSimpleClass;
|
||||
|
@ -3273,15 +3273,15 @@ gtk_tree_view_columns_autosize (GtkTreeView *tree_view)
|
||||
* "active" is confusing since it also is a widget state
|
||||
*/
|
||||
/**
|
||||
* gtk_tree_view_set_headers_active:
|
||||
* gtk_tree_view_set_headers_clickable:
|
||||
* @tree_view: A #GtkTreeView.
|
||||
* @active: TRUE if the columns are active.
|
||||
* @setting: TRUE if the columns are clickable.
|
||||
*
|
||||
* Sets the headers active (eg. keyboard navigable) or inactive.
|
||||
* Allow the column title buttons to be clicked.
|
||||
**/
|
||||
void
|
||||
gtk_tree_view_set_headers_active (GtkTreeView *tree_view,
|
||||
gboolean active)
|
||||
gtk_tree_view_set_headers_clickable (GtkTreeView *tree_view,
|
||||
gboolean setting)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
@ -3290,7 +3290,7 @@ gtk_tree_view_set_headers_active (GtkTreeView *tree_view,
|
||||
g_return_if_fail (tree_view->priv->model != NULL);
|
||||
|
||||
for (list = tree_view->priv->columns; list; list = list->next)
|
||||
gtk_tree_view_column_set_header_clickable (GTK_TREE_VIEW_COLUMN (list->data), active);
|
||||
gtk_tree_view_column_set_header_clickable (GTK_TREE_VIEW_COLUMN (list->data), setting);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,8 +77,8 @@ gboolean gtk_tree_view_get_headers_visible (GtkTreeView *tr
|
||||
void gtk_tree_view_set_headers_visible (GtkTreeView *tree_view,
|
||||
gboolean headers_visible);
|
||||
void gtk_tree_view_columns_autosize (GtkTreeView *tree_view);
|
||||
void gtk_tree_view_set_headers_active (GtkTreeView *tree_view,
|
||||
gboolean active);
|
||||
void gtk_tree_view_set_headers_clickable (GtkTreeView *tree_view,
|
||||
gboolean active);
|
||||
gint gtk_tree_view_append_column (GtkTreeView *tree_view,
|
||||
GtkTreeViewColumn *column);
|
||||
gint gtk_tree_view_remove_column (GtkTreeView *tree_view,
|
||||
|
4
tests/testtreeview-plan.txt
Normal file
4
tests/testtreeview-plan.txt
Normal file
@ -0,0 +1,4 @@
|
||||
This document is a laundry list of stuff to check if you want to
|
||||
verify that GtkTreeView and associated objects are working properly.
|
||||
|
||||
|
@ -2,6 +2,627 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
static GtkWidget* create_prop_editor (GObject *object);
|
||||
|
||||
/* This custom model is to test custom model use. */
|
||||
|
||||
#define GTK_TYPE_MODEL_TYPES (gtk_tree_model_types_get_type ())
|
||||
#define GTK_TREE_MODEL_TYPES(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MODEL_TYPES, GtkTreeModelTypes))
|
||||
#define GTK_TREE_MODEL_TYPES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MODEL_TYPES, GtkTreeModelTypesClass))
|
||||
#define GTK_IS_TREE_MODEL_TYPES(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MODEL_TYPES))
|
||||
#define GTK_IS_TREE_MODEL_TYPES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_MODEL_TYPES))
|
||||
|
||||
typedef struct _GtkTreeModelTypes GtkTreeModelTypes;
|
||||
typedef struct _GtkTreeModelTypesClass GtkTreeModelTypesClass;
|
||||
|
||||
struct _GtkTreeModelTypes
|
||||
{
|
||||
GtkObject parent;
|
||||
|
||||
gint stamp;
|
||||
};
|
||||
|
||||
struct _GtkTreeModelTypesClass
|
||||
{
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
guint (* get_flags) (GtkTreeModel *tree_model);
|
||||
gint (* get_n_columns) (GtkTreeModel *tree_model);
|
||||
GType (* get_column_type) (GtkTreeModel *tree_model,
|
||||
gint index);
|
||||
gboolean (* get_iter) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path);
|
||||
GtkTreePath *(* get_path) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void (* get_value) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
gboolean (* iter_next) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean (* iter_children) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
gboolean (* iter_has_child) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gint (* iter_n_children) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean (* iter_nth_child) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint n);
|
||||
gboolean (* iter_parent) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
void (* ref_iter) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void (* unref_iter) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
/* These will be moved into the GtkTreeModelIface eventually */
|
||||
void (* changed) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter);
|
||||
void (* inserted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter);
|
||||
void (* child_toggled) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter);
|
||||
void (* deleted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path);
|
||||
};
|
||||
|
||||
GtkType gtk_tree_model_types_get_type (void);
|
||||
GtkTreeModelTypes *gtk_tree_model_types_new (void);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MODEL_TYPES,
|
||||
MODEL_LAST
|
||||
} ModelType;
|
||||
|
||||
static GtkTreeModel *models[MODEL_LAST];
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *tv;
|
||||
GtkTreeViewColumn *col;
|
||||
GtkCellRenderer *rend;
|
||||
gint i;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
models[MODEL_TYPES] = GTK_TREE_MODEL (gtk_tree_model_types_new ());
|
||||
|
||||
i = 0;
|
||||
while (i < MODEL_LAST)
|
||||
{
|
||||
window = create_prop_editor (G_OBJECT (models[i]));
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), g_type_name (G_TYPE_FROM_INSTANCE (models[i])));
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
|
||||
tv = gtk_tree_view_new_with_model (models[0]);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), tv);
|
||||
|
||||
rend = gtk_cell_renderer_text_new ();
|
||||
|
||||
col = gtk_tree_view_column_new_with_attributes ("Type ID",
|
||||
rend,
|
||||
"text", 0,
|
||||
NULL);
|
||||
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
|
||||
|
||||
g_object_unref (G_OBJECT (rend));
|
||||
g_object_unref (G_OBJECT (col));
|
||||
|
||||
rend = gtk_cell_renderer_text_new ();
|
||||
|
||||
col = gtk_tree_view_column_new_with_attributes ("Name",
|
||||
rend,
|
||||
"text", 1,
|
||||
NULL);
|
||||
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
|
||||
|
||||
g_object_unref (G_OBJECT (rend));
|
||||
g_object_unref (G_OBJECT (col));
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* GtkTreeModelTypes
|
||||
*/
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
INSERTED,
|
||||
CHILD_TOGGLED,
|
||||
DELETED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static void gtk_tree_model_types_init (GtkTreeModelTypes *model_types);
|
||||
static void gtk_tree_model_types_class_init (GtkTreeModelTypesClass *class);
|
||||
static void gtk_tree_model_types_tree_model_init (GtkTreeModelIface *iface);
|
||||
static gint gtk_real_model_types_get_n_columns (GtkTreeModel *tree_model);
|
||||
static GType gtk_real_model_types_get_column_type (GtkTreeModel *tree_model,
|
||||
gint index);
|
||||
static GtkTreePath *gtk_real_model_types_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static void gtk_real_model_types_get_value (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
static gboolean gtk_real_model_types_iter_next (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static gboolean gtk_real_model_types_iter_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
static gboolean gtk_real_model_types_iter_has_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static gint gtk_real_model_types_iter_n_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static gboolean gtk_real_model_types_iter_nth_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint n);
|
||||
static gboolean gtk_real_model_types_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
|
||||
|
||||
static guint model_types_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
GtkType
|
||||
gtk_tree_model_types_get_type (void)
|
||||
{
|
||||
static GtkType model_types_type = 0;
|
||||
|
||||
if (!model_types_type)
|
||||
{
|
||||
static const GTypeInfo model_types_info =
|
||||
{
|
||||
sizeof (GtkTreeModelTypesClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gtk_tree_model_types_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GtkTreeModelTypes),
|
||||
0,
|
||||
(GInstanceInitFunc) gtk_tree_model_types_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo tree_model_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_tree_model_types_tree_model_init,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
model_types_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkTreeModelTypes", &model_types_info, 0);
|
||||
g_type_add_interface_static (model_types_type,
|
||||
GTK_TYPE_TREE_MODEL,
|
||||
&tree_model_info);
|
||||
}
|
||||
|
||||
return model_types_type;
|
||||
}
|
||||
|
||||
GtkTreeModelTypes *
|
||||
gtk_tree_model_types_new (void)
|
||||
{
|
||||
GtkTreeModelTypes *retval;
|
||||
|
||||
retval = GTK_TREE_MODEL_TYPES (g_object_new (GTK_TYPE_MODEL_TYPES, NULL));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_types_class_init (GtkTreeModelTypesClass *class)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = (GObjectClass*) class;
|
||||
|
||||
model_types_signals[CHANGED] =
|
||||
g_signal_newc ("changed",
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelTypesClass, changed),
|
||||
NULL,
|
||||
gtk_marshal_VOID__BOXED_BOXED,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_POINTER,
|
||||
G_TYPE_POINTER);
|
||||
model_types_signals[INSERTED] =
|
||||
g_signal_newc ("inserted",
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelTypesClass, inserted),
|
||||
NULL,
|
||||
gtk_marshal_VOID__BOXED_BOXED,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_POINTER,
|
||||
G_TYPE_POINTER);
|
||||
model_types_signals[CHILD_TOGGLED] =
|
||||
g_signal_newc ("child_toggled",
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelTypesClass, child_toggled),
|
||||
NULL,
|
||||
gtk_marshal_VOID__BOXED_BOXED,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_POINTER,
|
||||
G_TYPE_POINTER);
|
||||
model_types_signals[DELETED] =
|
||||
g_signal_newc ("deleted",
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelTypesClass, deleted),
|
||||
NULL,
|
||||
gtk_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_types_tree_model_init (GtkTreeModelIface *iface)
|
||||
{
|
||||
iface->get_n_columns = gtk_real_model_types_get_n_columns;
|
||||
iface->get_column_type = gtk_real_model_types_get_column_type;
|
||||
iface->get_path = gtk_real_model_types_get_path;
|
||||
iface->get_value = gtk_real_model_types_get_value;
|
||||
iface->iter_next = gtk_real_model_types_iter_next;
|
||||
iface->iter_children = gtk_real_model_types_iter_children;
|
||||
iface->iter_has_child = gtk_real_model_types_iter_has_child;
|
||||
iface->iter_n_children = gtk_real_model_types_iter_n_children;
|
||||
iface->iter_nth_child = gtk_real_model_types_iter_nth_child;
|
||||
iface->iter_parent = gtk_real_model_types_iter_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_types_init (GtkTreeModelTypes *model_types)
|
||||
{
|
||||
model_types->stamp = g_random_int ();
|
||||
}
|
||||
|
||||
static GType column_types[] = {
|
||||
G_TYPE_STRING, /* GType */
|
||||
G_TYPE_STRING /* type name */
|
||||
};
|
||||
|
||||
static gint
|
||||
gtk_real_model_types_get_n_columns (GtkTreeModel *tree_model)
|
||||
{
|
||||
return G_N_ELEMENTS (column_types);
|
||||
}
|
||||
|
||||
static GType
|
||||
gtk_real_model_types_get_column_type (GtkTreeModel *tree_model,
|
||||
gint index)
|
||||
{
|
||||
g_return_val_if_fail (index < G_N_ELEMENTS (column_types), G_TYPE_INVALID);
|
||||
|
||||
return column_types[index];
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Use default implementation of this */
|
||||
static gboolean
|
||||
gtk_real_model_types_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The toplevel nodes of the tree are the reserved types, G_TYPE_NONE through
|
||||
* G_TYPE_RESERVED_FUNDAMENTAL.
|
||||
*/
|
||||
|
||||
static GtkTreePath *
|
||||
gtk_real_model_types_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreePath *retval;
|
||||
GType type;
|
||||
GType parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_TYPES (tree_model), NULL);
|
||||
g_return_val_if_fail (iter != NULL, NULL);
|
||||
|
||||
type = GPOINTER_TO_INT (iter->user_data);
|
||||
|
||||
retval = gtk_tree_path_new ();
|
||||
|
||||
parent = g_type_parent (type);
|
||||
while (parent != G_TYPE_INVALID)
|
||||
{
|
||||
GType* children = g_type_children (parent, NULL);
|
||||
gint i = 0;
|
||||
|
||||
if (!children || children[0] == G_TYPE_INVALID)
|
||||
{
|
||||
g_warning ("bad iterator?");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (children[i] != type)
|
||||
++i;
|
||||
|
||||
gtk_tree_path_prepend_index (retval, i);
|
||||
|
||||
g_free (children);
|
||||
|
||||
type = parent;
|
||||
parent = g_type_parent (parent);
|
||||
}
|
||||
|
||||
/* The fundamental type itself is the index on the toplevel */
|
||||
gtk_tree_path_prepend_index (retval, type);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_real_model_types_get_value (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value)
|
||||
{
|
||||
GType type;
|
||||
|
||||
type = GPOINTER_TO_INT (iter->user_data);
|
||||
|
||||
switch (column)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
gchar *str;
|
||||
|
||||
g_value_init (value, G_TYPE_STRING);
|
||||
|
||||
str = g_strdup_printf ("%d", type);
|
||||
g_value_set_string (value, str);
|
||||
g_free (str);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
g_value_init (value, G_TYPE_STRING);
|
||||
g_value_set_string (value, g_type_name (type));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Bad column %d requested", column);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_real_model_types_iter_next (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
|
||||
GType parent;
|
||||
GType type;
|
||||
|
||||
type = GPOINTER_TO_INT (iter->user_data);
|
||||
|
||||
parent = g_type_parent (type);
|
||||
|
||||
if (parent == G_TYPE_INVALID)
|
||||
{
|
||||
/* fundamental type, add 1 */
|
||||
if ((type + 1) < G_TYPE_LAST_RESERVED_FUNDAMENTAL)
|
||||
{
|
||||
iter->user_data = GINT_TO_POINTER (type + 1);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GType* children = g_type_children (parent, NULL);
|
||||
gint i = 0;
|
||||
|
||||
g_assert (children != NULL);
|
||||
|
||||
while (children[i] != type)
|
||||
++i;
|
||||
|
||||
++i;
|
||||
|
||||
if (children[i] != G_TYPE_INVALID)
|
||||
{
|
||||
g_free (children);
|
||||
iter->user_data = GINT_TO_POINTER (children[i]);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (children);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_real_model_types_iter_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent)
|
||||
{
|
||||
GType type;
|
||||
GType* children;
|
||||
|
||||
type = GPOINTER_TO_INT (parent->user_data);
|
||||
|
||||
children = g_type_children (type, NULL);
|
||||
|
||||
if (!children || children[0] == G_TYPE_INVALID)
|
||||
{
|
||||
g_free (children);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
iter->user_data = GINT_TO_POINTER (children[0]);
|
||||
g_free (children);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_real_model_types_iter_has_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GType type;
|
||||
GType* children;
|
||||
|
||||
type = GPOINTER_TO_INT (iter->user_data);
|
||||
|
||||
children = g_type_children (type, NULL);
|
||||
|
||||
if (!children || children[0] == G_TYPE_INVALID)
|
||||
{
|
||||
g_free (children);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (children);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_real_model_types_iter_n_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
if (iter == NULL)
|
||||
{
|
||||
return G_TYPE_LAST_RESERVED_FUNDAMENTAL - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
GType type;
|
||||
GType* children;
|
||||
guint n_children = 0;
|
||||
|
||||
type = GPOINTER_TO_INT (iter->user_data);
|
||||
|
||||
children = g_type_children (type, &n_children);
|
||||
|
||||
g_free (children);
|
||||
|
||||
return n_children;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_real_model_types_iter_nth_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint n)
|
||||
{
|
||||
if (parent == NULL)
|
||||
{
|
||||
/* fundamental type */
|
||||
if (n < G_TYPE_LAST_RESERVED_FUNDAMENTAL)
|
||||
{
|
||||
iter->user_data = GINT_TO_POINTER (n);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GType type = GPOINTER_TO_INT (parent->user_data);
|
||||
guint n_children = 0;
|
||||
GType* children = g_type_children (type, &n_children);
|
||||
|
||||
if (n_children == 0)
|
||||
{
|
||||
g_free (children);
|
||||
return FALSE;
|
||||
}
|
||||
else if (n >= n_children)
|
||||
{
|
||||
g_free (children);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
iter->user_data = GINT_TO_POINTER (children[n]);
|
||||
g_free (children);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_real_model_types_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child)
|
||||
{
|
||||
GType type;
|
||||
GType parent;
|
||||
|
||||
type = GPOINTER_TO_INT (child->user_data);
|
||||
|
||||
parent = g_type_parent (type);
|
||||
|
||||
if (parent == G_TYPE_INVALID)
|
||||
{
|
||||
if (type >= G_TYPE_LAST_RESERVED_FUNDAMENTAL)
|
||||
g_warning ("no parent for %d %s\n", type, g_type_name (type));
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
iter->user_data = GINT_TO_POINTER (parent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Property editor thingy
|
||||
*/
|
||||
|
||||
static void
|
||||
get_param_specs (GObject *object,
|
||||
@ -55,7 +676,7 @@ connect_controller (GObject *controller,
|
||||
p->prop = g_strdup (prop_name);
|
||||
|
||||
g_signal_connect_data (controller, signal, func, p,
|
||||
(GDestroyNotify)free_object_property,
|
||||
(GClosureNotify)free_object_property,
|
||||
FALSE, FALSE);
|
||||
}
|
||||
|
||||
@ -142,6 +763,52 @@ bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
|
||||
g_value_unset (&val);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
enum_modified (GtkOptionMenu *om, gpointer data)
|
||||
{
|
||||
ObjectProperty *p = data;
|
||||
gint i;
|
||||
GParamSpec *spec;
|
||||
GEnumClass *eclass;
|
||||
|
||||
spec = g_object_class_find_property (G_OBJECT_GET_CLASS (p->obj),
|
||||
p->prop);
|
||||
|
||||
eclass = G_ENUM_CLASS (g_type_class_peek (spec->value_type));
|
||||
|
||||
i = gtk_option_menu_get_history (om);
|
||||
|
||||
g_object_set (p->obj, p->prop, eclass->values[i].value, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
|
||||
{
|
||||
GtkOptionMenu *om = GTK_OPTION_MENU (data);
|
||||
GValue val = { 0, };
|
||||
GEnumClass *eclass;
|
||||
gint i;
|
||||
|
||||
eclass = G_ENUM_CLASS (g_type_class_peek (pspec->value_type));
|
||||
|
||||
g_value_init (&val, pspec->value_type);
|
||||
g_object_get_property (object, pspec->name, &val);
|
||||
|
||||
i = 0;
|
||||
while (i < eclass->n_values)
|
||||
{
|
||||
if (eclass->values[i].value == g_value_get_enum (&val))
|
||||
break;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (gtk_option_menu_get_history (om) != i)
|
||||
gtk_option_menu_set_history (om, i);
|
||||
|
||||
g_value_unset (&val);
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
create_prop_editor (GObject *object)
|
||||
{
|
||||
@ -260,18 +927,64 @@ create_prop_editor (GObject *object)
|
||||
connect_controller (G_OBJECT (prop_edit), "toggled",
|
||||
object, spec->name, (GtkSignalFunc) bool_modified);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
{
|
||||
gchar *msg = g_strdup_printf ("%s: don't know how to edit type %s",
|
||||
spec->nick, g_type_name (spec->value_type));
|
||||
hbox = gtk_hbox_new (FALSE, 10);
|
||||
label = gtk_label_new (msg);
|
||||
g_free (msg);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
}
|
||||
if (g_type_is_a (spec->value_type, G_TYPE_ENUM))
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GEnumClass *eclass;
|
||||
gint i;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 10);
|
||||
label = gtk_label_new (spec->nick);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
|
||||
prop_edit = gtk_option_menu_new ();
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
eclass = G_ENUM_CLASS (g_type_class_peek (spec->value_type));
|
||||
|
||||
i = 0;
|
||||
while (i < eclass->n_values)
|
||||
{
|
||||
GtkWidget *mi;
|
||||
|
||||
mi = gtk_menu_item_new_with_label (eclass->values[i].value_name);
|
||||
|
||||
gtk_widget_show (mi);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (prop_edit), menu);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (hbox), prop_edit, FALSE, FALSE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
g_object_connect_property (object, spec->name,
|
||||
GTK_SIGNAL_FUNC (enum_changed),
|
||||
prop_edit);
|
||||
|
||||
if (can_modify)
|
||||
connect_controller (G_OBJECT (prop_edit), "changed",
|
||||
object, spec->name, (GtkSignalFunc) enum_modified);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *msg = g_strdup_printf ("%s: don't know how to edit type %s",
|
||||
spec->nick, g_type_name (spec->value_type));
|
||||
hbox = gtk_hbox_new (FALSE, 10);
|
||||
label = gtk_label_new (msg);
|
||||
g_free (msg);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -294,20 +1007,3 @@ create_prop_editor (GObject *object)
|
||||
return win;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* I didn't write the tree test yet, just the property editor to use
|
||||
* inside the tree test ;-)
|
||||
*/
|
||||
window = create_prop_editor (G_OBJECT (gtk_text_tag_new ("foo")));
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user