mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 10:50:08 +00:00
texthandle: small refactor
These long enums are used too often, shorten things a bit with temp vars.
This commit is contained in:
parent
cfaa421433
commit
14dde08e33
@ -739,6 +739,7 @@ _gtk_text_handle_set_mode (GtkTextHandle *handle,
|
|||||||
GtkTextHandleMode mode)
|
GtkTextHandleMode mode)
|
||||||
{
|
{
|
||||||
GtkTextHandlePrivate *priv;
|
GtkTextHandlePrivate *priv;
|
||||||
|
HandleWindow *start, *end;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_TEXT_HANDLE (handle));
|
g_return_if_fail (GTK_IS_TEXT_HANDLE (handle));
|
||||||
|
|
||||||
@ -748,21 +749,24 @@ _gtk_text_handle_set_mode (GtkTextHandle *handle,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
priv->mode = mode;
|
priv->mode = mode;
|
||||||
|
start = &priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START];
|
||||||
|
end = &priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END];
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case GTK_TEXT_HANDLE_MODE_CURSOR:
|
case GTK_TEXT_HANDLE_MODE_CURSOR:
|
||||||
priv->windows[GTK_TEXT_HANDLE_POSITION_CURSOR].mode_visible = TRUE;
|
start->mode_visible = FALSE;
|
||||||
priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].mode_visible = FALSE;
|
/* end = cursor */
|
||||||
|
end->mode_visible = TRUE;
|
||||||
break;
|
break;
|
||||||
case GTK_TEXT_HANDLE_MODE_SELECTION:
|
case GTK_TEXT_HANDLE_MODE_SELECTION:
|
||||||
priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].mode_visible = TRUE;
|
start->mode_visible = TRUE;
|
||||||
priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].mode_visible = TRUE;
|
end->mode_visible = TRUE;
|
||||||
break;
|
break;
|
||||||
case GTK_TEXT_HANDLE_MODE_NONE:
|
case GTK_TEXT_HANDLE_MODE_NONE:
|
||||||
default:
|
default:
|
||||||
priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].mode_visible = FALSE;
|
start->mode_visible = FALSE;
|
||||||
priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].mode_visible = FALSE;
|
end->mode_visible = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user