Commit 5233c3ea authored by Morten Welinder's avatar Morten Welinder

GnmExprEntry::with_icon: simplify.

parent 49da22c8
2011-05-23 Morten Welinder <terra@gnome.org>
* gnumeric-expr-entry.c (gee_set_with_icon): Extract from
gee_set_property and do nothing if nothing changes.
* widget-font-selector.c (font_selector_get_pango)
(font_selector_set_from_pango): Unused. Remove.
......
......@@ -439,6 +439,28 @@ gee_set_format (GnmExprEntry *gee, GOFormat const *fmt)
g_object_notify (G_OBJECT (gee), "constant-format");
}
static void
gee_set_with_icon (GnmExprEntry *gee, gboolean with_icon)
{
gboolean has_icon = (gee->icon != NULL);
with_icon = !!with_icon;
if (has_icon == with_icon)
return;
if (with_icon) {
gee->icon = gtk_toggle_button_new ();
gtk_container_add (GTK_CONTAINER (gee->icon),
gtk_image_new_from_stock ("Gnumeric_ExprEntry",
GTK_ICON_SIZE_MENU));
gtk_box_pack_end (GTK_BOX (gee), gee->icon, FALSE, FALSE, 0);
gtk_widget_show_all (gee->icon);
g_signal_connect (gee->icon, "clicked",
G_CALLBACK (cb_icon_clicked), gee);
} else
gtk_widget_destroy (gee->icon);
}
static void
gee_set_property (GObject *object,
guint prop_id,
......@@ -452,19 +474,7 @@ gee_set_property (GObject *object,
break;
case PROP_WITH_ICON:
if (g_value_get_boolean (value)) {
if (gee->icon == NULL) {
gee->icon = gtk_toggle_button_new ();
gtk_container_add (GTK_CONTAINER (gee->icon),
gtk_image_new_from_stock ("Gnumeric_ExprEntry",
GTK_ICON_SIZE_MENU));
gtk_box_pack_end (GTK_BOX (gee), gee->icon, FALSE, FALSE, 0);
gtk_widget_show_all (gee->icon);
g_signal_connect (gee->icon, "clicked",
G_CALLBACK (cb_icon_clicked), gee);
}
} else if (gee->icon != NULL)
gtk_widget_destroy (gee->icon);
gee_set_with_icon (gee, g_value_get_boolean (value));
break;
case PROP_TEXT: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment