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

gEDA-user: PCB: Default Saving-path





Hello, everybody!

This is my first post at this mailing-list, so I would like to introduce myself very short. The main part of this mail starts after the double-line.

My name is Felix and I am studying electrical engineering in Germany. I am sorry for my bad English, I hope, you will understand me and I will not offend someone by using wrong words. I am using gschem and pcb since some weeks and like it very much.

For me, some things could be modified to improve user-comfort, especially for new users (like me). So I looked through some parts of the code and tried to changed them by myself. Here is my first patch:

=============

I realized that the 'Save layou as' - dialog gives full path and filename in name-line, but did not switched to given path in folder-list (lower part of the dialog). For me, this is unkomfortable, e.g. if I just want to switch to another near-by - folder.

The following patch changes this behaviour. If a filename is given to this dialog, the folder-list will jump to its path. Otherwise there are two possibilities: If a path is given (from a previous run of this dialog), this path will be used, otherwise the $HOME-directory of the user.

Any feedback is very welcome!

diff --git a/src/hid/gtk/gui-dialog.c b/src/hid/gtk/gui-dialog.c

index ec91233..c45d970 100644

--- a/src/hid/gtk/gui-dialog.c

+++ b/src/hid/gtk/gui-dialog.c

@@ -367,7 +367,7 @@ ghid_dialog_file_select_save (gchar * title, gchar ** path, gchar * file,

                   gchar * shortcuts)

 {

   GtkWidget *dialog;

-  gchar *result = NULL, *folder, *seed;

+  gchar *result = NULL, *folder, *seed, *filename;

   GHidPort *out =&ghid_port;

   dialog = gtk_file_chooser_dialog_new (title,

@@ -379,11 +379,25 @@ ghid_dialog_file_select_save (gchar * title, gchar ** path, gchar * file,

   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);

-  if (path&&  *path&&  **path)

-    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), *path);

-

-  if (file&&  *file)

-    gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file);

+  if (file&&  *file)

+    {

+      filename = g_path_get_basename(file);

+      gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename);

+      g_free(filename);

+

+      *path = g_path_get_dirname(file);

+      gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), *path);

+    }

+  else

+    {

+      if(path&&  *path&&  **path)

+      gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), *path);

+      else

+    {

+      *path = (gchar*) g_get_home_dir();

+      gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), *path);

+    }

+    }

   if (shortcuts&&  *shortcuts)

     {



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user