diff options
author | Havoc Pennington <hp@redhat.com> | 2001-04-28 00:12:47 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-04-28 00:12:47 +0000 |
commit | 7e9b154f0c73563c4f6a1ce681b78f508d88317c (patch) | |
tree | 3888c389efc586044b95640a31bd02d21423497f | |
parent | 8ff2bf3b6efe288b29b2f406909ae635c9a84a71 (diff) | |
download | gdk-pixbuf-7e9b154f0c73563c4f6a1ce681b78f508d88317c.tar.gz |
fix warning
2001-04-27 Havoc Pennington <hp@redhat.com>
* gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
* gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
line/para separators
(gtk_entry_create_layout): set single paragraph mode on the layout
* gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
spacing between the image and label; instead, inside a button box
the button will get extra space that will go there, but if people
configure button box for 0 chubbiness, then there's no spacing.
* gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
and min/max size style properties, so people can tune their
chubbiness.
* tests/testgtk.c (make_toolbar): remove calls to removed toolbar
functions
* gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
space_style, and button_relief into style properties, remove
functions for setting them
* gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
it back down
* gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
types from gtk_widget_style_get
* gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
with a style property.
* gdk/x11/gdkevents-x11.c: namespace the settings
* gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
* gtk/gtksettings.c (gtk_settings_class_init): remove code with
side effects from inside g_assert(), so that G_DISABLE_ASSERT can
be used. Also, translate doc strings for settings. Also, namespace
the double-click-time property. Also, remove bell properties crap.
-rw-r--r-- | ChangeLog | 44 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 44 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 44 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 44 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 44 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 44 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 44 | ||||
-rw-r--r-- | docs/reference/gtk/tmpl/gtkmenubar.sgml | 15 | ||||
-rw-r--r-- | docs/reference/gtk/tmpl/gtkrc.sgml | 1 | ||||
-rw-r--r-- | docs/reference/gtk/tmpl/gtktoolbar.sgml | 51 | ||||
-rw-r--r-- | gdk/x11/gdkevents-x11.c | 4 | ||||
-rw-r--r-- | gtk/gtkbbox.c | 60 | ||||
-rw-r--r-- | gtk/gtkbutton.c | 6 | ||||
-rw-r--r-- | gtk/gtkcombo.c | 2 | ||||
-rw-r--r-- | gtk/gtkentry.c | 55 | ||||
-rw-r--r-- | gtk/gtkmenu.c | 42 | ||||
-rw-r--r-- | gtk/gtkmenubar.c | 241 | ||||
-rw-r--r-- | gtk/gtkmenubar.h | 5 | ||||
-rw-r--r-- | gtk/gtkmessagedialog.c | 3 | ||||
-rw-r--r-- | gtk/gtkoptionmenu.c | 3 | ||||
-rw-r--r-- | gtk/gtksettings.c | 51 | ||||
-rw-r--r-- | gtk/gtktoolbar.c | 211 | ||||
-rw-r--r-- | gtk/gtktoolbar.h | 11 | ||||
-rw-r--r-- | tests/testgtk.c | 90 | ||||
-rw-r--r-- | tests/testgtkrc | 5 | ||||
-rw-r--r-- | tests/testtext.c | 11 |
26 files changed, 729 insertions, 446 deletions
@@ -1,3 +1,47 @@ +2001-04-27 Havoc Pennington <hp@redhat.com> + + * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning + + * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable + + * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip + line/para separators + (gtk_entry_create_layout): set single paragraph mode on the layout + + * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much + spacing between the image and label; instead, inside a button box + the button will get extra space that will go there, but if people + configure button box for 0 chubbiness, then there's no spacing. + + * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding + and min/max size style properties, so people can tune their + chubbiness. + + * tests/testgtk.c (make_toolbar): remove calls to removed toolbar + functions + + * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, + space_style, and button_relief into style properties, remove + functions for setting them + + * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop + it back down + + * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed + types from gtk_widget_style_get + + * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace + with a style property. + + * gdk/x11/gdkevents-x11.c: namespace the settings + + * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. + + * gtk/gtksettings.c (gtk_settings_class_init): remove code with + side effects from inside g_assert(), so that G_DISABLE_ASSERT can + be used. Also, translate doc strings for settings. Also, namespace + the double-click-time property. Also, remove bell properties crap. + 2001-04-27 Sven Neumann <sven@gimp.org> * Makefile.am: before creating links, check if pkg-config files diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 2923e3379..2b6bf3bcf 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,47 @@ +2001-04-27 Havoc Pennington <hp@redhat.com> + + * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning + + * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable + + * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip + line/para separators + (gtk_entry_create_layout): set single paragraph mode on the layout + + * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much + spacing between the image and label; instead, inside a button box + the button will get extra space that will go there, but if people + configure button box for 0 chubbiness, then there's no spacing. + + * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding + and min/max size style properties, so people can tune their + chubbiness. + + * tests/testgtk.c (make_toolbar): remove calls to removed toolbar + functions + + * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, + space_style, and button_relief into style properties, remove + functions for setting them + + * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop + it back down + + * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed + types from gtk_widget_style_get + + * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace + with a style property. + + * gdk/x11/gdkevents-x11.c: namespace the settings + + * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. + + * gtk/gtksettings.c (gtk_settings_class_init): remove code with + side effects from inside g_assert(), so that G_DISABLE_ASSERT can + be used. Also, translate doc strings for settings. Also, namespace + the double-click-time property. Also, remove bell properties crap. + 2001-04-27 Sven Neumann <sven@gimp.org> * Makefile.am: before creating links, check if pkg-config files diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2923e3379..2b6bf3bcf 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,47 @@ +2001-04-27 Havoc Pennington <hp@redhat.com> + + * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning + + * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable + + * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip + line/para separators + (gtk_entry_create_layout): set single paragraph mode on the layout + + * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much + spacing between the image and label; instead, inside a button box + the button will get extra space that will go there, but if people + configure button box for 0 chubbiness, then there's no spacing. + + * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding + and min/max size style properties, so people can tune their + chubbiness. + + * tests/testgtk.c (make_toolbar): remove calls to removed toolbar + functions + + * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, + space_style, and button_relief into style properties, remove + functions for setting them + + * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop + it back down + + * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed + types from gtk_widget_style_get + + * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace + with a style property. + + * gdk/x11/gdkevents-x11.c: namespace the settings + + * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. + + * gtk/gtksettings.c (gtk_settings_class_init): remove code with + side effects from inside g_assert(), so that G_DISABLE_ASSERT can + be used. Also, translate doc strings for settings. Also, namespace + the double-click-time property. Also, remove bell properties crap. + 2001-04-27 Sven Neumann <sven@gimp.org> * Makefile.am: before creating links, check if pkg-config files diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 2923e3379..2b6bf3bcf 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,47 @@ +2001-04-27 Havoc Pennington <hp@redhat.com> + + * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning + + * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable + + * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip + line/para separators + (gtk_entry_create_layout): set single paragraph mode on the layout + + * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much + spacing between the image and label; instead, inside a button box + the button will get extra space that will go there, but if people + configure button box for 0 chubbiness, then there's no spacing. + + * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding + and min/max size style properties, so people can tune their + chubbiness. + + * tests/testgtk.c (make_toolbar): remove calls to removed toolbar + functions + + * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, + space_style, and button_relief into style properties, remove + functions for setting them + + * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop + it back down + + * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed + types from gtk_widget_style_get + + * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace + with a style property. + + * gdk/x11/gdkevents-x11.c: namespace the settings + + * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. + + * gtk/gtksettings.c (gtk_settings_class_init): remove code with + side effects from inside g_assert(), so that G_DISABLE_ASSERT can + be used. Also, translate doc strings for settings. Also, namespace + the double-click-time property. Also, remove bell properties crap. + 2001-04-27 Sven Neumann <sven@gimp.org> * Makefile.am: before creating links, check if pkg-config files diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2923e3379..2b6bf3bcf 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,47 @@ +2001-04-27 Havoc Pennington <hp@redhat.com> + + * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning + + * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable + + * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip + line/para separators + (gtk_entry_create_layout): set single paragraph mode on the layout + + * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much + spacing between the image and label; instead, inside a button box + the button will get extra space that will go there, but if people + configure button box for 0 chubbiness, then there's no spacing. + + * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding + and min/max size style properties, so people can tune their + chubbiness. + + * tests/testgtk.c (make_toolbar): remove calls to removed toolbar + functions + + * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, + space_style, and button_relief into style properties, remove + functions for setting them + + * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop + it back down + + * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed + types from gtk_widget_style_get + + * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace + with a style property. + + * gdk/x11/gdkevents-x11.c: namespace the settings + + * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. + + * gtk/gtksettings.c (gtk_settings_class_init): remove code with + side effects from inside g_assert(), so that G_DISABLE_ASSERT can + be used. Also, translate doc strings for settings. Also, namespace + the double-click-time property. Also, remove bell properties crap. + 2001-04-27 Sven Neumann <sven@gimp.org> * Makefile.am: before creating links, check if pkg-config files diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2923e3379..2b6bf3bcf 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,47 @@ +2001-04-27 Havoc Pennington <hp@redhat.com> + + * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning + + * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable + + * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip + line/para separators + (gtk_entry_create_layout): set single paragraph mode on the layout + + * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much + spacing between the image and label; instead, inside a button box + the button will get extra space that will go there, but if people + configure button box for 0 chubbiness, then there's no spacing. + + * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding + and min/max size style properties, so people can tune their + chubbiness. + + * tests/testgtk.c (make_toolbar): remove calls to removed toolbar + functions + + * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, + space_style, and button_relief into style properties, remove + functions for setting them + + * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop + it back down + + * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed + types from gtk_widget_style_get + + * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace + with a style property. + + * gdk/x11/gdkevents-x11.c: namespace the settings + + * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. + + * gtk/gtksettings.c (gtk_settings_class_init): remove code with + side effects from inside g_assert(), so that G_DISABLE_ASSERT can + be used. Also, translate doc strings for settings. Also, namespace + the double-click-time property. Also, remove bell properties crap. + 2001-04-27 Sven Neumann <sven@gimp.org> * Makefile.am: before creating links, check if pkg-config files diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2923e3379..2b6bf3bcf 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,47 @@ +2001-04-27 Havoc Pennington <hp@redhat.com> + + * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning + + * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable + + * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip + line/para separators + (gtk_entry_create_layout): set single paragraph mode on the layout + + * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much + spacing between the image and label; instead, inside a button box + the button will get extra space that will go there, but if people + configure button box for 0 chubbiness, then there's no spacing. + + * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding + and min/max size style properties, so people can tune their + chubbiness. + + * tests/testgtk.c (make_toolbar): remove calls to removed toolbar + functions + + * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, + space_style, and button_relief into style properties, remove + functions for setting them + + * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop + it back down + + * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed + types from gtk_widget_style_get + + * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace + with a style property. + + * gdk/x11/gdkevents-x11.c: namespace the settings + + * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. + + * gtk/gtksettings.c (gtk_settings_class_init): remove code with + side effects from inside g_assert(), so that G_DISABLE_ASSERT can + be used. Also, translate doc strings for settings. Also, namespace + the double-click-time property. Also, remove bell properties crap. + 2001-04-27 Sven Neumann <sven@gimp.org> * Makefile.am: before creating links, check if pkg-config files diff --git a/docs/reference/gtk/tmpl/gtkmenubar.sgml b/docs/reference/gtk/tmpl/gtkmenubar.sgml index 8fad04298..964cf153a 100644 --- a/docs/reference/gtk/tmpl/gtkmenubar.sgml +++ b/docs/reference/gtk/tmpl/gtkmenubar.sgml @@ -56,18 +56,3 @@ Adds a new #GtkMenuItem to the GtkMenuBar at the position defined by @position @position: the position in the item list where the @child is added. -<!-- ##### FUNCTION gtk_menu_bar_set_shadow_type ##### --> -<para> -Sets the shadow type to use on the GtkMenuBar. The shadow types to use are: -GTK_SHADOW_NONE, GTK_SHADOW_IN, GTK_SHADOW_OUT, GTK_SHADOW_ETCHED_IN, and GTK_SHADOW_ETCHED_OUT -</para> - -@menu_bar: a #GtkMenuBar -@type: the GtkShadowtype - - -<!-- ##### ARG GtkMenuBar:shadow ##### --> -<para> -Used by #GtkMenuBar to determine the shadow type. -</para> - diff --git a/docs/reference/gtk/tmpl/gtkrc.sgml b/docs/reference/gtk/tmpl/gtkrc.sgml index 178b40392..4c81682d1 100644 --- a/docs/reference/gtk/tmpl/gtkrc.sgml +++ b/docs/reference/gtk/tmpl/gtkrc.sgml @@ -496,6 +496,7 @@ This can later be composited together with other #GtkRcStyle structures to form a #GtkStyle. </para> +@parent_instance: @name: @bg_pixmap_name: @font_desc: diff --git a/docs/reference/gtk/tmpl/gtktoolbar.sgml b/docs/reference/gtk/tmpl/gtktoolbar.sgml index 5d7286193..e96aba29a 100644 --- a/docs/reference/gtk/tmpl/gtktoolbar.sgml +++ b/docs/reference/gtk/tmpl/gtktoolbar.sgml @@ -258,24 +258,6 @@ alters the view of @toolbar to display either icons only, text only, or both. @style: the new style for @toolbar. -<!-- ##### FUNCTION gtk_toolbar_set_space_size ##### --> -<para> -should be used to set the number of pixels each item of space takes up in a toolbar. -</para> - -@toolbar: a #GtkToolbar. -@space_size: the new number of pixels that spaces should consume. - - -<!-- ##### FUNCTION gtk_toolbar_set_space_style ##### --> -<para> -sets whether a 'space' in the toolbar appears as a line or just plain empty space. -</para> - -@toolbar: a #GtkToolbar. -@space_style: the new style for the toolbar's spaces. - - <!-- ##### FUNCTION gtk_toolbar_set_tooltips ##### --> <para> sets if the tooltips of a toolbar should be active or not. @@ -285,24 +267,6 @@ sets if the tooltips of a toolbar should be active or not. @enable: set to 0 to disable the tooltips, or 1 to enable them. -<!-- ##### FUNCTION gtk_toolbar_set_button_relief ##### --> -<para> - -</para> - -@toolbar: -@relief: - - -<!-- ##### FUNCTION gtk_toolbar_get_button_relief ##### --> -<para> - -</para> - -@toolbar: -@Returns: - - <!-- ##### FUNCTION gtk_toolbar_insert_stock ##### --> <para> @@ -355,18 +319,3 @@ should be used if you wish to perform an action when ever the style of a toolbar </para> -<!-- ##### ARG GtkToolbar:space-size ##### --> -<para> - -</para> - -<!-- ##### ARG GtkToolbar:space-style ##### --> -<para> - -</para> - -<!-- ##### ARG GtkToolbar:relief ##### --> -<para> - -</para> - diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 8767c33a7..8fdb559f0 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -1903,8 +1903,8 @@ static struct const char *xsettings_name; const char *gdk_name; } settings_map[] = { - { "Net/DoubleClickTime", "double-click-timeout" }, - { "Net/DragThreshold", "drag-threshold" } + { "Net/DoubleClickTime", "gtk-double-click-timeout" }, + { "Net/DragThreshold", "gtk-drag-threshold" } }; static void diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c index 45fe3d345..720248e95 100644 --- a/gtk/gtkbbox.c +++ b/gtk/gtkbbox.c @@ -25,17 +25,16 @@ */ #include "gtkbbox.h" +#include "gtkintl.h" static void gtk_button_box_class_init (GtkButtonBoxClass *klass); static void gtk_button_box_init (GtkButtonBox *box); - -static gint default_child_min_width = 85; -static gint default_child_min_height = 27; -static gint default_child_ipad_x = 7; -static gint default_child_ipad_y = 0; - +#define DEFAULT_CHILD_MIN_WIDTH 85 +#define DEFAULT_CHILD_MIN_HEIGHT 27 +#define DEFAULT_CHILD_IPAD_X 7 +#define DEFAULT_CHILD_IPAD_Y 0 GtkType gtk_button_box_get_type (void) @@ -72,6 +71,42 @@ gtk_button_box_class_init (GtkButtonBoxClass *class) /* FIXME we need to override the "spacing" property on GtkBox once * libgobject allows that. */ + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_int ("child_min_width", + _("Minimum child width"), + _("Minimum width of buttons inside the box"), + 0, + G_MAXINT, + DEFAULT_CHILD_MIN_WIDTH, + G_PARAM_READABLE)); + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_int ("child_min_height", + _("Minimum child height"), + _("Minimum height of buttons inside the box"), + 0, + G_MAXINT, + DEFAULT_CHILD_MIN_HEIGHT, + G_PARAM_READABLE)); + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_int ("child_internal_pad_x", + _("Child internal width padding"), + _("Amount to increase child's size on either side"), + 0, + G_MAXINT, + DEFAULT_CHILD_IPAD_X, + G_PARAM_READABLE)); + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_int ("child_internal_pad_y", + _("Child internal height padding"), + _("Amount to increase child's size on the top and bottom"), + 0, + G_MAXINT, + DEFAULT_CHILD_IPAD_Y, + G_PARAM_READABLE)); } static void @@ -166,10 +201,15 @@ _gtk_button_box_child_requisition (GtkWidget *widget, bbox = GTK_BUTTON_BOX (widget); - width_default = default_child_min_width; - height_default = default_child_min_height; - ipad_x_default = default_child_ipad_x; - ipad_y_default = default_child_ipad_y; + gtk_widget_style_get (widget, + "child_min_width", + &width_default, + "child_min_height", + &height_default, + "child_internal_pad_x", + &ipad_x_default, + "child_internal_pad_y", + &ipad_y_default, NULL); child_min_width = bbox->child_min_width != GTK_BUTTONBOX_DEFAULT ? bbox->child_min_width : width_default; diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 17b57cc56..bb9a0cd2e 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -376,10 +376,10 @@ gtk_button_new_from_stock (const gchar *stock_id) gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_hbox_new (FALSE, 1); - gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 2); - gtk_box_pack_end (GTK_BOX (hbox), label, TRUE, TRUE, 2); + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), label, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (button), hbox); gtk_widget_show_all (hbox); diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index e8ec8d108..0d68fb0d4 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -500,7 +500,7 @@ gtk_combo_popup_button_press (GtkWidget *button, gtk_widget_grab_focus (combo->entry); if (event->button != 1) - return; + return FALSE; combo->current_button = event->button; diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 644c4c4c5..193ef4912 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1694,43 +1694,6 @@ gtk_entry_style_set (GtkWidget *widget, } } -static char * -strstr_len (const char *haystack, - int haystack_len, - const char *needle) -{ - int i; - - g_return_val_if_fail (haystack != NULL, NULL); - g_return_val_if_fail (needle != NULL, NULL); - - if (haystack_len < 0) - return strstr (haystack, needle); - else - { - const char *p = haystack; - int needle_len = strlen (needle); - const char *end = haystack + haystack_len - needle_len; - - if (needle_len == 0) - return (char *)haystack; - - while (*p && p <= end) - { - for (i = 0; i < needle_len; i++) - if (p[i] != needle[i]) - goto next; - - return (char *)p; - - next: - p++; - } - } - - return NULL; -} - /* Default signal handlers */ static void @@ -1741,26 +1704,10 @@ gtk_entry_real_insert_text (GtkEntry *entry, { gint index; gint n_chars; - gchar line_separator[7]; - gint len; - gchar *p; if (new_text_length < 0) new_text_length = strlen (new_text); - /* We don't want to allow inserting paragraph delimeters - */ - pango_find_paragraph_boundary (new_text, new_text_length, &new_text_length, NULL); - - /* Or line separators - this is really painful - */ - len = g_unichar_to_utf8 (0x2028, line_separator); /* 0x2028 == LS */ - line_separator[len] = '\0'; - - p = strstr_len (new_text, new_text_length, line_separator); - if (p) - new_text_length = p - new_text; - n_chars = g_utf8_strlen (new_text, new_text_length); if (entry->text_max_length > 0 && n_chars + entry->text_length > entry->text_max_length) { @@ -2167,6 +2114,8 @@ gtk_entry_create_layout (GtkEntry *entry, gint preedit_length = 0; PangoAttrList *preedit_attrs = NULL; + pango_layout_set_single_paragraph_mode (layout, TRUE); + if (include_preedit) { gtk_im_context_get_preedit_string (entry->im_context, diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 3de7d6d7d..c32dd6969 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -36,6 +36,7 @@ #include "gtkwindow.h" #include "gtkhbox.h" #include "gtkvscrollbar.h" +#include "gtksettings.h" #define MENU_ITEM_CLASS(w) GTK_MENU_ITEM_GET_CLASS (w) @@ -1372,19 +1373,54 @@ gtk_menu_key_press (GtkWidget *widget, GdkEventKey *event) { GtkMenuShell *menu_shell; + GtkMenu *menu; gboolean delete = FALSE; - + gchar *accel = NULL; + g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_MENU (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); menu_shell = GTK_MENU_SHELL (widget); - - gtk_menu_stop_navigating_submenu (GTK_MENU (widget)); + menu = GTK_MENU (widget); + + gtk_menu_stop_navigating_submenu (menu); if (GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event)) return TRUE; + + g_object_get (G_OBJECT (gtk_settings_get_global ()), + "gtk-menu-bar-accel", + &accel, + NULL); + if (accel) + { + guint keyval = 0; + GdkModifierType mods = 0; + gboolean handled = FALSE; + + gtk_accelerator_parse (accel, &keyval, &mods); + + if (keyval == 0) + g_warning ("Failed to parse menu bar accelerator '%s'\n", accel); + + /* FIXME this is wrong, needs to be in the global accel resolution + * thing, to properly consider i18n etc., but that probably requires + * AccelGroup changes etc. + */ + if (event->keyval == keyval && + (mods & event->state) == mods) + { + gtk_signal_emit_by_name (GTK_OBJECT (menu), "cancel"); + } + + g_free (accel); + + if (handled) + return TRUE; + } + switch (event->keyval) { case GDK_Delete: diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index 73602d848..8cefad1ed 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -29,6 +29,10 @@ #include "gtkmain.h" #include "gtkmenubar.h" #include "gtkmenuitem.h" +#include "gtksettings.h" +#include "gtkintl.h" +#include "gtkwindow.h" +#include "gtksignal.h" enum { ARG_0, @@ -41,13 +45,6 @@ enum { static void gtk_menu_bar_class_init (GtkMenuBarClass *klass); -static void gtk_menu_bar_init (GtkMenuBar *menu_bar); -static void gtk_menu_bar_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_menu_bar_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); static void gtk_menu_bar_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_menu_bar_size_allocate (GtkWidget *widget, @@ -56,7 +53,8 @@ static void gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area); static gint gtk_menu_bar_expose (GtkWidget *widget, GdkEventExpose *event); - +static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget); +static GtkShadowType get_shadow_type (GtkMenuBar *menubar); static GtkMenuShellClass *parent_class = NULL; @@ -73,7 +71,7 @@ gtk_menu_bar_get_type (void) sizeof (GtkMenuBar), sizeof (GtkMenuBarClass), (GtkClassInitFunc) gtk_menu_bar_class_init, - (GtkObjectInitFunc) gtk_menu_bar_init, + (GtkObjectInitFunc) NULL, /* reserved_1 */ NULL, /* reserved_2 */ NULL, (GtkClassInitFunc) NULL, @@ -100,15 +98,11 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class) widget_class = (GtkWidgetClass*) class; menu_shell_class = (GtkMenuShellClass*) class; - gtk_object_add_arg_type ("GtkMenuBar::shadow", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW); - - object_class->set_arg = gtk_menu_bar_set_arg; - object_class->get_arg = gtk_menu_bar_get_arg; - widget_class->size_request = gtk_menu_bar_size_request; widget_class->size_allocate = gtk_menu_bar_size_allocate; widget_class->expose_event = gtk_menu_bar_expose; - + widget_class->hierarchy_changed = gtk_menu_bar_hierarchy_changed; + menu_shell_class->submenu_placement = GTK_TOP_BOTTOM; binding_set = gtk_binding_set_by_class (class); @@ -132,51 +126,21 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class) "move_current", 1, GTK_TYPE_MENU_DIRECTION_TYPE, GTK_MENU_DIR_CHILD); -} - -static void -gtk_menu_bar_init (GtkMenuBar *menu_bar) -{ - menu_bar->shadow_type = GTK_SHADOW_OUT; -} - -static void -gtk_menu_bar_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) -{ - GtkMenuBar *menu_bar; - menu_bar = GTK_MENU_BAR (object); - - switch (arg_id) - { - case ARG_SHADOW: - gtk_menu_bar_set_shadow_type (menu_bar, GTK_VALUE_ENUM (*arg)); - break; - default: - break; - } -} - -static void -gtk_menu_bar_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) -{ - GtkMenuBar *menu_bar; - - menu_bar = GTK_MENU_BAR (object); - - switch (arg_id) - { - case ARG_SHADOW: - GTK_VALUE_ENUM (*arg) = menu_bar->shadow_type; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } + gtk_settings_install_property (gtk_settings_get_global (), + g_param_spec_string ("gtk-menu-bar-accel", + _("Menu bar accelerator"), + _("Keybinding to activate the menu bar"), + "F10", + G_PARAM_READWRITE)); + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_enum ("shadow_type", + _("Shadow type"), + _("Style of bevel around the menubar"), + GTK_TYPE_SHADOW_TYPE, + GTK_SHADOW_OUT, + G_PARAM_READABLE)); } GtkWidget* @@ -347,25 +311,6 @@ gtk_menu_bar_size_allocate (GtkWidget *widget, } } -void -gtk_menu_bar_set_shadow_type (GtkMenuBar *menu_bar, - GtkShadowType type) -{ - g_return_if_fail (menu_bar != NULL); - g_return_if_fail (GTK_IS_MENU_BAR (menu_bar)); - - if ((GtkShadowType) menu_bar->shadow_type != type) - { - menu_bar->shadow_type = type; - - if (GTK_WIDGET_DRAWABLE (menu_bar)) - { - gtk_widget_queue_clear (GTK_WIDGET (menu_bar)); - } - gtk_widget_queue_resize (GTK_WIDGET (menu_bar)); - } -} - static void gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area) { @@ -377,7 +322,7 @@ gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area) gtk_paint_box (widget->style, widget->window, GTK_STATE_NORMAL, - GTK_MENU_BAR (widget)->shadow_type, + get_shadow_type (GTK_MENU_BAR (widget)), area, widget, "menubar", 0, 0, -1,-1); @@ -401,3 +346,141 @@ gtk_menu_bar_expose (GtkWidget *widget, return FALSE; } + +static gboolean +window_key_press_handler (GtkWidget *widget, + GdkEventKey *event, + gpointer data) +{ + gchar *accel = NULL; + gboolean retval = FALSE; + + g_object_get (G_OBJECT (gtk_settings_get_global ()), + "gtk-menu-bar-accel", + &accel, + NULL); + + if (accel) + { + guint keyval = 0; + GdkModifierType mods = 0; + + gtk_accelerator_parse (accel, &keyval, &mods); + + if (keyval == 0) + g_warning ("Failed to parse menu bar accelerator '%s'\n", accel); + + /* FIXME this is wrong, needs to be in the global accel resolution + * thing, to properly consider i18n etc., but that probably requires + * AccelGroup changes etc. + */ + if (event->keyval == keyval && + (mods & event->state) == mods) + { + GtkMenuBar *menubar; + GtkMenuShell *menushell; + + menubar = GTK_MENU_BAR (data); + menushell = GTK_MENU_SHELL (menubar); + + if (menushell->children) + { + gtk_signal_emit_by_name (GTK_OBJECT (menushell->children->data), + "activate_item"); + + retval = TRUE; + } + } + + g_free (accel); + } + + return retval; +} + +static void +add_to_window (GtkWindow *window, + GtkMenuBar *menubar) +{ + GtkMenuBar *old_menubar; + + old_menubar = g_object_get_data (G_OBJECT (window), + "gtk-menu-bar"); + + if (old_menubar) + return; /* ignore this case; app programmer on crack, but + * shouldn't spew stuff, just don't support the accel + * for menubar #2 + */ + + g_object_set_data (G_OBJECT (window), + "gtk-menu-bar", + menubar); + + g_signal_connect_data (G_OBJECT (window), + "key_press_event", + G_CALLBACK (window_key_press_handler), + menubar, + NULL, FALSE, FALSE); + + menubar->toplevel = GTK_WIDGET (window); +} + +/* Hack-around */ +#define g_signal_handlers_disconnect_by_func(obj, func, data) g_signal_handlers_disconnect_matched (obj, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, func, data) + +static void +remove_from_window (GtkWindow *window, + GtkMenuBar *menubar) +{ + g_return_if_fail (menubar->toplevel == GTK_WIDGET (window)); + + g_signal_handlers_disconnect_by_func (G_OBJECT (window), + G_CALLBACK (window_key_press_handler), + menubar); + + /* dnotify zeroes menubar->toplevel */ + g_object_set_data (G_OBJECT (window), + "gtk-menu-bar", + NULL); + + menubar->toplevel = NULL; +} + +static void +gtk_menu_bar_hierarchy_changed (GtkWidget *widget) +{ + GtkWidget *toplevel; + GtkMenuBar *menubar; + + menubar = GTK_MENU_BAR (widget); + + toplevel = gtk_widget_get_toplevel (widget); + + if (menubar->toplevel && + toplevel != menubar->toplevel) + { + remove_from_window (GTK_WINDOW (menubar->toplevel), + menubar); + } + + if (toplevel && + GTK_IS_WINDOW (toplevel)) + { + add_to_window (GTK_WINDOW (toplevel), + menubar); + } +} + +static GtkShadowType +get_shadow_type (GtkMenuBar *menubar) +{ + GtkShadowType shadow_type = GTK_SHADOW_OUT; + + gtk_widget_style_get (GTK_WIDGET (menubar), + "shadow_type", &shadow_type, + NULL); + + + return shadow_type; +} diff --git a/gtk/gtkmenubar.h b/gtk/gtkmenubar.h index 235639de5..e1d55830a 100644 --- a/gtk/gtkmenubar.h +++ b/gtk/gtkmenubar.h @@ -52,7 +52,7 @@ struct _GtkMenuBar { GtkMenuShell menu_shell; - GtkShadowType shadow_type; + GtkWidget *toplevel; }; struct _GtkMenuBarClass @@ -70,9 +70,6 @@ void gtk_menu_bar_prepend (GtkMenuBar *menu_bar, void gtk_menu_bar_insert (GtkMenuBar *menu_bar, GtkWidget *child, gint position); -void gtk_menu_bar_set_shadow_type (GtkMenuBar *menu_bar, - GtkShadowType type); - #ifdef __cplusplus } diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index c6a0145a9..f37c96e97 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -94,7 +94,8 @@ gtk_message_dialog_init (GtkMessageDialog *dialog) dialog->image = gtk_image_new_from_stock (NULL, GTK_ICON_SIZE_DIALOG); gtk_label_set_line_wrap (GTK_LABEL (dialog->label), TRUE); - + gtk_label_set_selectable (GTK_LABEL (dialog->label), TRUE); + hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox), dialog->image, diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index 525883734..6c8a18f4c 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -347,6 +347,9 @@ gtk_option_menu_get_props (GtkOptionMenu *option_menu, props->indicator_spacing = *indicator_spacing; else props->indicator_spacing = default_props.indicator_spacing; + + g_free (indicator_size); + g_free (indicator_spacing); } static void diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index e0b82820e..8c329212e 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -15,16 +15,13 @@ * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "gtksettings.h" - +#include "gtksettings.h" +#include "gtkintl.h" enum { PROP_0, - PROP_DOUBLE_CLICK_TIMEOUT, - PROP_BELL_PITCH, - PROP_BELL_DURATION, - PROP_BELL_PERCENT + PROP_DOUBLE_CLICK_TIMEOUT }; @@ -114,6 +111,7 @@ static void gtk_settings_class_init (GtkSettingsClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); + guint result; parent_class = g_type_class_peek_parent (class); @@ -127,30 +125,14 @@ gtk_settings_class_init (GtkSettingsClass *class) quark_property_id = g_quark_try_string ("GObject-property-id"); g_assert (quark_property_id != 0); /* special quarks from GObjectClass */ - g_assert (PROP_DOUBLE_CLICK_TIMEOUT == - settings_install_property_parser (class, - g_param_spec_int ("double-click-timeout", "Double Click Timeout", NULL, - 0, G_MAXINT, 1000, - G_PARAM_READWRITE), - NULL)); - g_assert (PROP_BELL_PITCH == - settings_install_property_parser (class, - g_param_spec_int ("bell-pitch", "Bell Pitch", NULL, - 0, G_MAXINT, 440, - G_PARAM_READWRITE), - NULL)); - g_assert (PROP_BELL_DURATION == - settings_install_property_parser (class, - g_param_spec_int ("bell_duration", "Bell Duration", NULL, - 1, G_MAXINT, 250, - G_PARAM_READWRITE), - NULL)); - g_assert (PROP_BELL_PERCENT == - settings_install_property_parser (class, - g_param_spec_float ("bell_percent", "Bell Percent", NULL, - 0, 100, 80, - G_PARAM_READWRITE), - NULL)); + result = settings_install_property_parser (class, + g_param_spec_int ("gtk-double-click-timeout", + _("Double Click Timeout"), + _("Maximum time allowed between two clicks for them to be considered a double click"), + 0, G_MAXINT, 1000, + G_PARAM_READWRITE), + NULL); + g_assert (result == PROP_DOUBLE_CLICK_TIMEOUT); } static void @@ -243,15 +225,6 @@ gtk_settings_notify (GObject *object, g_object_get (object, pspec->name, &double_click_time, NULL); gdk_set_double_click_time (double_click_time); break; - case PROP_BELL_PITCH: - g_print ("settings-notify: %s = \"%s\"\n", pspec->name, contents); - break; - case PROP_BELL_DURATION: - g_print ("settings-notify: %s = \"%s\"\n", pspec->name, contents); - break; - case PROP_BELL_PERCENT: - g_print ("settings-notify: %s = \"%s\"\n", pspec->name, contents); - break; } g_free (contents); diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index ccfc5e0dd..3ba23cbc4 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -35,6 +35,7 @@ #include "gtkstock.h" #include "gtkiconfactory.h" #include "gtkimage.h" +#include "gtkintl.h" #define DEFAULT_SPACE_SIZE 5 @@ -86,6 +87,8 @@ static void gtk_toolbar_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_toolbar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static void gtk_toolbar_style_set (GtkWidget *widget, + GtkStyle *prev_style); static void gtk_toolbar_add (GtkContainer *container, GtkWidget *widget); static void gtk_toolbar_remove (GtkContainer *container, @@ -121,6 +124,13 @@ static GtkWidget * gtk_toolbar_internal_insert_item (GtkToolbar *toolbar, gint position, gboolean has_mnemonic); +static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar); + +static GtkReliefStyle get_button_relief (GtkToolbar *toolbar); +static gint get_space_size (GtkToolbar *toolbar); +static GtkToolbarSpaceStyle get_space_style (GtkToolbar *toolbar); + + static GtkContainerClass *parent_class; static guint toolbar_signals[LAST_SIGNAL] = { 0 }; @@ -173,7 +183,8 @@ gtk_toolbar_class_init (GtkToolbarClass *class) widget_class->expose_event = gtk_toolbar_expose; widget_class->size_request = gtk_toolbar_size_request; widget_class->size_allocate = gtk_toolbar_size_allocate; - + widget_class->style_set = gtk_toolbar_style_set; + container_class->add = gtk_toolbar_add; container_class->remove = gtk_toolbar_remove; container_class->forall = gtk_toolbar_forall; @@ -203,12 +214,31 @@ gtk_toolbar_class_init (GtkToolbarClass *class) GTK_ARG_READWRITE, ARG_ORIENTATION); gtk_object_add_arg_type ("GtkToolbar::toolbar_style", GTK_TYPE_TOOLBAR_STYLE, GTK_ARG_READWRITE, ARG_TOOLBAR_STYLE); - gtk_object_add_arg_type ("GtkToolbar::space_size", GTK_TYPE_UINT, - GTK_ARG_READWRITE, ARG_SPACE_SIZE); - gtk_object_add_arg_type ("GtkToolbar::space_style", GTK_TYPE_TOOLBAR_SPACE_STYLE, - GTK_ARG_READWRITE, ARG_SPACE_STYLE); - gtk_object_add_arg_type ("GtkToolbar::relief", GTK_TYPE_RELIEF_STYLE, - GTK_ARG_READWRITE, ARG_RELIEF); + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_int ("space_size", + _("Spacer size"), + _("Size of spacers"), + 0, + G_MAXINT, + DEFAULT_SPACE_SIZE, + G_PARAM_READABLE)); + gtk_widget_class_install_style_property (widget_class, + g_param_spec_enum ("space_style", + _("Space style"), + _("Whether spacers are vertical lines or just blank"), + GTK_TYPE_TOOLBAR_SPACE_STYLE, + DEFAULT_SPACE_STYLE, + + G_PARAM_READABLE)); + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_enum ("button_relief", + _("Button relief"), + _("Type of bevel around toolbar buttons"), + GTK_TYPE_RELIEF_STYLE, + GTK_RELIEF_NORMAL, + G_PARAM_READABLE)); } static void @@ -221,9 +251,6 @@ gtk_toolbar_init (GtkToolbar *toolbar) toolbar->children = NULL; toolbar->orientation = GTK_ORIENTATION_HORIZONTAL; toolbar->style = GTK_TOOLBAR_ICONS; - toolbar->relief = GTK_RELIEF_NORMAL; - toolbar->space_size = DEFAULT_SPACE_SIZE; - toolbar->space_style = DEFAULT_SPACE_STYLE; toolbar->icon_size = DEFAULT_ICON_SIZE; toolbar->tooltips = gtk_tooltips_new (); toolbar->button_maxw = 0; @@ -245,15 +272,6 @@ gtk_toolbar_set_arg (GtkObject *object, case ARG_TOOLBAR_STYLE: gtk_toolbar_set_style (toolbar, GTK_VALUE_ENUM (*arg)); break; - case ARG_SPACE_SIZE: - gtk_toolbar_set_space_size (toolbar, GTK_VALUE_UINT (*arg)); - break; - case ARG_SPACE_STYLE: - gtk_toolbar_set_space_style (toolbar, GTK_VALUE_ENUM (*arg)); - break; - case ARG_RELIEF: - gtk_toolbar_set_button_relief (toolbar, GTK_VALUE_ENUM (*arg)); - break; } } @@ -272,15 +290,6 @@ gtk_toolbar_get_arg (GtkObject *object, case ARG_TOOLBAR_STYLE: GTK_VALUE_ENUM (*arg) = toolbar->style; break; - case ARG_SPACE_SIZE: - GTK_VALUE_UINT (*arg) = toolbar->space_size; - break; - case ARG_SPACE_STYLE: - GTK_VALUE_ENUM (*arg) = toolbar->space_style; - break; - case ARG_RELIEF: - GTK_VALUE_ENUM (*arg) = toolbar->relief; - break; default: arg->type = GTK_TYPE_INVALID; break; @@ -393,7 +402,8 @@ gtk_toolbar_paint_space_line (GtkWidget *widget, { GtkToolbar *toolbar; GtkToolbarChildSpace *child_space; - + gint space_size; + g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TOOLBAR (widget)); g_return_if_fail (child != NULL); @@ -402,7 +412,8 @@ gtk_toolbar_paint_space_line (GtkWidget *widget, toolbar = GTK_TOOLBAR (widget); child_space = (GtkToolbarChildSpace *) child; - + space_size = get_space_size (toolbar); + if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) gtk_paint_vline (widget->style, widget->window, GTK_WIDGET_STATE (widget), area, widget, @@ -412,7 +423,7 @@ gtk_toolbar_paint_space_line (GtkWidget *widget, child_space->alloc_y + toolbar->button_maxh * SPACE_LINE_END / SPACE_LINE_DIVISION, child_space->alloc_x + - (toolbar->space_size - + (space_size - widget->style->xthickness) / 2); else gtk_paint_hline (widget->style, widget->window, @@ -423,7 +434,7 @@ gtk_toolbar_paint_space_line (GtkWidget *widget, child_space->alloc_x + toolbar->button_maxw * SPACE_LINE_END / SPACE_LINE_DIVISION, child_space->alloc_y + - (toolbar->space_size - + (space_size - widget->style->ythickness) / 2); } @@ -449,7 +460,7 @@ gtk_toolbar_expose (GtkWidget *widget, if (child->type == GTK_TOOLBAR_CHILD_SPACE) { - if (toolbar->space_style == GTK_TOOLBAR_SPACE_LINE) + if (get_space_style (toolbar) == GTK_TOOLBAR_SPACE_LINE) gtk_toolbar_paint_space_line (widget, &event->area, child); } else @@ -473,7 +484,8 @@ gtk_toolbar_size_request (GtkWidget *widget, gint button_maxw, button_maxh; gint widget_maxw, widget_maxh; GtkRequisition child_requisition; - + gint space_size; + g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TOOLBAR (widget)); g_return_if_fail (requisition != NULL); @@ -488,6 +500,8 @@ gtk_toolbar_size_request (GtkWidget *widget, widget_maxw = 0; widget_maxh = 0; + space_size = get_space_size (toolbar); + for (children = toolbar->children; children; children = children->next) { child = children->data; @@ -496,9 +510,9 @@ gtk_toolbar_size_request (GtkWidget *widget, { case GTK_TOOLBAR_CHILD_SPACE: if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) - requisition->width += toolbar->space_size; + requisition->width += space_size; else - requisition->height += toolbar->space_size; + requisition->height += space_size; break; @@ -506,7 +520,7 @@ gtk_toolbar_size_request (GtkWidget *widget, case GTK_TOOLBAR_CHILD_RADIOBUTTON: case GTK_TOOLBAR_CHILD_TOGGLEBUTTON: if (GTK_WIDGET_VISIBLE (child->widget)) - { + { gtk_widget_size_request (child->widget, &child_requisition); nbuttons++; @@ -563,6 +577,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget, GtkAllocation alloc; GtkRequisition child_requisition; gint border_width; + gint space_size; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TOOLBAR (widget)); @@ -578,6 +593,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget, else alloc.y = allocation->y + border_width; + space_size = get_space_size (toolbar); + for (children = toolbar->children; children; children = children->next) { child = children->data; @@ -592,13 +609,13 @@ gtk_toolbar_size_allocate (GtkWidget *widget, { child_space->alloc_x = alloc.x; child_space->alloc_y = allocation->y + (allocation->height - toolbar->button_maxh) / 2; - alloc.x += toolbar->space_size; + alloc.x += space_size; } else { child_space->alloc_x = allocation->x + (allocation->width - toolbar->button_maxw) / 2; child_space->alloc_y = alloc.y; - alloc.y += toolbar->space_size; + alloc.y += space_size; } break; @@ -656,6 +673,14 @@ gtk_toolbar_size_allocate (GtkWidget *widget, } static void +gtk_toolbar_style_set (GtkWidget *widget, + GtkStyle *prev_style) +{ + if (prev_style) + gtk_toolbar_update_button_relief (GTK_TOOLBAR (widget)); +} + +static void gtk_toolbar_add (GtkContainer *container, GtkWidget *widget) { @@ -1086,12 +1111,12 @@ gtk_toolbar_internal_insert_element (GtkToolbar *toolbar, if (type == GTK_TOOLBAR_CHILD_BUTTON) { child->widget = gtk_button_new (); - gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief); + gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar)); } else if (type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON) { child->widget = gtk_toggle_button_new (); - gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief); + gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar)); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget), FALSE); } @@ -1100,7 +1125,7 @@ gtk_toolbar_internal_insert_element (GtkToolbar *toolbar, child->widget = gtk_radio_button_new (widget ? gtk_radio_button_group (GTK_RADIO_BUTTON (widget)) : NULL); - gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief); + gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar)); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget), FALSE); } @@ -1192,34 +1217,6 @@ gtk_toolbar_set_style (GtkToolbar *toolbar, } void -gtk_toolbar_set_space_size (GtkToolbar *toolbar, - gint space_size) -{ - g_return_if_fail (toolbar != NULL); - g_return_if_fail (GTK_IS_TOOLBAR (toolbar)); - - if (toolbar->space_size != space_size) - { - toolbar->space_size = space_size; - gtk_widget_queue_resize (GTK_WIDGET (toolbar)); - } -} - -void -gtk_toolbar_set_space_style (GtkToolbar *toolbar, - GtkToolbarSpaceStyle space_style) -{ - g_return_if_fail (toolbar != NULL); - g_return_if_fail (GTK_IS_TOOLBAR (toolbar)); - - if (toolbar->space_style != space_style) - { - toolbar->space_style = space_style; - gtk_widget_queue_resize (GTK_WIDGET (toolbar)); - } -} - -void gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gboolean enable) { @@ -1232,42 +1229,28 @@ gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gtk_tooltips_disable (toolbar->tooltips); } -void -gtk_toolbar_set_button_relief (GtkToolbar *toolbar, - GtkReliefStyle relief) +static void +gtk_toolbar_update_button_relief (GtkToolbar *toolbar) { GList *children; GtkToolbarChild *child; + GtkReliefStyle relief; g_return_if_fail (toolbar != NULL); g_return_if_fail (GTK_IS_TOOLBAR (toolbar)); - if (toolbar->relief != relief) + relief = get_button_relief (toolbar); + + for (children = toolbar->children; children; children = children->next) { - toolbar->relief = relief; - - for (children = toolbar->children; children; children = children->next) - { - child = children->data; - if (child->type == GTK_TOOLBAR_CHILD_BUTTON || - child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON || - child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON) - gtk_button_set_relief (GTK_BUTTON (child->widget), relief); - } - - gtk_widget_queue_resize (GTK_WIDGET (toolbar)); + child = children->data; + if (child->type == GTK_TOOLBAR_CHILD_BUTTON || + child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON || + child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON) + gtk_button_set_relief (GTK_BUTTON (child->widget), relief); } } -GtkReliefStyle -gtk_toolbar_get_button_relief (GtkToolbar *toolbar) -{ - g_return_val_if_fail (toolbar != NULL, GTK_RELIEF_NORMAL); - g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_RELIEF_NORMAL); - - return toolbar->relief; -} - static void gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar, GtkOrientation orientation) @@ -1421,3 +1404,41 @@ gtk_real_toolbar_style_changed (GtkToolbar *toolbar, gtk_widget_queue_resize (GTK_WIDGET (toolbar)); } } + + +static GtkReliefStyle +get_button_relief (GtkToolbar *toolbar) +{ + GtkReliefStyle button_relief = GTK_RELIEF_NORMAL; + + gtk_widget_style_get (GTK_WIDGET (toolbar), + "button_relief", &button_relief, + NULL); + + return button_relief; +} + +static gint +get_space_size (GtkToolbar *toolbar) +{ + gint space_size = DEFAULT_SPACE_SIZE; + + gtk_widget_style_get (GTK_WIDGET (toolbar), + "space_size", &space_size, + NULL); + + return space_size; +} + +static GtkToolbarSpaceStyle +get_space_style (GtkToolbar *toolbar) +{ + GtkToolbarSpaceStyle space_style = DEFAULT_SPACE_STYLE; + + gtk_widget_style_get (GTK_WIDGET (toolbar), + "space_style", &space_style, + NULL); + + + return space_style; +} diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h index c050c25b8..19ed1b90c 100644 --- a/gtk/gtktoolbar.h +++ b/gtk/gtktoolbar.h @@ -85,15 +85,12 @@ struct _GtkToolbar GList *children; GtkOrientation orientation; GtkToolbarStyle style; - gint space_size; /* big optional space between buttons */ - GtkToolbarSpaceStyle space_style; GtkIconSize icon_size; GtkTooltips *tooltips; gint button_maxw; gint button_maxh; - GtkReliefStyle relief; }; struct _GtkToolbarClass @@ -206,16 +203,8 @@ void gtk_toolbar_set_orientation (GtkToolbar *toolbar, GtkOrientation orientation); void gtk_toolbar_set_style (GtkToolbar *toolbar, GtkToolbarStyle style); -void gtk_toolbar_set_space_size (GtkToolbar *toolbar, - gint space_size); -void gtk_toolbar_set_space_style (GtkToolbar *toolbar, - GtkToolbarSpaceStyle space_style); void gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gboolean enable); -void gtk_toolbar_set_button_relief (GtkToolbar *toolbar, - GtkReliefStyle relief); -GtkReliefStyle gtk_toolbar_get_button_relief (GtkToolbar *toolbar); - #ifdef __cplusplus } diff --git a/tests/testgtk.c b/tests/testgtk.c index 83b63411a..d3b0a5238 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -689,20 +689,6 @@ set_toolbar_both_horiz (GtkWidget *widget, } static void -set_toolbar_small_space (GtkWidget *widget, - gpointer data) -{ - gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 5); -} - -static void -set_toolbar_big_space (GtkWidget *widget, - gpointer data) -{ - gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 10); -} - -static void set_toolbar_enable (GtkWidget *widget, gpointer data) { @@ -717,34 +703,6 @@ set_toolbar_disable (GtkWidget *widget, } static void -set_toolbar_borders (GtkWidget *widget, - gpointer data) -{ - gtk_toolbar_set_button_relief (GTK_TOOLBAR (data), GTK_RELIEF_NORMAL); -} - -static void -set_toolbar_borderless (GtkWidget *widget, - gpointer data) -{ - gtk_toolbar_set_button_relief (GTK_TOOLBAR (data), GTK_RELIEF_NONE); -} - -static void -set_toolbar_space_style_empty (GtkWidget *widget, - gpointer data) -{ - gtk_toolbar_set_space_style (GTK_TOOLBAR (data), GTK_TOOLBAR_SPACE_EMPTY); -} - -static void -set_toolbar_space_style_line (GtkWidget *widget, - gpointer data) -{ - gtk_toolbar_set_space_style (GTK_TOOLBAR (data), GTK_TOOLBAR_SPACE_LINE); -} - -static void create_toolbar (void) { static GtkWidget *window = NULL; @@ -765,7 +723,6 @@ create_toolbar (void) gtk_widget_realize (window); toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); - gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_NEW, @@ -815,16 +772,6 @@ create_toolbar (void) gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); - gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Small", "Use small spaces", "Toolbar/Small", - new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_small_space, toolbar); - gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Big", "Use big spaces", "Toolbar/Big", - new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_big_space, toolbar); - - gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Enable", "Enable tooltips", NULL, @@ -838,24 +785,24 @@ create_toolbar (void) gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Borders", "Show Borders", NULL, + "Frobate", "Frobate tooltip", NULL, new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_borders, toolbar); + (GtkSignalFunc) NULL, toolbar); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Borderless", "Hide Borders", NULL, + "Baz", "Baz tooltip", NULL, new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_borderless, toolbar); + (GtkSignalFunc) NULL, toolbar); gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Empty", "Empty spaces", NULL, + "Blah", "Blah tooltip", NULL, new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_space_style_empty, toolbar); + (GtkSignalFunc) NULL, toolbar); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Lines", "Lines in spaces", NULL, + "Bar", "Bar tooltip", NULL, new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_space_style_line, toolbar); + (GtkSignalFunc) NULL, toolbar); gtk_container_add (GTK_CONTAINER (window), toolbar); } @@ -875,7 +822,6 @@ make_toolbar (GtkWidget *window) gtk_widget_realize (window); toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); - gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Horizontal", "Horizontal toolbar layout", NULL, @@ -904,13 +850,13 @@ make_toolbar (GtkWidget *window) gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Small", "Use small spaces", NULL, + "Woot", "Woot woot woot", NULL, new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_small_space, toolbar); + (GtkSignalFunc) NULL, toolbar); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Big", "Use big spaces", "Toolbar/Big", + "Blah", "Blah blah blah", "Toolbar/Big", new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_big_space, toolbar); + (GtkSignalFunc) NULL, toolbar); gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); @@ -926,13 +872,13 @@ make_toolbar (GtkWidget *window) gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Borders", "Show Borders", NULL, + "Hoo", "Hoo tooltip", NULL, new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_borders, toolbar); + (GtkSignalFunc) NULL, toolbar); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), - "Borderless", "Hide Borders", NULL, + "Woo", "Woo tooltip", NULL, new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) set_toolbar_borderless, toolbar); + (GtkSignalFunc) NULL, toolbar); return toolbar; } @@ -1653,7 +1599,7 @@ create_handle_box (void) gtk_widget_show (handle_box); toolbar = make_toolbar (window); - gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NORMAL); + gtk_container_add (GTK_CONTAINER (handle_box), toolbar); gtk_widget_show (toolbar); @@ -3664,7 +3610,7 @@ create_entry (void) cb = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (cb), cbitems); - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(cb)->entry), "hello world"); + gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(cb)->entry), "hello world \n\n\n foo"); gtk_editable_select_region (GTK_EDITABLE (GTK_COMBO(cb)->entry), 0, -1); gtk_box_pack_start (GTK_BOX (box2), cb, TRUE, TRUE, 0); diff --git a/tests/testgtkrc b/tests/testgtkrc index 56124a4a4..31250b346 100644 --- a/tests/testgtkrc +++ b/tests/testgtkrc @@ -33,6 +33,11 @@ style "global-style-properties" # xthickness = 20 GtkSpinButton::shadow_type = etched-out GtkEntry::cursor_color = "#ff0000" + GtkToolbar::space_size = 10 + GtkToolbar::space_style = line + GtkToolbar::button_relief = none + GtkButtonBox::child_min_width = 0 + GtkButtonBox::child_min_height = 0 } class "GtkWidget" style "global-style-properties" diff --git a/tests/testtext.c b/tests/testtext.c index 51ab5bcba..baa648f5d 100644 --- a/tests/testtext.c +++ b/tests/testtext.c @@ -424,6 +424,7 @@ fill_example_buffer (GtkTextBuffer *buffer) { GtkTextIter iter, iter2; GtkTextTag *tag; + GtkTextChildAnchor *anchor; GdkColor color; GdkColor color2; GdkPixbuf *pixbuf; @@ -513,7 +514,6 @@ fill_example_buffer (GtkTextBuffer *buffer) NULL); -#if 0 gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); anchor = gtk_text_buffer_create_child_anchor (buffer, &iter); @@ -522,7 +522,6 @@ fill_example_buffer (GtkTextBuffer *buffer) g_object_set_data_full (G_OBJECT (buffer), "anchor", anchor, (GDestroyNotify) g_object_unref); -#endif pixbuf = gdk_pixbuf_new_from_xpm_data (book_closed_xpm); @@ -2199,9 +2198,10 @@ view_add_example_widgets (View *view) GtkTextChildAnchor *anchor; Buffer *buffer; - return; - buffer = view->buffer; + + /* REMOVE to test widgets */ + return; anchor = g_object_get_data (G_OBJECT (buffer->buffer), "anchor"); @@ -2209,9 +2209,6 @@ view_add_example_widgets (View *view) if (anchor && !gtk_text_child_anchor_get_deleted (anchor)) { GtkWidget *widget; - - widget = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, - GTK_ICON_SIZE_DIALOG); widget = gtk_button_new_with_label ("Foo"); |