Am Dienstag, den 18.10.2005, 10:30 +0200 schrieb Alexander Larsson: > On Sun, 2005-07-31 at 01:22 +0200, Christian Neumair wrote: > > From bug 168561 [1]: > > > > "When I open "Computer" in the File Browser, the Information sidebar > > shows "x-directory/normal, 11 items". This is very silly considering > > that my computer is not a directory." > > > > The proposed patches introduce a concept of "abstract" files which don't > > map to actual inodes, i.e. "computer:///", "network:///", > > "x-nautilus-desktop:///" etc.. All of them should not expose their file > > type to the user, since the information is generally crap. I've just > > noticed that I didn't add "fonts:///" and "burn:///", but this would be > > trivial to add. Maybe you remember any other URIs that are abstract? > > For now I'm just interested in architectural feedback :). > > > > Note that we can later adapt [2] to this API where appropriate, although > > this is not yet a priority. > > > > [1] http://bugzilla.gnome.org/show_bug.cgi?id=168561 > > [2] http://mail.gnome.org/archives/nautilus-list/2005-July/msg00331.html > > I'm not sure this is the right kind of abstraction we need. It adds a > new abstraction "abstract file" (btw, "vitual" sounds better), without a > clear definition of exactly what it means and when to use it. > > For instance, the mail you mention in [2] is somewhat similar to the > issue in [1], but the new abstraction doesn't really help for it, since > you do want to show the directory size for some abstract files such as > burn://. For the property dialog I would like to totally special-case > the properties dialog for computer to just show some information about > the hardware (hostname, cpu, speed, memory size) and drop the > permissions tab. The "abstract file" abstraction doesn't really help > here either. > > So, unless we have a very well specified and useful semantics for them > we shouldn't introduce new abstract properties like that. Its better to > have specific ones instead (nautils_file_display_type() maybe?). Thanks for your valuable remarks. For consistency reasons, I've called the function nautilus_file_should_show_type. -- Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-file.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v
retrieving revision 1.373
diff -u -p -r1.373 nautilus-file.c
--- libnautilus-private/nautilus-file.c 3 Oct 2005 13:44:48 -0000 1.373
+++ libnautilus-private/nautilus-file.c 18 Oct 2005 17:58:45 -0000
@@ -3208,6 +3208,26 @@ nautilus_file_should_show_directory_item
}
gboolean
+nautilus_file_should_show_type (NautilusFile *file)
+{
+ char *uri;
+ gboolean ret;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
+
+ uri = nautilus_file_get_uri (file);
+ ret = ((strcmp (uri, "computer:///") != 0) &&
+ (strcmp (uri, "network:///") != 0) &&
+ (strcmp (uri, "trash:///") != 0) &&
+ (strcmp (uri, "smb:///") != 0) &&
+ (strcmp (uri, "burn:///") != 0) &&
+ (strcmp (uri, "fonts:///") != 0));
+ g_free (uri);
+
+ return ret;
+}
+
+gboolean
nautilus_file_should_get_top_left_text (NautilusFile *file)
{
static gboolean show_text_in_icons_callback_added = FALSE;
Index: libnautilus-private/nautilus-file.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.h,v
retrieving revision 1.107
diff -u -p -r1.107 nautilus-file.h
--- libnautilus-private/nautilus-file.h 20 Sep 2005 16:05:43 -0000 1.107
+++ libnautilus-private/nautilus-file.h 18 Oct 2005 17:58:45 -0000
@@ -167,6 +167,7 @@ NautilusRequestStatus nautilus_file_ge
GnomeVFSFileSize *total_size,
gboolean force);
gboolean nautilus_file_should_show_directory_item_count (NautilusFile *file);
+gboolean nautilus_file_should_show_type (NautilusFile *file);
GList * nautilus_file_get_keywords (NautilusFile *file);
void nautilus_file_set_keywords (NautilusFile *file,
GList *keywords);
Index: src/nautilus-sidebar-title.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-sidebar-title.c,v
retrieving revision 1.154
diff -u -p -r1.154 nautilus-sidebar-title.c
--- src/nautilus-sidebar-title.c 17 Oct 2005 17:43:57 -0000 1.154
+++ src/nautilus-sidebar-title.c 18 Oct 2005 17:58:46 -0000
@@ -450,7 +450,12 @@ update_more_info (NautilusSidebarTitle *
g_free (component_info);
} else {
info_string = g_string_new (NULL);
- type_string = nautilus_file_get_string_attribute (file, "type");
+
+ type_string = NULL;
+ if (file != NULL && nautilus_file_should_show_type (file)) {
+ type_string = nautilus_file_get_string_attribute (file, "type");
+ }
+
if (type_string != NULL) {
append_and_eat (info_string, NULL, type_string);
append_and_eat (info_string, ", ",
Attachment:
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil