Re: HIG-compliant GtkMessageDialog



On Wed, 2004-01-07 at 03:07, Michael Terry wrote:
> Hello.  I believe that it is currently too difficult to create an
> HIG-compliant alert
> (http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-windows).
> 
> One way to do it is create a GtkDialog and manually HIG-ify it according
> to the instructions in the HIG.  This is fine, but not very convenient. 
> I feel that it should be as convenient as possible to create an alert,
> since uniformity in alert implementations is one main point of the HIG.
> 
> Another way to make an alert is to create a GtkMessageDialog and pass it
> appropriate Pango markup per HIG.  However, the GtkMessageDialog widget
> fails in several areas:
> 1) Window title is non-empty
> 2) Separator bar is present
> 3) Spacing is wrong
> 4) Specifying required markup is a pain (especially when using gettext)
> 5) Window must be modal only to the parent window
> 
> 1, 2, 3, and 5 can all be fixed inside GtkMessageDialog code without
> breaking the API.  4 is somewhat easy to get around.  5 is awkward to
> do, needing to monkey with gtk_window_groups (could also be done without
> changing the API).
> 
> There are two things wrong with the current GtkMessageDialog API when
> making alerts:
> A) The GtkDialogFlags parameter shouldn't exist -- all alerts would have
> the same flags
> B) Markup is a pain.  All alerts have a required markup structure like
> the following:  '<span font="larger" weight="bold">primary
> text\n</span>\nsecondary text'.  When using gettext, you need to make
> sure that no markup gets in your translators' way.
> 
> So, would you be willing to make the changes needed behind the scenes to
> GtkMessageDialog and then just live with the admittedly trivial markup
> problem and the unnecessary parameter problem?  Or, would you prefer a
> whole new widget?  Maybe GtkAlertDialog with the following API:
> 
> GtkWidget *gtk_alert_dialog_new (GtkWindow *parent, GtkMessageType type,
> GtkButtonsType buttons, const gchar *primary_text, const gchar
> *secondary_text);
> 
> I am willing to make either code change and submit a patch to the
> appropriate place (gtk for the non-API one, libegg for the new-widget
> one).  But, I request official GTK+ sanction and discussion on this
> issue.

All of these ideas sounds good to me FWIW

BTW I've got something similar inside Conglomerate with this API, though
this is intended purely for errors (it does all of the required markup
and spacing internally):
/**
 * Routine to manufacture a GNOME HIG-compliant error dialog.
 */
GtkDialog* 
cong_error_dialog_new(GtkWindow *parent_window,
		      const gchar* what_failed, 
		      const gchar* why_failed, 
		      const gchar* suggestions);

/**
 * Routine to manufacture a GNOME HIG-compliant error dialog with a
"convenience button" that does something relevant.
 */
GtkDialog* 
cong_error_dialog_new_with_convenience(GtkWindow *parent_window,
				       const gchar* what_failed, 
				       const gchar* why_failed, 
				       const gchar* suggestions,
				       const gchar* convenience_label,
				       void (*convenience_action)(gpointer data),
				       gpointer convenience_data);


-- 
David Malcolm
www.conglomerate.org




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