Allow %NULL for style to mean "revert to default style"

Tue Jun 26 19:39:03 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
	for style to mean "revert to default style"

	* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
	  gtk_widget_restore_default_style): Make this functions
	deprecated aliases for gtk_widget_set_style (widget, NULL).

	* gtk/gtkwidget.[ch]: Remove:
	   gtk_widget_set_default_style ()
	   gtk_widget_push_style ()
	   gtk_widget_pop_style ()
	These functions interact are overriden by RC files, and
	thus virtually useless, and complicated.

Fri Jun 22 18:49:48 2001  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkrc.c: Add a GtkRcContext structure to hold
	most of the previous global variables in gtkrc.c. This is
	in preparation for multi-head, since each screen can
	have different GtkSettings and RC information.

	* gtk/gtkrc.[ch]:

	* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
	GtkSettings parameter to GtkRcStyle::parse.

	* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
	Add two new settings gtk-theme-name, gtk-key-theme-name,
	for RC files that are loaded by name after reading
	the default RC files.

	* gtk/gtkrc.c: Allow priorities for styles, as wll as
	bindings.

	* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
	and use it by default for RC files loaded via
	gtk-theme-name, gtk-key-theme-name.

	* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
        gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
	tests/testgtkrc: Require pathnames to be absolute.

	* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
	the source when parsing, since the operation of looking up a
	pixmap from an RC file depends on the parsing context.

	* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
	reset RC styles on all widgets when files are reparsed.

	* tests/testgtk.c (create_rc_file)
	  gtk/gtkwindow.c (gtk_window_read_rcfiles):
	Simplify, now that gtk_rc_reparse_all() resets styles on
	all widgets itself.

	* gtk/gtkmain.c (gtk_get_default_language): Fix broken
	return value.

	* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
	GtkSettings argument.

	* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
	gtk_settings_get_global().

	* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
	to get the appropriate GtkSettings for a widget. (For now,
	just gets the default GtkSetttings.)

	* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
	  gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
        changes.

	* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
	getting a style for a path without actually having a widget.
	(Allows using a style for a subpart of a widget, for
	example.)

	* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
	the RC files to be reloaded for just one GtkSettings
	(not sure how useful this really is.)

	* gtk/gtkrc.h: Deprecate
	gtk_rc_add_widget_name/widget_class/class_style
This commit is contained in:
Owen Taylor 2001-06-30 16:08:25 +00:00 committed by Owen Taylor
parent ba02311234
commit fbfc305174
28 changed files with 1529 additions and 655 deletions

View File

@ -1,3 +1,88 @@
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 Alex Larsson <alexl@redhat.com> 2001-06-30 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkinput-none.c: * gdk/linux-fb/gdkinput-none.c:

View File

@ -1,3 +1,88 @@
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 Alex Larsson <alexl@redhat.com> 2001-06-30 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkinput-none.c: * gdk/linux-fb/gdkinput-none.c:

View File

@ -1,3 +1,88 @@
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 Alex Larsson <alexl@redhat.com> 2001-06-30 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkinput-none.c: * gdk/linux-fb/gdkinput-none.c:

View File

@ -1,3 +1,88 @@
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 Alex Larsson <alexl@redhat.com> 2001-06-30 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkinput-none.c: * gdk/linux-fb/gdkinput-none.c:

View File

@ -1,3 +1,88 @@
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 Alex Larsson <alexl@redhat.com> 2001-06-30 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkinput-none.c: * gdk/linux-fb/gdkinput-none.c:

View File

@ -1,3 +1,88 @@
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 Alex Larsson <alexl@redhat.com> 2001-06-30 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkinput-none.c: * gdk/linux-fb/gdkinput-none.c:

View File

@ -1,3 +1,88 @@
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL
for style to mean "revert to default style"
* gtk/gtkwidget.[ch] (gtk_widget_set_rc_style,
gtk_widget_restore_default_style): Make this functions
deprecated aliases for gtk_widget_set_style (widget, NULL).
* gtk/gtkwidget.[ch]: Remove:
gtk_widget_set_default_style ()
gtk_widget_push_style ()
gtk_widget_pop_style ()
These functions interact are overriden by RC files, and
thus virtually useless, and complicated.
Fri Jun 22 18:49:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: Add a GtkRcContext structure to hold
most of the previous global variables in gtkrc.c. This is
in preparation for multi-head, since each screen can
have different GtkSettings and RC information.
* gtk/gtkrc.[ch]:
* gtk/gtkrc.h (struct _GtkRcStyleClass): Add a
GtkSettings parameter to GtkRcStyle::parse.
* gdk/x11/gdkevents-x11.c gtk/gtksettings.c gtk/gtkrc.c:
Add two new settings gtk-theme-name, gtk-key-theme-name,
for RC files that are loaded by name after reading
the default RC files.
* gtk/gtkrc.c: Allow priorities for styles, as wll as
bindings.
* gtk/gtkenums.h gtk/gtkrc.c: Add GTK_PATH_PRIO_THEME,
and use it by default for RC files loaded via
gtk-theme-name, gtk-key-theme-name.
* gtk/gtkiconfactory.c (gtk_icon_source_set_filename)
gtk/gtkrc.c (gtk_rc_parse_pixmap_path_string)
tests/testgtkrc: Require pathnames to be absolute.
* gtk/gtkrc.c gtk/gtkiconfactory.c: Look up the full filename for
the source when parsing, since the operation of looking up a
pixmap from an RC file depends on the parsing context.
* gtk/gtkrc.c (gtk_rc_context_reparse_all): Automatically
reset RC styles on all widgets when files are reparsed.
* tests/testgtk.c (create_rc_file)
gtk/gtkwindow.c (gtk_window_read_rcfiles):
Simplify, now that gtk_rc_reparse_all() resets styles on
all widgets itself.
* gtk/gtkmain.c (gtk_get_default_language): Fix broken
return value.
* gtk/gtksettings.[ch] (gtk_settings_install_property[_ch]): Remove
GtkSettings argument.
* gtk/gtksettings.[ch] (gtk_settings_get_default): Rename from
gtk_settings_get_global().
* gtk/gtkwidget.[ch]: Add a function gtk_widget_Get_settings()
to get the appropriate GtkSettings for a widget. (For now,
just gets the default GtkSetttings.)
* gtk/gtkcolorsel.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtkmenubar.c
gtk/gtktextview.c gtk/gtktoolbar.c: Fixes for GtkSettings
changes.
* gtk/gtkrc.[ch]: Add gtk_rc_get_style_by_paths() to allow
getting a style for a path without actually having a widget.
(Allows using a style for a subpart of a widget, for
example.)
* gtk/gtkrc.[ch]: Add gtk_rc_reparse_all_for_setting() to allow forcing
the RC files to be reloaded for just one GtkSettings
(not sure how useful this really is.)
* gtk/gtkrc.h: Deprecate
gtk_rc_add_widget_name/widget_class/class_style
2001-06-30 Alex Larsson <alexl@redhat.com> 2001-06-30 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkinput-none.c: * gdk/linux-fb/gdkinput-none.c:

