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@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: PCB: Default Saving-path
Felix Ruoff wrote: 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 No problem. You are not the only German on the list. In fact, we may well be the second largest user group :-) 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. Nice. 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; IMHO, it would be better to put the patch file in a regular attachment rather than copy paste it to the main body of the mail. Mail servers do quite a bit of space, tab and new line munging on the main body and render the patch unusable. By contrast, they leave attachments alone. An additional advice: Go on nagging on the list until a developer either explicitly rejected your patch, or applied it to the source. Else, your effort will just be ignored like many others in the past. The official bug tracker may be an option. But note, that patches tend to be ignored there, too. ---)kaimartin(--- -- Kai-Martin Knaak Öffentlicher PGP-Schlüssel: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6C0B9F53 ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: PCB: Default Saving-path (patch attached)
Thank you, kaimartin, for your reply! IMHO, it would be better to put the patch file in a regular attachment rather than copy paste it to the main body of the mail. Mail servers do quite a bit of space, tab and new line munging on the main body and render the patch unusable. By contrast, they leave attachments alone. I have attached the patch to this mail. Hope, it will be easy to apply. An additional advice: Go on nagging on the list until a developer either explicitly rejected your patch, or applied it to the source. Else, your effort will just be ignored like many others in the past. The official bug tracker may be an option. But note, that patches tend to be ignored there, too. Thanks for the hint. I have also done a patch-report at sourceforge. Felix ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: PCB: Default Saving-path (patch attached)
Sorry, i forgot the attachement :-(. Here it is. Felix Am 26.09.2010 21:38, schrieb Felix Ruoff: Thank you, kaimartin, for your reply! IMHO, it would be better to put the patch file in a regular attachment rather than copy paste it to the main body of the mail. Mail servers do quite a bit of space, tab and new line munging on the main body and render the patch unusable. By contrast, they leave attachments alone. I have attached the patch to this mail. Hope, it will be easy to apply. An additional advice: Go on nagging on the list until a developer either explicitly rejected your patch, or applied it to the source. Else, your effort will just be ignored like many others in the past. The official bug tracker may be an option. But note, that patches tend to be ignored there, too. Thanks for the hint. I have also done a patch-report at sourceforge. Felix ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user 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@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user