GNOME Bugzilla – Bug 728199
set the looked up word or its combination as default filename for print-to-file operation
Last modified: 2021-06-10 11:23:12 UTC
The default filename for print-to-file is output.pdf. This has to be changed to something more meaningful. I found the original print-to-file bug here: https://wiki.gnome.org/Initiatives/GnomeGoals/PrintToFile
patch attached
Created attachment 274293 [details] [review] patch for print-to-file default filename bug
Review of attachment 274293 [details] [review]: thanks for the patch! the commit message should break at 72 columns in the body. to be fair, I don't see the usefulness of prefixing "dictionary" to the file. ::: src/gdict-print.c @@ +291,3 @@ + default_output_filename = (char *)malloc(sizeof(char)*(strlen("dictionary_")+strlen((char *)word))); + strcpy(default_output_filename,"dictionary_"); + strcat(default_output_filename,(char *)word); please, use g_strdup_printf(). you should also mark the string for localization, as well as dropping the underscore. also, you should follow the surrounding coding style. @@ +294,3 @@ + settings = gtk_print_settings_new(); + gtk_print_settings_set(settings,GTK_PRINT_SETTINGS_OUTPUT_BASENAME,(gchar *)default_output_filename); + gtk_print_operation_set_print_settings(operation,settings); you should follow the surrounding coding style: * space is required between function name and opening bracket * space is required after comma in the arguments list no need to cast between char* and gchar*: they are the same type.
(In reply to comment #3) > you should also mark the string for localization, as well as dropping the > underscore. As this was asked on IRC: Normally _("foo") should work; long version at https://wiki.gnome.org/TranslationProject/DevGuidelines
revised patch attached
Created attachment 274368 [details] [review] patch for print-to-file default filename bug
Review of attachment 274368 [details] [review]: you should really re-submit the patch, not as a patch on top of the previous one. ::: src/gdict-print.c @@ +294,3 @@ + default_output_filename); + gtk_print_operation_set_print_settings (operation, settings); + g_free (default_output_filename); you need to call g_object_unref() on the GtkPrintSettings instance you create, otherwise you'll leak it.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version of gnome-dictionary, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a ticket at https://gitlab.gnome.org/GNOME/gnome-dictionary/-/issues/ Thank you for your understanding and your help.