Back to index

lightning-sunbird  0.9+nobinonly
XIDefines.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code, released
00016  * March 31, 1998.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Samir Gehani <sgehani@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #ifndef _XIDEFINES_H_
00041 #define _XIDEFINES_H_
00042 
00043 #include "XIErrors.h"
00044 #include <gtk/gtk.h>
00045 
00046 
00047 /*--------------------------------------------------------------------*
00048  *   Limits
00049  *--------------------------------------------------------------------*/
00050 #define MAX_COMPONENTS 64
00051 #define MAX_SETUP_TYPES 4
00052 #define MAX_URLS 32
00053 #define MAX_URL_LEN 1024
00054 #define MAX_DEPENDEE_KEY_LEN 16
00055 
00056 
00057 /*--------------------------------------------------------------------*
00058  *   Widget Dims
00059  *--------------------------------------------------------------------*/
00060 #define XI_WIN_HEIGHT 320
00061 #define XI_WIN_WIDTH  550
00062 
00063 
00064 /*--------------------------------------------------------------------*
00065  *   Parse Keys
00066  *--------------------------------------------------------------------*/
00067 #define GENERAL             "General"
00068 #define DEFAULT_LOCATION    "Default Location" 
00069 #define PROGRAM_NAME        "Program Name"
00070 
00071 #define DLG_WELCOME         "Dialog Welcome"
00072 #define SHOW_DLG            "Show Dialog"
00073 #define WATERMARK           "Watermark"
00074 #define TITLE               "Title"
00075 #define SUBTITLE            "Sub Title"
00076 
00077 #define MSGWELCOME          "MessageWelcome"
00078 #define PRODUCT_NAME        "Product Name"
00079 #define README              "Readme File"
00080 #define HEADER_IMAGE        "Header Image"
00081 
00082 #define DLG_LICENSE         "Dialog License"
00083 #define LICENSE             "License File"
00084 
00085 #define DLG_SETUP_TYPE      "Dialog Setup Type"
00086 #define MSG0                "Message0"
00087 #define MSG1                "Message1"
00088 #define MSG2                "Message2"
00089 #define SETUP_TYPE          "Setup Type"
00090 #define SETUP_TYPEd         "Setup Type%d"
00091 #define DESC_SHORT          "Description Short"
00092 #define DESC_LONG           "Description Long"
00093 #define MSGEXISTING         "MessageExistingInstall"
00094 
00095 #define DLG_COMPONENTS      "Dialog Select Components"
00096 #define COMPONENT           "Component"
00097 #define COMPONENTd          "Component%d"
00098 #define Cd                  "C%d"
00099 #define ARCHIVE             "Archive"
00100 #define URLd                "URL%d"
00101 #define INSTALL_SIZE        "Install Size"
00102 #define ARCHIVE_SIZE        "Install Size Archive"
00103 #define DEPENDENCYd         "Dependency%d"
00104 #define DEPENDEEd           "Dependee%d"
00105 #define ATTRIBUTES          "Attributes"
00106 #define SELECTED_ATTR       "SELECTED"
00107 #define INVISIBLE_ATTR      "INVISIBLE"
00108 #define LAUNCHAPP_ATTR      "LAUNCHAPP"
00109 #define DOWNLOAD_ONLY_ATTR  "DOWNLOAD_ONLY"
00110 #define MAIN_COMPONENT_ATTR "MAIN_COMPONENT"
00111 
00112 #define RUNAPPd             "RunApp%d"
00113 #define TARGET              "Target"
00114 #define ARGS                "Arguments"
00115 
00116 #define DLG_START_INSTALL   "Dialog Start Install"
00117 #define XPINSTALL_ENGINE    "XPInstall Engine"
00118 
00119 
00120 /*--------------------------------------------------------------------*
00121  *   Macros
00122  *--------------------------------------------------------------------*/
00123 #define TMP_EXTRACT_SUBDIR "bin"
00124 #define XPI_DIR "./xpi"
00125 
00126 #define XPISTUB "libxpistub.so"
00127 #define FN_INIT     "XPI_Init"
00128 #define FN_INSTALL  "XPI_Install"
00129 #define FN_EXIT     "XPI_Exit"
00130 
00131 #define XI_IF_DELETE(_object)                           \
00132 do {                                                    \
00133     if (_object)                                        \
00134         delete _object;                                 \
00135     _object = NULL;                                     \
00136 } while(0);
00137 
00138 #define XI_IF_FREE(_ptr)                                \
00139 do {                                                    \
00140     if (_ptr)                                           \
00141         free(_ptr);                                     \
00142     _ptr = NULL;                                        \
00143 } while(0);
00144 
00145 #define XI_GTK_IF_FREE(_gtkWidgetPtr)                   \
00146 do {                                                    \
00147     if (_gtkWidgetPtr && GTK_IS_WIDGET(_gtkWidgetPtr))  \
00148         gtk_widget_destroy(_gtkWidgetPtr);              \
00149     _gtkWidgetPtr = NULL;                               \
00150 } while(0);
00151 
00152 #define XI_ERR_BAIL(_function)                          \
00153 do {                                                    \
00154     err = _function;                                    \
00155     if (err != OK)                                      \
00156     {                                                   \
00157         ErrorHandler(err);                              \
00158         goto BAIL;                                      \
00159     }                                                   \
00160 } while (0); 
00161 
00162 #define XI_VERIFY(_ptr)                                 \
00163 do {                                                    \
00164     if (!_ptr)                                          \
00165         return ErrorHandler(E_INVALID_PTR);             \
00166 } while (0);
00167      
00168 #if defined(DEBUG_sgehani) || defined(DEBUG_druidd) || defined(DEBUG_root)
00169 #define XI_ASSERT(_expr, _msg)                                              \
00170 do {                                                                        \
00171     if (!(_expr))                                                           \
00172         printf("%s %d: ASSERTION FAILED! %s \n", __FILE__, __LINE__, _msg); \
00173 } while(0);
00174 #else
00175 #define XI_ASSERT(_expr, _msg)
00176 #endif
00177 
00178 #define XI_GTK_UPDATE_UI()                              \
00179 do {                                                    \
00180     while (gtk_events_pending())                        \
00181         gtk_main_iteration();                           \
00182 } while (0);
00183 
00184 
00185 #ifndef TRUE
00186 #define TRUE 1
00187 #endif
00188 
00189 #ifndef FALSE
00190 #define FALSE 0
00191 #endif
00192 
00193 #ifndef NULL
00194 #define NULL 0
00195 #endif
00196 
00197 #endif /* _XIDEFINES_H_ */