lecture about error handling



Hi,

WRONG:
 
                gnome_help_display_desktop (NULL,
                         "control-center-manual",
                        "config-mouse.xml",
                        "CONFIGURATION", &error);
                if (error) {
                        g_warning ("help error: %s\n",
                        error->message);
                        g_error_free (error);
                }

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);
        }

Havoc



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