file_list_show_popover (impl, x, y);
}
+static GtkWidget*
+get_current_view_widget (GtkFileChooserWidget *impl)
+{
+ switch (impl->view_type)
+ {
+ case VIEW_TYPE_LIST:
+ return impl->browse_files_column_view;
+
+ case VIEW_TYPE_GRID:
+ return impl->browse_files_grid_view;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ return NULL;
+}
+
static void
set_view_type (GtkFileChooserWidget *impl,
ViewType view_type)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (user_data);
graphene_rect_t bounds;
+ GtkWidget *view_widget;
+
+ view_widget = get_current_view_widget (impl);
- if (!gtk_widget_compute_bounds (impl->browse_files_column_view,
- GTK_WIDGET (impl),
- &bounds))
+ if (!gtk_widget_compute_bounds (view_widget, GTK_WIDGET (impl), &bounds))
return FALSE;
file_list_show_popover (impl,
location_switch_to_path_bar (impl);
if (switch_to_file_list)
- gtk_widget_grab_focus (impl->browse_files_column_view);
+ gtk_widget_grab_focus (get_current_view_widget (impl));
break;
current_focus = NULL;
file_list_seen = FALSE;
- if (current_focus == impl->browse_files_column_view)
+ if (current_focus == get_current_view_widget (impl))
{
GtkBitsetIter iter;
GtkBitset *bitset;
else
goto empty;
}
- else if (impl->toplevel_last_focus_widget == impl->browse_files_column_view)
+ else if (impl->toplevel_last_focus_widget == get_current_view_widget (impl))
goto file_list;
else if (impl->location_entry && impl->toplevel_last_focus_widget == impl->location_entry)
goto file_entry;
current_focus = gtk_root_get_focus (GTK_ROOT (toplevel));
- if (current_focus == impl->browse_files_column_view)
+ if (current_focus == get_current_view_widget (impl))
{
/* The following array encodes what we do based on the impl->action and the
* number of files selected.
g_object_unref (file);
}
- else if (impl->toplevel_last_focus_widget == impl->browse_files_column_view)
+ else if (impl->toplevel_last_focus_widget == get_current_view_widget (impl))
{
/* The focus is on a dialog's action area button, *and* the widget that
* was focused immediately before it is the file list.
{
if (impl->location_mode == LOCATION_MODE_PATH_BAR
|| impl->operation_mode == OPERATION_MODE_RECENT)
- widget = impl->browse_files_column_view;
+ widget = get_current_view_widget (impl);
else
widget = impl->location_entry;
}