diff --git a/ChangeLog b/ChangeLog index f49110102c..398a755925 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-04-04 Matthias Clasen + + * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_class_init): + * gtk/gtkruler.c (gtk_ruler_class_init): Add docs. + + * gtk/gtktoggletoolbutton.c: Add an active property. + 2005-04-04 Matthias Clasen Allow completion popups to be wider than the entry. (#131916, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f49110102c..398a755925 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2005-04-04 Matthias Clasen + + * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_class_init): + * gtk/gtkruler.c (gtk_ruler_class_init): Add docs. + + * gtk/gtktoggletoolbutton.c: Add an active property. + 2005-04-04 Matthias Clasen Allow completion popups to be wider than the entry. (#131916, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f49110102c..398a755925 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2005-04-04 Matthias Clasen + + * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_class_init): + * gtk/gtkruler.c (gtk_ruler_class_init): Add docs. + + * gtk/gtktoggletoolbutton.c: Add an active property. + 2005-04-04 Matthias Clasen Allow completion popups to be wider than the entry. (#131916, diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c index 4181e167df..724aa07ea4 100644 --- a/gtk/gtkradiomenuitem.c +++ b/gtk/gtkradiomenuitem.c @@ -365,11 +365,18 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass) gobject_class->set_property = gtk_radio_menu_item_set_property; gobject_class->get_property = gtk_radio_menu_item_get_property; + /** + * GtkRadioMenuItem:group: + * + * The radio menu item whose group this widget belongs to. + * + * Since: 2.8 + */ g_object_class_install_property (gobject_class, PROP_GROUP, g_param_spec_object ("group", P_("Group"), - P_("The radio menu item whose group this widget belongs to."), + P_("The radio menu item whose group this widget belongs to."), GTK_TYPE_RADIO_MENU_ITEM, GTK_PARAM_WRITABLE)); diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c index f4e00ed244..6840b86496 100644 --- a/gtk/gtkruler.c +++ b/gtk/gtkruler.c @@ -155,6 +155,13 @@ gtk_ruler_class_init (GtkRulerClass *class) G_MAXDOUBLE, 0.0, GTK_PARAM_READWRITE)); + /** + * GtkRuler:metric: + * + * The metric used for the ruler. + * + * Since: 2.8 + */ g_object_class_install_property (gobject_class, PROP_METRIC, g_param_spec_enum ("metric", diff --git a/gtk/gtktoggletoolbutton.c b/gtk/gtktoggletoolbutton.c index e1d4461f92..286976d2d0 100644 --- a/gtk/gtktoggletoolbutton.c +++ b/gtk/gtktoggletoolbutton.c @@ -37,6 +37,12 @@ enum { LAST_SIGNAL }; +enum { + PROP_0, + PROP_ACTIVE +}; + + #define GTK_TOGGLE_TOOL_BUTTON_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_TOGGLE_TOOL_BUTTON, GtkToggleToolButtonPrivate)) struct _GtkToggleToolButtonPrivate @@ -47,6 +53,15 @@ struct _GtkToggleToolButtonPrivate static void gtk_toggle_tool_button_init (GtkToggleToolButton *button); static void gtk_toggle_tool_button_class_init (GtkToggleToolButtonClass *klass); +static void gtk_toggle_tool_button_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_toggle_tool_button_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + static gboolean gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *button); static void button_toggled (GtkWidget *widget, @@ -97,9 +112,27 @@ gtk_toggle_tool_button_class_init (GtkToggleToolButtonClass *klass) toolitem_class = (GtkToolItemClass *)klass; toolbutton_class = (GtkToolButtonClass *)klass; + object_class->set_property = gtk_toggle_tool_button_set_property; + object_class->get_property = gtk_toggle_tool_button_get_property; + toolitem_class->create_menu_proxy = gtk_toggle_tool_button_create_menu_proxy; toolbutton_class->button_type = GTK_TYPE_TOGGLE_BUTTON; - + + /** + * GtkToggleToolButton:active: + * + * If the toggle tool button should be pressed in or not. + * + * Since: 2.8 + */ + g_object_class_install_property (gobject_class, + PROP_ACTIVE, + g_param_spec_boolean ("active", + P_("Active"), + P_("If the toggle button should be pressed in or not"), + FALSE, + GTK_PARAM_READWRITE)); + /** * GtkToggleToolButton::toggled: * @toggle_tool_button: the object that emitted the signal @@ -135,6 +168,46 @@ gtk_toggle_tool_button_init (GtkToggleToolButton *button) "toggled", G_CALLBACK (button_toggled), button, 0); } +static void +gtk_toggle_tool_button_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GtkToggleToolButton *button = GTK_TOGGLE_TOOL_BUTTON (object); + + switch (prop_id) + { + case PROP_ACTIVE: + button->priv->active = g_value_get_boolean (value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gtk_toggle_tool_button_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GtkToggleToolButton *button = GTK_TOGGLE_TOOL_BUTTON (object); + + switch (prop_id) + { + case PROP_ACTIVE: + g_value_set_boolean (value, gtk_toggle_tool_button_get_active (button)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + static gboolean gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item) { @@ -219,6 +292,7 @@ menu_item_activated (GtkWidget *menu_item, gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_gtk_tool_button_get_button (tool_button)), toggle_tool_button->priv->active); + g_object_notify (G_OBJECT (toggle_tool_button), "active"); g_signal_emit (toggle_tool_button, toggle_signals[TOGGLED], 0); } } @@ -242,6 +316,7 @@ button_toggled (GtkWidget *widget, toggle_tool_button->priv->active); } + g_object_notify (G_OBJECT (toggle_tool_button), "active"); g_signal_emit (toggle_tool_button, toggle_signals[TOGGLED], 0); } }