Re: Modules and Name space

On Sep 15, 2004, at 2:33 PM, Kevin C. Krinke wrote:

Before we get to my real questions, here's a quick tut on how to use
these wrappers. There are currently three dialogs implemented.
"Message"  which is a straight forward message box, ok button and
optional stock-icon placed nicely to the left of the content. "ErrorMsg"
which is just a "Message" with the default title of "Error" and
stock-icon "gtk-dialog-error". The last is "Question" which is the same
a "Message" with the exception of having "Yes" and "No" buttons.

i hate to say it, because it sounds like you've done a fair amount of work, but Gtk2::MessageDialog (nee GtkMessageDialog) has most of this functionality already, including the ability to specify a parent window (which is rather important, actually); they are meant to be standards, and gtk+ 2.6 is supposed to have extended gnome HIG compliance. Gnome2::App has some handlers which make sure the message dialogs are transient to the app window and have the app's name as the title.

are your dialogs meant to be replacements for those, or just wrappers around them?

# Note: Questions always block with a call to run()
$answer = new_run Question ( title => "And?",
                             text => "So what's it going to be?" );
if ( $answer eq 'yes' ) {
} else {

i once created a wrapper along the lines of

boolean = confirm ($parent, $title, $verb, $default_yes, $prompt_string)

which will create a dialog with two buttons, saying "Don't $verb" and "$verb", in a style used by Mac and recent Gnome -- i find it a little clearer.

       TRUE = 1
       FALSE = 0

i think ross already pointed out that these are in Glib since 1.020. in fact, in Glib, the FALSE is '', as is usually returned by perl for false.


those look handy.

The final module has two very simple utility functions:


sub Gtk2_Main_Iteration {
    while ( events_pending Gtk2 ) {
        main_iteration Gtk2;

a more to-the-point name would be "update_ui" or "flush_events", as that's what you'd use this for. "Main_Iteration" makes it sound like it's just going to go through once. the original Inline-based Gtk2 had an "update_ui", iirc.

So what this all boils down to is the following questions:

A) Do I tuck these things into UI::Dialog::PurePerl::Gtk2?
   (my original plan).

if they are just backend implementations for UI::Dialog, then that may make sense.

B) Make a separate module under a different name space, ie: Gtk2::UI::*

it would be Gtk2::Ex, our "sanctioned" pureperl extension namespace (to avoid potential clashes with future additions from gtk+).

C) either A or B but omit the Constants and/or Utils

Gtk2::Ex::Constants and Gtk2::Ex::Utils would be handy; i could see lots of useful stuff fitting nicely into those.

D) Get suggestions and implement a best fit solution
All feedback on this topic is greatly appreciated.

give it a few days for more people to respond; there are other opinionated people on the list besides ross and me. ;-)

Walk softly, and carry a BFG-9000.
  -- unknown

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