+
+static void
+show_image_change_notify (GtkButton *button)
+{
+ GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
+
+ if (priv->image)
+ {
+ if (show_image (button))
+ gtk_widget_show (priv->image);
+ else
+ gtk_widget_hide (priv->image);
+ }
+}
+
+static void
+traverse_container (GtkWidget *widget,
+ gpointer data)
+{
+ if (GTK_IS_BUTTON (widget))
+ show_image_change_notify (GTK_BUTTON (widget));
+ else if (GTK_IS_CONTAINER (widget))
+ gtk_container_forall (GTK_CONTAINER (widget), traverse_container, NULL);
+}
+
+static void
+gtk_button_setting_changed (GtkSettings *settings)
+{
+ GList *list, *l;
+
+ list = gtk_window_list_toplevels ();
+
+ for (l = list; l; l = l->next)
+ gtk_container_forall (GTK_CONTAINER (l->data),
+ traverse_container, NULL);
+
+ g_list_free (list);
+}
+
+
+static void
+gtk_button_screen_changed (GtkWidget *widget,
+ GdkScreen *previous_screen)
+{
+ GtkSettings *settings;
+ guint show_image_connection;
+
+ if (!gtk_widget_has_screen (widget))
+ return;
+
+ settings = gtk_widget_get_settings (widget);
+
+ show_image_connection =
+ GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (settings),
+ "gtk-button-connection"));
+
+ if (show_image_connection)
+ return;
+
+ show_image_connection =
+ g_signal_connect (settings, "notify::gtk-button-images",
+ G_CALLBACK (gtk_button_setting_changed), NULL);
+ g_object_set_data (G_OBJECT (settings),
+ I_("gtk-button-connection"),
+ GUINT_TO_POINTER (show_image_connection));
+
+ show_image_change_notify (GTK_BUTTON (widget));
+}
+
+static void
+gtk_button_state_changed (GtkWidget *widget,
+ GtkStateType previous_state)
+{
+ GtkButton *button = GTK_BUTTON (widget);
+
+ if (!GTK_WIDGET_IS_SENSITIVE (widget))
+ {
+ button->in_button = FALSE;
+ gtk_real_button_released (button);
+ }
+}
+
+static void
+gtk_button_grab_notify (GtkWidget *widget,
+ gboolean was_grabbed)
+{
+ GtkButton *button = GTK_BUTTON (widget);
+
+ if (!was_grabbed)
+ {
+ button->in_button = FALSE;
+ gtk_real_button_released (button);
+ }
+}
+
+/**
+ * gtk_button_set_image:
+ * @button: a #GtkButton
+ * @image: a widget to set as the image for the button
+ *
+ * Set the image of @button to the given widget. Note that
+ * it depends on the gtk-button-images setting whether the
+ * image will be displayed or not, you don't have to call
+ * gtk_widget_show() on @image yourself.
+ *
+ * Since: 2.6
+ */
+void
+gtk_button_set_image (GtkButton *button,
+ GtkWidget *image)
+{
+ GtkButtonPrivate *priv;
+
+ g_return_if_fail (GTK_IS_BUTTON (button));
+ g_return_if_fail (image == NULL || GTK_IS_WIDGET (image));
+
+ priv = GTK_BUTTON_GET_PRIVATE (button);
+
+ priv->image = image;
+ priv->image_is_stock = (image == NULL);
+
+ gtk_button_construct_child (button);
+
+ g_object_notify (G_OBJECT (button), "image");
+}
+
+/**
+ * gtk_button_get_image:
+ * @button: a #GtkButton
+ *
+ * Gets the widget that is currenty set as the image of @button.
+ * This may have been explicitly set by gtk_button_set_image()
+ * or constructed by gtk_button_new_from_stock().
+ *
+ * Return value: a #GtkWidget or %NULL in case there is no image
+ *
+ * Since: 2.6
+ */
+GtkWidget *
+gtk_button_get_image (GtkButton *button)
+{
+ GtkButtonPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
+
+ priv = GTK_BUTTON_GET_PRIVATE (button);
+
+ return priv->image;
+}
+
+/**
+ * gtk_button_set_image_position:
+ * @button: a #GtkButton
+ * @position: the position
+ *
+ * Sets the position of the image relative to the text
+ * inside the button.
+ *
+ * Since: 2.10
+ */
+void
+gtk_button_set_image_position (GtkButton *button,
+ GtkPositionType position)
+{
+
+ GtkButtonPrivate *priv;
+
+ g_return_if_fail (GTK_IS_BUTTON (button));
+ g_return_if_fail (position >= GTK_POS_LEFT && position <= GTK_POS_BOTTOM);
+
+ priv = GTK_BUTTON_GET_PRIVATE (button);
+
+ if (priv->image_position != position)
+ {
+ priv->image_position = position;
+
+ gtk_button_construct_child (button);
+
+ g_object_notify (G_OBJECT (button), "image-position");
+ }
+}
+
+/**
+ * gtk_button_get_image_position:
+ * @button: a #GtkButton
+ *
+ * Gets the position of the image relative to the text
+ * inside the button.
+ *
+ * Return value: the position
+ *
+ * Since: 2.10
+ */
+GtkPositionType
+gtk_button_get_image_position (GtkButton *button)
+{
+ GtkButtonPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_POS_LEFT);
+
+ priv = GTK_BUTTON_GET_PRIVATE (button);
+
+ return priv->image_position;
+}
+
+
+#define __GTK_BUTTON_C__
+#include "gtkaliasdef.c"