View File

@ -367,6 +367,11 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
* gtk_rc_set_image_loader() and gtk_rc_load_image() has been removed, now * gtk_rc_set_image_loader() and gtk_rc_load_image() has been removed, now
that GTK+ includes decent image loading capabilities itself. that GTK+ includes decent image loading capabilities itself.
* An extra GtkSettings argument has been added to
gtk_rc_find_pixmap_in_path(). This function is only actually useful
from a theme engine during parsing, at which point the GtkSettings
is provided.
* The child argument facility in gtkcontainer.c has been converted * The child argument facility in gtkcontainer.c has been converted
to a child property facility using GParamSpec and other facilities to a child property facility using GParamSpec and other facilities
for GObject. for GObject.

View File

@ -182,6 +182,7 @@ Represents the packing location #GtkBox children. (See: #GtkVBox,
@GTK_PATH_PRIO_LOWEST: @GTK_PATH_PRIO_LOWEST:
@GTK_PATH_PRIO_GTK: @GTK_PATH_PRIO_GTK:
@GTK_PATH_PRIO_APPLICATION: @GTK_PATH_PRIO_APPLICATION:
@GTK_PATH_PRIO_THEME:
@GTK_PATH_PRIO_RC: @GTK_PATH_PRIO_RC:
@GTK_PATH_PRIO_HIGHEST: @GTK_PATH_PRIO_HIGHEST:
@GTK_PATH_PRIO_MASK: @GTK_PATH_PRIO_MASK:

View File

@ -589,6 +589,7 @@ specific portions of a RC file.
@GTK_RC_TOKEN_LOWEST: @GTK_RC_TOKEN_LOWEST:
@GTK_RC_TOKEN_GTK: @GTK_RC_TOKEN_GTK:
@GTK_RC_TOKEN_APPLICATION: @GTK_RC_TOKEN_APPLICATION:
@GTK_RC_TOKEN_THEME:
@GTK_RC_TOKEN_RC: @GTK_RC_TOKEN_RC:
@GTK_RC_TOKEN_HIGHEST: @GTK_RC_TOKEN_HIGHEST:
@GTK_RC_TOKEN_ENGINE: @GTK_RC_TOKEN_ENGINE:
@ -610,19 +611,10 @@ specific portions of a RC file.
<!-- ##### FUNCTION gtk_rc_get_style ##### --> <!-- ##### FUNCTION gtk_rc_get_style ##### -->
<para> <para>
Finds all matching RC styles for a given widget,
composites them together, and then creates a
#GtkStyle representing the composite appearance.
(GTK+ actually keeps a cache of previously
created styles, so a new style may not be
created.)
</para> </para>
@widget: a #GtkWidget @widget:
@Returns: the resulting style. The caller should @Returns:
reference the result, since GTK+ will retain the
initial reference count itself for the cache
of created styles.
<!-- ##### FUNCTION gtk_rc_add_widget_name_style ##### --> <!-- ##### FUNCTION gtk_rc_add_widget_name_style ##### -->
@ -686,42 +678,30 @@ Parse resource information directly from a string.
<!-- ##### FUNCTION gtk_rc_reparse_all ##### --> <!-- ##### FUNCTION gtk_rc_reparse_all ##### -->
<para> <para>
If the modification time on any previously read file
has changed, discard all style information
and then reread all previously read RC files.
</para> </para>
@Returns: %TRUE if the files were reread. @Returns:
<!-- ##### FUNCTION gtk_rc_add_default_file ##### --> <!-- ##### FUNCTION gtk_rc_add_default_file ##### -->
<para> <para>
Adds a file to the list of files to be parsed at the
end of gtk_init().
</para> </para>
@filename: the pathname to the file. @filename:
<!-- ##### FUNCTION gtk_rc_get_default_files ##### --> <!-- ##### FUNCTION gtk_rc_get_default_files ##### -->
<para> <para>
Retrieves the current list of RC files that will be parsed
at the end of gtk_init()
</para> </para>
@Returns: A NULL terminated array of filenames. This memory @Returns:
is owned by GTK+ and must not be freed by the application.
If you want to store this information, you should make a
copy.
<!-- ##### FUNCTION gtk_rc_set_default_files ##### --> <!-- ##### FUNCTION gtk_rc_set_default_files ##### -->
<para> <para>
Sets the list of files that GTK+ will read at the
end of gtk_init()
</para> </para>
@filenames: A %NULL terminated list of filenames. @filenames:
<!-- ##### FUNCTION gtk_rc_parse_color ##### --> <!-- ##### FUNCTION gtk_rc_parse_color ##### -->
@ -773,11 +753,9 @@ otherwise %NULL.
<!-- ##### FUNCTION gtk_rc_find_pixmap_in_path ##### --> <!-- ##### FUNCTION gtk_rc_find_pixmap_in_path ##### -->
<para> <para>
Looks up a file in the current pixmap path. If the file is
not found, it outputs a warning message using g_warning()
and returns %NULL.
</para> </para>
@context:
@scanner: a #GtkScanner. Used for printing out warning messages @scanner: a #GtkScanner. Used for printing out warning messages
if the file is not found. if the file is not found.
@pixmap_file: The name of the file to search for. @pixmap_file: The name of the file to search for.

View File

@ -2027,7 +2027,9 @@ static struct
{ "Gtk/ToolbarStyle", "gtk-toolbar-style" }, { "Gtk/ToolbarStyle", "gtk-toolbar-style" },
{ "Gtk/ToolbarIconSize", "gtk-toolbar-icon-size" }, { "Gtk/ToolbarIconSize", "gtk-toolbar-icon-size" },
{ "Net/CursorBlink", "gtk-cursor-blink" }, { "Net/CursorBlink", "gtk-cursor-blink" },
{ "Net/CursorBlinkTime", "gtk-cursor-blink-time" } { "Net/CursorBlinkTime", "gtk-cursor-blink-time" },
{ "Net/ThemeName", "gtk-theme-name" },
{ "Gtk/KeyThemeName", "gtk-key-theme-name" }
}; };
static void static void

View File

