Commit 3f5d5e2d authored by Carlos Soriano 's avatar Carlos Soriano

Merge branch 'a-very-vague-branch-name' into 'master'

Various cleanups and fixes

Closes #176

See merge request !52
parents 2fff34b2 3d2af160
Pipeline #1830 passed with stage
in 6 minutes and 12 seconds
# Nautilus
![Pipeline status](https://gitlab.gnome.org/GNOME/nautilus/badges/master/build.svg)
This is Nautilus, the file manager for the GNOME desktop.
https://wiki.gnome.org/Apps/Nautilus
# Hacking on Nautilus
## Hacking on Nautilus
To build the development version of Nautilus and hack on the code
see the general guide for build the GNOME platform at
......@@ -10,13 +14,13 @@ are in https://wiki.gnome.org/Newcomers/BuildProject
Guidelines and tutorials to contribute to the GNOME platform
are in https://wiki.gnome.org/Newcomers
# Mailing List
## Mailing List
The nautilus mailing list is nautilus-list@gnome.org. Subscription
information is available at
https://mail.gnome.org/mailman/listinfo/nautilus-list
# How to report bugs
## How to report bugs
Bugs should be reported to the GNOME bug tracking system at
https://gitlab.gnome.org/GNOME/nautilus/issues.
......
......@@ -236,11 +236,6 @@
<default>'large'</default>
<summary>Default icon view zoom level</summary>
</key>
<key type="i" name="thumbnail-size">
<default>64</default>
<summary>Default Thumbnail Icon Size</summary>
<description>The default size of an icon for a thumbnail in the icon view when using NAUTILUS_ICON_SIZE_STANDARD size.</description>
</key>
<key type="as" name="text-ellipsis-limit">
<default>[ '3' ]</default>
<summary>Text Ellipsis Limit</summary>
......
......@@ -3911,8 +3911,6 @@ thumbnail_state_free (ThumbnailState *state)
g_free (state);
}
extern int cached_thumbnail_size;
/* scale very large images down to the max. size we need */
static void
thumbnail_loader_size_prepared (GdkPixbufLoader *loader,
......@@ -3926,7 +3924,7 @@ thumbnail_loader_size_prepared (GdkPixbufLoader *loader,
aspect_ratio = ((double) width) / height;
/* cf. nautilus_file_get_icon() */
max_thumbnail_size = NAUTILUS_CANVAS_ICON_SIZE_LARGEST * cached_thumbnail_size / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
max_thumbnail_size = NAUTILUS_CANVAS_ICON_SIZE_LARGEST * NAUTILUS_CANVAS_ICON_SIZE_STANDARD / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
if (MAX (width, height) > max_thumbnail_size)
{
if (width > height)
......
......@@ -124,7 +124,6 @@ static guint signals[LAST_SIGNAL];
static GHashTable *symbolic_links;
static guint64 cached_thumbnail_limit;
int cached_thumbnail_size;
static NautilusSpeedTradeoffValue show_file_thumbs;
static NautilusSpeedTradeoffValue show_directory_item_count;
......@@ -175,7 +174,6 @@ static const char *nautilus_file_peek_display_name_collation_key (NautilusFile *
static void file_mount_unmounted (GMount *mount,
gpointer data);
static void metadata_hash_free (GHashTable *hash);
static gboolean real_drag_can_accept_files (NautilusFile *drop_target_item);
G_DEFINE_TYPE_WITH_CODE (NautilusFile, nautilus_file, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_FILE_INFO,
......@@ -1670,12 +1668,6 @@ can_rename_desktop_file (NautilusFile *file)
*/
gboolean
nautilus_file_can_rename (NautilusFile *file)
{
return NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (file))->can_rename (file);
}
static gboolean
real_can_rename (NautilusFile *file)
{
gboolean can_rename;
......@@ -1808,12 +1800,6 @@ nautilus_file_get_uri_scheme (NautilusFile *file)
gboolean
nautilus_file_opens_in_view (NautilusFile *file)
{
return NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (file))->opens_in_view (file);
}
static gboolean
real_opens_in_view (NautilusFile *file)
{
return nautilus_file_is_directory (file);
}
......@@ -2029,18 +2015,6 @@ name_is (NautilusFile *file,
return strcmp (new_name, old_name) == 0;
}
void
nautilus_file_rename (NautilusFile *file,
const char *new_name,
NautilusFileOperationCallback callback,
gpointer callback_data)
{
NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (file))->rename (file,
new_name,
callback,
callback_data);
}
static gchar *
nautilus_file_can_rename_file (NautilusFile *file,
const char *new_name,
......@@ -2178,6 +2152,58 @@ nautilus_file_can_rename_file (NautilusFile *file,
return new_file_name;
}
void
nautilus_file_rename (NautilusFile *file,
const char *new_name,
NautilusFileOperationCallback callback,
gpointer callback_data)
{
NautilusFileOperation *op;
char *old_name;
char *new_file_name;
GFile *location;
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (new_name != NULL);
g_return_if_fail (callback != NULL);
new_file_name = nautilus_file_can_rename_file (file,
new_name,
callback,
callback_data);
if (new_file_name == NULL)
{
return;
}
/* Set up a renaming operation. */
op = nautilus_file_operation_new (file, callback, callback_data);
op->is_rename = TRUE;
location = nautilus_file_get_location (file);
/* Tell the undo manager a rename is taking place */
if (!nautilus_file_undo_manager_is_operating ())
{
op->undo_info = nautilus_file_undo_info_rename_new ();
old_name = nautilus_file_get_display_name (file);
nautilus_file_undo_info_rename_set_data_pre (NAUTILUS_FILE_UNDO_INFO_RENAME (op->undo_info),
location, old_name, new_file_name);
g_free (old_name);
}
/* Do the renaming. */
g_file_set_display_name_async (location,
new_file_name,
G_PRIORITY_DEFAULT,
op->cancellable,
rename_callback,
op);
g_free (new_file_name);
g_object_unref (location);
}
gboolean
nautilus_file_rename_handle_file_gone (NautilusFile *file,
NautilusFileOperationCallback callback,
......@@ -2411,58 +2437,6 @@ nautilus_file_batch_rename (GList *files,
callback_data);
}
static void
real_rename (NautilusFile *file,
const char *new_name,
NautilusFileOperationCallback callback,
gpointer callback_data)
{
NautilusFileOperation *op;
char *old_name;
char *new_file_name;
GFile *location;
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (new_name != NULL);
g_return_if_fail (callback != NULL);
new_file_name = nautilus_file_can_rename_file (file,
new_name,
callback,
callback_data);
if (new_file_name == NULL)
{
return;
}
/* Set up a renaming operation. */
op = nautilus_file_operation_new (file, callback, callback_data);
op->is_rename = TRUE;
location = nautilus_file_get_location (file);
/* Tell the undo manager a rename is taking place */
if (!nautilus_file_undo_manager_is_operating ())
{
op->undo_info = nautilus_file_undo_info_rename_new ();
old_name = nautilus_file_get_display_name (file);
nautilus_file_undo_info_rename_set_data_pre (NAUTILUS_FILE_UNDO_INFO_RENAME (op->undo_info),
location, old_name, new_file_name);
g_free (old_name);
}
/* Do the renaming. */
g_file_set_display_name_async (location,
new_file_name,
G_PRIORITY_DEFAULT,
op->cancellable,
rename_callback,
op);
g_free (new_file_name);
g_object_unref (location);
}
gboolean
nautilus_file_rename_in_progress (NautilusFile *file)
{
......@@ -4721,12 +4695,6 @@ nautilus_file_get_activation_location (NautilusFile *file)
char *
nautilus_file_get_target_uri (NautilusFile *file)
{
return NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (file))->get_target_uri (file);
}
static char *
real_get_target_uri (NautilusFile *file)
{
char *uri, *target_uri;
GFile *location;
......@@ -5397,9 +5365,7 @@ nautilus_file_get_thumbnail_icon (NautilusFile *file,
}
else
{
modified_size = size * scale * cached_thumbnail_size / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
DEBUG ("Modifying icon size to %d, as our cached thumbnail size is %d",
modified_size, cached_thumbnail_size);
modified_size = size * scale * NAUTILUS_CANVAS_ICON_SIZE_STANDARD / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
}
if (file->details->thumbnail)
......@@ -5409,7 +5375,7 @@ nautilus_file_get_thumbnail_icon (NautilusFile *file,
s = MAX (w, h);
/* Don't scale up small thumbnails in the standard view */
if (s <= cached_thumbnail_size)
if (s <= NAUTILUS_CANVAS_ICON_SIZE_STANDARD)
{
thumb_scale = (double) size / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
}
......@@ -8288,18 +8254,6 @@ nautilus_file_is_user_special_directory (NautilusFile *file,
return is_special_dir;
}
gboolean
nautilus_file_is_special_link (NautilusFile *file)
{
return NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (file))->is_special_link (file);
}
static gboolean
real_is_special_link (NautilusFile *file)
{
return FALSE;
}
gboolean
nautilus_file_is_archive (NautilusFile *file)
{
......@@ -8817,13 +8771,6 @@ nautilus_file_invalidate_extension_info_internal (NautilusFile *file)
void
nautilus_file_invalidate_attributes_internal (NautilusFile *file,
NautilusFileAttributes file_attributes)
{
NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (file))->invalidate_attributes_internal (file, file_attributes);
}
static void
real_invalidate_attributes_internal (NautilusFile *file,
NautilusFileAttributes file_attributes)
{
Request request;
......@@ -9351,19 +9298,6 @@ thumbnail_limit_changed_callback (gpointer user_data)
emit_change_signals_for_all_files_in_all_directories ();
}
static void
thumbnail_size_changed_callback (gpointer user_data)
{
cached_thumbnail_size = g_settings_get_int (nautilus_icon_view_preferences,
NAUTILUS_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE);
/* Tell the world that icons might have changed. We could invent a narrower-scope
* signal to mean only "thumbnails might have changed" if this ends up being slow
* for some reason.
*/
emit_change_signals_for_all_files_in_all_directories ();
}
static void
show_thumbnails_changed_callback (gpointer user_data)
{
......@@ -9556,13 +9490,6 @@ nautilus_file_class_init (NautilusFileClass *class)
class->get_deep_counts = real_get_deep_counts;
class->set_metadata = real_set_metadata;
class->set_metadata_as_list = real_set_metadata_as_list;
class->can_rename = real_can_rename;
class->rename = real_rename;
class->get_target_uri = real_get_target_uri;
class->drag_can_accept_files = real_drag_can_accept_files;
class->invalidate_attributes_internal = real_invalidate_attributes_internal;
class->opens_in_view = real_opens_in_view;
class->is_special_link = real_is_special_link;
signals[CHANGED] =
g_signal_new ("changed",
......@@ -9589,11 +9516,6 @@ nautilus_file_class_init (NautilusFileClass *class)
"changed::" NAUTILUS_PREFERENCES_FILE_THUMBNAIL_LIMIT,
G_CALLBACK (thumbnail_limit_changed_callback),
NULL);
thumbnail_size_changed_callback (NULL);
g_signal_connect_swapped (nautilus_preferences,
"changed::" NAUTILUS_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE,
G_CALLBACK (thumbnail_size_changed_callback),
NULL);
show_thumbnails_changed_callback (NULL);
g_signal_connect_swapped (nautilus_preferences,
"changed::" NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS,
......@@ -9694,12 +9616,6 @@ nautilus_file_info_providers_done (NautilusFile *file)
static gboolean
nautilus_drag_can_accept_files (NautilusFile *drop_target_item)
{
return NAUTILUS_FILE_CLASS (G_OBJECT_GET_CLASS (drop_target_item))->drag_can_accept_files (drop_target_item);
}
static gboolean
real_drag_can_accept_files (NautilusFile *drop_target_item)
{
if (nautilus_file_is_directory (drop_target_item))
{
......
......@@ -121,11 +121,6 @@ typedef void (*NautilusFileOperationCallback) (NautilusFile *file,
GFile *result_location,
GError *error,
gpointer callback_data);
typedef int (*NautilusWidthMeasureCallback) (const char *string,
void *context);
typedef char * (*NautilusTruncateCallback) (const char *string,
int width,
void *context);
#define NAUTILUS_FILE_ATTRIBUTES_FOR_ICON (NAUTILUS_FILE_ATTRIBUTE_INFO | NAUTILUS_FILE_ATTRIBUTE_LINK_INFO | NAUTILUS_FILE_ATTRIBUTE_THUMBNAIL)
......@@ -213,7 +208,6 @@ gboolean nautilus_file_is_directory (Nautilu
gboolean nautilus_file_is_regular_file (NautilusFile *file);
gboolean nautilus_file_is_user_special_directory (NautilusFile *file,
GUserDirectory special_directory);
gboolean nautilus_file_is_special_link (NautilusFile *file);
gboolean nautilus_file_is_archive (NautilusFile *file);
gboolean nautilus_file_is_in_search (NautilusFile *file);
gboolean nautilus_file_is_in_trash (NautilusFile *file);
......@@ -619,27 +613,6 @@ typedef struct {
gpointer callback_data);
void (* poll_for_media) (NautilusFile *file);
gboolean (* can_rename) (NautilusFile *file);
void (* rename) (NautilusFile *file,
const char *new_name,
NautilusFileOperationCallback callback,
gpointer callback_data);
char* (* get_target_uri) (NautilusFile *file);
gboolean (* drag_can_accept_files) (NautilusFile *drop_target_item);
void (* invalidate_attributes_internal) (NautilusFile *file,
NautilusFileAttributes file_attributes);
gboolean (* opens_in_view) (NautilusFile *file);
/* Use this if the custom file class doesn't support usual operations like
* copy, delete or move.
*/
gboolean (* is_special_link) (NautilusFile *file);
} NautilusFileClass;
#endif /* NAUTILUS_FILE_H */
......@@ -4651,31 +4651,6 @@ nautilus_files_view_get_content_widget (NautilusFilesView *view)
return priv->scrolled_window;
}
static gboolean
nautilus_files_view_special_link_in_selection (NautilusFilesView *view,
GList *selection)
{
gboolean saw_link;
GList *node;
NautilusFile *file;
saw_link = FALSE;
for (node = selection; node != NULL; node = node->next)
{
file = NAUTILUS_FILE (node->data);
saw_link = nautilus_file_is_special_link (file);
if (saw_link)
{
break;
}
}
return saw_link;
}
/* desktop_or_home_dir_in_selection
*
* Return TRUE if either the desktop or the home directory is in the selection.
......@@ -7363,7 +7338,6 @@ real_update_actions_state (NautilusFilesView *view)
NautilusFile *file;
gint selection_count;
gboolean zoom_level_is_default;
gboolean selection_contains_special_link;
gboolean selection_contains_desktop_or_home_dir;
gboolean selection_contains_recent;
gboolean selection_contains_search;
......@@ -7402,7 +7376,6 @@ real_update_actions_state (NautilusFilesView *view)
selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
selection_count = g_list_length (selection);
selection_contains_special_link = nautilus_files_view_special_link_in_selection (view, selection);
selection_contains_desktop_or_home_dir = desktop_or_home_dir_in_selection (selection);
selection_contains_recent = showing_recent_directory (view);
selection_contains_starred = showing_starred_directory (view);
......@@ -7418,15 +7391,12 @@ real_update_actions_state (NautilusFilesView *view)
can_delete_files =
can_delete_all (selection) &&
selection_count != 0 &&
!selection_contains_special_link &&
!selection_contains_desktop_or_home_dir;
can_trash_files =
can_trash_all (selection) &&
selection_count != 0 &&
!selection_contains_special_link &&
!selection_contains_desktop_or_home_dir;
can_copy_files = selection_count != 0
&& !selection_contains_special_link;
can_copy_files = selection_count != 0;
can_move_files = can_delete_files && !selection_contains_recent &&
!selection_contains_starred;
can_paste_files_into = (!selection_contains_recent &&
......
......@@ -96,9 +96,6 @@ typedef enum
/* Which text attributes appear beneath icon names */
#define NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS "captions"
/* The default size for thumbnail icons */
#define NAUTILUS_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE "thumbnail-size"
/* ellipsization preferences */
#define NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT "text-ellipsis-limit"
......
......@@ -190,6 +190,7 @@ constructed (GObject *object)
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (self), 20);
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (self), GTK_SELECTION_MULTIPLE);
gtk_flow_box_set_homogeneous (GTK_FLOW_BOX (self), FALSE);
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
gtk_widget_set_valign (GTK_WIDGET (self), GTK_ALIGN_START);
gtk_widget_set_margin_top (GTK_WIDGET (self), 10);
gtk_widget_set_margin_start (GTK_WIDGET (self), 10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment