On Mon, 2005-08-08 at 22:19 +0100, Magnus Therning wrote: > Is there such an extension somewhere that I can use as a guide for > performing the same sort of magic? > > I have an extension that needs some configuration by the user and I > think it'd be best to include that configuration in the preferences > dialogue rather than add a new extension-specific preferences dialogue. No, this hasn't been done before. You can use ephy_shell_get_prefs_dialog() to start. I've played with the Python Console a bit, and here's what I came up with. I suggest you open the Python Console and type in the following to see what happens at each step: >>> import epiphany >>> shell = epiphany.ephy_shell_get_default() # an EphyShell >>> dialog = shell.get_prefs_dialog() # an EphyDialog >>> dialog.show() # the Python Console is interactive! Whee! >>> notebook = dialog.get_control("prefs_notebook") # a GtkNotebook >>> import gtk # to make widgets to append >>> notebook.append_page(gtk.Label("Hello, world!"), gtk.Label("Hello World Test")) # the entire page is just the gtk.Label("Hello, world!") 4 >>> notebook.show_all() # the page isn't visible until we show() it ... and when done: >>> notebook.remove_page(4) # notebook.append_page() returned 4 I don't think the show_all() should really be there, and the new prefs page should obviously contain more than just a GtkLabel, but you get the idea. And the dialog doesn't seem to close the first time I click the "Close" button -- it only closes on the second. I'm assuming this has to do with the way I'm calling "dialog.show()" -- Christian, can you see off-hand what's wrong? I've just got to reiterate the general caution I always give when people talk about adding preferences: do you really NEED to do it? That dialog doesn't really look nice with more than 4 tabs... and if *you* add that to your extension, everybody else will start doing it, too :). Imagine the prefs dialog with 7-8 tabs: it'd be a disaster. Though I do wonder if we should add some helper APIs for preferences. I forget how EphyDialog works, but I don't think there's a simple way to add new widgets and have them auto-connect to GConf -- at least, not with the EphyDialog API. Maybe there's some other simple utility function in GConf or egg which does it. I'm too lazy to look into any of this now. Good luck! -- Adam Hooper <adamh densi com>
Attachment:
signature.asc
Description: This is a digitally signed message part