@ -1586,7 +1586,7 @@ default_change_palette_func (const GdkColor *colors,
str = gtk_color_selection_palette_to_string (colors, n_colors); str = gtk_color_selection_palette_to_string (colors, n_colors);
gtk_settings_set_string_property (gtk_settings_get_global (), gtk_settings_set_string_property (gtk_settings_get_default (),
"gtk-color-palette", "gtk-color-palette",
str, str,
"gtk_color_selection_palette_to_string"); "gtk_color_selection_palette_to_string");
@ -1642,14 +1642,13 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
gtk_marshal_VOID__VOID, gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0); GTK_TYPE_NONE, 0);
gtk_settings_install_property (gtk_settings_get_global (), gtk_settings_install_property (g_param_spec_string ("gtk-color-palette",
g_param_spec_string ("gtk-color-palette",
_("Custom palette"), _("Custom palette"),
_("Palette to use in the color selector"), _("Palette to use in the color selector"),
default_colors, default_colors,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
g_object_get (G_OBJECT (gtk_settings_get_global ()), g_object_get (G_OBJECT (gtk_settings_get_default ()),
"gtk-color-palette", "gtk-color-palette",
&palette, &palette,
NULL); NULL);
@ -1659,7 +1658,7 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
change_palette_hook = default_change_palette_func; change_palette_hook = default_change_palette_func;
g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()), g_signal_connect_data (G_OBJECT (gtk_settings_get_default ()),
"notify::gtk-color-palette", "notify::gtk-color-palette",
G_CALLBACK (palette_change_notify_class), G_CALLBACK (palette_change_notify_class),
NULL, NULL, 0); NULL, NULL, 0);
@ -1825,7 +1824,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
update_palette (colorsel); update_palette (colorsel);
priv->settings_connection = priv->settings_connection =
g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()), g_signal_connect_data (G_OBJECT (gtk_settings_get_default ()),
"notify::gtk-color-palette", "notify::gtk-color-palette",
G_CALLBACK (palette_change_notify_instance), G_CALLBACK (palette_change_notify_instance),
colorsel, NULL, 0); colorsel, NULL, 0);
@ -1877,7 +1876,7 @@ gtk_color_selection_finalize (GObject *object)
priv = cselection->private_data; priv = cselection->private_data;
g_signal_handler_disconnect (gtk_settings_get_global (), g_signal_handler_disconnect (gtk_settings_get_default (),
priv->settings_connection); priv->settings_connection);
g_free (cselection->private_data); g_free (cselection->private_data);

View File

