Re: UI for scheduling events (appointments)



On Thu, 2005-03-17 at 01:33 -0500, ofey aikon wrote:
Since there is quite a bit of UI design involved, I am considering
using glade and Gtk2::GladeXML. But I am wondering what is a clean
approach to package the xml file in the module.

A number of the class modules in my Sprog package use GladeXML dialog
boxes.  I include the XML directly in the .pm file as a 'here doc' in a
subroutine, eg:

sub dialog_xml {
#  return 'file:/home/grant/projects/sprog/glade/readfile.glade';
  return <<'END_XML';
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
<glade-interface>

...

END_XML

}

Then I take the return value of that sub and pass it to GladeXML:

  Gtk2::GladeXML->new_from_buffer($xml)


My wrapper code first checks if the dialog_xml() method returned a file
URI instead of XML.  If it did, the contents of the file is passed to
GladeXML.  This is really handy during development since my class can
just refer to the XML file on disk that I'm tinkering with (see the
commented out line above).  Then when it's done, I just paste the XML
into my .pm file.

Cheers
Grant





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