changed gtk_item_factory_dump_items() and gtk_item_factory_dump_rc()
Tue Apr 3 13:52:57 2001 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: changed gtk_item_factory_dump_items()
and gtk_item_factory_dump_rc() GtkPatternSpec argument to
GPatternSpec. this is actually unlikely to cause breakage in
third-party apps since except for gle, pretty much ever caller
passes NULL here.
* gtk/gtkbindings.[hc]: removed gtk_pattern_*() API.
* *.c: use g_pattern_*() API.
* docs/Changes-2.0.txt: GtkPatternSpec->GPatternSpec updates.
* gtk/gtkstyle.c (gtk_default_draw_resize_grip): assert unhandled
directions aren't passed in.
* gtk/gtksettings.[hc] (_gtk_settings_parse_convert): export conversion
functionality to be usable from gtkstyle.c as well, give precedence
for conversion to user-supplied parsers.
s/_gtk_rc_property_parser_for_type/_gtk_rc_property_parser_from_type/;
* gtk/gtkstyle.c (_gtk_style_peek_property_value): use
_gtk_settings_parse_convert() for rcporperty value conversion.
This commit is contained in:
parent
655abd0872
commit
748560e1fc
21 changed files with 382 additions and 468 deletions
25
ChangeLog
25
ChangeLog
|
|
@ -1,3 +1,28 @@
|
||||||
|
Tue Apr 3 13:52:57 2001 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkitemfactory.[hc]: changed gtk_item_factory_dump_items()
|
||||||
|
and gtk_item_factory_dump_rc() GtkPatternSpec argument to
|
||||||
|
GPatternSpec. this is actually unlikely to cause breakage in
|
||||||
|
third-party apps since except for gle, pretty much ever caller
|
||||||
|
passes NULL here.
|
||||||
|
|
||||||
|
* gtk/gtkbindings.[hc]: removed gtk_pattern_*() API.
|
||||||
|
|
||||||
|
* *.c: use g_pattern_*() API.
|
||||||
|
|
||||||
|
* docs/Changes-2.0.txt: GtkPatternSpec->GPatternSpec updates.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (gtk_default_draw_resize_grip): assert unhandled
|
||||||
|
directions aren't passed in.
|
||||||
|
|
||||||
|
* gtk/gtksettings.[hc] (_gtk_settings_parse_convert): export conversion
|
||||||
|
functionality to be usable from gtkstyle.c as well, give precedence
|
||||||
|
for conversion to user-supplied parsers.
|
||||||
|
s/_gtk_rc_property_parser_for_type/_gtk_rc_property_parser_from_type/;
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (_gtk_style_peek_property_value): use
|
||||||
|
_gtk_settings_parse_convert() for rcporperty value conversion.
|
||||||
|
|
||||||
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkevents-fb.c:
|
* gdk/linux-fb/gdkevents-fb.c:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,28 @@
|
||||||
|
Tue Apr 3 13:52:57 2001 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkitemfactory.[hc]: changed gtk_item_factory_dump_items()
|
||||||
|
and gtk_item_factory_dump_rc() GtkPatternSpec argument to
|
||||||
|
GPatternSpec. this is actually unlikely to cause breakage in
|
||||||
|
third-party apps since except for gle, pretty much ever caller
|
||||||
|
passes NULL here.
|
||||||
|
|
||||||
|
* gtk/gtkbindings.[hc]: removed gtk_pattern_*() API.
|
||||||
|
|
||||||
|
* *.c: use g_pattern_*() API.
|
||||||
|
|
||||||
|
* docs/Changes-2.0.txt: GtkPatternSpec->GPatternSpec updates.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (gtk_default_draw_resize_grip): assert unhandled
|
||||||
|
directions aren't passed in.
|
||||||
|
|
||||||
|
* gtk/gtksettings.[hc] (_gtk_settings_parse_convert): export conversion
|
||||||
|
functionality to be usable from gtkstyle.c as well, give precedence
|
||||||
|
for conversion to user-supplied parsers.
|
||||||
|
s/_gtk_rc_property_parser_for_type/_gtk_rc_property_parser_from_type/;
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (_gtk_style_peek_property_value): use
|
||||||
|
_gtk_settings_parse_convert() for rcporperty value conversion.
|
||||||
|
|
||||||
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkevents-fb.c:
|
* gdk/linux-fb/gdkevents-fb.c:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,28 @@
|
||||||
|
Tue Apr 3 13:52:57 2001 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkitemfactory.[hc]: changed gtk_item_factory_dump_items()
|
||||||
|
and gtk_item_factory_dump_rc() GtkPatternSpec argument to
|
||||||
|
GPatternSpec. this is actually unlikely to cause breakage in
|
||||||
|
third-party apps since except for gle, pretty much ever caller
|
||||||
|
passes NULL here.
|
||||||
|
|
||||||
|
* gtk/gtkbindings.[hc]: removed gtk_pattern_*() API.
|
||||||
|
|
||||||
|
* *.c: use g_pattern_*() API.
|
||||||
|
|
||||||
|
* docs/Changes-2.0.txt: GtkPatternSpec->GPatternSpec updates.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (gtk_default_draw_resize_grip): assert unhandled
|
||||||
|
directions aren't passed in.
|
||||||
|
|
||||||
|
* gtk/gtksettings.[hc] (_gtk_settings_parse_convert): export conversion
|
||||||
|
functionality to be usable from gtkstyle.c as well, give precedence
|
||||||
|
for conversion to user-supplied parsers.
|
||||||
|
s/_gtk_rc_property_parser_for_type/_gtk_rc_property_parser_from_type/;
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (_gtk_style_peek_property_value): use
|
||||||
|
_gtk_settings_parse_convert() for rcporperty value conversion.
|
||||||
|
|
||||||
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkevents-fb.c:
|
* gdk/linux-fb/gdkevents-fb.c:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,28 @@
|
||||||
|
Tue Apr 3 13:52:57 2001 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkitemfactory.[hc]: changed gtk_item_factory_dump_items()
|
||||||
|
and gtk_item_factory_dump_rc() GtkPatternSpec argument to
|
||||||
|
GPatternSpec. this is actually unlikely to cause breakage in
|
||||||
|
third-party apps since except for gle, pretty much ever caller
|
||||||
|
passes NULL here.
|
||||||
|
|
||||||
|
* gtk/gtkbindings.[hc]: removed gtk_pattern_*() API.
|
||||||
|
|
||||||
|
* *.c: use g_pattern_*() API.
|
||||||
|
|
||||||
|
* docs/Changes-2.0.txt: GtkPatternSpec->GPatternSpec updates.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (gtk_default_draw_resize_grip): assert unhandled
|
||||||
|
directions aren't passed in.
|
||||||
|
|
||||||
|
* gtk/gtksettings.[hc] (_gtk_settings_parse_convert): export conversion
|
||||||
|
functionality to be usable from gtkstyle.c as well, give precedence
|
||||||
|
for conversion to user-supplied parsers.
|
||||||
|
s/_gtk_rc_property_parser_for_type/_gtk_rc_property_parser_from_type/;
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (_gtk_style_peek_property_value): use
|
||||||
|
_gtk_settings_parse_convert() for rcporperty value conversion.
|
||||||
|
|
||||||
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkevents-fb.c:
|
* gdk/linux-fb/gdkevents-fb.c:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,28 @@
|
||||||
|
Tue Apr 3 13:52:57 2001 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkitemfactory.[hc]: changed gtk_item_factory_dump_items()
|
||||||
|
and gtk_item_factory_dump_rc() GtkPatternSpec argument to
|
||||||
|
GPatternSpec. this is actually unlikely to cause breakage in
|
||||||
|
third-party apps since except for gle, pretty much ever caller
|
||||||
|
passes NULL here.
|
||||||
|
|
||||||
|
* gtk/gtkbindings.[hc]: removed gtk_pattern_*() API.
|
||||||
|
|
||||||
|
* *.c: use g_pattern_*() API.
|
||||||
|
|
||||||
|
* docs/Changes-2.0.txt: GtkPatternSpec->GPatternSpec updates.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (gtk_default_draw_resize_grip): assert unhandled
|
||||||
|
directions aren't passed in.
|
||||||
|
|
||||||
|
* gtk/gtksettings.[hc] (_gtk_settings_parse_convert): export conversion
|
||||||
|
functionality to be usable from gtkstyle.c as well, give precedence
|
||||||
|
for conversion to user-supplied parsers.
|
||||||
|
s/_gtk_rc_property_parser_for_type/_gtk_rc_property_parser_from_type/;
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (_gtk_style_peek_property_value): use
|
||||||
|
_gtk_settings_parse_convert() for rcporperty value conversion.
|
||||||
|
|
||||||
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkevents-fb.c:
|
* gdk/linux-fb/gdkevents-fb.c:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,28 @@
|
||||||
|
Tue Apr 3 13:52:57 2001 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkitemfactory.[hc]: changed gtk_item_factory_dump_items()
|
||||||
|
and gtk_item_factory_dump_rc() GtkPatternSpec argument to
|
||||||
|
GPatternSpec. this is actually unlikely to cause breakage in
|
||||||
|
third-party apps since except for gle, pretty much ever caller
|
||||||
|
passes NULL here.
|
||||||
|
|
||||||
|
* gtk/gtkbindings.[hc]: removed gtk_pattern_*() API.
|
||||||
|
|
||||||
|
* *.c: use g_pattern_*() API.
|
||||||
|
|
||||||
|
* docs/Changes-2.0.txt: GtkPatternSpec->GPatternSpec updates.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (gtk_default_draw_resize_grip): assert unhandled
|
||||||
|
directions aren't passed in.
|
||||||
|
|
||||||
|
* gtk/gtksettings.[hc] (_gtk_settings_parse_convert): export conversion
|
||||||
|
functionality to be usable from gtkstyle.c as well, give precedence
|
||||||
|
for conversion to user-supplied parsers.
|
||||||
|
s/_gtk_rc_property_parser_for_type/_gtk_rc_property_parser_from_type/;
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (_gtk_style_peek_property_value): use
|
||||||
|
_gtk_settings_parse_convert() for rcporperty value conversion.
|
||||||
|
|
||||||
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkevents-fb.c:
|
* gdk/linux-fb/gdkevents-fb.c:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,28 @@
|
||||||
|
Tue Apr 3 13:52:57 2001 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkitemfactory.[hc]: changed gtk_item_factory_dump_items()
|
||||||
|
and gtk_item_factory_dump_rc() GtkPatternSpec argument to
|
||||||
|
GPatternSpec. this is actually unlikely to cause breakage in
|
||||||
|
third-party apps since except for gle, pretty much ever caller
|
||||||
|
passes NULL here.
|
||||||
|
|
||||||
|
* gtk/gtkbindings.[hc]: removed gtk_pattern_*() API.
|
||||||
|
|
||||||
|
* *.c: use g_pattern_*() API.
|
||||||
|
|
||||||
|
* docs/Changes-2.0.txt: GtkPatternSpec->GPatternSpec updates.
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (gtk_default_draw_resize_grip): assert unhandled
|
||||||
|
directions aren't passed in.
|
||||||
|
|
||||||
|
* gtk/gtksettings.[hc] (_gtk_settings_parse_convert): export conversion
|
||||||
|
functionality to be usable from gtkstyle.c as well, give precedence
|
||||||
|
for conversion to user-supplied parsers.
|
||||||
|
s/_gtk_rc_property_parser_for_type/_gtk_rc_property_parser_from_type/;
|
||||||
|
|
||||||
|
* gtk/gtkstyle.c (_gtk_style_peek_property_value): use
|
||||||
|
_gtk_settings_parse_convert() for rcporperty value conversion.
|
||||||
|
|
||||||
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
2001-04-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkevents-fb.c:
|
* gdk/linux-fb/gdkevents-fb.c:
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
|
||||||
* gtk_widget_shape_combine_mask() now keeps a reference count on the
|
* gtk_widget_shape_combine_mask() now keeps a reference count on the
|
||||||
mask pixmap that is passed in.
|
mask pixmap that is passed in.
|
||||||
|
|
||||||
|
* the GtkPatternSpec has been moved to glib as GPatternSpec, the pattern
|
||||||
|
arguments to gtk_item_factory_dump_items() and gtk_item_factory_dump_rc()
|
||||||
|
have thusly been changed to take a GPatternSpec instead of GtkPatternSpec.
|
||||||
|
|
||||||
* Type system changes:
|
* Type system changes:
|
||||||
- GTK_TYPE_OBJECT is not a fundamental type anymore. Type checks of the
|
- GTK_TYPE_OBJECT is not a fundamental type anymore. Type checks of the
|
||||||
style (GTK_FUNDAMENTAL_TYPE (some_type) == GTK_TYPE_OBJECT)
|
style (GTK_FUNDAMENTAL_TYPE (some_type) == GTK_TYPE_OBJECT)
|
||||||
|
|
|
||||||
|
|
@ -604,6 +604,18 @@ after other user handlers and the default handler.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### STRUCT GtkPatternSpec ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@match_type:
|
||||||
|
@pattern_length:
|
||||||
|
@pattern:
|
||||||
|
@pattern_reversed:
|
||||||
|
@user_data:
|
||||||
|
@seq_id:
|
||||||
|
|
||||||
<!-- ##### ENUM GtkPrivateFlags ##### -->
|
<!-- ##### ENUM GtkPrivateFlags ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
@ -1172,6 +1184,50 @@ Set the the handle size to @size x @size pixels.
|
||||||
@paned: a paned widget
|
@paned: a paned widget
|
||||||
@size: the size in pixels
|
@size: the size in pixels
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gtk_pattern_match ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@pspec:
|
||||||
|
@string_length:
|
||||||
|
@string:
|
||||||
|
@string_reversed:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gtk_pattern_match_simple ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@pattern:
|
||||||
|
@string:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gtk_pattern_match_string ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@pspec:
|
||||||
|
@string:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gtk_pattern_spec_free_segs ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@pspec:
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gtk_pattern_spec_init ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@pspec:
|
||||||
|
@pattern:
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_rc_init ##### -->
|
<!-- ##### FUNCTION gtk_rc_init ##### -->
|
||||||
<para>
|
<para>
|
||||||
Internal function.
|
Internal function.
|
||||||
|
|
|
||||||
|
|
@ -14,67 +14,6 @@ Bindings
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!-- ##### STRUCT GtkPatternSpec ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@match_type:
|
|
||||||
@pattern_length:
|
|
||||||
@pattern:
|
|
||||||
@pattern_reversed:
|
|
||||||
@user_data:
|
|
||||||
@seq_id:
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_pattern_spec_init ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@pspec:
|
|
||||||
@pattern:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_pattern_spec_free_segs ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@pspec:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_pattern_match ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@pspec:
|
|
||||||
@string_length:
|
|
||||||
@string:
|
|
||||||
@string_reversed:
|
|
||||||
@Returns:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_pattern_match_string ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@pspec:
|
|
||||||
@string:
|
|
||||||
@Returns:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gtk_pattern_match_simple ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@pattern:
|
|
||||||
@string:
|
|
||||||
@Returns:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### STRUCT GtkBindingSet ##### -->
|
<!-- ##### STRUCT GtkBindingSet ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,14 @@
|
||||||
#define BINDING_MOD_MASK() (gtk_accelerator_get_default_mod_mask () | GDK_RELEASE_MASK)
|
#define BINDING_MOD_MASK() (gtk_accelerator_get_default_mod_mask () | GDK_RELEASE_MASK)
|
||||||
|
|
||||||
|
|
||||||
|
/* --- structures --- */
|
||||||
|
typedef struct {
|
||||||
|
GPatternSpec *pspec;
|
||||||
|
gpointer user_data;
|
||||||
|
guint seq_id;
|
||||||
|
} PatternSpec;
|
||||||
|
|
||||||
|
|
||||||
/* --- variables --- */
|
/* --- variables --- */
|
||||||
static GHashTable *binding_entry_hash_table = NULL;
|
static GHashTable *binding_entry_hash_table = NULL;
|
||||||
static GSList *binding_set_list = NULL;
|
static GSList *binding_set_list = NULL;
|
||||||
|
|
@ -719,7 +727,7 @@ gtk_binding_set_add_path (GtkBindingSet *binding_set,
|
||||||
const gchar *path_pattern,
|
const gchar *path_pattern,
|
||||||
GtkPathPriorityType priority)
|
GtkPathPriorityType priority)
|
||||||
{
|
{
|
||||||
GtkPatternSpec *pspec;
|
PatternSpec *pspec;
|
||||||
GSList **slist_p, *slist;
|
GSList **slist_p, *slist;
|
||||||
static guint seq_id = 0;
|
static guint seq_id = 0;
|
||||||
|
|
||||||
|
|
@ -745,8 +753,8 @@ gtk_binding_set_add_path (GtkBindingSet *binding_set,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pspec = g_new (GtkPatternSpec, 1);
|
pspec = g_new (PatternSpec, 1);
|
||||||
gtk_pattern_spec_init (pspec, path_pattern);
|
pspec->pspec = g_pattern_spec_new (path_pattern);
|
||||||
pspec->seq_id = seq_id++ & 0x0fffffff;
|
pspec->seq_id = seq_id++ & 0x0fffffff;
|
||||||
pspec->seq_id |= priority << 28;
|
pspec->seq_id |= priority << 28;
|
||||||
pspec->user_data = binding_set;
|
pspec->user_data = binding_set;
|
||||||
|
|
@ -754,15 +762,15 @@ gtk_binding_set_add_path (GtkBindingSet *binding_set,
|
||||||
slist = *slist_p;
|
slist = *slist_p;
|
||||||
while (slist)
|
while (slist)
|
||||||
{
|
{
|
||||||
GtkPatternSpec *tmp_pspec;
|
PatternSpec *tmp_pspec;
|
||||||
|
|
||||||
tmp_pspec = slist->data;
|
tmp_pspec = slist->data;
|
||||||
slist = slist->next;
|
slist = slist->next;
|
||||||
|
|
||||||
if (tmp_pspec->pattern_length == pspec->pattern_length &&
|
if (tmp_pspec->pspec->pattern_length == pspec->pspec->pattern_length &&
|
||||||
g_str_equal (tmp_pspec->pattern_reversed, pspec->pattern_reversed))
|
g_str_equal (tmp_pspec->pspec->pattern_reversed, pspec->pspec->pattern_reversed))
|
||||||
{
|
{
|
||||||
gtk_pattern_spec_free_segs (pspec);
|
g_pattern_spec_free (pspec->pspec);
|
||||||
g_free (pspec);
|
g_free (pspec);
|
||||||
pspec = NULL;
|
pspec = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
@ -783,10 +791,10 @@ binding_match_activate (GSList *pspec_list,
|
||||||
|
|
||||||
for (slist = pspec_list; slist; slist = slist->next)
|
for (slist = pspec_list; slist; slist = slist->next)
|
||||||
{
|
{
|
||||||
GtkPatternSpec *pspec;
|
PatternSpec *pspec;
|
||||||
|
|
||||||
pspec = slist->data;
|
pspec = slist->data;
|
||||||
if (gtk_pattern_match (pspec, path_length, path, path_reversed))
|
if (g_pattern_match (pspec->pspec, path_length, path, path_reversed))
|
||||||
{
|
{
|
||||||
GtkBindingSet *binding_set;
|
GtkBindingSet *binding_set;
|
||||||
|
|
||||||
|
|
@ -805,8 +813,8 @@ static gint
|
||||||
gtk_binding_pattern_compare (gconstpointer new_pattern,
|
gtk_binding_pattern_compare (gconstpointer new_pattern,
|
||||||
gconstpointer existing_pattern)
|
gconstpointer existing_pattern)
|
||||||
{
|
{
|
||||||
register const GtkPatternSpec *np = new_pattern;
|
register const PatternSpec *np = new_pattern;
|
||||||
register const GtkPatternSpec *ep = existing_pattern;
|
register const PatternSpec *ep = existing_pattern;
|
||||||
|
|
||||||
/* walk the list as long as the existing patterns have
|
/* walk the list as long as the existing patterns have
|
||||||
* higher priorities.
|
* higher priorities.
|
||||||
|
|
@ -845,7 +853,7 @@ gtk_binding_entries_sort_patterns (GtkBindingEntry *entries,
|
||||||
|
|
||||||
for (; slist; slist = slist->next)
|
for (; slist; slist = slist->next)
|
||||||
{
|
{
|
||||||
GtkPatternSpec *pspec;
|
PatternSpec *pspec;
|
||||||
|
|
||||||
pspec = slist->data;
|
pspec = slist->data;
|
||||||
patterns = g_slist_insert_sorted (patterns, pspec, gtk_binding_pattern_compare);
|
patterns = g_slist_insert_sorted (patterns, pspec, gtk_binding_pattern_compare);
|
||||||
|
|
@ -938,255 +946,6 @@ gtk_bindings_activate (GtkObject *object,
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Patterns
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline gboolean
|
|
||||||
gtk_pattern_ph_match (const gchar *match_pattern,
|
|
||||||
const gchar *match_string)
|
|
||||||
{
|
|
||||||
register const gchar *pattern, *string;
|
|
||||||
register gchar ch;
|
|
||||||
|
|
||||||
pattern = match_pattern;
|
|
||||||
string = match_string;
|
|
||||||
|
|
||||||
ch = *pattern;
|
|
||||||
pattern++;
|
|
||||||
while (ch)
|
|
||||||
{
|
|
||||||
switch (ch)
|
|
||||||
{
|
|
||||||
case '?':
|
|
||||||
if (!*string)
|
|
||||||
return FALSE;
|
|
||||||
string++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '*':
|
|
||||||
do
|
|
||||||
{
|
|
||||||
ch = *pattern;
|
|
||||||
pattern++;
|
|
||||||
if (ch == '?')
|
|
||||||
{
|
|
||||||
if (!*string)
|
|
||||||
return FALSE;
|
|
||||||
string++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (ch == '*' || ch == '?');
|
|
||||||
if (!ch)
|
|
||||||
return TRUE;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (ch != *string)
|
|
||||||
{
|
|
||||||
if (!*string)
|
|
||||||
return FALSE;
|
|
||||||
string++;
|
|
||||||
}
|
|
||||||
string++;
|
|
||||||
if (gtk_pattern_ph_match (pattern, string))
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
while (*string);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (ch == *string)
|
|
||||||
string++;
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ch = *pattern;
|
|
||||||
pattern++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *string == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gtk_pattern_match (GtkPatternSpec *pspec,
|
|
||||||
guint string_length,
|
|
||||||
const gchar *string,
|
|
||||||
const gchar *string_reversed)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (pspec != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (string != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (string_reversed != NULL, FALSE);
|
|
||||||
|
|
||||||
switch (pspec->match_type)
|
|
||||||
{
|
|
||||||
case GTK_MATCH_ALL:
|
|
||||||
return gtk_pattern_ph_match (pspec->pattern, string);
|
|
||||||
|
|
||||||
case GTK_MATCH_ALL_TAIL:
|
|
||||||
return gtk_pattern_ph_match (pspec->pattern_reversed, string_reversed);
|
|
||||||
|
|
||||||
case GTK_MATCH_HEAD:
|
|
||||||
if (pspec->pattern_length > string_length)
|
|
||||||
return FALSE;
|
|
||||||
else if (pspec->pattern_length == string_length)
|
|
||||||
return strcmp (pspec->pattern, string) == 0;
|
|
||||||
else if (pspec->pattern_length)
|
|
||||||
return strncmp (pspec->pattern, string, pspec->pattern_length) == 0;
|
|
||||||
else
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case GTK_MATCH_TAIL:
|
|
||||||
if (pspec->pattern_length > string_length)
|
|
||||||
return FALSE;
|
|
||||||
else if (pspec->pattern_length == string_length)
|
|
||||||
return strcmp (pspec->pattern_reversed, string_reversed) == 0;
|
|
||||||
else if (pspec->pattern_length)
|
|
||||||
return strncmp (pspec->pattern_reversed,
|
|
||||||
string_reversed,
|
|
||||||
pspec->pattern_length) == 0;
|
|
||||||
else
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case GTK_MATCH_EXACT:
|
|
||||||
if (pspec->pattern_length != string_length)
|
|
||||||
return FALSE;
|
|
||||||
else
|
|
||||||
return strcmp (pspec->pattern_reversed, string_reversed) == 0;
|
|
||||||
|
|
||||||
default:
|
|
||||||
g_return_val_if_fail (pspec->match_type < GTK_MATCH_LAST, FALSE);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_pattern_spec_init (GtkPatternSpec *pspec,
|
|
||||||
const gchar *pattern)
|
|
||||||
{
|
|
||||||
gchar *p;
|
|
||||||
|
|
||||||
g_return_if_fail (pspec != NULL);
|
|
||||||
|
|
||||||
pspec->match_type = GTK_MATCH_ALL;
|
|
||||||
pspec->seq_id = 0;
|
|
||||||
pspec->user_data = NULL;
|
|
||||||
|
|
||||||
if (!pattern)
|
|
||||||
pattern = "";
|
|
||||||
|
|
||||||
pspec->pattern = g_strdup (pattern);
|
|
||||||
pspec->pattern_length = strlen (pspec->pattern);
|
|
||||||
pspec->pattern_reversed = g_strdup (pspec->pattern);
|
|
||||||
g_strreverse (pspec->pattern_reversed);
|
|
||||||
if (pspec->pattern_reversed[0] != '*')
|
|
||||||
pspec->match_type = GTK_MATCH_ALL_TAIL;
|
|
||||||
|
|
||||||
if (strchr (pspec->pattern, '?'))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!strchr (pspec->pattern, '*'))
|
|
||||||
{
|
|
||||||
pspec->match_type = GTK_MATCH_EXACT;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = pspec->pattern;
|
|
||||||
while (*p == '*')
|
|
||||||
p++;
|
|
||||||
if (p > pspec->pattern &&
|
|
||||||
!strchr (p, '*'))
|
|
||||||
{
|
|
||||||
gchar *t;
|
|
||||||
|
|
||||||
pspec->match_type = GTK_MATCH_TAIL;
|
|
||||||
t = pspec->pattern;
|
|
||||||
pspec->pattern = g_strdup (p);
|
|
||||||
g_free (t);
|
|
||||||
g_free (pspec->pattern_reversed);
|
|
||||||
pspec->pattern_reversed = g_strdup (pspec->pattern);
|
|
||||||
g_strreverse (pspec->pattern_reversed);
|
|
||||||
pspec->pattern_length = strlen (pspec->pattern);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = pspec->pattern_reversed;
|
|
||||||
while (*p == '*')
|
|
||||||
p++;
|
|
||||||
if (p > pspec->pattern_reversed &&
|
|
||||||
!strchr (p, '*'))
|
|
||||||
{
|
|
||||||
gchar *t;
|
|
||||||
|
|
||||||
pspec->match_type = GTK_MATCH_HEAD;
|
|
||||||
t = pspec->pattern_reversed;
|
|
||||||
pspec->pattern_reversed = g_strdup (p);
|
|
||||||
g_free (t);
|
|
||||||
g_free (pspec->pattern);
|
|
||||||
pspec->pattern = g_strdup (pspec->pattern_reversed);
|
|
||||||
g_strreverse (pspec->pattern);
|
|
||||||
pspec->pattern_length = strlen (pspec->pattern);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gtk_pattern_match_string (GtkPatternSpec *pspec,
|
|
||||||
const gchar *string)
|
|
||||||
{
|
|
||||||
gchar *string_reversed;
|
|
||||||
guint length;
|
|
||||||
gboolean ergo;
|
|
||||||
|
|
||||||
g_return_val_if_fail (pspec != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (string != NULL, FALSE);
|
|
||||||
|
|
||||||
length = strlen (string);
|
|
||||||
string_reversed = g_strdup (string);
|
|
||||||
g_strreverse (string_reversed);
|
|
||||||
|
|
||||||
ergo = gtk_pattern_match (pspec, length, string, string_reversed);
|
|
||||||
g_free (string_reversed);
|
|
||||||
|
|
||||||
return ergo;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gtk_pattern_match_simple (const gchar *pattern,
|
|
||||||
const gchar *string)
|
|
||||||
{
|
|
||||||
GtkPatternSpec pspec;
|
|
||||||
gboolean ergo;
|
|
||||||
|
|
||||||
g_return_val_if_fail (pattern != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (string != NULL, FALSE);
|
|
||||||
|
|
||||||
gtk_pattern_spec_init (&pspec, pattern);
|
|
||||||
ergo = gtk_pattern_match_string (&pspec, string);
|
|
||||||
gtk_pattern_spec_free_segs (&pspec);
|
|
||||||
|
|
||||||
return ergo;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_pattern_spec_free_segs (GtkPatternSpec *pspec)
|
|
||||||
{
|
|
||||||
g_return_if_fail (pspec != NULL);
|
|
||||||
|
|
||||||
g_free (pspec->pattern);
|
|
||||||
pspec->pattern = NULL;
|
|
||||||
g_free (pspec->pattern_reversed);
|
|
||||||
pspec->pattern_reversed = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
gtk_binding_parse_signal (GScanner *scanner,
|
gtk_binding_parse_signal (GScanner *scanner,
|
||||||
GtkBindingSet *binding_set,
|
GtkBindingSet *binding_set,
|
||||||
|
|
@ -1447,4 +1206,3 @@ gtk_binding_parse_binding (GScanner *scanner)
|
||||||
|
|
||||||
return G_TOKEN_NONE;
|
return G_TOKEN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,33 +41,6 @@ extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
/* Pattern matching
|
|
||||||
*/
|
|
||||||
typedef struct _GtkPatternSpec GtkPatternSpec;
|
|
||||||
|
|
||||||
struct _GtkPatternSpec
|
|
||||||
{
|
|
||||||
GtkMatchType match_type;
|
|
||||||
guint pattern_length;
|
|
||||||
gchar *pattern;
|
|
||||||
gchar *pattern_reversed;
|
|
||||||
gpointer user_data;
|
|
||||||
guint seq_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
void gtk_pattern_spec_init (GtkPatternSpec *pspec,
|
|
||||||
const gchar *pattern);
|
|
||||||
void gtk_pattern_spec_free_segs (GtkPatternSpec *pspec);
|
|
||||||
gboolean gtk_pattern_match (GtkPatternSpec *pspec,
|
|
||||||
guint string_length,
|
|
||||||
const gchar *string,
|
|
||||||
const gchar *string_reversed);
|
|
||||||
gboolean gtk_pattern_match_string (GtkPatternSpec *pspec,
|
|
||||||
const gchar *string);
|
|
||||||
gboolean gtk_pattern_match_simple (const gchar *pattern,
|
|
||||||
const gchar *string);
|
|
||||||
|
|
||||||
|
|
||||||
/* Binding sets
|
/* Binding sets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,10 @@ struct _GtkIFCBData
|
||||||
};
|
};
|
||||||
struct _GtkIFDumpData
|
struct _GtkIFDumpData
|
||||||
{
|
{
|
||||||
GtkPrintFunc print_func;
|
GtkPrintFunc print_func;
|
||||||
gpointer func_data;
|
gpointer func_data;
|
||||||
guint modified_only : 1;
|
guint modified_only : 1;
|
||||||
GtkPatternSpec *pspec;
|
GPatternSpec *pspec;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -777,7 +777,7 @@ gtk_item_factory_foreach (gpointer hash_key,
|
||||||
item = value;
|
item = value;
|
||||||
data = user_data;
|
data = user_data;
|
||||||
|
|
||||||
if (data->pspec && !gtk_pattern_match_string (data->pspec, item->path))
|
if (data->pspec && !g_pattern_match_string (data->pspec, item->path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
comment_prefix[0] = gtk_item_factory_class->cpair_comment_single[0];
|
comment_prefix[0] = gtk_item_factory_class->cpair_comment_single[0];
|
||||||
|
|
@ -800,7 +800,7 @@ gtk_item_factory_foreach (gpointer hash_key,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_item_factory_dump_items (GtkPatternSpec *path_pspec,
|
gtk_item_factory_dump_items (GPatternSpec *path_pspec,
|
||||||
gboolean modified_only,
|
gboolean modified_only,
|
||||||
GtkPrintFunc print_func,
|
GtkPrintFunc print_func,
|
||||||
gpointer func_data)
|
gpointer func_data)
|
||||||
|
|
@ -834,9 +834,9 @@ gtk_item_factory_print_func (gpointer FILE_pointer,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_item_factory_dump_rc (const gchar *file_name,
|
gtk_item_factory_dump_rc (const gchar *file_name,
|
||||||
GtkPatternSpec *path_pspec,
|
GPatternSpec *path_pspec,
|
||||||
gboolean modified_only)
|
gboolean modified_only)
|
||||||
{
|
{
|
||||||
FILE *f_out;
|
FILE *f_out;
|
||||||
|
|
||||||
|
|
@ -1319,18 +1319,18 @@ void
|
||||||
gtk_item_factory_create_menu_entries (guint n_entries,
|
gtk_item_factory_create_menu_entries (guint n_entries,
|
||||||
GtkMenuEntry *entries)
|
GtkMenuEntry *entries)
|
||||||
{
|
{
|
||||||
static GtkPatternSpec pspec_separator = { 42, 0 };
|
static GPatternSpec *pspec_separator = NULL;
|
||||||
static GtkPatternSpec pspec_check = { 42, 0 };
|
static GPatternSpec *pspec_check = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (!n_entries)
|
if (!n_entries)
|
||||||
return;
|
return;
|
||||||
g_return_if_fail (entries != NULL);
|
g_return_if_fail (entries != NULL);
|
||||||
|
|
||||||
if (pspec_separator.pattern_length == 0)
|
if (!pspec_separator)
|
||||||
{
|
{
|
||||||
gtk_pattern_spec_init (&pspec_separator, "*<separator>*");
|
pspec_separator = g_pattern_spec_new ("*<separator>*");
|
||||||
gtk_pattern_spec_init (&pspec_check, "*<check>*");
|
pspec_check = g_pattern_spec_new ("*<check>*");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n_entries; i++)
|
for (i = 0; i < n_entries; i++)
|
||||||
|
|
@ -1359,9 +1359,9 @@ gtk_item_factory_create_menu_entries (guint n_entries,
|
||||||
entry.accelerator = entries[i].accelerator;
|
entry.accelerator = entries[i].accelerator;
|
||||||
entry.callback = entries[i].callback;
|
entry.callback = entries[i].callback;
|
||||||
entry.callback_action = 0;
|
entry.callback_action = 0;
|
||||||
if (gtk_pattern_match_string (&pspec_separator, path))
|
if (g_pattern_match_string (pspec_separator, path))
|
||||||
entry.item_type = "<Separator>";
|
entry.item_type = "<Separator>";
|
||||||
else if (!gtk_pattern_match_string (&pspec_check, path))
|
else if (!g_pattern_match_string (pspec_check, path))
|
||||||
entry.item_type = NULL;
|
entry.item_type = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include <gtk/gtkwidget.h>
|
#include <gtk/gtkwidget.h>
|
||||||
#include <gtk/gtkbindings.h> /* for GtkPatternSpec */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -171,12 +170,12 @@ GtkWidget* gtk_item_factory_get_item_by_action (GtkItemFactory *ifactory,
|
||||||
* all hash entries. otherwise only those entries will be dumped for which
|
* all hash entries. otherwise only those entries will be dumped for which
|
||||||
* the pattern matches, e.g. "<Image>*...".
|
* the pattern matches, e.g. "<Image>*...".
|
||||||
*/
|
*/
|
||||||
void gtk_item_factory_dump_items (GtkPatternSpec *path_pspec,
|
void gtk_item_factory_dump_items (GPatternSpec *path_pspec,
|
||||||
gboolean modified_only,
|
gboolean modified_only,
|
||||||
GtkPrintFunc print_func,
|
GtkPrintFunc print_func,
|
||||||
gpointer func_data);
|
gpointer func_data);
|
||||||
void gtk_item_factory_dump_rc (const gchar *file_name,
|
void gtk_item_factory_dump_rc (const gchar *file_name,
|
||||||
GtkPatternSpec *path_pspec,
|
GPatternSpec *path_pspec,
|
||||||
gboolean modified_only);
|
gboolean modified_only);
|
||||||
void gtk_item_factory_print_func (gpointer FILE_pointer,
|
void gtk_item_factory_print_func (gpointer FILE_pointer,
|
||||||
const gchar *string);
|
const gchar *string);
|
||||||
|
|
|
||||||
12
gtk/gtkrc.c
12
gtk/gtkrc.c
|
|
@ -69,8 +69,8 @@ typedef struct _GtkRcFile GtkRcFile;
|
||||||
|
|
||||||
struct _GtkRcSet
|
struct _GtkRcSet
|
||||||
{
|
{
|
||||||
GtkPatternSpec pspec;
|
GPatternSpec *pspec;
|
||||||
GtkRcStyle *rc_style;
|
GtkRcStyle *rc_style;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkRcFile
|
struct _GtkRcFile
|
||||||
|
|
@ -1064,7 +1064,7 @@ gtk_rc_free_rc_sets (GSList *slist)
|
||||||
GtkRcSet *rc_set;
|
GtkRcSet *rc_set;
|
||||||
|
|
||||||
rc_set = slist->data;
|
rc_set = slist->data;
|
||||||
gtk_pattern_spec_free_segs (&rc_set->pspec);
|
g_pattern_spec_free (rc_set->pspec);
|
||||||
g_free (rc_set);
|
g_free (rc_set);
|
||||||
|
|
||||||
slist = slist->next;
|
slist = slist->next;
|
||||||
|
|
@ -1156,7 +1156,7 @@ gtk_rc_styles_match (GSList *rc_styles,
|
||||||
rc_set = sets->data;
|
rc_set = sets->data;
|
||||||
sets = sets->next;
|
sets = sets->next;
|
||||||
|
|
||||||
if (gtk_pattern_match (&rc_set->pspec, path_length, path, path_reversed))
|
if (g_pattern_match (rc_set->pspec, path_length, path, path_reversed))
|
||||||
rc_styles = g_slist_append (rc_styles, rc_set->rc_style);
|
rc_styles = g_slist_append (rc_styles, rc_set->rc_style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1254,7 +1254,7 @@ gtk_rc_add_rc_sets (GSList *slist,
|
||||||
new_style->bg_pixmap_name[i] = g_strdup (rc_style->bg_pixmap_name[i]);
|
new_style->bg_pixmap_name[i] = g_strdup (rc_style->bg_pixmap_name[i]);
|
||||||
|
|
||||||
rc_set = g_new (GtkRcSet, 1);
|
rc_set = g_new (GtkRcSet, 1);
|
||||||
gtk_pattern_spec_init (&rc_set->pspec, pattern);
|
rc_set->pspec = g_pattern_spec_new (pattern);
|
||||||
rc_set->rc_style = rc_style;
|
rc_set->rc_style = rc_style;
|
||||||
|
|
||||||
return g_slist_prepend (slist, rc_set);
|
return g_slist_prepend (slist, rc_set);
|
||||||
|
|
@ -3002,7 +3002,7 @@ gtk_rc_parse_path_pattern (GScanner *scanner)
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_set = g_new (GtkRcSet, 1);
|
rc_set = g_new (GtkRcSet, 1);
|
||||||
gtk_pattern_spec_init (&rc_set->pspec, pattern);
|
rc_set->pspec = g_pattern_spec_new (pattern);
|
||||||
rc_set->rc_style = rc_style;
|
rc_set->rc_style = rc_style;
|
||||||
|
|
||||||
if (path_type == GTK_PATH_WIDGET)
|
if (path_type == GTK_PATH_WIDGET)
|
||||||
|
|
|
||||||
|
|
@ -259,59 +259,89 @@ gtk_settings_notify (GObject *object,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_gtk_settings_parse_convert (GtkRcPropertyParser parser,
|
||||||
|
const GValue *src_value,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
GValue *dest_value)
|
||||||
|
{
|
||||||
|
gboolean success = FALSE;
|
||||||
|
|
||||||
|
g_return_val_if_fail (G_VALUE_HOLDS (dest_value, G_PARAM_SPEC_VALUE_TYPE (pspec)), FALSE);
|
||||||
|
|
||||||
|
if (parser)
|
||||||
|
{
|
||||||
|
GString *gstring;
|
||||||
|
gboolean free_gstring = TRUE;
|
||||||
|
|
||||||
|
if (G_VALUE_HOLDS (src_value, G_TYPE_GSTRING))
|
||||||
|
{
|
||||||
|
gstring = g_value_get_boxed (src_value);
|
||||||
|
free_gstring = FALSE;
|
||||||
|
}
|
||||||
|
else if (G_VALUE_HOLDS_LONG (src_value))
|
||||||
|
{
|
||||||
|
gstring = g_string_new ("");
|
||||||
|
g_string_printfa (gstring, "%ld", g_value_get_long (src_value));
|
||||||
|
}
|
||||||
|
else if (G_VALUE_HOLDS_DOUBLE (src_value))
|
||||||
|
{
|
||||||
|
gstring = g_string_new ("");
|
||||||
|
g_string_printfa (gstring, "%f", g_value_get_double (src_value));
|
||||||
|
}
|
||||||
|
else if (G_VALUE_HOLDS_STRING (src_value))
|
||||||
|
{
|
||||||
|
gchar *tstr = g_strescape (g_value_get_string (src_value), NULL);
|
||||||
|
|
||||||
|
gstring = g_string_new ("\"");
|
||||||
|
g_string_append (gstring, tstr);
|
||||||
|
g_string_append_c (gstring, '\"');
|
||||||
|
g_free (tstr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (G_VALUE_HOLDS (src_value, G_TYPE_GSTRING), FALSE);
|
||||||
|
gstring = NULL; /* silence compiler */
|
||||||
|
}
|
||||||
|
|
||||||
|
success = (parser (pspec, gstring, dest_value) &&
|
||||||
|
!g_param_value_validate (pspec, dest_value));
|
||||||
|
|
||||||
|
if (free_gstring)
|
||||||
|
g_string_free (gstring, TRUE);
|
||||||
|
}
|
||||||
|
else if (!G_VALUE_HOLDS (src_value, G_TYPE_GSTRING) &&
|
||||||
|
g_value_type_transformable (G_VALUE_TYPE (src_value), G_VALUE_TYPE (dest_value)))
|
||||||
|
success = g_param_value_convert (pspec, src_value, dest_value, TRUE);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apply_queued_setting (GtkSettings *data,
|
apply_queued_setting (GtkSettings *data,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
GtkSettingsValue *qvalue)
|
GtkSettingsValue *qvalue)
|
||||||
{
|
{
|
||||||
gboolean warn_convert = TRUE;
|
GValue tmp_value = { 0, };
|
||||||
|
GtkRcPropertyParser parser = g_param_spec_get_qdata (pspec, quark_property_parser);
|
||||||
|
|
||||||
if (g_value_type_transformable (G_VALUE_TYPE (&qvalue->value), G_PARAM_SPEC_VALUE_TYPE (pspec)))
|
g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||||
{
|
if (_gtk_settings_parse_convert (parser, &qvalue->value,
|
||||||
GValue tmp_value = { 0, };
|
pspec, &tmp_value))
|
||||||
|
g_object_set_property (G_OBJECT (data), pspec->name, &tmp_value);
|
||||||
warn_convert = FALSE;
|
|
||||||
g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
|
||||||
if (g_param_value_convert (pspec, &qvalue->value, &tmp_value, TRUE))
|
|
||||||
g_object_set_property (G_OBJECT (data), pspec->name, &tmp_value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gchar *debug = g_strdup_value_contents (&tmp_value);
|
|
||||||
|
|
||||||
g_message ("%s: rc-value `%s' for rc-property \"%s\" of type `%s' has invalid contents \"%s\"",
|
|
||||||
qvalue->origin,
|
|
||||||
G_VALUE_TYPE_NAME (&qvalue->value),
|
|
||||||
pspec->name,
|
|
||||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
|
||||||
debug);
|
|
||||||
g_free (debug);
|
|
||||||
}
|
|
||||||
g_value_unset (&tmp_value);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GtkRcPropertyParser parser = g_param_spec_get_qdata (pspec, quark_property_parser);
|
gchar *debug = g_strdup_value_contents (&tmp_value);
|
||||||
|
|
||||||
if (parser)
|
g_message ("%s: failed to retrive property `%s' of type `%s' from rc file value \"%s\" of type `%s'",
|
||||||
{
|
qvalue->origin,
|
||||||
GValue tmp_value = { 0, };
|
pspec->name,
|
||||||
|
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
||||||
g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
debug,
|
||||||
if (parser (pspec, g_value_get_boxed (&qvalue->value), &tmp_value))
|
G_VALUE_TYPE_NAME (&tmp_value));
|
||||||
{
|
g_free (debug);
|
||||||
warn_convert = FALSE;
|
|
||||||
g_object_set_property (G_OBJECT (data), pspec->name, &tmp_value);
|
|
||||||
}
|
|
||||||
g_value_unset (&tmp_value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
g_value_unset (&tmp_value);
|
||||||
if (warn_convert)
|
|
||||||
g_message ("%s: unable to convert rc-value of type `%s' to rc-property \"%s\" of type `%s'",
|
|
||||||
qvalue->origin,
|
|
||||||
G_VALUE_TYPE_NAME (&qvalue->value),
|
|
||||||
pspec->name,
|
|
||||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
|
|
@ -379,7 +409,7 @@ settings_install_property_parser (GtkSettingsClass *class,
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkRcPropertyParser
|
GtkRcPropertyParser
|
||||||
_gtk_rc_property_parser_for_type (GType type)
|
_gtk_rc_property_parser_from_type (GType type)
|
||||||
{
|
{
|
||||||
if (type == GDK_TYPE_COLOR)
|
if (type == GDK_TYPE_COLOR)
|
||||||
return gtk_rc_property_parse_color;
|
return gtk_rc_property_parse_color;
|
||||||
|
|
@ -404,7 +434,7 @@ gtk_settings_install_property (GtkSettings *settings,
|
||||||
g_return_if_fail (GTK_IS_SETTINGS (settings));
|
g_return_if_fail (GTK_IS_SETTINGS (settings));
|
||||||
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
||||||
|
|
||||||
parser = _gtk_rc_property_parser_for_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
|
parser = _gtk_rc_property_parser_from_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||||
|
|
||||||
settings_install_property_parser (GTK_SETTINGS_GET_CLASS (settings), pspec, parser);
|
settings_install_property_parser (GTK_SETTINGS_GET_CLASS (settings), pspec, parser);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,15 @@ void gtk_settings_set_double_property (GtkSettings *settings,
|
||||||
gdouble v_double,
|
gdouble v_double,
|
||||||
const gchar *origin);
|
const gchar *origin);
|
||||||
|
|
||||||
void _gtk_settings_handle_event (GdkEventSetting *event);
|
|
||||||
|
|
||||||
GtkRcPropertyParser _gtk_rc_property_parser_for_type (GType type);
|
/* implementation details */
|
||||||
|
void _gtk_settings_handle_event (GdkEventSetting *event);
|
||||||
|
GtkRcPropertyParser _gtk_rc_property_parser_from_type (GType type);
|
||||||
|
gboolean _gtk_settings_parse_convert (GtkRcPropertyParser parser,
|
||||||
|
const GValue *src_value,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
GValue *dest_value);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "gtkwidget.h"
|
#include "gtkwidget.h"
|
||||||
#include "gtkthemes.h"
|
#include "gtkthemes.h"
|
||||||
#include "gtkiconfactory.h"
|
#include "gtkiconfactory.h"
|
||||||
|
#include "gtksettings.h" /* _gtk_settings_parse_convert() */
|
||||||
|
|
||||||
#define LIGHTNESS_MULT 1.3
|
#define LIGHTNESS_MULT 1.3
|
||||||
#define DARKNESS_MULT 0.7
|
#define DARKNESS_MULT 0.7
|
||||||
|
|
@ -1244,6 +1245,7 @@ _gtk_style_peek_property_value (GtkStyle *style,
|
||||||
return &pcache->value;
|
return &pcache->value;
|
||||||
|
|
||||||
/* cache miss, initialize value type, then set contents */
|
/* cache miss, initialize value type, then set contents */
|
||||||
|
g_param_spec_ref (pcache->pspec);
|
||||||
g_value_init (&pcache->value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
g_value_init (&pcache->value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||||
|
|
||||||
/* value provided by rc style? */
|
/* value provided by rc style? */
|
||||||
|
|
@ -1264,55 +1266,25 @@ _gtk_style_peek_property_value (GtkStyle *style,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* when supplied by rc style, we need to convert */
|
/* when supplied by rc style, we need to convert */
|
||||||
if (rcprop)
|
if (rcprop && !_gtk_settings_parse_convert (parser, &rcprop->value,
|
||||||
|
pspec, &pcache->value))
|
||||||
{
|
{
|
||||||
if (G_VALUE_TYPE (&rcprop->value) == G_TYPE_GSTRING)
|
gchar *contents = g_strdup_value_contents (&rcprop->value);
|
||||||
{
|
|
||||||
GString *gstring;
|
g_message ("%s: failed to retrive property `%s::%s' of type `%s' from rc file value \"%s\" of type `%s'",
|
||||||
|
rcprop->origin,
|
||||||
/* value still unparsed, need to revert to user supplied parser function */
|
g_type_name (pspec->owner_type), pspec->name,
|
||||||
|
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
||||||
gstring = g_value_get_boxed (&rcprop->value);
|
contents,
|
||||||
|
G_VALUE_TYPE_NAME (&rcprop->value));
|
||||||
if (!parser || !parser (pspec, gstring, &pcache->value) ||
|
g_free (contents);
|
||||||
g_param_value_validate (pspec, &pcache->value))
|
rcprop = NULL; /* needs default */
|
||||||
{
|
|
||||||
gchar *contents = g_strescape (gstring->str, NULL);
|
|
||||||
|
|
||||||
g_message ("%s: failed to parse property `%s::%s' of type `%s' from rc file value \"%s\"",
|
|
||||||
rcprop->origin,
|
|
||||||
g_type_name (pspec->owner_type), pspec->name,
|
|
||||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
|
||||||
gstring->str);
|
|
||||||
g_free (contents);
|
|
||||||
rcprop = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* we use the normal conversion functionality of param specs */
|
|
||||||
if (!g_param_value_convert (pspec, &rcprop->value, &pcache->value, TRUE))
|
|
||||||
{
|
|
||||||
gchar *contents = g_strdup_value_contents (&rcprop->value);
|
|
||||||
|
|
||||||
g_message ("%s: failed to retrive property `%s::%s' of type `%s' from rc file value \"%s\" of type `%s'",
|
|
||||||
rcprop->origin,
|
|
||||||
g_type_name (pspec->owner_type), pspec->name,
|
|
||||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
|
||||||
contents,
|
|
||||||
G_VALUE_TYPE_NAME (&rcprop->value));
|
|
||||||
g_free (contents);
|
|
||||||
rcprop = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not supplied by rc style (or conversion failed), revert to default */
|
/* not supplied by rc style (or conversion failed), revert to default */
|
||||||
if (!rcprop)
|
if (!rcprop)
|
||||||
g_param_value_set_default (pspec, &pcache->value);
|
g_param_value_set_default (pspec, &pcache->value);
|
||||||
|
|
||||||
g_param_spec_ref (pcache->pspec);
|
|
||||||
|
|
||||||
return &pcache->value;
|
return &pcache->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4025,7 +3997,9 @@ gtk_default_draw_resize_grip (GtkStyle *style,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (area)
|
if (area)
|
||||||
|
|
|
||||||
|
|
@ -5411,7 +5411,7 @@ gtk_widget_class_install_style_property (GtkWidgetClass *class,
|
||||||
g_return_if_fail (GTK_IS_WIDGET_CLASS (class));
|
g_return_if_fail (GTK_IS_WIDGET_CLASS (class));
|
||||||
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
||||||
|
|
||||||
parser = _gtk_rc_property_parser_for_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
|
parser = _gtk_rc_property_parser_from_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||||
|
|
||||||
gtk_widget_class_install_style_property_parser (class, pspec, parser);
|
gtk_widget_class_install_style_property_parser (class, pspec, parser);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ style "global-style-properties"
|
||||||
{
|
{
|
||||||
# xthickness = 20
|
# xthickness = 20
|
||||||
GtkSpinButton::shadow_type = etched-out
|
GtkSpinButton::shadow_type = etched-out
|
||||||
GtkEntry::cursor_color = { 1.0, 0.0, 0.0 }
|
GtkEntry::cursor_color = "#ff00ff"
|
||||||
}
|
}
|
||||||
class "GtkWidget" style "global-style-properties"
|
class "GtkWidget" style "global-style-properties"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ style "global-style-properties"
|
||||||
{
|
{
|
||||||
# xthickness = 20
|
# xthickness = 20
|
||||||
GtkSpinButton::shadow_type = etched-out
|
GtkSpinButton::shadow_type = etched-out
|
||||||
GtkEntry::cursor_color = { 1.0, 0.0, 0.0 }
|
GtkEntry::cursor_color = "#ff00ff"
|
||||||
}
|
}
|
||||||
class "GtkWidget" style "global-style-properties"
|
class "GtkWidget" style "global-style-properties"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue