[gedit/wip/spell-cleanup] spell: simplify and fix update_ui()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/spell-cleanup] spell: simplify and fix update_ui()
- Date: Sat, 9 Jan 2016 12:03:37 +0000 (UTC)
commit b44a339e9643193a204858cb4ff4175d0ef18097
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jan 9 12:44:32 2016 +0100
spell: simplify and fix update_ui()
plugins/spell/gedit-spell-plugin.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/plugins/spell/gedit-spell-plugin.c b/plugins/spell/gedit-spell-plugin.c
index 7230ded..ea551df 100644
--- a/plugins/spell/gedit-spell-plugin.c
+++ b/plugins/spell/gedit-spell-plugin.c
@@ -346,6 +346,7 @@ update_ui (GeditSpellPlugin *plugin)
{
GeditSpellPluginPrivate *priv;
GeditView *view;
+ gboolean editable_view;
GAction *check_spell_action;
GAction *config_spell_action;
GAction *inline_checker_action;
@@ -356,23 +357,22 @@ update_ui (GeditSpellPlugin *plugin)
view = gedit_window_get_active_view (priv->window);
+ editable_view = (view != NULL) && gtk_text_view_get_editable (GTK_TEXT_VIEW (view));
+
check_spell_action = g_action_map_lookup_action (G_ACTION_MAP (priv->window),
"check-spell");
g_simple_action_set_enabled (G_SIMPLE_ACTION (check_spell_action),
- (view != NULL) &&
- gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
+ editable_view);
config_spell_action = g_action_map_lookup_action (G_ACTION_MAP (priv->window),
"config-spell");
g_simple_action_set_enabled (G_SIMPLE_ACTION (config_spell_action),
- (view != NULL) &&
- gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
+ editable_view);
inline_checker_action = g_action_map_lookup_action (G_ACTION_MAP (priv->window),
"inline-spell-checker");
g_simple_action_set_enabled (G_SIMPLE_ACTION (inline_checker_action),
- (view != NULL) &&
- gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
+ editable_view);
if (view != NULL)
{
@@ -400,6 +400,7 @@ update_ui (GeditSpellPlugin *plugin)
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
g_simple_action_set_enabled (G_SIMPLE_ACTION (check_spell_action),
+ editable_view &&
gtk_text_buffer_get_char_count (buffer) > 0);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]