delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to geda-user-bounces using -f |
X-Recipient: | geda-user AT delorie DOT com |
X-Spam-Checker-Version: | SpamAssassin 3.3.1 (2010-03-16) on fly.srk.fer.hr |
X-Spam-Level: | |
X-Spam-Status: | No, score=-1.0 required=6.3 tests=ALL_TRUSTED,FSL_RCVD_USER |
autolearn=disabled version=3.3.1 | |
Date: | Sun, 8 Jul 2012 20:39:50 +0200 |
From: | Ivan Stankovic <pokemon AT fly DOT srk DOT fer DOT hr> |
To: | geda-user AT delorie DOT com |
Subject: | Re: [geda-user] [PATCH] gtk hid file chooser default path (corrected) |
Message-ID: | <20120708183950.GA12164@alpha2> |
References: | <4FF9CF99 DOT 1070901 AT cox DOT net> |
MIME-Version: | 1.0 |
In-Reply-To: | <4FF9CF99.1070901@cox.net> |
X-Operating-System: | GNU/Linux |
User-Agent: | Mutt/1.5.21 (2010-09-15) |
Reply-To: | geda-user AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | geda-user AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
On Sun, Jul 08, 2012 at 11:21:13AM -0700, Eric Brombaugh wrote: > diff --git a/src/hid/gtk/gui-dialog.c b/src/hid/gtk/gui-dialog.c > index 247b961..2cc0968 100644 > --- a/src/hid/gtk/gui-dialog.c > +++ b/src/hid/gtk/gui-dialog.c > @@ -330,6 +330,16 @@ ghid_dialog_file_select_open (gchar * title, gchar ** path, gchar * shortcuts) > > if (path && *path) > gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), *path); > + else > + { > + GFile *default_path; > + gchar *uri; > + default_path = g_file_new_for_path (g_get_current_dir()); > + uri = g_file_get_uri (default_path); > + gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), uri); > + g_free (uri); > + g_object_unref (G_OBJECT (default_path)); > + } You don't free the returned value from g_get_current_dir. That said, I'm not sure why you bother with constructing a GFile... Surely you can use g_filename_to_uri[1] to convert the path to a URI? Or, even better, avoid URIs and just use gtk_file_chooser_set_current_folder[2]? [1] http://developer.gnome.org/glib/2.30/glib-URI-Functions.html#g-filename-to-uri [2] http://developer.gnome.org/gtk/2.24/GtkFileChooser.html#gtk-file-chooser-set-current-folder -- Ivan Stankovic, pokemon AT fly DOT srk DOT fer DOT hr "Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm"
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |