Re: Patch for window titles



Looks like a good idea to me, a few comments inline below.

-dave

On Tue, 2004-04-27 at 23:52 +0800, Grahame Bowland wrote:
> Index: src/nautilus-window.c
> ===================================================================
> RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
> retrieving revision 1.433
> diff -u -r1.433 nautilus-window.c
> --- src/nautilus-window.c       14 Apr 2004 16:07:25 -0000      1.433
> +++ src/nautilus-window.c       27 Apr 2004 15:35:16 -0000
> @@ -1140,11 +1140,26 @@
>  compute_default_title (const char *text_uri)
>  {
>         NautilusFile *file;
> -       char *title;
> +       GnomeVFSURI *uri;
> +       char *title, *displayname;
> +       const gchar *hostname;

Should use char rather than gchar here,

> +
> +       hostname = NULL;
>  
>         if (text_uri) {
>                 file = nautilus_file_get (text_uri);
> -               title = nautilus_file_get_display_name (file);
> +               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);
> +                       gnome_vfs_uri_unref (uri);

This should move out of the if (hostname), in case there is a uri
without a hostname or it's local.

> +                       free (displayname);

Strings in nautilus are allocated with glib allocators, you'll want to
use g_free() here.

> +               } else {
> +                       title = displayname;
> +               }
>                 nautilus_file_unref (file);
>         } else {
>                 title = g_strdup ("");




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