Re: help on disabling file-chooser

Thanks for your help, but...

Can't be done by modifying the following on gtkfilechooserdefault.c ?
    case SAVE_ENTRY:
/*    goto save_entry; */
    gtk_widget_destroy (dialog);    /* or something that destroys and cleans up the widget/dialog */

2010/2/1 Tim Evans <t evans aranz com>
On 2010-02-01 7:49, Ruben wrote:
Maybe I didn't explained myself,

Is not a license concern, just techical- Has nothing to do with that.

What I need is to customize GTK with file-chooser
disabled/removed/noreferenced on my compiled library, just
doing nothing when a save file signal is generated.

 The app that runs above makes a call to save a file on the system, and
leaves this GTK window opened breaking the normal operation flow.

You might be able to replace the relevant calls using an LD_PRELOAD library.  There's an article about doing this sort of thing in the Linux Journal:

I think the best point of attack would be the gtk_dialog_run() function.  My development steps would be:

Step 1: write an LD_PRELOAD library as described above that contains a replacement gtk_dialog_run().  Initially just have it call the original gtk_dialog_run().

Step 2: link your LD_PRELOAD lib against GTK+ and see if you can query the type of the dialog without it crashing or something.

Step 3: change your function so that when it is passed a GtkFileChooserDialog it returns GTK_RESPONSE_CANCEL immediately instead of calling the original gtk_dialog_run().

Step 4 (optional): rather than just canceling, call gtk_file_chooser_set_filename() and return GTK_RESPONSE_ACCEPT to have the file saved somewhere.  May be required if the cancel response stops the app from doing further processing.

Tim Evans
Applied Research Associates NZ

gtk-devel-list mailing list
gtk-devel-list gnome org

Ruben Tato

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