gtkhtml r9097 - branches/gnome-2-24/components/editor
- From: mbarnes svn gnome org
- To: svn-commits-list gnome org
- Subject: gtkhtml r9097 - branches/gnome-2-24/components/editor
- Date: Mon, 12 Jan 2009 04:37:12 +0000 (UTC)
Author: mbarnes
Date: Mon Jan 12 04:37:12 2009
New Revision: 9097
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=9097&view=rev
Log:
2009-01-12 Matthew Barnes <mbarnes redhat com>
** Fixes bug #565493
* gtkhtml-editor-actions.c (action_bold_cb), (action_italic_cb),
(action_monospaced_cb), (action_style_cb), (action_size_cb),
(action_strikethrough_cb), (action_underline_cb):
Ignore the action activation if 'ignore_style_change' is set.
Means we're moving the cursor around and updating the toolbar.
* gtkhtml-editor.c (editor_font_style_changed_cb),
(editor_paragraph_style_changed_cb):
Set 'ignore_style_change' for the duration of the function.
* gtkhtml-editor-private.h:
Add 'ignore_style_change' counter to the private struct.
Modified:
branches/gnome-2-24/components/editor/ChangeLog
branches/gnome-2-24/components/editor/gtkhtml-editor-actions.c
branches/gnome-2-24/components/editor/gtkhtml-editor-private.h
branches/gnome-2-24/components/editor/gtkhtml-editor.c
Modified: branches/gnome-2-24/components/editor/gtkhtml-editor-actions.c
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-editor-actions.c (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-editor-actions.c Mon Jan 12 04:37:12 2009
@@ -329,6 +329,9 @@
{
const gchar *command;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action))
command = "bold-on";
else
@@ -815,6 +818,9 @@
{
const gchar *command;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action))
command = "italic-on";
else
@@ -982,6 +988,9 @@
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;
@@ -1078,6 +1087,9 @@
{
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";
@@ -1164,6 +1176,9 @@
{
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";
@@ -1204,6 +1219,9 @@
{
const gchar *command;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action))
command = "strikeout-on";
else
@@ -1231,6 +1249,9 @@
{
const gchar *command;
+ if (editor->priv->ignore_style_change)
+ return;
+
if (gtk_toggle_action_get_active (action))
command = "underline-on";
else
Modified: branches/gnome-2-24/components/editor/gtkhtml-editor-private.h
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-editor-private.h (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-editor-private.h Mon Jan 12 04:37:12 2009
@@ -170,6 +170,7 @@
gchar *current_folder;
GtkhtmlColorPalette *palette;
GtkhtmlColorState *text_color;
+ guint ignore_style_change;
gboolean changed;
};
Modified: branches/gnome-2-24/components/editor/gtkhtml-editor.c
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-editor.c (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-editor.c Mon Jan 12 04:37:12 2009
@@ -102,6 +102,8 @@
{
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 @@
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 @@
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]