X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020208.4FF9CF99.0082,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=1.1 cv=2cp5XZ03M2vnUJocAhlMkaMaDoAobX7R+Csg6TPaHnA= c=1 sm=1 a=8iEie87WbnsA:10 a=m7Mg8JBMEzoA:10 a=G8Uczd0VNMoA:10 a=vIu8Bjv99zA89b1LPaaZoA==:17 a=8PYNnABDDkV6yF0VaKAA:9 a=wPNLvfGTeEIA:10 a=qZXr2eiBHV4O50fJ8bsA:9 a=QEXdDO2ut3YA:10 a=vIu8Bjv99zA89b1LPaaZoA==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; none Message-ID: <4FF9CF99.1070901@cox.net> Date: Sun, 08 Jul 2012 11:21:13 -0700 From: Eric Brombaugh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: geda-user AT delorie DOT com Subject: [geda-user] [PATCH] gtk hid file chooser default path (corrected) Content-Type: multipart/mixed; boundary="------------050203080508090806090703" Reply-To: geda-user AT delorie DOT com This is a multi-part message in MIME format. --------------050203080508090806090703 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Here's the patch with Patrick and Andrew's suggestions/corrections. Limited testing, works for me, use with caution, void where prohibited, etc. Caveat - the "File->Load Vendor Resource File" menu still has the problem. Apparently it doesn't use ghid_dialog_file_select_open() function call and in a cursory check I didn't see where it was implemented. I don't use that menu item so it's not an issue for me. Eric --------------050203080508090806090703 Content-Type: text/plain; charset=UTF-8; name="pcb_file_chooser_patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pcb_file_chooser_patch.txt" 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)); + } if (shortcuts && *shortcuts) { @@ -406,6 +416,16 @@ ghid_dialog_file_select_multiple(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)); + } if (shortcuts && *shortcuts) { @@ -461,6 +481,16 @@ ghid_dialog_file_select_save (gchar * title, gchar ** path, gchar * file, if (path && *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)); + } if (file && *file) { --------------050203080508090806090703--