@ -2467,7 +2467,7 @@ gtk_entry_draw_cursor (GtkEntry *entry,
gtk_entry_get_cursor_locations (entry, type, &strong_x, &weak_x); gtk_entry_get_cursor_locations (entry, type, &strong_x, &weak_x);
g_object_get (gtk_settings_get_global (), g_object_get (gtk_widget_get_settings (widget),
"gtk-split-cursor", &split_cursor, "gtk-split-cursor", &split_cursor,
NULL); NULL);
@ -2694,7 +2694,7 @@ gtk_entry_move_visually (GtkEntry *entry,
gboolean split_cursor; gboolean split_cursor;
gboolean strong; gboolean strong;
g_object_get (gtk_settings_get_global (), g_object_get (gtk_widget_get_settings (GTK_WIDGET (entry)),
"gtk-split-cursor", &split_cursor, "gtk-split-cursor", &split_cursor,
NULL); NULL);
@ -3749,7 +3749,7 @@ gtk_entry_drag_data_delete (GtkWidget *widget,
static gboolean static gboolean
cursor_blinks (GtkEntry *entry) cursor_blinks (GtkEntry *entry)
{ {
GtkSettings *settings = gtk_settings_get_global (); GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (entry));
gboolean blink; gboolean blink;
if (GTK_WIDGET_HAS_FOCUS (entry) && if (GTK_WIDGET_HAS_FOCUS (entry) &&
@ -3765,7 +3765,7 @@ cursor_blinks (GtkEntry *entry)
static gint static gint
get_cursor_time (GtkEntry *entry) get_cursor_time (GtkEntry *entry)
{ {
GtkSettings *settings = gtk_settings_get_global (); GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (entry));
gint time; gint time;
g_object_get (G_OBJECT (settings), "gtk-cursor-blink-time", &time, NULL); g_object_get (G_OBJECT (settings), "gtk-cursor-blink-time", &time, NULL);

View File

@ -221,6 +221,7 @@ typedef enum
GTK_PATH_PRIO_LOWEST = 0, GTK_PATH_PRIO_LOWEST = 0,
GTK_PATH_PRIO_GTK = 4, GTK_PATH_PRIO_GTK = 4,
GTK_PATH_PRIO_APPLICATION = 8, GTK_PATH_PRIO_APPLICATION = 8,
GTK_PATH_PRIO_THEME = 10,
GTK_PATH_PRIO_RC = 12, GTK_PATH_PRIO_RC = 12,
GTK_PATH_PRIO_HIGHEST = 15, GTK_PATH_PRIO_HIGHEST = 15,
GTK_PATH_PRIO_MASK = 0x0f GTK_PATH_PRIO_MASK = 0x0f

View File

@ -1038,19 +1038,9 @@ find_and_prep_icon_source (GtkIconSet *icon_set,
if (source->pixbuf == NULL) if (source->pixbuf == NULL)
{ {
GError *error; GError *error;
gchar *full;
g_assert (source->filename); g_assert (source->filename);
source->pixbuf = gdk_pixbuf_new_from_file (source->filename, &error);
if (g_path_is_absolute (source->filename))
full = g_strdup (source->filename);
else
full = gtk_rc_find_pixmap_in_path (NULL, source->filename);
error = NULL;
source->pixbuf = gdk_pixbuf_new_from_file (full, &error);
g_free (full);
if (source->pixbuf == NULL) if (source->pixbuf == NULL)
{ {
@ -1435,19 +1425,15 @@ gtk_icon_source_free (GtkIconSource *source)
* @source: a #GtkIconSource * @source: a #GtkIconSource
* @filename: image file to use * @filename: image file to use
* *
* Sets the name of an image file to use as a base image when creating icon * Sets the name of an image file to use as a base image when creating
* variants for #GtkIconSet. If the filename is absolute, GTK+ will * icon variants for #GtkIconSet. The filename must be absolute.
* attempt to open the exact file given. If the filename is relative,
* GTK+ will search for it in the "pixmap path" which can be configured
* by users in their gtkrc files or specified as part of a theme's gtkrc
* file. See #GtkRcStyle for information on gtkrc files.
*
**/ **/
void void
gtk_icon_source_set_filename (GtkIconSource *source, gtk_icon_source_set_filename (GtkIconSource *source,
const gchar *filename) const gchar *filename)
{ {
g_return_if_fail (source != NULL); g_return_if_fail (source != NULL);
g_return_if_fail (filename == NULL || g_path_is_absolute (filename));
if (source->filename == filename) if (source->filename == filename)
return; return;

View File

@ -1443,7 +1443,7 @@ gtk_menu_key_press (GtkWidget *widget,
if (GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event)) if (GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event))
return TRUE; return TRUE;
g_object_get (G_OBJECT (gtk_settings_get_global ()), g_object_get (G_OBJECT (gtk_settings_get_default ()),
"gtk-menu-bar-accel", "gtk-menu-bar-accel",
&accel, &accel,
NULL); NULL);

View File

@ -142,8 +142,7 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
GTK_TYPE_MENU_DIRECTION_TYPE, GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_CHILD); GTK_MENU_DIR_CHILD);
gtk_settings_install_property (gtk_settings_get_global (), gtk_settings_install_property (g_param_spec_string ("gtk-menu-bar-accel",
g_param_spec_string ("gtk-menu-bar-accel",
_("Menu bar accelerator"), _("Menu bar accelerator"),
_("Keybinding to activate the menu bar"), _("Keybinding to activate the menu bar"),
"F10", "F10",
@ -395,7 +394,7 @@ window_key_press_handler (GtkWidget *widget,
gchar *accel = NULL; gchar *accel = NULL;
gboolean retval = FALSE; gboolean retval = FALSE;
g_object_get (G_OBJECT (gtk_settings_get_global ()), g_object_get (G_OBJECT (gtk_widget_get_settings (widget)),
"gtk-menu-bar-accel", "gtk-menu-bar-accel",
&accel, &accel,
NULL); NULL);

File diff suppressed because it is too large Load Diff

View File

@ -29,17 +29,17 @@
#include <gtk/gtkstyle.h> #include <gtk/gtkstyle.h>
#include <gtk/gtkwidget.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/* Forward declaration */ /* Forward declarations */
typedef struct _GtkIconFactory GtkIconFactory; typedef struct _GtkIconFactory GtkIconFactory;
typedef struct _GtkRcContext GtkRcContext;
typedef struct _GtkSettings GtkSettings;
typedef struct _GtkRcStyleClass GtkRcStyleClass; typedef struct _GtkRcStyleClass GtkRcStyleClass;
typedef struct _GtkRCContext GtkRcContext;
#define GTK_TYPE_RC_STYLE (gtk_rc_style_get_type ()) #define GTK_TYPE_RC_STYLE (gtk_rc_style_get_type ())
#define GTK_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle)) #define GTK_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
@ -99,8 +99,9 @@ struct _GtkRcStyleClass
* of brackets. Returns G_TOKEN_NONE if succesful, otherwise returns * of brackets. Returns G_TOKEN_NONE if succesful, otherwise returns
* the token it expected but didn't get. * the token it expected but didn't get.
*/ */
guint (*parse) (GtkRcStyle *rc_style, guint (*parse) (GtkRcStyle *rc_style,
GScanner *scanner); GtkSettings *settings,
GScanner *scanner);
/* Combine RC style data from src into dest. If overriden, this /* Combine RC style data from src into dest. If overriden, this
* function should chain to the parent. * function should chain to the parent.
@ -117,18 +118,30 @@ void _gtk_rc_init (void);
void gtk_rc_add_default_file (const gchar *filename); void gtk_rc_add_default_file (const gchar *filename);
void gtk_rc_set_default_files (gchar **filenames); void gtk_rc_set_default_files (gchar **filenames);
gchar** gtk_rc_get_default_files (void); gchar** gtk_rc_get_default_files (void);
GtkStyle* gtk_rc_get_style (GtkWidget *widget);
GtkStyle* gtk_rc_get_style_by_paths (GtkSettings *settings,
const char *widget_path,
const char *class_path,
GType type);
gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings,
gboolean force_load);
gchar* gtk_rc_find_pixmap_in_path (GtkSettings *context,
GScanner *scanner,
const gchar *pixmap_file);
void gtk_rc_parse (const gchar *filename); void gtk_rc_parse (const gchar *filename);
void gtk_rc_parse_string (const gchar *rc_string); void gtk_rc_parse_string (const gchar *rc_string);
GtkStyle* gtk_rc_get_style (GtkWidget *widget);
gboolean gtk_rc_reparse_all (void); gboolean gtk_rc_reparse_all (void);
void gtk_rc_add_widget_name_style (GtkRcStyle *rc_style,
const gchar *pattern);
void gtk_rc_add_widget_class_style (GtkRcStyle *rc_style,
const gchar *pattern);
void gtk_rc_add_class_style (GtkRcStyle *rc_style,
const gchar *pattern);
#ifndef GTK_DISABLE_DEPRECATED
void gtk_rc_add_widget_name_style (GtkRcStyle *rc_style,
const gchar *pattern);
void gtk_rc_add_widget_class_style (GtkRcStyle *rc_style,
const gchar *pattern);
void gtk_rc_add_class_style (GtkRcStyle *rc_style,
const gchar *pattern);
#endif /* GTK_DISABLE_DEPRECATED */
GType gtk_rc_style_get_type (void) G_GNUC_CONST; GType gtk_rc_style_get_type (void) G_GNUC_CONST;
@ -137,8 +150,6 @@ GtkRcStyle* gtk_rc_style_copy (GtkRcStyle *orig);
void gtk_rc_style_ref (GtkRcStyle *rc_style); void gtk_rc_style_ref (GtkRcStyle *rc_style);
void gtk_rc_style_unref (GtkRcStyle *rc_style); void gtk_rc_style_unref (GtkRcStyle *rc_style);
gchar* gtk_rc_find_pixmap_in_path (GScanner *scanner,
const gchar *pixmap_file);
gchar* gtk_rc_find_module_in_path (const gchar *module_file); gchar* gtk_rc_find_module_in_path (const gchar *module_file);
gchar* gtk_rc_get_theme_dir (void); gchar* gtk_rc_get_theme_dir (void);
gchar* gtk_rc_get_module_dir (void); gchar* gtk_rc_get_module_dir (void);
@ -174,6 +185,7 @@ typedef enum {
GTK_RC_TOKEN_LOWEST, GTK_RC_TOKEN_LOWEST,
GTK_RC_TOKEN_GTK, GTK_RC_TOKEN_GTK,
GTK_RC_TOKEN_APPLICATION, GTK_RC_TOKEN_APPLICATION,
GTK_RC_TOKEN_THEME,
GTK_RC_TOKEN_RC, GTK_RC_TOKEN_RC,
GTK_RC_TOKEN_HIGHEST, GTK_RC_TOKEN_HIGHEST,
GTK_RC_TOKEN_ENGINE, GTK_RC_TOKEN_ENGINE,
@ -212,7 +224,6 @@ const GtkRcProperty* _gtk_rc_style_lookup_rc_property (GtkRcStyle *rc_style,
GQuark type_name, GQuark type_name,
GQuark property_name); GQuark property_name);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
gchar* gtk_win32_get_installation_directory (void); gchar* gtk_win32_get_installation_directory (void);
#endif #endif

View File

@ -17,14 +17,18 @@
*/ */
#include "gtksettings.h" #include "gtksettings.h"
#include "gtkrc.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkwidget.h"
enum { enum {
PROP_0, PROP_0,
PROP_DOUBLE_CLICK_TIME, PROP_DOUBLE_CLICK_TIME,
PROP_CURSOR_BLINK, PROP_CURSOR_BLINK,
PROP_CURSOR_BLINK_TIME, PROP_CURSOR_BLINK_TIME,
PROP_SPLIT_CURSOR PROP_SPLIT_CURSOR,
PROP_THEME_NAME,
PROP_KEY_THEME_NAME
}; };
@ -166,6 +170,22 @@ gtk_settings_class_init (GtkSettingsClass *class)
G_PARAM_READWRITE), G_PARAM_READWRITE),
NULL); NULL);
g_assert (result == PROP_SPLIT_CURSOR); g_assert (result == PROP_SPLIT_CURSOR);
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-theme-name",
_("Theme Name"),
_("Name of theme RC file to load"),
NULL,
G_PARAM_READWRITE),
NULL);
g_assert (result == PROP_THEME_NAME);
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-key-theme-name",
_("Key Theme Name"),
_("Name of key theme RC file to load"),
NULL,
G_PARAM_READWRITE),
NULL);
g_assert (result == PROP_KEY_THEME_NAME);
} }
static void static void
@ -207,7 +227,7 @@ gtk_settings_constructor (GType type,
} }
GtkSettings* GtkSettings*
gtk_settings_get_global (void) gtk_settings_get_default (void)
{ {
if (!the_singleton) if (!the_singleton)
g_object_new (GTK_TYPE_SETTINGS, NULL); g_object_new (GTK_TYPE_SETTINGS, NULL);
@ -294,6 +314,7 @@ gtk_settings_notify (GObject *object,
{ {
guint property_id = pspec->param_id; guint property_id = pspec->param_id;
gint double_click_time; gint double_click_time;
gchar *str_value;
#if 1 #if 1
GValue tmp_value = { 0, }; GValue tmp_value = { 0, };
@ -484,29 +505,25 @@ _gtk_rc_property_parser_from_type (GType type)
} }
void void
gtk_settings_install_property (GtkSettings *settings, gtk_settings_install_property (GParamSpec *pspec)
GParamSpec *pspec)
{ {
GtkRcPropertyParser parser = NULL; GtkRcPropertyParser parser = NULL;
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_from_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_type_class (GTK_TYPE_SETTINGS), pspec, parser);
} }
void void
gtk_settings_install_property_parser (GtkSettings *settings, gtk_settings_install_property_parser (GParamSpec *pspec,
GParamSpec *pspec,
GtkRcPropertyParser parser) GtkRcPropertyParser parser)
{ {
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));
g_return_if_fail (parser != NULL); g_return_if_fail (parser != NULL);
settings_install_property_parser (GTK_SETTINGS_GET_CLASS (settings), pspec, parser); settings_install_property_parser (gtk_type_class (GTK_TYPE_SETTINGS), pspec, parser);
} }
static void static void
@ -884,7 +901,7 @@ gtk_rc_property_parse_border (const GParamSpec *pspec,
void void
_gtk_settings_handle_event (GdkEventSetting *event) _gtk_settings_handle_event (GdkEventSetting *event)
{ {
GtkSettings *settings = gtk_settings_get_global (); GtkSettings *settings = gtk_settings_get_default ();
if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), event->name)) if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), event->name))
g_object_notify (G_OBJECT (settings), event->name); g_object_notify (G_OBJECT (settings), event->name);

View File

@ -35,7 +35,6 @@ extern "C" {
/* --- typedefs --- */ /* --- typedefs --- */
typedef struct _GtkSettings GtkSettings;
typedef struct _GtkSettingsClass GtkSettingsClass; typedef struct _GtkSettingsClass GtkSettingsClass;
typedef struct _GtkSettingsValue GtkSettingsValue; typedef struct _GtkSettingsValue GtkSettingsValue;
@ -47,6 +46,8 @@ struct _GtkSettings
GData *queued_settings; /* of type GtkSettingsValue* */ GData *queued_settings; /* of type GtkSettingsValue* */
GValue *property_values; GValue *property_values;
GtkRcContext *rc_context;
}; };
struct _GtkSettingsClass struct _GtkSettingsClass
{ {
@ -69,11 +70,9 @@ struct _GtkSettingsValue
/* --- functions --- */ /* --- functions --- */
GType gtk_settings_get_type (void); GType gtk_settings_get_type (void);
GtkSettings* gtk_settings_get_global (void); /* singleton */ GtkSettings* gtk_settings_get_default (void);
void gtk_settings_install_property (GtkSettings *settings, void gtk_settings_install_property (GParamSpec *pspec);
GParamSpec *pspec); void gtk_settings_install_property_parser (GParamSpec *pspec,
void gtk_settings_install_property_parser (GtkSettings *settings,
GParamSpec *pspec,
GtkRcPropertyParser parser); GtkRcPropertyParser parser);
/* --- precoded parsing functions --- */ /* --- precoded parsing functions --- */

View File

@ -3663,7 +3663,7 @@ gtk_text_view_forall (GtkContainer *container,
static gboolean static gboolean
cursor_blinks (GtkTextView *text_view) cursor_blinks (GtkTextView *text_view)
{ {
GtkSettings *settings = gtk_settings_get_global (); GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
gboolean blink; gboolean blink;
g_object_get (G_OBJECT (settings), "gtk-cursor-blink", &blink, NULL); g_object_get (G_OBJECT (settings), "gtk-cursor-blink", &blink, NULL);
@ -3673,7 +3673,7 @@ cursor_blinks (GtkTextView *text_view)
static gint static gint
get_cursor_time (GtkTextView *text_view) get_cursor_time (GtkTextView *text_view)
{ {
GtkSettings *settings = gtk_settings_get_global (); GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
gint time; gint time;
g_object_get (G_OBJECT (settings), "gtk-cursor-blink-time", &time, NULL); g_object_get (G_OBJECT (settings), "gtk-cursor-blink-time", &time, NULL);
@ -4352,8 +4352,9 @@ gtk_text_view_check_keymap_direction (GtkTextView *text_view)
{ {
gboolean split_cursor; gboolean split_cursor;
GtkTextDirection new_dir; GtkTextDirection new_dir;
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
g_object_get (gtk_settings_get_global (), g_object_get (G_OBJECT (settings),
"gtk-split-cursor", &split_cursor, "gtk-split-cursor", &split_cursor,
NULL); NULL);
if (split_cursor) if (split_cursor)

View File

@ -283,16 +283,14 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
GTK_SHADOW_OUT, GTK_SHADOW_OUT,
G_PARAM_READABLE)); G_PARAM_READABLE));
gtk_settings_install_property (gtk_settings_get_global (), gtk_settings_install_property (g_param_spec_enum ("gtk-toolbar-style",
g_param_spec_enum ("gtk-toolbar-style",
_("Toolbar style"), _("Toolbar style"),
_("Whether default toolbars have text only, text and icons, icons only, etc."), _("Whether default toolbars have text only, text and icons, icons only, etc."),
GTK_TYPE_TOOLBAR_STYLE, GTK_TYPE_TOOLBAR_STYLE,
GTK_TOOLBAR_BOTH, GTK_TOOLBAR_BOTH,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
gtk_settings_install_property (gtk_settings_get_global (), gtk_settings_install_property (g_param_spec_enum ("gtk-toolbar-icon-size",
g_param_spec_enum ("gtk-toolbar-icon-size",
_("Toolbar icon size"), _("Toolbar icon size"),
_("Size of icons in default toolbars"), _("Size of icons in default toolbars"),
GTK_TYPE_ICON_SIZE, GTK_TYPE_ICON_SIZE,
@ -350,7 +348,7 @@ gtk_toolbar_init (GtkToolbar *toolbar)
toolbar->style_set = FALSE; toolbar->style_set = FALSE;
toolbar->icon_size_set = FALSE; toolbar->icon_size_set = FALSE;
g_object_get (gtk_settings_get_global (), g_object_get (gtk_settings_get_default (),
"gtk-toolbar-icon-size", "gtk-toolbar-icon-size",
&toolbar->icon_size, &toolbar->icon_size,
"gtk-toolbar-style", "gtk-toolbar-style",
@ -358,13 +356,13 @@ gtk_toolbar_init (GtkToolbar *toolbar)
NULL); NULL);
toolbar->style_set_connection = toolbar->style_set_connection =
g_signal_connect (G_OBJECT (gtk_settings_get_global ()), g_signal_connect (G_OBJECT (gtk_settings_get_default ()),
"notify::gtk-toolbar-style", "notify::gtk-toolbar-style",
G_CALLBACK (style_change_notify), G_CALLBACK (style_change_notify),
toolbar); toolbar);
toolbar->icon_size_connection = toolbar->icon_size_connection =
g_signal_connect (G_OBJECT (gtk_settings_get_global ()), g_signal_connect (G_OBJECT (gtk_settings_get_default ()),
"notify::gtk-toolbar-icon-size", "notify::gtk-toolbar-icon-size",
G_CALLBACK (icon_size_change_notify), G_CALLBACK (icon_size_change_notify),
toolbar); toolbar);
@ -377,9 +375,9 @@ gtk_toolbar_finalize (GObject *object)
toolbar = GTK_TOOLBAR (object); toolbar = GTK_TOOLBAR (object);
g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_global ()), g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_default ()),
toolbar->style_set_connection); toolbar->style_set_connection);
g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_global ()), g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_default ()),
toolbar->icon_size_connection); toolbar->icon_size_connection);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
@ -1087,7 +1085,7 @@ gtk_toolbar_unset_icon_size (GtkToolbar *toolbar)
if (toolbar->icon_size_set) if (toolbar->icon_size_set)
{ {
g_object_get (gtk_settings_get_global (), g_object_get (gtk_settings_get_default (),
"gtk-toolbar-icon-size", "gtk-toolbar-icon-size",
&size, NULL); &size, NULL);
@ -1542,7 +1540,7 @@ gtk_toolbar_unset_style (GtkToolbar *toolbar)
if (toolbar->style_set) if (toolbar->style_set)
{ {
g_object_get (gtk_settings_get_global (), g_object_get (gtk_settings_get_default (),
"gtk-toolbar-style", "gtk-toolbar-style",
&style, &style,
NULL); NULL);

View File

@ -197,12 +197,12 @@ static gboolean gtk_widget_real_focus_out_event (GtkWidget *widget,
static gboolean gtk_widget_real_focus (GtkWidget *widget, static gboolean gtk_widget_real_focus (GtkWidget *widget,
GtkDirectionType direction); GtkDirectionType direction);
static GdkColormap* gtk_widget_peek_colormap (void); static GdkColormap* gtk_widget_peek_colormap (void);
static GtkStyle* gtk_widget_peek_style (void);
static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget); static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget);
static void gtk_widget_reparent_container_child (GtkWidget *widget, static void gtk_widget_reparent_container_child (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void gtk_widget_propagate_state (GtkWidget *widget, static void gtk_widget_propagate_state (GtkWidget *widget,
GtkStateData *data); GtkStateData *data);
static void gtk_widget_reset_rc_style (GtkWidget *widget);
static void gtk_widget_set_style_internal (GtkWidget *widget, static void gtk_widget_set_style_internal (GtkWidget *widget,
GtkStyle *style, GtkStyle *style,
gboolean initial_emission); gboolean initial_emission);
@ -227,7 +227,6 @@ static GMemChunk *aux_info_mem_chunk = NULL;
static GdkColormap *default_colormap = NULL; static GdkColormap *default_colormap = NULL;
static GtkStyle *gtk_default_style = NULL; static GtkStyle *gtk_default_style = NULL;
static GSList *colormap_stack = NULL; static GSList *colormap_stack = NULL;
static GSList *style_stack = NULL;
static guint composite_child_stack = 0; static guint composite_child_stack = 0;
static GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR; static GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
static GParamSpecPool *style_property_spec_pool = NULL; static GParamSpecPool *style_property_spec_pool = NULL;
@ -237,7 +236,6 @@ static GQuark quark_aux_info = 0;
static GQuark quark_event_mask = 0; static GQuark quark_event_mask = 0;
static GQuark quark_extension_event_mode = 0; static GQuark quark_extension_event_mode = 0;
static GQuark quark_parent_window = 0; static GQuark quark_parent_window = 0;
static GQuark quark_saved_default_style = 0;
static GQuark quark_shape_info = 0; static GQuark quark_shape_info = 0;
static GQuark quark_colormap = 0; static GQuark quark_colormap = 0;
static GQuark quark_pango_context = 0; static GQuark quark_pango_context = 0;
@ -307,7 +305,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
quark_event_mask = g_quark_from_static_string ("gtk-event-mask"); quark_event_mask = g_quark_from_static_string ("gtk-event-mask");
quark_extension_event_mode = g_quark_from_static_string ("gtk-extension-event-mode"); quark_extension_event_mode = g_quark_from_static_string ("gtk-extension-event-mode");
quark_parent_window = g_quark_from_static_string ("gtk-parent-window"); quark_parent_window = g_quark_from_static_string ("gtk-parent-window");
quark_saved_default_style = g_quark_from_static_string ("gtk-saved-default-style");
quark_shape_info = g_quark_from_static_string ("gtk-shape-info"); quark_shape_info = g_quark_from_static_string ("gtk-shape-info");
quark_colormap = g_quark_from_static_string ("gtk-colormap"); quark_colormap = g_quark_from_static_string ("gtk-colormap");
quark_pango_context = g_quark_from_static_string ("gtk-pango-context"); quark_pango_context = g_quark_from_static_string ("gtk-pango-context");
@ -1309,7 +1306,7 @@ gtk_widget_init (GtkWidget *widget)
(composite_child_stack ? GTK_COMPOSITE_CHILD : 0) | (composite_child_stack ? GTK_COMPOSITE_CHILD : 0) |
GTK_DOUBLE_BUFFERED); GTK_DOUBLE_BUFFERED);
widget->style = gtk_widget_peek_style (); widget->style = gtk_widget_get_default_style ();
gtk_style_ref (widget->style); gtk_style_ref (widget->style);
colormap = gtk_widget_peek_colormap (); colormap = gtk_widget_peek_colormap ();
@ -3239,7 +3236,7 @@ gtk_widget_set_name (GtkWidget *widget,
widget->name = g_strdup (name); widget->name = g_strdup (name);
if (GTK_WIDGET_RC_STYLE (widget)) if (GTK_WIDGET_RC_STYLE (widget))
gtk_widget_set_rc_style (widget); gtk_widget_reset_rc_style (widget);
g_object_notify (G_OBJECT (widget), "name"); g_object_notify (G_OBJECT (widget), "name");
} }
@ -3486,7 +3483,8 @@ gtk_widget_get_parent (GtkWidget *widget)
/** /**
* gtk_widget_set_style: * gtk_widget_set_style:
* @widget: a #GtkWidget * @widget: a #GtkWidget
* @style: a #GtkStyle * @style: a #GtkStyle, or %NULL to remove the effect of a previous
* gtk_widget_set_style and go back to the default style
* *
* Sets the #GtkStyle for a widget (widget->style). You probably don't * Sets the #GtkStyle for a widget (widget->style). You probably don't
* want to use this function; it interacts badly with themes, because * want to use this function; it interacts badly with themes, because
@ -3498,26 +3496,25 @@ void
gtk_widget_set_style (GtkWidget *widget, gtk_widget_set_style (GtkWidget *widget,
GtkStyle *style) GtkStyle *style)
{ {
GtkStyle *default_style;
gboolean initial_emission;
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (style != NULL);
initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget); if (style)
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RC_STYLE);
GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
default_style = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_saved_default_style);
if (!default_style)
{ {
gtk_style_ref (widget->style); gboolean initial_emission;
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_saved_default_style, widget->style);
}
gtk_widget_set_style_internal (widget, style, initial_emission); initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RC_STYLE);
GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
gtk_widget_set_style_internal (widget, style, initial_emission);
}
else
{
if (GTK_WIDGET_USER_STYLE (widget))
gtk_widget_reset_rc_style (widget);
}
} }
/** /**
@ -3538,19 +3535,15 @@ gtk_widget_ensure_style (GtkWidget *widget)
if (!GTK_WIDGET_USER_STYLE (widget) && if (!GTK_WIDGET_USER_STYLE (widget) &&
!GTK_WIDGET_RC_STYLE (widget)) !GTK_WIDGET_RC_STYLE (widget))
gtk_widget_set_rc_style (widget); gtk_widget_reset_rc_style (widget);
} }
/** /* Look up the RC style for this widget, unsetting any user style that
* gtk_widget_set_rc_style: * may be in effect currently
* @widget: a #GtkWidget
*
*
**/ **/
void static void
gtk_widget_set_rc_style (GtkWidget *widget) gtk_widget_reset_rc_style (GtkWidget *widget)
{ {
GtkStyle *saved_style;
GtkStyle *new_style; GtkStyle *new_style;
gboolean initial_emission; gboolean initial_emission;
@ -3562,52 +3555,12 @@ gtk_widget_set_rc_style (GtkWidget *widget)
GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE); GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
GTK_WIDGET_SET_FLAGS (widget, GTK_RC_STYLE); GTK_WIDGET_SET_FLAGS (widget, GTK_RC_STYLE);
saved_style = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_saved_default_style);
new_style = gtk_rc_get_style (widget); new_style = gtk_rc_get_style (widget);
if (new_style) if (!new_style)
{ new_style = gtk_widget_get_default_style ();
if (!saved_style)
{
gtk_style_ref (widget->style);
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_saved_default_style, widget->style);
}
gtk_widget_set_style_internal (widget, new_style, initial_emission);
}
else
{
if (saved_style)
{
g_assert (initial_emission == FALSE); /* FIXME: remove this line */
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_saved_default_style); if (initial_emission || new_style != widget->style)
gtk_widget_set_style_internal (widget, saved_style, initial_emission); gtk_widget_set_style_internal (widget, widget->style, TRUE);
gtk_style_unref (saved_style);
}
else
{
if (initial_emission)
gtk_widget_set_style_internal (widget, widget->style, TRUE);
}
}
}
void
gtk_widget_restore_default_style (GtkWidget *widget)
{
GtkStyle *default_style;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
default_style = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_saved_default_style);
if (default_style)
{
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_saved_default_style);
gtk_widget_set_style_internal (widget, default_style, FALSE);
gtk_style_unref (default_style);
}
} }
/** /**
@ -3671,7 +3624,7 @@ gtk_widget_modify_style (GtkWidget *widget,
*/ */
if (GTK_WIDGET_RC_STYLE (widget)) if (GTK_WIDGET_RC_STYLE (widget))
gtk_widget_set_rc_style (widget); gtk_widget_reset_rc_style (widget);
} }
/** /**
@ -3950,7 +3903,7 @@ gtk_widget_set_style_recurse (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
if (GTK_WIDGET_RC_STYLE (widget)) if (GTK_WIDGET_RC_STYLE (widget))
gtk_widget_set_rc_style (widget); gtk_widget_reset_rc_style (widget);
if (GTK_IS_CONTAINER (widget)) if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget), gtk_container_forall (GTK_CONTAINER (widget),
@ -3995,19 +3948,6 @@ gtk_widget_reset_rc_styles (GtkWidget *widget)
gtk_widget_set_style_recurse (widget, NULL); gtk_widget_set_style_recurse (widget, NULL);
} }
void
gtk_widget_set_default_style (GtkStyle *style)
{
if (style != gtk_default_style)
{
if (gtk_default_style)
gtk_style_unref (gtk_default_style);
gtk_default_style = style;
if (gtk_default_style)
gtk_style_ref (gtk_default_style);
}
}
GtkStyle* GtkStyle*
gtk_widget_get_default_style (void) gtk_widget_get_default_style (void)
{ {
@ -4020,38 +3960,6 @@ gtk_widget_get_default_style (void)
return gtk_default_style; return gtk_default_style;
} }
void
gtk_widget_push_style (GtkStyle *style)
{
g_return_if_fail (style != NULL);
gtk_style_ref (style);
style_stack = g_slist_prepend (style_stack, style);
}
static GtkStyle*
gtk_widget_peek_style (void)
{
if (style_stack)
return (GtkStyle*) style_stack->data;
else
return gtk_widget_get_default_style ();
}
void
gtk_widget_pop_style (void)
{
GSList *tmp;
if (style_stack)
{
tmp = style_stack;
style_stack = style_stack->next;
gtk_style_unref ((GtkStyle*) tmp->data);
g_slist_free_1 (tmp);
}
}
static PangoContext * static PangoContext *
gtk_widget_peek_pango_context (GtkWidget *widget) gtk_widget_peek_pango_context (GtkWidget *widget)
{ {
@ -4717,6 +4625,20 @@ gtk_widget_get_visual (GtkWidget *widget)
return gdk_colormap_get_visual (gtk_widget_get_colormap (widget)); return gdk_colormap_get_visual (gtk_widget_get_colormap (widget));
} }
/**
* gtk_widget_get_settings:
* @widget: a #GtkWidget
*
* Get the settings object holding the settings (global property
* settings, RC file information, etc) used for this widget.
*
* Return value: the relevant #GtkSettings object
**/
GtkSettings*
gtk_widget_get_settings (GtkWidget *widget)
{
return gtk_settings_get_default ();
}
/** /**
* gtk_widget_set_colormap: * gtk_widget_set_colormap:
@ -5161,7 +5083,6 @@ static void
gtk_widget_real_destroy (GtkObject *object) gtk_widget_real_destroy (GtkObject *object)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkStyle *saved_style;
/* gtk_object_destroy() will already hold a refcount on object /* gtk_object_destroy() will already hold a refcount on object
*/ */
@ -5170,15 +5091,8 @@ gtk_widget_real_destroy (GtkObject *object)
gtk_grab_remove (widget); gtk_grab_remove (widget);
gtk_selection_remove_all (widget); gtk_selection_remove_all (widget);
saved_style = gtk_object_get_data_by_id (object, quark_saved_default_style);
if (saved_style)
{
gtk_style_unref (saved_style);
gtk_object_remove_data_by_id (object, quark_saved_default_style);
}
gtk_style_unref (widget->style); gtk_style_unref (widget->style);
widget->style = gtk_widget_peek_style (); widget->style = gtk_widget_get_default_style ();
gtk_style_ref (widget->style); gtk_style_ref (widget->style);
GTK_OBJECT_CLASS (parent_class)->destroy (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
@ -5191,19 +5105,11 @@ gtk_widget_finalize (GObject *object)
GtkWidgetAuxInfo *aux_info; GtkWidgetAuxInfo *aux_info;
gint *events; gint *events;
GdkExtensionMode *mode; GdkExtensionMode *mode;
GtkStyle *saved_style;
GtkAccessible *accessible; GtkAccessible *accessible;
gtk_grab_remove (widget); gtk_grab_remove (widget);
gtk_selection_remove_all (widget); gtk_selection_remove_all (widget);
saved_style = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_saved_default_style);
if (saved_style)
{
gtk_style_unref (saved_style);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_saved_default_style);
}
gtk_style_unref (widget->style); gtk_style_unref (widget->style);
widget->style = NULL; widget->style = NULL;

