static GObject * gtk_scale_button_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { GObject *object; GtkScaleButton *button; GtkWidget *frame, *box; GtkScaleButtonPrivate *priv; object = G_OBJECT_CLASS (gtk_scale_button_parent_class)->constructor (type, n_construct_properties, construct_params); button = GTK_SCALE_BUTTON (object); priv = button->priv; /* frame */ frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); gtk_container_add (GTK_CONTAINER (priv->dock), frame); /* box with scale and +/- buttons */ box = gtk_scale_button_scale_box_new (button); gtk_container_add (GTK_CONTAINER (frame), box); /* set button text and size */ priv->size = GTK_ICON_SIZE_SMALL_TOOLBAR; gtk_scale_button_update_icon (button); return object; }
/** * gtk_scale_button_set_icons: * @button: a #GtkScaleButton * @icons: a %NULL-terminated array of icon names * * Sets the icons to be used by the scale button. * For details, see the #GtkScaleButton:icons property. * * Since: 2.12 */ void gtk_scale_button_set_icons (GtkScaleButton *button, const gchar **icons) { GtkScaleButtonPrivate *priv; gchar **tmp; g_return_if_fail (GTK_IS_SCALE_BUTTON (button)); priv = button->priv; tmp = priv->icon_list; priv->icon_list = g_strdupv ((gchar **) icons); g_strfreev (tmp); gtk_scale_button_update_icon (button); g_object_notify (G_OBJECT (button), "icons"); }
static void gtk_scale_button_scale_value_changed (GtkRange *range) { GtkScaleButton *button; gdouble value; if (GTK_IS_SCALE_BUTTON_VSCALE (range)) button = GTK_SCALE_BUTTON_VSCALE (range)->button; else button = GTK_SCALE_BUTTON_HSCALE (range)->button; value = gtk_range_get_value (range); gtk_scale_button_update_icon (button); g_signal_emit (button, signals[VALUE_CHANGED], 0, value); g_object_notify (G_OBJECT (button), "value"); }
static GObject * gtk_scale_button_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { GObject *object; GtkScaleButton *button; GtkScaleButtonPrivate *priv; object = G_OBJECT_CLASS (gtk_scale_button_parent_class)->constructor (type, n_construct_properties, construct_params); button = GTK_SCALE_BUTTON (object); priv = button->priv; /* set button text and size */ priv->size = GTK_ICON_SIZE_SMALL_TOOLBAR; gtk_scale_button_update_icon (button); return object; }
static void gtk_scale_button_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GtkScaleButton *button = GTK_SCALE_BUTTON (object); switch (prop_id) { case PROP_ORIENTATION: gtk_scale_button_set_orientation (button, g_value_get_enum (value)); break; case PROP_VALUE: gtk_scale_button_set_value (button, g_value_get_double (value)); break; case PROP_SIZE: { GtkIconSize size; size = g_value_get_enum (value); if (button->priv->size != size) { button->priv->size = size; gtk_scale_button_update_icon (button); } } break; case PROP_ADJUSTMENT: gtk_scale_button_set_adjustment (button, g_value_get_object (value)); break; case PROP_ICONS: gtk_scale_button_set_icons (button, (const gchar **)g_value_get_boxed (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }