Re: [PATCH] - Fix for 155928 -Adds GTK2 Bookmarks to Nautilus



Looks good in general, a couple of nit-picks below.  One problem is that
it seems to lose Titles given by the user.  I'm not sure this is a big
deal, but it'll mean we need to clean up the bookmark-editing UI.  We
can add it back if the gtk bookmarks end up supporting it.

Thanks!

-dave

On Tue, 2005-06-21 at 12:45 +0100, Jamie McCracken wrote:

> 
> +
> +static char *
> +compute_default_title (const char *text_uri)
> +{
> +       NautilusFile *file;
> +       GnomeVFSURI *uri;
> +       char *title, *displayname;
> +       const char *hostname;
> +
> +       hostname = NULL;
> +
> +       if (text_uri) {
> +               file = nautilus_file_get (text_uri);
> +               uri = gnome_vfs_uri_new (text_uri);
> +               if (uri && !gnome_vfs_uri_is_local (uri)) {
> +                       hostname = gnome_vfs_uri_get_host_name (uri);
> +               }
> +               displayname = nautilus_file_get_display_name (file);
> +               if (hostname) {
> +                       title = g_strdup_printf (("%s on %s"),
> displayname, hostname);
> +                       g_free (displayname);
> +               } else {
> +                       title = displayname;
> +               }
> +               if (uri) {
> +                       gnome_vfs_uri_unref (uri);
> +               }
> +               nautilus_file_unref (file);
> +       } else {
> +               title = g_strdup ("");
> +       }
> +       title = eel_str_middle_truncate (title,
> MAX_TITLE_LENGTH);      
> +       return title;
> +
> +}

There's one of these in nautilus-window.c too, maybe we should put it in
libnautilus-private somewhere.

> +
> +static NautilusBookmark *
> +new_bookmark_from_uri (const char *uri)
> +{
> +       NautilusBookmark *new_bookmark;
> +       char *name;
> +
> +       name = compute_default_title (uri);
> +       new_bookmark = nautilus_bookmark_new_with_icon (uri, name,
> "gnome-fs-directory");

Maybe this should use the icon factory, in case it's a special directory
or a directory with a custom icon.
> 
> +       gchar *filename;
> +       gchar *contents;

eeew, gchar :)






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]