Re: lecture about error handling



Havoc Pennington wrote:

> RIGHT:
>
>       err = NULL;
>       gnome_help_display ("gnome-terminal", "gnome-terminal-prefs",
>                           &err);
>
>       if (err)
>         {
>           GtkWidget *dialog;
>
>           dialog = gtk_message_dialog_new (GTK_WINDOW (editor),
>                                            GTK_DIALOG_DESTROY_WITH_PARENT,
>                                            GTK_MESSAGE_ERROR,
>                                            GTK_BUTTONS_CLOSE,
>                                            _("There was an error
>                                            displaying help: %s"),
>                                            err->message);
>
>           g_signal_connect (G_OBJECT (dialog), "response",
>                             G_CALLBACK (gtk_widget_destroy),
>                             NULL);
>
>           gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
>
>           gtk_widget_show (dialog);
>
>           g_error_free (err);
>         }
>

That's great Havoc. The earlier error handling (shown in the  commandline)
may not be shown at all for applets etc.

One more thing  we may not have a gtk window always for
the dialog box , so we can have  something like

dialog = gtk_message_dialog_new (NULL,

GTK_DIALOG_MODAL,
                                                                 ........ );

regds
satya




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