OBS User unknown 2008-04-28 16:11:59 +00:00 committed by Git OBS Bridge
parent c95ae35e13
commit ac9413e4b4
6 changed files with 287 additions and 226 deletions

View File

@ -1,30 +1,35 @@
http://bugzilla.gnome.org/show_bug.cgi?id=350950
Install a nautilus-search.desktop for "Search for Files".
From: Federico Mena Quintero <federico@gnu.org>
? depcomp
? jpr@macintyre.suse.de
? nautilus-folder-handler.desktop
? nautilus-search-desktop.patch
? stamp-h1
? test/test-nautilus-directory-async
? test/test-nautilus-search-engine
Index: Makefile.am
===================================================================
--- Makefile.am.orig
+++ Makefile.am
Install a nautilus-search.desktop with a shortcut to
x-nautilus-search: so that people can easily add *that* link to their
desktops.
---
Makefile.am | 1
nautilus-search.desktop.in | 113 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 114 insertions(+), 0 deletions(-)
create mode 100644 nautilus-search.desktop.in
diff --git a/Makefile.am b/Makefile.am
index 7e134d9..997ae21 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,6 +8,7 @@ desktop_in_files = \
nautilus.desktop.in \
nautilus-home.desktop.in \
nautilus-computer.desktop.in \
+ nautilus-search.desktop.in \
nautilus-folder-handler.desktop.in \
nautilus-file-management-properties.desktop.in
Index: nautilus-search.desktop.in
===================================================================
nautilus-file-management-properties.desktop.in \
nautilus-autorun-software.desktop.in
diff --git a/nautilus-search.desktop.in b/nautilus-search.desktop.in
new file mode 100644
index 0000000..e8bc394
--- /dev/null
+++ nautilus-search.desktop.in
+++ b/nautilus-search.desktop.in
@@ -0,0 +1,113 @@
+[Desktop Entry]
+Encoding=UTF-8

View File

