Skip to content

Commit 709835d

Browse files
committed
nemo-list-view.c: Ignore expander size for click position
calculations if expanders are disabled.
1 parent 802dff9 commit 709835d

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

src/nemo-list-view.c

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -901,13 +901,17 @@ clicked_on_text_in_name_cell (NemoListView *view, GtkTreePath *path, GdkEventBut
901901
GTK_CELL_RENDERER (details->file_name_cell),
902902
&x_cell_offset, &width);
903903

904-
gtk_widget_style_get (GTK_WIDGET (details->tree_view),
905-
"expander-size", &expander_size,
906-
"horizontal-separator", &horizontal_separator,
907-
NULL);
908-
909-
expander_size += 4;
910-
expansion_offset = ((horizontal_separator / 2) + gtk_tree_path_get_depth (path) * expander_size);
904+
if (g_settings_get_boolean (nemo_list_view_preferences, NEMO_PREFERENCES_LIST_VIEW_ENABLE_EXPANSION)) {
905+
gtk_widget_style_get (GTK_WIDGET (details->tree_view),
906+
"expander-size", &expander_size,
907+
"horizontal-separator", &horizontal_separator,
908+
NULL);
909+
910+
expander_size += 4;
911+
expansion_offset = ((horizontal_separator / 2) + gtk_tree_path_get_depth (path) * expander_size);
912+
} else {
913+
expansion_offset = 0;
914+
}
911915

912916
ret = (event->x > (expansion_offset + x_col_offset + x_cell_offset) &&
913917
event->x < (x_col_offset + x_cell_offset + width)) &&
@@ -1129,17 +1133,21 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
11291133
call_parent = TRUE;
11301134
if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y,
11311135
&path, NULL, NULL, NULL)) {
1132-
gtk_widget_style_get (widget,
1133-
"expander-size", &expander_size,
1134-
"horizontal-separator", &horizontal_separator,
1135-
NULL);
1136-
/* TODO we should not hardcode this extra padding. It is
1137-
* EXPANDER_EXTRA_PADDING from GtkTreeView.
1138-
*/
1139-
expander_size += 4;
1140-
on_expander = (event->x <= horizontal_separator / 2 +
1141-
gtk_tree_path_get_depth (path) * expander_size);
1142-
1136+
if (g_settings_get_boolean (nemo_list_view_preferences,
1137+
NEMO_PREFERENCES_LIST_VIEW_ENABLE_EXPANSION)) {
1138+
gtk_widget_style_get (widget,
1139+
"expander-size", &expander_size,
1140+
"horizontal-separator", &horizontal_separator,
1141+
NULL);
1142+
/* TODO we should not hardcode this extra padding. It is
1143+
* EXPANDER_EXTRA_PADDING from GtkTreeView.
1144+
*/
1145+
expander_size += 4;
1146+
on_expander = (event->x <= horizontal_separator / 2 +
1147+
gtk_tree_path_get_depth (path) * expander_size);
1148+
} else {
1149+
on_expander = FALSE;
1150+
}
11431151
/* Keep track of path of last click so double clicks only happen
11441152
* on the same item */
11451153
if ((event->button == 1 || event->button == 2) &&

0 commit comments

Comments
 (0)