Re: Gnome fe questions


Subject: Re: Gnome fe questions
From: Joaquín Cuenca Abela (cuenca@ie2.u-psud.fr)
Date: Tue Apr 04 2000 - 12:46:42 CDT


John Tunison wrote:
>
> Hi,
>
> I'm interested in hacking out some more gnome dialogs, and I have a
> question:
>
> Is the current class hierarchy preferred? Right now things look like:
> AP_Dialog_* -> AP_UnixDialog_* -> AP_UnixGnomeDialog_*
>
> The problem with this is that there's going to be a lot of duplication
> between gtk code and Gnome code. One option is simply to copy-and-paste
> the gtk code, as has been done for ap_UnixGnomeDlg_Zoom and
> ap_UnixGnomeDlg_About.
>
> It would be nice to isolate the common code. Large chunks of
> _constructWindow will be the same. Is it better to isolate the
> "common" chunks within the UnixDialog class as separate methods and call
> these methods from both UnixDialog and UnixGnomeDialog, or is it ok to
> rearrange the class hierarchy a bit?
>
> The modified hierarchy might look like:
> AP_Dialog_* -> AP_UnixGtkCommonDialog_*
> |
> |-------------> AP_UnixGnomeDialog_*
> |
> |-------------> AP_UnixGtkDialog_*
>
> Let me know which way you'd like it (copy'n'paste, separated
> functions/same hierarchy, or new hierarchy) and I'll get to work putting
> in those GNOME_STOCKs....

Lately, I've been using the "separated functions/same hierarchy"
approach. You can see an example at "ap_UnixGnomeDialog_WordCount."

The point is that usually, the gnome dialogs and the gtk dialogs are the
same, except for the buttons, so I think that we can change the actual
_constructWindow (which is a copy'n'paste of the interface.c file of
glade, isn't it? :) for a pair
_constructWindow/_constructWindowContents. _constructWindow will
construct all the dialog box... it will call _constructWindowContents to
construct the widget that will be embedded in the dialog box, and in the
gtk+ version, it usually will put this widget in a vbox and construct
the row of buttons. In the gnome version, it will embed this widget in
the gnome_dialog and make the row of (gnome-)buttons.

If the gnome version has to change the contents of the dialog box, it
can inherit "_constructWindowContents." What do you think?

Thank you for your help!

PS: Feel free to fix all the Gtk+ dialog boxs to add a
_constructWindowContents (it's and "cut'n'paste" work).

--
Joaquín Cuenca Abela
e-mail: cuenca@ie2.u-psud.fr



This archive was generated by hypermail 2b25 : Tue Apr 04 2000 - 12:46:51 CDT