From 14dde08e33f45e08f8b71353f7dfad37e8988d77 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 14 Oct 2015 17:41:12 +0200 Subject: [PATCH] texthandle: small refactor These long enums are used too often, shorten things a bit with temp vars. --- gtk/gtktexthandle.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c index d5745665b5..ebc5c88fc1 100644 --- a/gtk/gtktexthandle.c +++ b/gtk/gtktexthandle.c @@ -739,6 +739,7 @@ _gtk_text_handle_set_mode (GtkTextHandle *handle, GtkTextHandleMode mode) { GtkTextHandlePrivate *priv; + HandleWindow *start, *end; g_return_if_fail (GTK_IS_TEXT_HANDLE (handle)); @@ -748,21 +749,24 @@ _gtk_text_handle_set_mode (GtkTextHandle *handle, return; priv->mode = mode; + start = &priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START]; + end = &priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END]; switch (mode) { case GTK_TEXT_HANDLE_MODE_CURSOR: - priv->windows[GTK_TEXT_HANDLE_POSITION_CURSOR].mode_visible = TRUE; - priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].mode_visible = FALSE; + start->mode_visible = FALSE; + /* end = cursor */ + end->mode_visible = TRUE; break; case GTK_TEXT_HANDLE_MODE_SELECTION: - priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].mode_visible = TRUE; - priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].mode_visible = TRUE; + start->mode_visible = TRUE; + end->mode_visible = TRUE; break; case GTK_TEXT_HANDLE_MODE_NONE: default: - priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].mode_visible = FALSE; - priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].mode_visible = FALSE; + start->mode_visible = FALSE; + end->mode_visible = FALSE; break; }