Commit 0bea8579 authored by Rohit Kaushik's avatar Rohit Kaushik Committed by Ernestas Kulik

files-view: port to G_DECLARE* type declaration

This patch reduces the manual definition of macros and ports it
to G_Declare type declaration, which makes the code cleaner and
easier to read and understand.

https://bugzilla.gnome.org/show_bug.cgi?id=777700
parent 1856e2fb
......@@ -167,7 +167,7 @@ static int scripts_directory_uri_length;
static GHashTable *script_accels = NULL;
struct NautilusFilesViewDetails
typedef struct
{
/* Main components */
GtkWidget *overlay;
......@@ -278,7 +278,7 @@ struct NautilusFilesViewDetails
gulong stop_signal_handler;
gulong reload_signal_handler;
};
} NautilusFilesViewPrivate;
typedef struct
{
......@@ -341,7 +341,8 @@ static gboolean nautilus_files_view_is_read_only (NautilusFilesView *view);
G_DEFINE_TYPE_WITH_CODE (NautilusFilesView,
nautilus_files_view,
GTK_TYPE_GRID,
G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_VIEW, nautilus_files_view_iface_init));
G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_VIEW, nautilus_files_view_iface_init)
G_ADD_PRIVATE (NautilusFilesView));
static const struct
{
......@@ -363,19 +364,27 @@ static const struct
static void
remove_loading_floating_bar (NautilusFilesView *view)
{
if (view->details->floating_bar_loading_timeout_id != 0)
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
if (priv->floating_bar_loading_timeout_id != 0)
{
g_source_remove (view->details->floating_bar_loading_timeout_id);
view->details->floating_bar_loading_timeout_id = 0;
g_source_remove (priv->floating_bar_loading_timeout_id);
priv->floating_bar_loading_timeout_id = 0;
}
gtk_widget_hide (view->details->floating_bar);
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (view->details->floating_bar));
gtk_widget_hide (priv->floating_bar);
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (priv->floating_bar));
}
static void
real_setup_loading_floating_bar (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
gboolean disable_chrome;
g_object_get (nautilus_files_view_get_window (view),
......@@ -384,29 +393,32 @@ real_setup_loading_floating_bar (NautilusFilesView *view)
if (disable_chrome)
{
gtk_widget_hide (view->details->floating_bar);
gtk_widget_hide (priv->floating_bar);
return;
}
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (view->details->floating_bar));
nautilus_floating_bar_set_primary_label (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (priv->floating_bar));
nautilus_floating_bar_set_primary_label (NAUTILUS_FLOATING_BAR (priv->floating_bar),
nautilus_view_is_searching (NAUTILUS_VIEW (view)) ? _("Searching…") : _("Loading…"));
nautilus_floating_bar_set_details_label (NAUTILUS_FLOATING_BAR (view->details->floating_bar), NULL);
nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (view->details->floating_bar), view->details->loading);
nautilus_floating_bar_add_action (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
nautilus_floating_bar_set_details_label (NAUTILUS_FLOATING_BAR (priv->floating_bar), NULL);
nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (priv->floating_bar), priv->loading);
nautilus_floating_bar_add_action (NAUTILUS_FLOATING_BAR (priv->floating_bar),
"process-stop-symbolic",
NAUTILUS_FLOATING_BAR_ACTION_ID_STOP);
gtk_widget_set_halign (view->details->floating_bar, GTK_ALIGN_END);
gtk_widget_show (view->details->floating_bar);
gtk_widget_set_halign (priv->floating_bar, GTK_ALIGN_END);
gtk_widget_show (priv->floating_bar);
}
static gboolean
setup_loading_floating_bar_timeout_cb (gpointer user_data)
{
NautilusFilesView *view = user_data;
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
view->details->floating_bar_loading_timeout_id = 0;
priv->floating_bar_loading_timeout_id = 0;
real_setup_loading_floating_bar (view);
return FALSE;
......@@ -415,20 +427,24 @@ setup_loading_floating_bar_timeout_cb (gpointer user_data)
static void
setup_loading_floating_bar (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
/* setup loading overlay */
if (view->details->floating_bar_set_status_timeout_id != 0)
if (priv->floating_bar_set_status_timeout_id != 0)
{
g_source_remove (view->details->floating_bar_set_status_timeout_id);
view->details->floating_bar_set_status_timeout_id = 0;
g_source_remove (priv->floating_bar_set_status_timeout_id);
priv->floating_bar_set_status_timeout_id = 0;
}
if (view->details->floating_bar_loading_timeout_id != 0)
if (priv->floating_bar_loading_timeout_id != 0)
{
g_source_remove (view->details->floating_bar_loading_timeout_id);
view->details->floating_bar_loading_timeout_id = 0;
g_source_remove (priv->floating_bar_loading_timeout_id);
priv->floating_bar_loading_timeout_id = 0;
}
view->details->floating_bar_loading_timeout_id =
priv->floating_bar_loading_timeout_id =
g_timeout_add (FLOATING_BAR_LOADING_DELAY, setup_loading_floating_bar_timeout_cb, view);
}
......@@ -437,10 +453,14 @@ floating_bar_action_cb (NautilusFloatingBar *floating_bar,
gint action,
NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
if (action == NAUTILUS_FLOATING_BAR_ACTION_ID_STOP)
{
remove_loading_floating_bar (view);
nautilus_window_slot_stop_loading (view->details->slot);
nautilus_window_slot_stop_loading (priv->slot);
}
}
......@@ -449,15 +469,19 @@ real_floating_bar_set_short_status (NautilusFilesView *view,
const gchar *primary_status,
const gchar *detail_status)
{
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
gboolean disable_chrome;
if (view->details->loading)
if (priv->loading)
{
return;
}
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (view->details->floating_bar));
nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
nautilus_floating_bar_cleanup_actions (NAUTILUS_FLOATING_BAR (priv->floating_bar));
nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (priv->floating_bar),
FALSE);
g_object_get (nautilus_files_view_get_window (view),
......@@ -466,16 +490,16 @@ real_floating_bar_set_short_status (NautilusFilesView *view,
if ((primary_status == NULL && detail_status == NULL) || disable_chrome)
{
gtk_widget_hide (view->details->floating_bar);
nautilus_floating_bar_remove_hover_timeout (NAUTILUS_FLOATING_BAR (view->details->floating_bar));
gtk_widget_hide (priv->floating_bar);
nautilus_floating_bar_remove_hover_timeout (NAUTILUS_FLOATING_BAR (priv->floating_bar));
return;
}
nautilus_floating_bar_set_labels (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
nautilus_floating_bar_set_labels (NAUTILUS_FLOATING_BAR (priv->floating_bar),
primary_status,
detail_status);
gtk_widget_show (view->details->floating_bar);
gtk_widget_show (priv->floating_bar);
}
typedef struct
......@@ -499,9 +523,13 @@ floating_bar_set_status_data_free (gpointer data)
static gboolean
floating_bar_set_status_timeout_cb (gpointer data)
{
NautilusFilesViewPrivate *priv;
FloatingBarSetStatusData *status_data = data;
status_data->view->details->floating_bar_set_status_timeout_id = 0;
priv = nautilus_files_view_get_instance_private (status_data->view);
priv->floating_bar_set_status_timeout_id = 0;
real_floating_bar_set_short_status (status_data->view,
status_data->primary_status,
status_data->detail_status);
......@@ -517,11 +545,14 @@ set_floating_bar_status (NautilusFilesView *view,
GtkSettings *settings;
gint double_click_time;
FloatingBarSetStatusData *status_data;
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
if (view->details->floating_bar_set_status_timeout_id != 0)
if (priv->floating_bar_set_status_timeout_id != 0)
{
g_source_remove (view->details->floating_bar_set_status_timeout_id);
view->details->floating_bar_set_status_timeout_id = 0;
g_source_remove (priv->floating_bar_set_status_timeout_id);
priv->floating_bar_set_status_timeout_id = 0;
}
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (view)));
......@@ -538,7 +569,7 @@ set_floating_bar_status (NautilusFilesView *view,
* the status seems to be a good approximation of not setting it
* too often and not delaying the statusbar too much.
*/
view->details->floating_bar_set_status_timeout_id =
priv->floating_bar_set_status_timeout_id =
g_timeout_add_full (G_PRIORITY_DEFAULT,
(guint) (double_click_time / 2),
floating_bar_set_status_timeout_cb,
......@@ -549,14 +580,18 @@ set_floating_bar_status (NautilusFilesView *view,
static char *
real_get_backing_uri (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), NULL);
if (view->details->model == NULL)
priv = nautilus_files_view_get_instance_private (view);
if (priv->model == NULL)
{
return NULL;
}
return nautilus_directory_get_uri (view->details->model);
return nautilus_directory_get_uri (priv->model);
}
/**
......@@ -656,9 +691,13 @@ nautilus_files_view_using_manual_layout (NautilusFilesView *view)
static NautilusToolbarMenuSections *
nautilus_files_view_get_toolbar_menu_sections (NautilusView *view)
{
NautilusFilesViewPrivate *priv;
g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), NULL);
return NAUTILUS_FILES_VIEW (view)->details->toolbar_menu_sections;
priv = nautilus_files_view_get_instance_private (NAUTILUS_FILES_VIEW (view));
return priv->toolbar_menu_sections;
}
static gboolean
......@@ -700,10 +739,14 @@ nautilus_files_view_supports_creating_files (NautilusFilesView *view)
static gboolean
nautilus_files_view_supports_extract_here (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), FALSE);
return nautilus_files_view_supports_creating_files (view)
&& !nautilus_directory_is_remote (view->details->model)
&& !nautilus_directory_is_remote (priv->model)
&& !nautilus_view_is_searching (NAUTILUS_VIEW (view));
}
......@@ -782,9 +825,13 @@ nautilus_files_view_can_zoom_out (NautilusFilesView *view)
gboolean
nautilus_files_view_supports_zooming (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), FALSE);
return view->details->supports_zooming;
return priv->supports_zooming;
}
/**
......@@ -815,15 +862,17 @@ gboolean
nautilus_files_view_is_searching (NautilusView *view)
{
NautilusFilesView *files_view;
NautilusFilesViewPrivate *priv;
files_view = NAUTILUS_FILES_VIEW (view);
priv = nautilus_files_view_get_instance_private (files_view);
if (!files_view->details->model)
if (!priv->model)
{
return FALSE;
}
return NAUTILUS_IS_SEARCH_DIRECTORY (files_view->details->model);
return NAUTILUS_IS_SEARCH_DIRECTORY (priv->model);
}
guint
......@@ -999,15 +1048,23 @@ create_templates_parameters_free (CreateTemplateParameters *parameters)
NautilusWindow *
nautilus_files_view_get_window (NautilusFilesView *view)
{
return nautilus_window_slot_get_window (view->details->slot);
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
return nautilus_window_slot_get_window (priv->slot);
}
NautilusWindowSlot *
nautilus_files_view_get_nautilus_window_slot (NautilusFilesView *view)
{
g_assert (view->details->slot != NULL);
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
return view->details->slot;
g_assert (priv->slot != NULL);
return priv->slot;
}
/* Returns the GtkWindow that this directory view occupies, or NULL
......@@ -1070,10 +1127,13 @@ nautilus_files_view_confirm_multiple (GtkWindow *parent_window,
static char *
get_view_directory (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
char *uri, *path;
GFile *f;
uri = nautilus_directory_get_uri (view->details->model);
priv = nautilus_files_view_get_instance_private (view);
uri = nautilus_directory_get_uri (priv->model);
if (eel_uri_is_desktop (uri))
{
g_free (uri);
......@@ -1132,6 +1192,7 @@ nautilus_files_view_activate_files (NautilusFilesView *view,
NautilusWindowOpenFlags flags,
gboolean confirm_multiple)
{
NautilusFilesViewPrivate *priv;
GList *files_to_extract;
GList *files_to_activate;
char *path;
......@@ -1141,6 +1202,8 @@ nautilus_files_view_activate_files (NautilusFilesView *view,
return;
}
priv = nautilus_files_view_get_instance_private (view);
files_to_extract = nautilus_file_list_filter (files,
&files_to_activate,
(NautilusFileFilterFunc) nautilus_mime_file_extracts,
......@@ -1166,7 +1229,7 @@ nautilus_files_view_activate_files (NautilusFilesView *view,
path = get_view_directory (view);
nautilus_mime_activate_files (nautilus_files_view_get_containing_window (view),
view->details->slot,
priv->slot,
files_to_activate,
path,
flags,
......@@ -1182,8 +1245,11 @@ nautilus_files_view_activate_file (NautilusFilesView *view,
NautilusFile *file,
NautilusWindowOpenFlags flags)
{
NautilusFilesViewPrivate *priv;
char *path;
priv = nautilus_files_view_get_instance_private (view);
if (nautilus_mime_file_extracts (file))
{
GList *files = NULL;
......@@ -1215,7 +1281,7 @@ nautilus_files_view_activate_file (NautilusFilesView *view,
path = get_view_directory (view);
nautilus_mime_activate_file (nautilus_files_view_get_containing_window (view),
view->details->slot,
priv->slot,
file,
path,
flags);
......@@ -1431,20 +1497,23 @@ action_open_with_other_application (GSimpleAction *action,
static void
trash_or_delete_selected_files (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
GList *selection;
priv = nautilus_files_view_get_instance_private (view);
/* This might be rapidly called multiple times for the same selection
* when using keybindings. So we remember if the current selection
* was already removed (but the view doesn't know about it yet).
*/
if (!view->details->selection_was_removed)
if (!priv->selection_was_removed)
{
selection = nautilus_files_view_get_selection_for_file_transfer (view);
trash_or_delete_files (nautilus_files_view_get_containing_window (view),
selection,
view);
nautilus_file_list_free (selection);
view->details->selection_was_removed = TRUE;
priv->selection_was_removed = TRUE;
}
}
......@@ -1692,6 +1761,7 @@ new_folder_done (GFile *new_folder,
gpointer user_data)
{
NautilusFilesView *directory_view;
NautilusFilesViewPrivate *priv;
NautilusFile *file;
char screen_string[32];
GdkScreen *screen;
......@@ -1700,6 +1770,7 @@ new_folder_done (GFile *new_folder,
data = (NewFolderData *) user_data;
directory_view = data->directory_view;
priv = nautilus_files_view_get_instance_private (directory_view);
if (directory_view == NULL)
{
......@@ -1759,7 +1830,7 @@ new_folder_done (GFile *new_folder,
}
else
{
g_hash_table_insert (directory_view->details->pending_reveal,
g_hash_table_insert (priv->pending_reveal,
file,
GUINT_TO_POINTER (TRUE));
}
......@@ -1807,15 +1878,19 @@ new_folder_data_new (NautilusFilesView *directory_view,
static GdkPoint *
context_menu_to_file_operation_position (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), NULL);
priv = nautilus_files_view_get_instance_private (view);
if (nautilus_files_view_using_manual_layout (view)
&& view->details->context_menu_position.x >= 0
&& view->details->context_menu_position.y >= 0)
&& priv->context_menu_position.x >= 0
&& priv->context_menu_position.y >= 0)
{
NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->widget_to_file_operation_position
(view, &view->details->context_menu_position);
return &view->details->context_menu_position;
(view, &priv->context_menu_position);
return &priv->context_menu_position;
}
else
{
......@@ -1836,22 +1911,24 @@ rename_file_popover_controller_on_name_accepted (NautilusFileNameWidgetControlle
NautilusFilesView *view;
NautilusFile *target_file;
g_autofree gchar *name = NULL;
NautilusFilesViewPrivate *priv;
view = NAUTILUS_FILES_VIEW (user_data);
priv = nautilus_files_view_get_instance_private (view);
name = nautilus_file_name_widget_controller_get_new_name (controller);
target_file =
nautilus_rename_file_popover_controller_get_target_file (view->details->rename_file_controller);
nautilus_rename_file_popover_controller_get_target_file (priv->rename_file_controller);
/* Put it on the queue for reveal after the view acknowledges the change */
g_hash_table_insert (view->details->pending_reveal,
g_hash_table_insert (priv->pending_reveal,
target_file,
GUINT_TO_POINTER (FALSE));
nautilus_rename_file (target_file, name, NULL, NULL);
g_clear_object (&view->details->rename_file_controller);
g_clear_object (&priv->rename_file_controller);
}
static void
......@@ -1859,10 +1936,12 @@ rename_file_popover_controller_on_cancelled (NautilusFileNameWidgetController *c
gpointer user_data)
{
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
view = NAUTILUS_FILES_VIEW (user_data);
priv = nautilus_files_view_get_instance_private (view);
g_clear_object (&view->details->rename_file_controller);
g_clear_object (&priv->rename_file_controller);
}
static void
......@@ -1870,24 +1949,27 @@ nautilus_files_view_rename_file_popover_new (NautilusFilesView *view,
NautilusFile *target_file)
{
GdkRectangle *pointing_to;
NautilusFilesViewPrivate *priv;
if (view->details->rename_file_controller != NULL)
priv = nautilus_files_view_get_instance_private (view);
if (priv->rename_file_controller != NULL)
{
return;
}
pointing_to = nautilus_files_view_compute_rename_popover_pointing_to (view);
view->details->rename_file_controller =
priv->rename_file_controller =
nautilus_rename_file_popover_controller_new (target_file,
pointing_to,
GTK_WIDGET (view));
g_signal_connect (view->details->rename_file_controller,
g_signal_connect (priv->rename_file_controller,
"name-accepted",
(GCallback) rename_file_popover_controller_on_name_accepted,
view);
g_signal_connect (view->details->rename_file_controller,
g_signal_connect (priv->rename_file_controller,
"cancelled",
(GCallback) rename_file_popover_controller_on_cancelled,
view);
......@@ -1898,6 +1980,7 @@ new_folder_dialog_controller_on_name_accepted (NautilusFileNameWidgetController
gpointer user_data)
{
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
NewFolderData *data;
GdkPoint *position = NULL;
g_autofree gchar *parent_uri = NULL;
......@@ -1906,9 +1989,10 @@ new_folder_dialog_controller_on_name_accepted (NautilusFileNameWidgetController
gboolean with_selection;
view = NAUTILUS_FILES_VIEW (user_data);
priv = nautilus_files_view_get_instance_private (view);
with_selection =
nautilus_new_folder_dialog_controller_get_with_selection (view->details->new_folder_controller);
nautilus_new_folder_dialog_controller_get_with_selection (priv->new_folder_controller);
data = new_folder_data_new (view, with_selection);
......@@ -1930,7 +2014,7 @@ new_folder_dialog_controller_on_name_accepted (NautilusFileNameWidgetController
position, parent_uri, name,
new_folder_done, data);
g_clear_object (&view->details->new_folder_controller);
g_clear_object (&priv->new_folder_controller);
g_object_unref (parent);
}
......@@ -1939,10 +2023,12 @@ new_folder_dialog_controller_on_cancelled (NautilusNewFolderDialogController *co
gpointer user_data)
{
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
view = NAUTILUS_FILES_VIEW (user_data);
priv = nautilus_files_view_get_instance_private (view);
g_clear_object (&view->details->new_folder_controller);
g_clear_object (&priv->new_folder_controller);
}
static void
......@@ -1950,11 +2036,14 @@ nautilus_files_view_new_folder_dialog_new (NautilusFilesView *view,
gboolean with_selection)
{
NautilusDirectory *containing_directory;
NautilusFilesViewPrivate *priv;
GList *selection;
g_autofree char *uri = NULL;
g_autofree char *common_prefix = NULL;
if (view->details->new_folder_controller != NULL)
priv = nautilus_files_view_get_instance_private (view);
if (priv->new_folder_controller != NULL)
{
return;
}
......@@ -1965,17 +2054,17 @@ nautilus_files_view_new_folder_dialog_new (NautilusFilesView *view,
selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
common_prefix = nautilus_get_common_filename_prefix (selection, MIN_COMMON_FILENAME_PREFIX_LENGTH);
view->details->new_folder_controller =
priv->new_folder_controller =
nautilus_new_folder_dialog_controller_new (nautilus_files_view_get_containing_window (view),
containing_directory,
with_selection,
common_prefix);
g_signal_connect (view->details->new_folder_controller,
g_signal_connect (priv->new_folder_controller,
"name-accepted",
(GCallback) new_folder_dialog_controller_on_name_accepted,
view);
g_signal_connect (view->details->new_folder_controller,
g_signal_connect (priv->new_folder_controller,
"cancelled",
(GCallback) new_folder_dialog_controller_on_cancelled,
view);
......@@ -1997,6 +2086,7 @@ compress_done (GFile *new_file,
{
CompressData *data;
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
NautilusFile *file;
data = user_data;
......@@ -2007,6 +2097,8 @@ compress_done (GFile *new_file,
goto out;
}
priv = nautilus_files_view_get_instance_private (view);
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (track_newly_added_locations),
data->added_locations);
......@@ -2026,7 +2118,7 @@ compress_done (GFile *new_file,
}
else
{
g_hash_table_insert (view->details->pending_reveal,
g_hash_table_insert (priv->pending_reveal,
file,
GUINT_TO_POINTER (TRUE));
}
......@@ -2057,10 +2149,12 @@ compress_dialog_controller_on_name_accepted (NautilusFileNameWidgetController *c
g_autoptr (GFile) output = NULL;
g_autoptr (GFile) parent = NULL;
NautilusCompressionFormat compression_format;
NautilusFilesViewPrivate *priv;
AutoarFormat format;
AutoarFilter filter;
view = NAUTILUS_FILES_VIEW (user_data);
priv = nautilus_files_view_get_instance_private (view);
selection = nautilus_files_view_get_selection_for_file_transfer (view);
......@@ -2132,7 +2226,7 @@ compress_dialog_controller_on_name_accepted (NautilusFileNameWidgetController *c
nautilus_file_list_free (selection);
g_list_free_full (source_files, g_object_unref);
g_clear_object (&view->details->compress_controller);
g_clear_object (&priv->compress_controller);
}
static void
......@@ -2140,10 +2234,12 @@ compress_dialog_controller_on_cancelled (NautilusNewFolderDialogController *cont
gpointer user_data)
{
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
view = NAUTILUS_FILES_VIEW (user_data);
priv = nautilus_files_view_get_instance_private (view);
g_clear_object (&view->details->compress_controller);
g_clear_object (&priv->compress_controller);
}
......@@ -2151,10 +2247,13 @@ static void
nautilus_files_view_compress_dialog_new (NautilusFilesView *view)
{
NautilusDirectory *containing_directory;
NautilusFilesViewPrivate *priv;
GList *selection;
g_autofree char *common_prefix = NULL;
if (view->details->compress_controller != NULL)
priv = nautilus_files_view_get_instance_private (view);
if (priv->compress_controller != NULL)
{
return;
}
......@@ -2177,15 +2276,15 @@ nautilus_files_view_compress_dialog_new (NautilusFilesView *view)
MIN_COMMON_FILENAME_PREFIX_LENGTH);
}
view->details->compress_controller = nautilus_compress_dialog_controller_new (nautilus_files_view_get_containing_window (view),
containing_directory,
common_prefix);
priv->compress_controller = nautilus_compress_dialog_controller_new (nautilus_files_view_get_containing_window (view),
containing_directory,
common_prefix);
g_signal_connect (view->details->compress_controller,
g_signal_connect (priv->compress_controller,
"name-accepted",
(GCallback) compress_dialog_controller_on_name_accepted,
view);
g_signal_connect (view->details->compress_controller,
g_signal_connect (priv->compress_controller,
"cancelled",
(GCallback) compress_dialog_controller_on_cancelled,
view);
......@@ -2321,18 +2420,20 @@ action_properties (GSimpleAction *action,
gpointer user_data)
{
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
GList *selection;
GList *files;
g_assert (NAUTILUS_IS_FILES_VIEW (user_data));
view = NAUTILUS_FILES_VIEW (user_data);
priv = nautilus_files_view_get_instance_private (view);
selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
if (g_list_length (selection) == 0)
{
if (view->details->directory_as_file != NULL)
if (priv->directory_as_file != NULL)
{
files = g_list_append (NULL, nautilus_file_ref (view->details->directory_as_file));
files = g_list_append (NULL, nautilus_file_ref (priv->directory_as_file));
nautilus_properties_window_present (files, GTK_WIDGET (view), NULL);
......@@ -2350,22 +2451,26 @@ static void
nautilus_files_view_set_show_hidden_files (NautilusFilesView *view,
gboolean show_hidden)
{
if (view->details->ignore_hidden_file_preferences)
NautilusFilesViewPrivate *priv;
priv = nautilus_files_view_get_instance_private (view);
if (priv->ignore_hidden_file_preferences)
{
return;
}
if (show_hidden != view->details->show_hidden_files)
if (show_hidden != priv->show_hidden_files)
{
view->details->show_hidden_files = show_hidden;
priv->show_hidden_files = show_hidden;
g_settings_set_boolean (gtk_filechooser_preferences,
NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
show_hidden);
if (view->details->model != NULL)
if (priv->model != NULL)
{
load_directory (view, view->details->model);
load_directory (view, priv->model);
}
}
}
......@@ -2496,13 +2601,15 @@ paste_clipboard_received_callback (GtkClipboard *clipboard,
gpointer data)
{
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
char *view_uri;
view = NAUTILUS_FILES_VIEW (data);
priv = nautilus_files_view_get_instance_private (view);
view_uri = nautilus_files_view_get_backing_uri (view);
if (view->details->slot != NULL)
if (priv->slot != NULL)
{
paste_clipboard_data (view, selection_data, view_uri);
}
......@@ -2536,13 +2643,15 @@ create_links_clipboard_received_callback (GtkClipboard *clipboard,
gpointer data)
{
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
char *view_uri;
view = NAUTILUS_FILES_VIEW (data);
priv = nautilus_files_view_get_instance_private (view);
view_uri = nautilus_files_view_get_backing_uri (view);
if (view->details->slot != NULL)