From cf40e95d713212d65c4d5fdefa04a61e32b4a2ad Mon Sep 17 00:00:00 2001 From: buliabyak Date: Thu, 13 Aug 2009 22:15:00 +0000 Subject: [PATCH] fix 376068 --- src/widgets/gradient-vector.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 1f0c07754..ba31470f6 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -793,7 +793,6 @@ sp_gradient_vector_widget_new (SPGradient *gradient, SPStop *select_stop) gtk_widget_show (w); gtk_box_pack_start (GTK_BOX (vb), w, TRUE, TRUE, PAD); - gtk_object_set_data (GTK_OBJECT (vb), "gradient", gradient); sp_repr_add_listener (SP_OBJECT_REPR(gradient), &grad_edit_dia_repr_events, vb); GtkTooltips *tt = gtk_tooltips_new (); @@ -1013,6 +1012,8 @@ sp_gradient_vector_widget_load_gradient (GtkWidget *widget, SPGradient *gradient g_object_set_data (G_OBJECT (widget), "gradient", gradient); if (gradient) { + gtk_widget_set_sensitive (widget, TRUE); + sp_gradient_ensure_vector (gradient); GtkOptionMenu *mnu = (GtkOptionMenu *)g_object_get_data (G_OBJECT(widget), "stopmenu"); @@ -1026,22 +1027,23 @@ sp_gradient_vector_widget_load_gradient (GtkWidget *widget, SPGradient *gradient SPColor color( SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c) ); // set color csel->base->setColor( color ); - } - /* Fill preview */ - GtkWidget *w = static_cast(g_object_get_data(G_OBJECT(widget), "preview")); - sp_gradient_image_set_gradient (SP_GRADIENT_IMAGE (w), gradient); + /* Fill preview */ + GtkWidget *w = static_cast(g_object_get_data(G_OBJECT(widget), "preview")); + sp_gradient_image_set_gradient (SP_GRADIENT_IMAGE (w), gradient); - GtkWidget *mnu = static_cast(g_object_get_data(G_OBJECT(widget), "stopmenu")); - update_stop_list (GTK_WIDGET(mnu), gradient, NULL); + update_stop_list (GTK_WIDGET(mnu), gradient, NULL); - // Once the user edits a gradient, it stops being auto-collectable - if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) { - SPDocument *document = SP_OBJECT_DOCUMENT (gradient); - bool saved = sp_document_get_undo_sensitive(document); - sp_document_set_undo_sensitive (document, false); - SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL); - sp_document_set_undo_sensitive (document, saved); + // Once the user edits a gradient, it stops being auto-collectable + if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) { + SPDocument *document = SP_OBJECT_DOCUMENT (gradient); + bool saved = sp_document_get_undo_sensitive(document); + sp_document_set_undo_sensitive (document, false); + SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL); + sp_document_set_undo_sensitive (document, saved); + } + } else { // no gradient, disable everything + gtk_widget_set_sensitive (widget, FALSE); } blocked = FALSE; -- 2.30.2