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 337559 - Remember what the last medium for sending was
Remember what the last medium for sending was
Status: RESOLVED FIXED
Product: nautilus-sendto
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Roberto Majadas
Roberto Majadas
Depends on:
Blocks:
 
 
Reported: 2006-04-06 23:29 UTC by Bastien Nocera
Modified: 2006-08-21 13:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to 0.7 (5.66 KB, patch)
2006-07-03 09:52 UTC, Colin Leroy
needs-work Details | Review
updated patch (5.68 KB, patch)
2006-07-10 16:27 UTC, Colin Leroy
needs-work Details | Review
third patch (7.18 KB, patch)
2006-07-13 12:07 UTC, Colin Leroy
needs-work Details | Review
fourth patch (10.45 KB, patch)
2006-07-18 10:03 UTC, Colin Leroy
none Details | Review

Description Bastien Nocera 2006-04-06 23:29:10 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.
Comment 1 Colin Leroy 2006-07-03 09:52:00 UTC
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 2 Bastien Nocera 2006-07-10 16:00:00 UTC
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);
Comment 3 Colin Leroy 2006-07-10 16:27:38 UTC
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?
Comment 4 Bastien Nocera 2006-07-13 11:03:27 UTC
(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).
Comment 5 Colin Leroy 2006-07-13 12:07:59 UTC
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!
Comment 6 Colin Leroy 2006-07-13 12:09:37 UTC
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.
Comment 7 Bastien Nocera 2006-07-17 13:04:18 UTC
Looks good.
Comment 8 Bastien Nocera 2006-07-17 21:43:43 UTC
Just the one thing before this can be committed, we need a schemas files.
Comment 9 Colin Leroy 2006-07-18 06:44:24 UTC
I don't have the slighest idea how to do that, could you point to a doc? 
Comment 10 Bastien Nocera 2006-07-18 07:10:39 UTC
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.
Comment 11 Colin Leroy 2006-07-18 10:03:04 UTC
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.
Comment 12 Colin Leroy 2006-08-04 11:36:54 UTC
ping ;-)
Comment 13 Bastien Nocera 2006-08-21 13:19:24 UTC
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)