GNOME Bugzilla – Bug 337559
Remember what the last medium for sending was
Last modified: 2006-08-21 13:19:24 UTC
If you're trying to send a load of files to people via e-mail, or to your phone, you might want to have that last selection as the medium to send stuff through.
Created attachment 68290 [details] [review] patch to 0.7 This patch fixes this bug, and also a few leaks and attachment error (wrong filename) with Sylpheed-Claws and archived attachments.
Comment on attachment 68290 [details] [review] patch to 0.7 <snip> >+ gconf_client_set_int(gconf_client_get_default(), >+ NAUTILUS_SENDTO_LAST_COMPRESS, >+ gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)), >+ NULL); You only save the settings when we press Send? <snip> >+ >+ gconf_client_set_int(gconf_client_get_default(), >+ NAUTILUS_SENDTO_LAST_MAILER, option, NULL); Same here. > gtk_widget_hide ((GtkWidget *) aux->data); > aux = g_list_nth (ui->contact_widgets, option); > gtk_widget_show ((GtkWidget *) aux->data); >@@ -253,6 +278,7 @@ > GtkCellRenderer *renderer; > GList *aux; > NstPlugin *p; >+ Spurious line. >+ option = gconf_client_get_int(gconf_client_get_default(), >+ NAUTILUS_SENDTO_LAST_MAILER, NULL); You're leaking a reference to the GConfClient. >+ gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option); > } > > static void >@@ -312,7 +340,10 @@ > ui->pack_entry = glade_xml_get_widget (app, "pack_entry"); > > >- gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox), 0); >+ gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox), >+ gconf_client_get_int(gconf_client_get_default(), >+ NAUTILUS_SENDTO_LAST_COMPRESS, NULL)); >+ > gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files")); > /* create_entry_completion (ui->entry); */ > set_contact_widgets (ui); >diff -ur nautilus-sendto-0.7/src/plugins/sylpheed-claws.c nautilus-sendto-0.7-fixes/src/plugins/sylpheed-claws.c >--- nautilus-sendto-0.7/src/plugins/sylpheed-claws.c 2006-05-28 03:39:34.000000000 +0200 >+++ nautilus-sendto-0.7-fixes/src/plugins/sylpheed-claws.c 2006-06-29 15:38:06.000000000 +0200 >@@ -77,7 +77,7 @@ > else > { > mailto = g_string_new("--compose "); >- g_string_append_printf (mailto, "%s", send_to); >+ g_string_append_printf (mailto, "\"%s\"", send_to); > } > > sc_cmd = g_find_program_in_path ("sylpheed-claws-gtk2"); >@@ -89,11 +89,15 @@ > > if(sc_cmd == NULL) > return FALSE; >- /* tmp_str is used for delete file:/// at the start of the filename path */ >- tmp_str = g_string_new(file_list->data); >- tmp_str = g_string_erase (tmp_str, 0, 7); >- g_string_append_printf (mailto," --attach \"%s\"",tmp_str->str); >- g_string_free(tmp_str, TRUE); >+ /* tmp_str is used for delete file:/// at the start of the filename path, */ >+ if (!strncmp(file_list->data, "file:///", strlen("file:///"))) { That's completely broken, use g_filename_from_uri instead. >+ tmp_str = g_string_new(file_list->data); >+ tmp_str = g_string_erase (tmp_str, 0, 7); >+ g_string_append_printf (mailto," --attach \"%s\"",tmp_str->str); >+ g_string_free(tmp_str, TRUE); >+ } else { >+ g_string_append_printf (mailto," --attach \"%s\"",file_list->data); >+ } > > for (l = file_list->next ; l; l=l->next){ > tmp_str = g_string_new(l->data);
Created attachment 68726 [details] [review] updated patch This patch fixes the following remarks: >Spurious line. >You're leaking a reference to the GConfClient. >That's completely broken, use g_filename_from_uri instead. (On the last one I have to state it'd be easier if the plugin always got the same type of string, either filename or uri. right now it's a filename when creating an archive, an uri if not). I didn't change: >You only save the settings when we press Send? I don't think we should save stuff when the user clicks Cancel. Do you?
(In reply to comment #3) > Created an attachment (id=68726) [edit] > updated patch > > This patch fixes the following remarks: > >Spurious line. > >You're leaking a reference to the GConfClient. > >That's completely broken, use g_filename_from_uri instead. > (On the last one I have to state it'd be easier if the plugin always got the > same type of string, either filename or uri. right now it's a filename when > creating an archive, an uri if not). Agreed, and I thought it did do that already. If it doesn't, then it should be fixed to do so. > I didn't change: > >You only save the settings when we press Send? > > I don't think we should save stuff when the user clicks Cancel. Do you? Fair enough. One last problem, you should save the "id" of the plugin used (might need to add this to the plugin structure), not the index, as the index could change (like the bluetooth plugin that depends on the presence of a Bluetooth adapter to work).
Created attachment 68859 [details] [review] third patch Here's a new patch: - adds an id to plugins - use this id to save/restore the last used medium for sending I removed the two other fixes from this patch, and separed bugs, #347391 and #347392. HTH!
In reply to comment #5: > I removed the two other fixes from this patch, and separed bugs, #347391 and > #347392 I meant, the two other bugs the first patch fixed, are now separated and filed in these two new bugs.
Looks good.
Just the one thing before this can be committed, we need a schemas files.
I don't have the slighest idea how to do that, could you point to a doc?
This is an example: http://developer.gnome.org/doc/API/gconf/c420.html Take a look at an application like nautilus-cd-burner, or totem, for the Makefile and configure snippets to use.
Created attachment 69097 [details] [review] fourth patch This patch is based on the third one, with an added schema (inspired from nautilus-cd-burner). I also modified the key name from 'last_mailer' to 'last_medium' because instant messengers can also be used.
ping ;-)
2006-08-21 Bastien Nocera <hadess@hadess.net> * Makefile.am: * configure.in: * nst.schemas.in: * src/nautilus-sendto-command.c: (pack_files), (send_button_cb), (set_model_for_options_combobox), (nautilus_sendto_create_ui), (main): * src/nautilus-sendto-plugin.h: * src/plugins/balsa.c: * src/plugins/bluetooth.c: * src/plugins/evolution.c: * src/plugins/gaim.c: * src/plugins/gajim.c: * src/plugins/sylpheed-claws.c: * src/plugins/thunderbird.c: Patch from Colin Leroy <colin@colino.net> to remember the last selected medium used to send files, as well as the packing preference used (Closes: #337559)