<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >Functions and structures</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Gaby's documentation" HREF="index.html"><LINK REL="UP" TITLE="Gaby Developers' Guide" HREF="p489.html"><LINK REL="PREVIOUS" TITLE="What to know before writing Gaby plugins" HREF="x502.html"><LINK REL="NEXT" TITLE="Structures" HREF="x570.html"></HEAD ><BODY CLASS="CHAPTER" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Gaby's documentation</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x502.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x570.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="CHAPTER" ><H1 ><A NAME="FUNCTIONS" ></A >Chapter 8. Functions and structures</H1 ><P >Unlike the reference chapter this one is manually written and can be outdated but I'll do my best to avoid this. I'll also try to provide examples and purpose informations for most entries.</P ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN520" >8.1. Messages and errors</A ></H1 ><P >Gaby provides a simple way to ensure that every message (being an informal message, an emergency error or a critical error) get a correct and coherent handling.</P ><P >This is done using two global variable : <P ></P ><UL ><LI ><P >gaby_errno (int) holds a number that gives the type of message. They are defined in <TT CLASS="FILENAME" >gabyerror.h</TT >.</P ><P >Today it looks like : <PRE CLASS="PROGRAMLISTING" >#define NO_ERROR 0 #define CUSTOM_MESSAGE 1 #define CUSTOM_WARNING 2 #define CUSTOM_ERROR 3 #define ONLY_IN_GNOME 4 #define FILE_READ_ERROR 5 #define FILE_WRITE_ERROR 6 #define TEMPFILE_ERROR 7 #define LOAD_PLUGIN_ERROR 8 #define UNKNOWN_ERROR 999</PRE ></P ></LI ><LI ><P >gaby_message (char*) holds a string that has a different behaviour regarding the value of gaby_errno</P ></LI ></UL ></P ><P ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >FIXME</I ></SPAN >: this table is broken.</P ><P ><DIV CLASS="TABLE" ><A NAME="AEN535" ></A ><P ><B >Table 8-1. </B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL WIDTH="7" ALIGN="LEFT"><COL><COL><TBODY ><TR ><TD >NO_ERROR</TD ><TD >NULL</TD ><TD >Nothing</TD ></TR ><TR ><TD >CUSTOM_MESSAGE</TD ><TD >string to show</TD ><TD >A string in an "Information Box"</TD ></TR ><TR ><TD >CUSTOM_WARNING</TD ><TD >string to show</TD ><TD >A string in a "Warning Box"</TD ></TR ><TR ><TD >CUSTOM_ERROR</TD ><TD >string to show</TD ><TD >A string in an "Error Box"</TD ></TR ><TR ><TD >ONLY_IN_GNOME</TD ><TD >NULL</TD ><TD >A message to warn about a feature only available if it was compiled with Gnome support</TD ></TR ><TR ><TD >FILE_READ_ERROR</TD ><TD >name of the file</TD ><TD >A message telling that an error occured when reading a file</TD ></TR ><TR ><TD >FILE_WRITE_ERROR</TD ><TD >name of the file</TD ><TD >A message telling that an error occured when writing a file</TD ></TR ></TBODY ></TABLE ></DIV ></P ><P >The message is then issued when you call <CODE CLASS="FUNCTION" >gaby_perror_in_a_box()</CODE >.</P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x502.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x570.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >What to know before writing Gaby plugins</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="p489.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Structures</TD ></TR ></TABLE ></DIV ></BODY ></HTML >