View File

@ -32,6 +32,7 @@
#include <gtk/gtkobject.h> #include <gtk/gtkobject.h>
#include <gtk/gtkadjustment.h> #include <gtk/gtkadjustment.h>
#include <gtk/gtkstyle.h> #include <gtk/gtkstyle.h>
#include <gtk/gtksettings.h>
#include <atk/atkobject.h> #include <atk/atkobject.h>
#ifdef __cplusplus #ifdef __cplusplus
@ -579,6 +580,8 @@ GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
GdkColormap* gtk_widget_get_colormap (GtkWidget *widget); GdkColormap* gtk_widget_get_colormap (GtkWidget *widget);
GdkVisual* gtk_widget_get_visual (GtkWidget *widget); GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
/* Accessibility support */ /* Accessibility support */
AtkObject* gtk_widget_get_accessible (GtkWidget *widget); AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
@ -608,10 +611,8 @@ gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
*/ */
void gtk_widget_set_style (GtkWidget *widget, void gtk_widget_set_style (GtkWidget *widget,
GtkStyle *style); GtkStyle *style);
void gtk_widget_set_rc_style (GtkWidget *widget);
void gtk_widget_ensure_style (GtkWidget *widget); void gtk_widget_ensure_style (GtkWidget *widget);
GtkStyle* gtk_widget_get_style (GtkWidget *widget); GtkStyle* gtk_widget_get_style (GtkWidget *widget);
void gtk_widget_restore_default_style (GtkWidget *widget);
void gtk_widget_modify_style (GtkWidget *widget, void gtk_widget_modify_style (GtkWidget *widget,
GtkRcStyle *style); GtkRcStyle *style);
@ -631,6 +632,11 @@ void gtk_widget_modify_base (GtkWidget *widget,
void gtk_widget_modify_font (GtkWidget *widget, void gtk_widget_modify_font (GtkWidget *widget,
PangoFontDescription *font_desc); PangoFontDescription *font_desc);
#ifndef GTK_DISABLE_DEPRECATED
#define gtk_widget_set_rc_style(widget) (gtk_widget_set_style (widget, NULL))
#define gtk_widget_restore_default_style(widget) (gtk_widget_set_style (widget, NULL))
#endif
PangoContext *gtk_widget_create_pango_context (GtkWidget *widget); PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
PangoContext *gtk_widget_get_pango_context (GtkWidget *widget); PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget, PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
@ -655,11 +661,9 @@ void gtk_widget_reset_rc_styles (GtkWidget *widget);
* This will override the values that got set by the * This will override the values that got set by the
* gtk_widget_set_default_* () functions. * gtk_widget_set_default_* () functions.
*/ */
void gtk_widget_push_style (GtkStyle *style);
void gtk_widget_push_colormap (GdkColormap *cmap); void gtk_widget_push_colormap (GdkColormap *cmap);
void gtk_widget_push_composite_child (void); void gtk_widget_push_composite_child (void);
void gtk_widget_pop_composite_child (void); void gtk_widget_pop_composite_child (void);
void gtk_widget_pop_style (void);
void gtk_widget_pop_colormap (void); void gtk_widget_pop_colormap (void);
/* widget style properties /* widget style properties

View File

@ -2524,29 +2524,7 @@ gtk_window_read_rcfiles (GtkWidget *widget,
} }
} }
if (gtk_rc_reparse_all ()) gtk_rc_reparse_all ();
{
/* If the above returned true, some of our RC files are out
* of date, so we need to reset all our widgets. Our other
* toplevel windows will also get the message, but by
* then, the RC file will up to date, so we have to tell
* them now. Also, we have to invalidate cached icons in
* icon sets so they get re-rendered.
*/
GList *list, *toplevels;
_gtk_icon_set_invalidate_caches ();
toplevels = gtk_window_list_toplevels ();
g_list_foreach (toplevels, (GFunc)g_object_ref, NULL);
for (list = toplevels; list; list = list->next)
{
gtk_widget_reset_rc_styles (list->data);
gtk_widget_unref (list->data);
}
g_list_free (toplevels);
}
} }
static gint static gint

