* Boston, MA 02111-1307, USA.
*/
+#include <config.h>
#include "gtktoolbutton.h"
#include "gtkbutton.h"
#include "gtkhbox.h"
g_object_class_install_property (object_class,
PROP_LABEL,
g_param_spec_string ("label",
- _("Label"),
- _("Text to show in the item."),
+ P_("Label"),
+ P_("Text to show in the item."),
NULL,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_USE_UNDERLINE,
g_param_spec_boolean ("use_underline",
- _("Use underline"),
- _("If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu"),
+ P_("Use underline"),
+ P_("If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu"),
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_LABEL_WIDGET,
g_param_spec_object ("label_widget",
- _("Label widget"),
- _("Widget to use as the item label"),
+ P_("Label widget"),
+ P_("Widget to use as the item label"),
GTK_TYPE_WIDGET,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_STOCK_ID,
g_param_spec_string ("stock_id",
- _("Stock Id"),
- _("The stock icon displayed on the item"),
+ P_("Stock Id"),
+ P_("The stock icon displayed on the item"),
NULL,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_ICON_WIDGET,
g_param_spec_object ("icon_widget",
- _("Icon widget"),
- _("Icon widget to display in the item"),
+ P_("Icon widget"),
+ P_("Icon widget to display in the item"),
GTK_TYPE_WIDGET,
G_PARAM_READWRITE));
case GTK_TOOLBAR_BOTH_HORIZ:
box = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), icon, label? FALSE : TRUE, TRUE, 0);
+ if (icon)
+ gtk_box_pack_start (GTK_BOX (box), icon, label? FALSE : TRUE, TRUE, 0);
if (label)
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
gtk_tool_button_property_notify (GObject *object,
GParamSpec *pspec)
{
- if (strcmp (pspec->name, "is_important"))
+ if (strcmp (pspec->name, "is-important") == 0)
gtk_tool_button_construct_contents (GTK_TOOL_ITEM (object));
+
+ if (parent_class->notify)
+ parent_class->notify (object, pspec);
}
static void
if (icon_widget != button->priv->icon_widget)
{
if (button->priv->icon_widget)
- g_object_unref (G_OBJECT (button->priv->icon_widget));
+ {
+ if (button->priv->icon_widget->parent)
+ {
+ gtk_container_remove (GTK_CONTAINER (button->priv->icon_widget->parent),
+ button->priv->icon_widget);
+ }
+ g_object_unref (G_OBJECT (button->priv->icon_widget));
+ }
+
if (icon_widget)
{
g_object_ref (icon_widget);
if (label_widget != button->priv->label_widget)
{
if (button->priv->label_widget)
- g_object_unref (button->priv->label_widget);
-
+ {
+ if (button->priv->icon_widget->parent)
+ {
+ gtk_container_remove (GTK_CONTAINER (button->priv->icon_widget->parent),
+ button->priv->icon_widget);
+ }
+
+ g_object_unref (button->priv->label_widget);
+ }
+
if (label_widget)
{
g_object_ref (label_widget);