Re: GtkDialog comments.



jrb redhat com writes:  
>  * I don't really like adding the flags to gtk_dialog_new_with_buttons.
>    I think that dialogs should be easy to create without having to look
>    up what the flags are every time.  I would like to have that function
>    look more like:
> 
> GtkWidget* gtk_dialog_new_with_buttons (const gchar     *title,
>                                         GtkWindow       *parent,
>                                         const gchar     *first_button_text,
>                                         ...);
> 
>    and add a:
> 
> void gtk_dialog_set_flags (GtkDialog      *dialog,
>                            GtkDialogFlags  flags);
> 
>    function.  With good defaults, you don't have to worry about this
>    unless you want to make it non-modal.

gtk_dialog_set_flags() has little point, it's not significantly more
convenient than:

 gtk_window_set_modal (dialog, TRUE);
 gtk_window_set_destroy_with_parent (dialog, TRUE);

especially if you only want to change one setting.

The flags are only useful in _new(), so you can avoid typing those two
calls.  To save everyone digging in source, the current flags are:

 typedef enum
 {
    GTK_DIALOG_MODAL,              /* call gtk_window_set_modal (win, TRUE) */
    GTK_DIALOG_DESTROY_WITH_PARENT /* call gtk_window_set_destroy_with_parent () */
 } GtkDialogFlags;

To me there's a reasonably compelling argument for simply nuking the
flags concept and not even providing a set_flags function, since the
"flags" thing introduces a new concept to learn.

I don't think we should change the defaults on
modal/destroy_with_parent, the main reason being that the defaults are
the same as GtkWindow. But also it's not clear to me that the defaults
are wrong now. Most modal dialogs will use gtk_dialog_run() which
makes the dialog modal during the run anyhow, and destroy_with_parent
could be surprising if you hadn't set it explicitly.

>  The other is to set the behavior in
>    the entry -- something like:
> 
> typedef enum {
>         GTK_ENTRY_ACTION_ACTIVATE,
>         GTK_ENTRY_ACTION_IGNORE,
>         GTK_ENTRY_ACTION_MOVE_FOCUS
> } GtkEntryAction;
> 
> gtk_entry_set_activate_action (GtkEntry       *entry,
>                                GtkEntryAction  action);
> 

We were suggesting this approach because it maps well to glade,
i.e. when editing the GtkEntry properties you could just choose an
option.

Another way is to make it a GtkWindow property, i.e. 
gtk_window_set_activate_widget() or something.

Havoc




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