GNOME Bugzilla – Bug 780237
add save button to build log
Last modified: 2017-03-23 21:38:32 UTC
Sometimes it might be convenient to be able to save the build log to a file without having to copy/paste it first. To fix this bug: - Add a save button to the build log panel (ide-build-log-panel.ui) that actives an action like build-log.save. - Implement build-log.save in ide-build-log-panel.c by adding a GtkFileChooserDialog to select the location of the file. - Save the contents of the buffer to the chosen file
Hi, I am new to gnome so I started working on this issue. For clear button there is a small icon representing the removal of data(broom), so similarly, in this case should I use the commonly used floppy disk one?
Created attachment 348521 [details] [review] Added save button to build log Hey! After hacking some time created patch. Can you see at my code? I have a questions: 1) I can't find a way to get the whole Gnome Builder GtkWindow, so in 'gtk_file_chooser_dialog_new' parent = NULL. Can you help me with this? 2) Should we "block" save button while compiling? P.S. Sorry Pratyusha, but I started worked earlier.. Afaik at the Gnome Wiki there was a suggestion NOT to write in bugs words like "I started worked", but don't sure.
Review of attachment 348521 [details] [review]: Right idea, just some technical details to take care of. ::: libide/buildui/ide-build-log-panel.c @@ +729,3 @@ + + GtkWidget* dialog = gtk_file_chooser_dialog_new ("Save File", + IdeBuildLogPanel *self = user_data; You can get the window to be transient-for with: gtk_widget_get_toplevel (GTK_WIDGET (self)) @@ -721,0 +721,13 @@ +ide_build_log_panel_save_in_file (GSimpleAction *action, + GVariant *param, + gpointer user_data) ... 10 more ... Put name/response pairs on the same line like: _("Cancel"), GTK_RESPONSE_CANCEL, @@ -721,0 +721,19 @@ +ide_build_log_panel_save_in_file (GSimpleAction *action, + GVariant *param, + gpointer user_data) ... 16 more ... It's not safe to block on gtk_dialog_run() in gtk applications that do other things like D-Bus because it can get into deadlock scenarios. However, if you use GtkNativeDialog, it is (but that is not a GtkWidget, so some of this code would need to be changed). If you don't want to use GtkFileChooserNative, then the correct way to handle this would be to add a "response" signal callback and handle the (res == GTK_RESPONSE_ACCEPT) in that callback.
Created attachment 348553 [details] [review] Added save button to build log (with native file chooser) Thank for your help!
Created attachment 348608 [details] [review] buildui: Added save button to build log
I've updated the patch with a couple things to give you an idea for future contributions on our coding style and such. - I try to avoid the variable name "start" because that is a libc function. Typically I use "begin". - We do one variable name per line - Keep all variable declarations at the beginning of scope (use the nearest scope, but at the top of that {} block) - Use g_autoptr() and g_autofree when possible Thanks!
Attachment 348608 [details] pushed as 9006f20 - buildui: Added save button to build log