diff options
author | Ernestas Kulik <ernestask@gnome.org> | 2017-12-19 21:05:07 +0200 |
---|---|---|
committer | Ernestas Kulik <ernestask@gnome.org> | 2018-01-02 13:11:10 +0200 |
commit | ac0e5578d291073fc034e5a206dcb36a2fd0220f (patch) | |
tree | 581cd329b96c629c7abe89651219a413ba5cf01c | |
parent | 5275ee19d387582a3d1d4b07084898a0f84b0e3f (diff) | |
download | nautilus-ac0e5578d291073fc034e5a206dcb36a2fd0220f.tar.gz |
general: always show file names for desktop files
-rw-r--r-- | src/nautilus-directory-async.c | 23 | ||||
-rw-r--r-- | src/nautilus-file.c | 73 | ||||
-rw-r--r-- | src/nautilus-link.c | 16 | ||||
-rw-r--r-- | src/nautilus-link.h | 3 |
4 files changed, 9 insertions, 106 deletions
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c index d642e6fad..42ee8918c 100644 --- a/src/nautilus-directory-async.c +++ b/src/nautilus-directory-async.c @@ -194,7 +194,6 @@ static void add_all_files_to_work_queue (NautilusDirectory *directory); static void link_info_done (NautilusDirectory *directory, NautilusFile *file, const char *uri, - const char *name, GIcon *icon, gboolean is_launcher); static void move_file_to_low_priority_queue (NautilusDirectory *directory, @@ -1811,7 +1810,7 @@ lacks_link_info (NautilusFile *file) } else { - link_info_done (file->details->directory, file, NULL, NULL, NULL, FALSE); + link_info_done (file->details->directory, file, NULL, NULL, FALSE); return FALSE; } } @@ -3588,7 +3587,6 @@ static void link_info_done (NautilusDirectory *directory, NautilusFile *file, const char *uri, - const char *name, GIcon *icon, gboolean is_launcher) { @@ -3598,15 +3596,6 @@ link_info_done (NautilusDirectory *directory, is_trusted = is_link_trusted (file, is_launcher); - if (is_trusted) - { - nautilus_file_set_display_name (file, name, name, TRUE); - } - else - { - nautilus_file_set_display_name (file, NULL, NULL, TRUE); - } - file->details->got_link_info = TRUE; g_clear_object (&file->details->custom_icon); @@ -3660,14 +3649,13 @@ link_info_got_data (NautilusDirectory *directory, goffset bytes_read, char *file_contents) { - char *link_uri, *uri, *name; + char *link_uri, *uri; GIcon *icon; gboolean is_launcher; nautilus_directory_ref (directory); uri = NULL; - name = NULL; icon = NULL; is_launcher = FALSE; @@ -3676,7 +3664,7 @@ link_info_got_data (NautilusDirectory *directory, { link_uri = nautilus_file_get_uri (file); nautilus_link_get_link_info_given_file_contents (file_contents, bytes_read, link_uri, - &uri, &name, &icon, &is_launcher); + &uri, &icon, &is_launcher); g_free (link_uri); } else @@ -3685,12 +3673,11 @@ link_info_got_data (NautilusDirectory *directory, } nautilus_file_ref (file); - link_info_done (directory, file, uri, name, icon, is_launcher); + link_info_done (directory, file, uri, icon, is_launcher); nautilus_file_changed (file); nautilus_file_unref (file); g_free (uri); - g_free (name); if (icon != NULL) { @@ -3779,7 +3766,7 @@ link_info_start (NautilusDirectory *directory, /* If it's not a link we are done. If it is, we need to read it. */ if (!nautilus_style_link) { - link_info_done (directory, file, NULL, NULL, NULL, FALSE); + link_info_done (directory, file, NULL, NULL, FALSE); } else { diff --git a/src/nautilus-file.c b/src/nautilus-file.c index e62b54a5c..88a367e88 100644 --- a/src/nautilus-file.c +++ b/src/nautilus-file.c @@ -2048,19 +2048,10 @@ nautilus_file_can_rename_file (NautilusFile *file, gpointer callback_data) { GError *error; - gboolean is_renameable_desktop_file; - gboolean success; - gboolean name_changed; gchar *new_file_name; - gchar *uri; - gchar *old_name; - - is_renameable_desktop_file = - is_desktop_file (file) && can_rename_desktop_file (file); - /* Return an error for incoming names containing path separators. - * But not for .desktop files as '/' are allowed for them */ - if (strstr (new_name, "/") != NULL && !is_renameable_desktop_file) + /* Return an error for incoming names containing path separators. */ + if (strstr (new_name, "/") != NULL) { error = g_error_new (G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Slashes are not allowed in filenames")); @@ -2085,8 +2076,7 @@ nautilus_file_can_rename_file (NautilusFile *file, * (1) rename returns an error if new & old are same. * (2) We don't want to send file-changed signal if nothing changed. */ - if (!is_renameable_desktop_file && - name_is (file, new_name)) + if (name_is (file, new_name)) { if (callback != NULL) { @@ -2118,62 +2108,7 @@ nautilus_file_can_rename_file (NautilusFile *file, return NULL; } - if (is_renameable_desktop_file) - { - /* Don't actually change the name if the new name is the same. - * This helps for the vfolder method where this can happen and - * we want to minimize actual changes - */ - uri = nautilus_file_get_uri (file); - old_name = nautilus_link_local_get_text (uri); - if (old_name != NULL && strcmp (new_name, old_name) == 0) - { - success = TRUE; - name_changed = FALSE; - } - else - { - success = nautilus_link_local_set_text (uri, new_name); - name_changed = TRUE; - } - g_free (old_name); - g_free (uri); - - if (!success) - { - error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, - _("Probably the content of the file is an invalid desktop file format")); - if (callback != NULL) - { - (*callback)(file, NULL, error, callback_data); - } - g_error_free (error); - return NULL; - } - new_file_name = g_strdup_printf ("%s.desktop", new_name); - new_file_name = g_strdelimit (new_file_name, "/", '-'); - - if (name_is (file, new_file_name)) - { - if (name_changed) - { - nautilus_file_invalidate_attributes (file, - NAUTILUS_FILE_ATTRIBUTE_INFO | - NAUTILUS_FILE_ATTRIBUTE_LINK_INFO); - } - - if (callback != NULL) - { - (*callback)(file, NULL, NULL, callback_data); - } - g_free (new_file_name); - return NULL; - } - } - else - { - new_file_name = g_strdup (new_name); - } + new_file_name = g_strdup (new_name); return new_file_name; } diff --git a/src/nautilus-link.c b/src/nautilus-link.c index d52841843..8246752e1 100644 --- a/src/nautilus-link.c +++ b/src/nautilus-link.c @@ -320,14 +320,6 @@ nautilus_link_local_set_key (const char *uri, } gboolean -nautilus_link_local_set_text (const char *uri, - const char *text) -{ - return nautilus_link_local_set_key (uri, "Name", text, TRUE); -} - - -gboolean nautilus_link_local_set_icon (const char *uri, const char *icon) { @@ -400,12 +392,6 @@ nautilus_link_get_link_uri_from_desktop (GKeyFile *key_file, return retval; } -static char * -nautilus_link_get_link_name_from_desktop (GKeyFile *key_file) -{ - return g_key_file_get_locale_string (key_file, MAIN_GROUP, "Name", NULL, NULL); -} - static GIcon * nautilus_link_get_link_icon_from_desktop (GKeyFile *key_file) { @@ -525,7 +511,6 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents, int link_file_size, const char *file_uri, char **uri, - char **name, GIcon **icon, gboolean *is_launcher) { @@ -544,7 +529,6 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents, } *uri = nautilus_link_get_link_uri_from_desktop (key_file, file_uri); - *name = nautilus_link_get_link_name_from_desktop (key_file); *icon = nautilus_link_get_link_icon_from_desktop (key_file); *is_launcher = FALSE; diff --git a/src/nautilus-link.h b/src/nautilus-link.h index be0c691ce..fc73b6e58 100644 --- a/src/nautilus-link.h +++ b/src/nautilus-link.h @@ -31,8 +31,6 @@ gboolean nautilus_link_local_create (const char const char *target_uri, int screen, gboolean unique_filename); -gboolean nautilus_link_local_set_text (const char *uri, - const char *text); gboolean nautilus_link_local_set_icon (const char *uri, const char *icon); char * nautilus_link_local_get_text (const char *uri); @@ -41,7 +39,6 @@ void nautilus_link_get_link_info_given_file_contents (const char int link_file_size, const char *file_uri, char **uri, - char **name, GIcon **icon, gboolean *is_launcher); |