app: make GimpOverlayDialog's title and icon-name settable after construction

This commit is contained in:
Michael Natterer 2014-06-09 01:42:09 +02:00
parent f348d1d321
commit 17bd4d2c28
3 changed files with 16 additions and 13 deletions

View File

@ -281,7 +281,7 @@ gimp_tool_gui_set_description (GimpToolGui *gui,
if (private->overlay)
{
/* TODO */
g_object_set (private->dialog, "title", description, NULL);
}
else
{
@ -308,14 +308,7 @@ gimp_tool_gui_set_icon_name (GimpToolGui *gui,
if (! icon_name)
icon_name = gimp_viewable_get_icon_name (GIMP_VIEWABLE (private->tool_info));
if (private->overlay)
{
/* TODO */
}
else
{
g_object_set (private->dialog, "icon-name", icon_name, NULL);
}
g_object_set (private->dialog, "icon-name", icon_name, NULL);
}
void

View File

@ -119,14 +119,14 @@ gimp_overlay_dialog_class_init (GimpOverlayDialogClass *klass)
NULL, NULL,
NULL,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ICON_NAME,
g_param_spec_string ("icon-name",
NULL, NULL,
NULL,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
G_PARAM_CONSTRUCT));
signals[RESPONSE] =
g_signal_new ("response",
@ -175,11 +175,12 @@ gimp_overlay_dialog_constructed (GObject *object)
G_OBJECT_CLASS (parent_class)->constructed (object);
image = gtk_image_new_from_icon_name (dialog->icon_name, GTK_ICON_SIZE_MENU);
dialog->icon_image = image = gtk_image_new_from_icon_name (dialog->icon_name,
GTK_ICON_SIZE_MENU);
gtk_box_pack_start (GTK_BOX (dialog->header), image, FALSE, FALSE, 0);
gtk_widget_show (image);
label = gtk_label_new (dialog->title);
dialog->title_label = label = gtk_label_new (dialog->title);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
@ -254,11 +255,18 @@ gimp_overlay_dialog_set_property (GObject *object,
switch (property_id)
{
case PROP_TITLE:
g_free (dialog->title);
dialog->title = g_value_dup_string (value);
if (dialog->title_label)
gtk_label_set_text (GTK_LABEL (dialog->title_label), dialog->title);
break;
case PROP_ICON_NAME:
g_free (dialog->icon_name);
dialog->icon_name = g_value_dup_string (value);
if (dialog->icon_image)
gtk_image_set_from_icon_name (GTK_IMAGE (dialog->icon_image),
dialog->icon_name, GTK_ICON_SIZE_MENU);
break;
default:

View File

@ -44,6 +44,8 @@ struct _GimpOverlayDialog
gchar *icon_name;
GtkWidget *header;
GtkWidget *icon_image;
GtkWidget *title_label;
GtkWidget *close_button;
GtkWidget *action_area;
};