[gedit-list] Newbie question. Configure dialogs in Gedit plugins



Hi people,

BACKGROUND INFO:
Under the excuse of learning how to play with networking using Python,
I decided to try my hand at writing a plugin for Gedit that allows two
or more users to connect and edit a same document (or group of
documents) at the same time. In the first couple hours, I quickly
found a good tutorial explaining how to write plugins and got a tiny
piece of the plugin written down.

THE PROBLEM:
However, quickly I bumped into the first problem: Where's the method
that runs the configure dialog? I mean, there's one that creates and
returns it, but where is the dialog being run from.

WHY DOES IT SOUND LIKE IT MATTERS TO ME:
So, I define "create_configure_dialog", connect the response signal to
a standalone function called "on_preferences_dialog_response(ob,
*args)" and that's that. The dialog has one entry, USERNAME, and the
OK and Cancel button. If Cancel is pressed, I destroy (should I hide
it instead?) the dialog without any remorse. But if OK is pressed, it
means that changes are relevant and I want the plugin to know about
it, and that means telling the plugin about the new username.

Am I following a correct line of thought here or should I be doing
something different? I considered just shoving a plugin reference into
the dialog and having the dialog change information in the plugin
while handling the ok response, but that sounds horribly nonstandard
to me.

The alternative which I have started to ponder is having the dialog
write the configuration file when handling the ok response. In that
case, where should I send the configuration file?

Here's the tutorial I found:
http://live.gnome.org/Gedit/PythonPluginHowTo

I googled a bit for other sources, but I couldn't find anything more
complete for that.

-Thiago

PS: A couple of minutes ago I noticed that there's the Collaborate
(http://matt.colyer.name/projects/collaborate/) plugin for Gedit, but
I'm still interested in writing mine anyway.


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