View File

@ -9882,28 +9882,6 @@ create_idle_test (void)
* rc file test * rc file test
*/ */
void
reload_rc_file (void)
{
GList *toplevels;
if (gtk_rc_reparse_all ())
{
toplevels = gdk_window_get_toplevels();
while (toplevels)
{
GtkWidget *widget;
gdk_window_get_user_data (toplevels->data, (gpointer *)&widget);
if (widget)
gtk_widget_reset_rc_styles (widget);
toplevels = toplevels->next;
}
g_list_free (toplevels);
}
}
void void
reload_all_rc_files (void) reload_all_rc_files (void)
{ {
@ -9941,7 +9919,7 @@ create_rc_file (void)
button = gtk_button_new_with_label ("Reload"); button = gtk_button_new_with_label ("Reload");
gtk_signal_connect (GTK_OBJECT (button), "clicked", gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC(reload_rc_file), NULL); GTK_SIGNAL_FUNC(gtk_rc_reparse_all), NULL);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
button, TRUE, TRUE, 0); button, TRUE, TRUE, 0);

View File

@ -26,8 +26,6 @@ double-click_timeout = 42
bell-duration = 39 bell-duration = 39
bell_duration = 40 bell_duration = 40
pixmap_path "."
style "global-style-properties" style "global-style-properties"
{ {
# xthickness = 20 # xthickness = 20