How to emit the 'confirm-overwrite' to show the overwrite dialog?



Hello everyone,

Lately, I have been working on a patch for totem
<http://bugzilla.gnome.org/show_bug.cgi?id=379608> to improve the 'Save
Playlist' dialog. A few hours ago, I posted this patch:
http://bugzilla.gnome.org/attachment.cgi?id=83199. Since then I have
been doing some cleanups, so my current code is slightly better.

The mentioned patch connects one callback function directly to the
GtkFileChooserDialog, ie to the 'response' signal. Another function is
connected to the 'changed' signal, from the combo_box that's attached to
the GtkFileChooserDialog. Both callback functions call the same function
that changes the entered filename, to make sure the correct suffix
(based on the mime type from the combobox) is added to the filename.

It took some time for me to find out how to do it, but I finally did
it :) . However, there is a small problem for which I'd like your help.

To make sure that files don't get overwritten after adding or altering
the suffix of the entered filename (when the user clicks the Save
button), I have added some code to check if the file already exists:

if (gnome_vfs_uri_exists (filename_new) == TRUE && 
        gnome_vfs_uri_equal (gnome_vfs_uri_new 
        (filename_from_filechooser), filename_new) == FALSE)
{
        g_signal_emit_by_name (GTK_FILE_CHOOSER (fs), 
                "confirm-overwrite");
        printf ("The file already exists: %s \n", tmp);
}

The result of this code should be that the stock confirmation dialog for
overwriting files comes up. But, it doesn't... so, what am I doing wrong
here? Is it possible to call this 'file overwrite dialog' directly? What
do I have to do to invoke it? Is this the correct place to call it? A
lot of questions and I hope you can help me.

I hope you can help me and thank you in advance.

Kind regards,
Harm Hilvers




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]