Re: help on disabling file-chooser



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:
    http://www.linuxjournal.com/article/7795

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
http://www.aranz.com/


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