@ -1,33 +1,51 @@
2008-04-21 Federico Mena Quintero <federico@novell.com>
From: Federico Mena Quintero <federico@gnu.org>
http://bugzilla.gnome.org/show_bug.cgi?id=364843
Keep the generated names for "reallylongfilename (copy).txt" from
overflowing the maximum allowed length for path names. Patch by
Dave Camp <dave@novell.com>.
Keep the generated names for "reallylongfilename (copy).txt" from
overflowing the maximum allowed length for path names.
Index: libnautilus-private/nautilus-file-operations.c
================================================================================
--- libnautilus-private/nautilus-file-operations.c
+++ libnautilus-private/nautilus-file-operations.c
@@ -1163,19 +1163,58 @@
}
Original patch by Dave Camp <campd@campd.org>
* libnautilus-private/nautilus-file-operations.c
(shorten_utf8_string): New function; takes an UTF8 string and
hygienically truncates it to a given number of bytes.
(get_link_name): Ensure the final name doesn't exceed a maximum length.
(make_next_duplicate_name): Likewise.
(get_max_name_length): Wrapper around pathconf() for basename lengths.
(get_unique_target_file): Use a maximum length for the target name.
(get_target_file_for_link): Likewise.
---
libnautilus-private/nautilus-file-operations.c | 239 +++++++++++++++++++-----
1 files changed, 186 insertions(+), 53 deletions(-)
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 15dd601..bc1d941 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -228,15 +228,55 @@ format_time (int seconds)
hours), hours);
}
+
+static char *
+shorten_string (const char *base, int reduce_by)
+shorten_utf8_string (const char *base, int reduce_by_num_bytes)
+{
+ int len;
+ char *ret;
+ const char *p;
+
+ len = strlen (base);
+ len -= reduce_by;
+ len -= reduce_by_num_bytes;
+
+ if (len <= 0) {
+ return NULL;
+ }
+
+ ret = g_malloc (len + 1);
+ ret = g_new (char, len + 1);
+
+ p = base;
+ while (len) {
@ -46,7 +64,7 @@ Index: libnautilus-private/nautilus-file-operations.c
+ return NULL;
+ } else {
+ memcpy (ret, base, p - base);
+ ret[p-base] = '\0';
+ ret[p - base] = '\0';
+ return ret;
+ }
+}
@ -56,56 +74,58 @@ Index: libnautilus-private/nautilus-file-operations.c
*/
static char *
-get_link_name (char *name, int count)
+get_link_name (char *name, int count, int max_length)
-get_link_name (const char *name, int count)
+get_link_name (const char *name, int count, int max_length)
{
char *result;
char *unescaped_name;
char *unescaped_tmp_name;
char *unescaped_result;
char *new_file;
-
+ int unescaped_result_size;
const char *format;
char *result;
+ int unshortened_length;
+ gboolean use_count;
g_assert (name != NULL);
@@ -1210,6 +1249,17 @@
@@ -262,8 +302,8 @@ get_link_name (const char *name, int count)
format = _("Another link to %s");
break;
}
unescaped_result = g_strdup_printf (format, unescaped_name);
+ if (max_length > 0 && (unescaped_result_size = strlen (unescaped_result)) > max_length) {
+ char *new_name;
+
+ new_name = shorten_string (unescaped_name, unescaped_result_size - max_length);
+ if (new_name) {
+ g_free (unescaped_result);
+ unescaped_result = g_strdup_printf (format, new_name);
+ g_assert (strlen (unescaped_result) <= max_length);
+ g_free (new_name);
+ }
+ }
- result = g_strdup_printf (format, name);
+ use_count = FALSE;
} else {
/* Handle special cases for the first few numbers of each ten.
@@ -1238,6 +1288,17 @@
* For locales where getting this exactly right is difficult,
@@ -290,7 +330,30 @@ get_link_name (const char *name, int count)
format = _("%'dth link to %s");
break;
}
unescaped_result = g_strdup_printf (format, count, unescaped_name);
+ if (max_length > 0 && (unescaped_result_size = strlen (unescaped_result)) > max_length) {
+ char *new_name;
+
+ new_name = shorten_string (unescaped_name, unescaped_result_size - max_length);
+ if (new_name) {
+ g_free (unescaped_result);
+ unescaped_result = g_strdup_printf (format, count, new_name);
+ g_assert (strlen (unescaped_result) <= max_length);
+ g_free (new_name);
+ }
+
+ use_count = TRUE;
+ }
+
+ if (use_count)
result = g_strdup_printf (format, count, name);
+ else
+ result = g_strdup_printf (format, name);
+
+ if (max_length > 0 && (unshortened_length = strlen (result)) > max_length) {
+ char *new_name;
+
+ new_name = shorten_utf8_string (name, unshortened_length - max_length);
+ if (new_name) {
+ g_free (result);
+
+ if (use_count)
+ result = g_strdup_printf (format, count, new_name);
+ else
+ result = g_strdup_printf (format, new_name);
+
+ g_assert (strlen (result) <= max_length);
+ g_free (new_name);
+ }
}
new_file = g_filename_from_utf8 (unescaped_result, -1, NULL, NULL, NULL);
result = gnome_vfs_escape_path_string (new_file);
@@ -1434,11 +1495,11 @@
return result;
@@ -482,11 +545,12 @@ parse_previous_duplicate_name (const char *name,
}
static char *
@ -115,44 +135,48 @@ Index: libnautilus-private/nautilus-file-operations.c
const char *format;
char *result;
-
+ int name_size;
+ int unshortened_length;
+ gboolean use_count;
if (count < 1) {
g_warning ("bad count %d in get_duplicate_name", count);
@@ -1463,6 +1524,18 @@
@@ -510,7 +574,8 @@ make_next_duplicate_name (const char *base, const char *suffix, int count)
break;
}
result = g_strdup_printf (format, base, suffix);
- result = g_strdup_printf (format, base, suffix);
+
+ if (max_length > 0 && (name_size = strlen (result)) > max_length) {
+ char *new_base;
+
+ new_base = shorten_string (base, name_size - max_length);
+ if (new_base) {
+ g_free (result);
+ result = g_strdup_printf (format, new_base, suffix);
+ g_assert (strlen (result) <= max_length);
+ g_free (new_base);
+ }
+ }
+ use_count = FALSE;
} else {
/* Handle special cases for the first few numbers of each ten.
@@ -1506,13 +1579,25 @@
@@ -553,14 +618,37 @@ make_next_duplicate_name (const char *base, const char *suffix, int count)
}
}
result = g_strdup_printf (format, base, count, suffix);
+ if (max_length > 0 && (name_size = strlen (result)) > max_length) {
+ char *new_base;
+
+ new_base = shorten_string (base, name_size - max_length);
+ if (new_base) {
+ g_free (result);
+ result = g_strdup_printf (format, new_base, count, suffix);
+ g_assert (strlen (result) <= max_length);
+ g_free (new_base);
+ use_count = TRUE;
+
+ }
+ }
+
+ if (use_count)
result = g_strdup_printf (format, base, count, suffix);
+ else
+ result = g_strdup_printf (format, base, suffix);
+
+ if (max_length > 0 && (unshortened_length = strlen (result)) > max_length) {
+ char *new_base;
+
+ new_base = shorten_utf8_string (base, unshortened_length - max_length);
+ if (new_base) {
+ g_free (result);
+
+ if (use_count)
+ result = g_strdup_printf (format, new_base, count, suffix);
+ else
+ result = g_strdup_printf (format, new_base, suffix);
+
+ g_assert (strlen (result) <= max_length);
+ g_free (new_base);
+ }
}
@ -165,7 +189,7 @@ Index: libnautilus-private/nautilus-file-operations.c
{
char *result;
char *name_base;
@@ -1520,7 +1605,7 @@
@@ -568,7 +656,7 @@ get_duplicate_name (const char *name, int count_increment)
int count;
parse_previous_duplicate_name (name, &name_base, &suffix, &count);
@ -174,50 +198,27 @@ Index: libnautilus-private/nautilus-file-operations.c
g_free (name_base);
@@ -1528,7 +1613,7 @@
@@ -2626,6 +2714,45 @@ report_copy_progress (CopyMoveJob *copy_job,
nautilus_progress_info_set_progress (job->progress, transfer_info->num_bytes, total_size);
}
static char *
-get_next_duplicate_name (char *name, int count_increment)
+get_next_duplicate_name (char *name, int count_increment, int max_length)
{
char *unescaped_name;
char *unescaped_tmp_name;
@@ -1554,7 +1639,7 @@
g_free (unescaped_tmp_name);
- unescaped_result = get_duplicate_name (unescaped_name, count_increment);
+ unescaped_result = get_duplicate_name (unescaped_name, count_increment, max_length);
g_free (unescaped_name);
new_file = g_filename_from_utf8 (unescaped_result, -1, NULL, NULL, NULL);
@@ -1565,21 +1650,74 @@
}
static int
+get_max_name_length (const char *text_uri)
+static int
+get_max_name_length (GFile *file_dir)
+{
+ int max_length;
+ GnomeVFSURI *uri;
+ char *dir;
+ long max_path;
+ long max_name;
+
+ max_length = -1;
+
+ uri = gnome_vfs_uri_new (text_uri);
+ if (!uri) {
+ if (!g_file_has_uri_scheme (file_dir, "file"))
+ return max_length;
+ }
+
+ if (strcmp (gnome_vfs_uri_get_scheme (uri), "file") != 0) {
+ gnome_vfs_uri_unref (uri);
+ dir = g_file_get_path (file_dir);
+ if (!dir)
+ return max_length;
+ }
+
+ dir = gnome_vfs_uri_extract_dirname (uri);
+
+
+ max_path = pathconf (dir, _PC_PATH_MAX);
+ max_name = pathconf (dir, _PC_NAME_MAX);
+
@ -234,44 +235,76 @@ Index: libnautilus-private/nautilus-file-operations.c
+
+ max_length = MIN (leftover, max_name);
+ }
+
+
+ g_free (dir);
+
+ gnome_vfs_uri_unref (uri);
+
+
+ return max_length;
+}
+
+static int
handle_transfer_duplicate (GnomeVFSXferProgressInfo *progress_info,
TransferInfo *transfer_info)
{
static GFile *
get_unique_target_file (GFile *src,
GFile *dest_dir,
@@ -2636,6 +2763,9 @@ get_unique_target_file (GFile *src,
char *basename, *new_name;
GFileInfo *info;
GFile *dest;
+ int max_length;
+
+ max_length = get_max_name_length (progress_info->target_name);
+
switch (transfer_info->kind) {
case TRANSFER_LINK:
progress_info->duplicate_name = get_link_name
(progress_info->duplicate_name,
- progress_info->duplicate_count);
+ progress_info->duplicate_count,
+ max_length);
break;
+
+ max_length = get_max_name_length (dest_dir);
dest = NULL;
info = g_file_query_info (src,
@@ -2645,7 +2775,7 @@ get_unique_target_file (GFile *src,
editname = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME);
if (editname != NULL) {
- new_name = get_duplicate_name (editname, count);
+ new_name = get_duplicate_name (editname, count, max_length);
dest = g_file_get_child_for_display_name (dest_dir, new_name, NULL);
g_free (new_name);
}
@@ -2657,7 +2787,7 @@ get_unique_target_file (GFile *src,
basename = g_file_get_basename (src);
case TRANSFER_COPY:
case TRANSFER_MOVE_TO_TRASH:
progress_info->duplicate_name = get_next_duplicate_name
(progress_info->duplicate_name,
- progress_info->duplicate_count);
+ progress_info->duplicate_count,
+ max_length);
break;
default:
break;
@@ -2722,47 +2860,47 @@
setlocale (LC_MESSAGES, "C");
if (g_utf8_validate (basename, -1, NULL)) {
- new_name = get_duplicate_name (basename, count);
+ new_name = get_duplicate_name (basename, count, max_length);
dest = g_file_get_child_for_display_name (dest_dir, new_name, NULL);
g_free (new_name);
}
@@ -2687,7 +2817,10 @@ get_target_file_for_link (GFile *src,
char *basename, *new_name;
GFileInfo *info;
GFile *dest;
-
+ int max_length;
+
+ max_length = get_max_name_length (dest_dir);
+
dest = NULL;
info = g_file_query_info (src,
G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME,
@@ -2696,7 +2829,7 @@ get_target_file_for_link (GFile *src,
editname = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME);
if (editname != NULL) {
- new_name = get_link_name (editname, count);
+ new_name = get_link_name (editname, count, max_length);
dest = g_file_get_child_for_display_name (dest_dir, new_name, NULL);
g_free (new_name);
}
@@ -2708,7 +2841,7 @@ get_target_file_for_link (GFile *src,
basename = g_file_get_basename (src);
if (g_utf8_validate (basename, -1, NULL)) {
- new_name = get_link_name (basename, count);
+ new_name = get_link_name (basename, count, max_length);
dest = g_file_get_child_for_display_name (dest_dir, new_name, NULL);
g_free (new_name);
}
@@ -5136,47 +5269,47 @@ nautilus_self_check_file_operations (void)
/* test the next duplicate name generator */
- EEL_CHECK_STRING_RESULT (get_duplicate_name (" (copy)", 1), " (another copy)");
- EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo", 1), "foo (copy)");

View File

@ -0,0 +1,69 @@
http://bugzilla.gnome.org/show_bug.cgi?id=350962
From: Federico Mena Quintero <federico@gnu.org>
https://bugzilla.novell.com/show_bug.cgi?id=117333
Use "gnome-fs-directory" instead of "file-manager" as an icon. A
folder is more recognizable than a filing cabinet.
---
nautilus-file-management-properties.desktop.in.in | 2 +-
nautilus.desktop.in.in | 2 +-
src/nautilus-file-management-properties.c | 2 +-
src/nautilus-navigation-window.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/nautilus-file-management-properties.desktop.in.in b/nautilus-file-management-properties.desktop.in.in
index a696c81..d372b64 100644
--- a/nautilus-file-management-properties.desktop.in.in
+++ b/nautilus-file-management-properties.desktop.in.in
@@ -3,7 +3,7 @@ Encoding=UTF-8
_Name=File Management
_Comment=Change the behaviour and appearance of file manager windows
Exec=nautilus-file-management-properties
-Icon=system-file-manager
+Icon=gnome-fs-directory
Terminal=false
Type=Application
StartupNotify=true
diff --git a/nautilus.desktop.in.in b/nautilus.desktop.in.in
index ef7d18d..ed6314f 100644
--- a/nautilus.desktop.in.in
+++ b/nautilus.desktop.in.in
@@ -4,7 +4,7 @@ _Name=File Browser
_Comment=Browse the file system with the file manager
TryExec=nautilus
Exec=nautilus --no-desktop --browser %U
-Icon=system-file-manager
+Icon=gnome-fs-directory
Terminal=false
StartupNotify=true
Type=Application
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index 6fcb700..b1338f6 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -789,7 +789,7 @@ nautilus_file_management_properties_dialog_setup (GladeXML *xml_dialog, GtkWindo
(GClosureNotify)g_object_unref,
0);
- gtk_window_set_icon_name (GTK_WINDOW (dialog), "file-manager");
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), "gnome-fs-directory");
if (window) {
gtk_window_set_screen (GTK_WINDOW (dialog), gtk_window_get_screen(window));
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index f22e2cd..a23cfca 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -949,7 +949,7 @@ real_set_title (NautilusWindow *window, const char *title)
static NautilusIconInfo *
real_get_icon (NautilusWindow *window)
{
- return nautilus_icon_info_lookup_from_name ("file-manager", 48);
+ return nautilus_icon_info_lookup_from_name ("gnome-fs-directory", 48);
}
static void

View File

@ -1,59 +0,0 @@
http://bugzilla.gnome.org/show_bug.cgi?id=350962
https://bugzilla.novell.com/show_bug.cgi?id=117333
Use "gnome-fs-directory" instead of "file-manager" as an icon. A
folder is more recognizable than a filing cabinet.
Index: nautilus-2.21.5/nautilus-file-management-properties.desktop.in.in
===================================================================
--- nautilus-2.21.5.orig/nautilus-file-management-properties.desktop.in.in
+++ nautilus-2.21.5/nautilus-file-management-properties.desktop.in.in
@@ -3,7 +3,7 @@ Encoding=UTF-8
_Name=File Management
_Comment=Change the behaviour and appearance of file manager windows
Exec=nautilus-file-management-properties
-Icon=file-manager
+Icon=gnome-fs-directory
Terminal=false
Type=Application
StartupNotify=true
Index: nautilus-2.21.5/nautilus.desktop.in.in
===================================================================
--- nautilus-2.21.5.orig/nautilus.desktop.in.in
+++ nautilus-2.21.5/nautilus.desktop.in.in
@@ -4,7 +4,7 @@ _Name=File Browser
_Comment=Browse the file system with the file manager
TryExec=nautilus
Exec=nautilus --no-desktop --browser %U
-Icon=file-manager
+Icon=gnome-fs-directory
Terminal=false
StartupNotify=true
Type=Application
Index: nautilus-2.21.5/src/nautilus-file-management-properties.c
===================================================================
--- nautilus-2.21.5.orig/src/nautilus-file-management-properties.c
+++ nautilus-2.21.5/src/nautilus-file-management-properties.c
@@ -667,7 +667,7 @@ nautilus_file_management_properties_dial
G_CALLBACK (nautilus_file_management_properties_dialog_response_cb),
xml_dialog);
- gtk_window_set_icon_name (GTK_WINDOW (dialog), "file-manager");
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), "gnome-fs-directory");
if (window) {
gtk_window_set_screen (GTK_WINDOW (dialog), gtk_window_get_screen(window));
Index: nautilus-2.21.5/src/nautilus-navigation-window.c
===================================================================
--- nautilus-2.21.5.orig/src/nautilus-navigation-window.c
+++ nautilus-2.21.5/src/nautilus-navigation-window.c
@@ -949,7 +949,7 @@ real_set_title (NautilusWindow *window,
static NautilusIconInfo *
real_get_icon (NautilusWindow *window)
{
- return nautilus_icon_info_lookup_from_name ("file-manager", 48);
+ return nautilus_icon_info_lookup_from_name ("gnome-fs-directory", 48);
}
static void

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Apr 28 18:12:44 CEST 2008 - federico@novell.com
- Rebased these patches:
nautilus-bgo364843-name-copy-dont-overflow-max-path-len.diff
nautilus-bgo350950-search-desktop.diff
nautilus-bnc117333-bgo350962-folder-icon-for-menus-and-windows.diff
-------------------------------------------------------------------
Wed Apr 23 21:52:31 CEST 2008 - vuntz@suse.de

View File

@ -16,17 +16,17 @@ BuildRequires: cdparanoia eel-devel fdupes gnome-common gnome-desktop-devel gno
License: GPL v2 or later
Group: Productivity/File utilities
Version: 2.22.2
Release: 9
Release: 11
Summary: The GNOME 2.x Desktop File Manager
Source: ftp://ftp.gnome.org/pub/gnome/sources/nautilus/2.20/%{name}-%{version}.tar.bz2
Url: http://www.gnome.org
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# PATCH-NEEDS-REBASE nautilus-name-length.patch
Patch2: nautilus-name-length.patch
# PATCH-FIX-UPSTREAM nautilus-search-desktop.patch bgo350950 federico@novell.com -- add a desktop file for Nautilus search interface
Patch4: nautilus-search-desktop.patch
# PATCH-NEEDS-REBASE nautilus-icon.patch bgo350962 bnc117333 federico@novell.com
Patch5: nautilus-icon.patch
# PATCH-FIX-UPSTREAM nautilus-bgo364843-name-copy-dont-overflow-max-path-len.diff bgo364843 -- make "longfilename (copy).txt" not overflow the maximum filename length
Patch2: nautilus-bgo364843-name-copy-dont-overflow-max-path-len.diff
# PATCH-FIX-UPSTREAM nautilus-bgo350950-search-desktop.diff bgo350950 federico@novell.com -- add a desktop file for Nautilus search interface
Patch4: nautilus-bgo350950-search-desktop.diff
# PATCH-FIX-UPSTREAM nautilus-bnc117333-bgo350962-folder-icon-for-menus-and-windows.diff bnc117333 bgo350962 federico@novell.com - Use a folder icon instead of a file cabinet window
Patch5: nautilus-bnc117333-bgo350962-folder-icon-for-menus-and-windows.diff
# PATCH-FIX-OPENSUSE nautilus-genericname.patch
Patch6: nautilus-genericname.patch
# PATCH-FIX-OPENSUSE nautilus-disable-zoom-control-and-view-as-option-menu.patch
@ -86,11 +86,11 @@ features of the Nautilus file manager.
%prep
%setup -q
gnome-patch-translation-prepare
#%patch2 -p0
%patch2 -p1
%if ! %sles_version
%patch4
%patch4 -p1
%endif
### %patch5 -p1
%patch5 -p1
%patch6 -p0
%patch7
### %patch8 -p1
@ -188,6 +188,11 @@ fi
%{_libdir}/pkgconfig/*.pc
%changelog
* Mon Apr 28 2008 federico@novell.com
- Rebased these patches:
nautilus-bgo364843-name-copy-dont-overflow-max-path-len.diff
nautilus-bgo350950-search-desktop.diff
nautilus-bnc117333-bgo350962-folder-icon-for-menus-and-windows.diff
* Wed Apr 23 2008 vuntz@suse.de
- Rename nautilus-docpath.patch to nautilus-genericname.patch and
drop the part of the patch adding a DocPath.