After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 728199 - set the looked up word or its combination as default filename for print-to-file operation
set the looked up word or its combination as default filename for print-to-fi...
Status: RESOLVED OBSOLETE
Product: gnome-dictionary
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-dictionary-maint
gnome-dictionary-maint
Depends on:
Blocks: 686927
 
 
Reported: 2014-04-14 17:38 UTC by jacobian
Modified: 2021-06-10 11:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for print-to-file default filename bug (1.66 KB, patch)
2014-04-14 17:43 UTC, jacobian
needs-work Details | Review
patch for print-to-file default filename bug (1.79 KB, patch)
2014-04-15 14:08 UTC, jacobian
needs-work Details | Review

Description jacobian 2014-04-14 17:38:02 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
Comment 1 jacobian 2014-04-14 17:42:10 UTC
patch attached
Comment 2 jacobian 2014-04-14 17:43:21 UTC
Created attachment 274293 [details] [review]
patch for print-to-file default filename bug
Comment 3 Emmanuele Bassi (:ebassi) 2014-04-14 17:58:06 UTC
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.
Comment 4 André Klapper 2014-04-15 13:24:37 UTC
(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
Comment 5 jacobian 2014-04-15 14:08:18 UTC
revised patch attached
Comment 6 jacobian 2014-04-15 14:08:57 UTC
Created attachment 274368 [details] [review]
patch for print-to-file default filename bug
Comment 7 Emmanuele Bassi (:ebassi) 2014-11-02 11:07:20 UTC
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.
Comment 8 André Klapper 2021-06-10 11:23:12 UTC
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.