delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/07/08/14:58:20

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.0A020209.4FF9D841.001E,ss=1,re=0.000,fgs=0
X-CT-Spam: 0
X-Authority-Analysis: v=1.1 cv=7DTXskVBSpuAR/MBl5itprnUq89zrLWEwH6mAWzvx2I=
c=1 sm=1 a=8iEie87WbnsA:10 a=RBpK_FrwJwYA:10 a=G8Uczd0VNMoA:10
a=vIu8Bjv99zA89b1LPaaZoA==:17 a=1KtWFQlAsNTuHbNFA8oA:9 a=wPNLvfGTeEIA:10
a=FrEy1KTYvh2GkRQM2CoA:9 a=QEXdDO2ut3YA:10 a=vIu8Bjv99zA89b1LPaaZoA==:117
X-CM-Score: 0.00
Authentication-Results: cox.net; none
Message-ID: <4FF9D840.9010207@cox.net>
Date: Sun, 08 Jul 2012 11:58:08 -0700
From: Eric Brombaugh <ebrombaugh1 AT cox DOT net>
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 (Simplified/Extended)
Reply-To: geda-user AT delorie DOT com

This is a multi-part message in MIME format.
--------------000306070700080005050007
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Here's the patch with Ivan and Andrew's suggestions & corrections. This 
now addresses all the Save/Load actions in the File-> menu and 
simplifies the logic as Ivan pointed out.

Eric

--------------000306070700080005050007
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..e3b93ce 100644
--- a/src/hid/gtk/gui-dialog.c
+++ b/src/hid/gtk/gui-dialog.c
@@ -330,6 +330,13 @@ 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
+  {
+	gchar *default_path;
+	default_path = g_get_current_dir();
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), default_path);
+	g_free(default_path);
+  }
 
   if (shortcuts && *shortcuts)
     {
@@ -406,6 +413,13 @@ 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
+  {
+	gchar *default_path;
+	default_path = g_get_current_dir();
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), default_path);
+	g_free(default_path);
+  }
 
   if (shortcuts && *shortcuts)
     {
@@ -461,6 +475,13 @@ 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
+  {
+	gchar *default_path;
+	default_path = g_get_current_dir();
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), default_path);
+	g_free(default_path);
+  }
 
   if (file && *file)
     {
@@ -533,7 +554,7 @@ ghid_fileselect (const char *title, const char *descr,
   gchar *path = NULL, *base = NULL;
   int history_pool = -1;
   int i;
- 
+
   if (history_tag && *history_tag)
     {
       /* 
@@ -600,6 +621,13 @@ ghid_fileselect (const char *title, const char *descr,
       gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), path);
       g_free (path);
     }
+  else
+	{
+	  gchar *default_path;
+	  default_path = g_get_current_dir();
+	  gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), default_path);
+	  g_free(default_path);
+	}
 
   if (base && *base)
     {

--------------000306070700080005050007--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019