From 7b833c5982a36ec5d9e77e7115e8f73de7a52c02 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 15 Sep 2010 00:43:40 -0700 Subject: [PATCH] Prevent opacity slider changes from going into undo as separate items. Fixes bug #629300. --- src/widgets/gradient-vector.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 7f0256665..1c1e8173b 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -648,25 +648,22 @@ static void sp_grad_edit_select(GtkOptionMenu *mnu, GtkWidget *tbl) static void offadjustmentChanged( GtkAdjustment *adjustment, GtkWidget *vb) { - if (blocked) { - return; - } + if (!blocked) { + blocked = TRUE; - blocked = TRUE; + GtkOptionMenu *mnu = static_cast(g_object_get_data(G_OBJECT(vb), "stopmenu")); + if ( g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop") ) { + SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop")); - GtkOptionMenu *mnu = static_cast(g_object_get_data(G_OBJECT(vb), "stopmenu")); - if (!g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop")) { - return; - } - SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop")); - - stop->offset = adjustment->value; - sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset); + stop->offset = adjustment->value; + sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset); - sp_document_done(SP_OBJECT_DOCUMENT(stop), SP_VERB_CONTEXT_GRADIENT, - _("Change gradient stop offset")); + sp_document_maybe_done(SP_OBJECT_DOCUMENT(stop), "gradient:stop:offset", SP_VERB_CONTEXT_GRADIENT, + _("Change gradient stop offset")); - blocked = FALSE; + blocked = FALSE; + } + } } guint32 sp_average_color(guint32 c1, guint32 c2, gdouble p = 0.5) -- 2.30.2