File bgo-565493-ignore-style-change.patch of Package gtkhtml2
Index: components/editor/gtkhtml-editor-actions.c
===================================================================
--- components/editor/gtkhtml-editor-actions.c (revision 9074)
+++ components/editor/gtkhtml-editor-actions.c (working copy)
@@ -286,6 +286,9 @@ action_bold_cb (GtkToggleAction *action,
{
const gchar *command;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action))
command = "bold-on";
else
@@ -694,6 +697,9 @@ action_italic_cb (GtkToggleAction *actio
{
const gchar *command;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action))
command = "italic-on";
else
@@ -861,6 +867,9 @@ action_monospaced_cb (GtkToggleAction *a
GtkHTMLFontStyle and_mask;
GtkHTMLFontStyle or_mask;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action)) {
and_mask = GTK_HTML_FONT_STYLE_MAX;
or_mask = GTK_HTML_FONT_STYLE_FIXED;
@@ -957,6 +966,9 @@ action_style_cb (GtkRadioAction *action,
{
const gchar *command = NULL;
+ if (editor->priv->ignore_style_change)
+ return;
+
switch (gtk_radio_action_get_current_value (current)) {
case GTK_HTML_PARAGRAPH_STYLE_NORMAL:
command = "style-normal";
@@ -1043,6 +1055,9 @@ action_size_cb (GtkRadioAction *action,
{
const gchar *command = NULL;
+ if (editor->priv->ignore_style_change)
+ return;
+
switch (gtk_radio_action_get_current_value (current)) {
case GTK_HTML_FONT_STYLE_SIZE_1:
command = "size-minus-2";
@@ -1083,6 +1098,9 @@ action_strikethrough_cb (GtkToggleAction
{
const gchar *command;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action))
command = "strikeout-on";
else
@@ -1110,6 +1128,9 @@ action_underline_cb (GtkToggleAction *ac
{
const gchar *command;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action))
command = "underline-on";
else
Index: components/editor/gtkhtml-editor.c
===================================================================
--- components/editor/gtkhtml-editor.c (revision 9074)
+++ components/editor/gtkhtml-editor.c (working copy)
@@ -102,6 +102,8 @@ editor_font_style_changed_cb (GtkhtmlEdi
{
GtkHTMLFontStyle size;
+ editor->priv->ignore_style_change++;
+
gtk_toggle_action_set_active (
GTK_TOGGLE_ACTION (ACTION (BOLD)),
style & GTK_HTML_FONT_STYLE_BOLD);
@@ -128,6 +130,8 @@ editor_font_style_changed_cb (GtkhtmlEdi
gtk_radio_action_set_current_value (
GTK_RADIO_ACTION (ACTION (SIZE_PLUS_ZERO)), size);
+
+ editor->priv->ignore_style_change--;
}
static void
@@ -141,8 +145,12 @@ static void
editor_paragraph_style_changed_cb (GtkhtmlEditor *editor,
GtkHTMLParagraphStyle style)
{
+ editor->priv->ignore_style_change++;
+
gtk_radio_action_set_current_value (
GTK_RADIO_ACTION (ACTION (STYLE_NORMAL)), style);
+
+ editor->priv->ignore_style_change--;
}
static void
Index: components/editor/gtkhtml-editor-private.h
===================================================================
--- components/editor/gtkhtml-editor-private.h (revision 9074)
+++ components/editor/gtkhtml-editor-private.h (working copy)
@@ -172,6 +172,7 @@ struct _GtkhtmlEditorPrivate {
gchar *current_folder;
GtkhtmlColorPalette *palette;
GtkhtmlColorState *text_color;
+ guint ignore_style_change;
gboolean changed;
};