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 of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or 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 #define MAX_LEGACY_CHECKS 32
00056 
00057 
00058 /*--------------------------------------------------------------------*
00059  *   Widget Dims
00060  *--------------------------------------------------------------------*/
00061 #define XI_WIN_HEIGHT 320
00062 #define XI_WIN_WIDTH  550
00063 #define README_FONT "-misc-fixed-medium-r-normal--8-100-75-75-c-50-iso8859-1"
00064 #define LICENSE_FONT "-misc-fixed-medium-r-normal--8-100-75-75-c-50-iso8859-1"
00065 
00066 
00067 /*--------------------------------------------------------------------*
00068  *   Parse Keys
00069  *--------------------------------------------------------------------*/
00070 #define GENERAL             "General"
00071 #define DEFAULT_LOCATION    "Default Location" 
00072 #define DEFAULT_SETUP_TYPE  "Default Setup Type"
00073 
00074 #define CLEAN_UPGRADE       "Cleanup On Upgrade"
00075 #define OBJECT_IGNOREd      "ObjectToIgnore%d"
00076 
00077 #define DLG_WELCOME         "Dialog Welcome"
00078 #define SHOW_DLG            "Show Dialog"
00079 #define TITLE               "Title"
00080 #define README              "Readme File"
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_TYPEd         "Setup Type%d"
00090 #define DESC_SHORT          "Description Short"
00091 #define DESC_LONG           "Description Long"
00092 
00093 #define LEGACY_CHECKd       "LegacyCheck%d"
00094 #define FILENAME            "Filename"
00095 #define MSG                 "Message"
00096 
00097 #define DLG_COMPONENTS      "Dialog Select Components"
00098 #define COMPONENT           "Component"
00099 #define COMPONENTd          "Component%d"
00100 #define Cd                  "C%d"
00101 #define ARCHIVE             "Archive"
00102 #define URLd                "URL%d"
00103 #define INSTALL_SIZE        "Install Size"
00104 #define ARCHIVE_SIZE        "Archive Size"
00105 #define DEPENDENCYd         "Dependency%d"
00106 #define DEPENDEEd           "Dependee%d"
00107 #define ATTRIBUTES          "Attributes"
00108 #define SELECTED_ATTR       "SELECTED"
00109 #define INVISIBLE_ATTR      "INVISIBLE"
00110 #define LAUNCHAPP_ATTR      "LAUNCHAPP"
00111 #define DOWNLOAD_ONLY_ATTR  "DOWNLOAD_ONLY"
00112 
00113 #define RUNAPPd             "RunApp%d"
00114 #define POSTINSTALLRUNd     "PostInstallRun%d"
00115 #define TARGET              "Target"
00116 #define ARGS                "Arguments"
00117 
00118 #define DLG_START_INSTALL   "Dialog Start Install"
00119 #define XPINSTALL_ENGINE    "XPInstall Engine"
00120 
00121 
00122 /*--------------------------------------------------------------------*
00123  *   Macros
00124  *--------------------------------------------------------------------*/
00125 #define TMP_EXTRACT_SUBDIR "bin"
00126 #define XPI_DIR "./xpi"
00127 
00128 #define XPISTUB "libxpistub.so"
00129 #define FN_INIT     "XPI_Init"
00130 #define FN_INSTALL  "XPI_Install"
00131 #define FN_EXIT     "XPI_Exit"
00132 
00133 #define XI_IF_DELETE(_object)                           \
00134 do {                                                    \
00135     if (_object)                                        \
00136         delete _object;                                 \
00137     _object = NULL;                                     \
00138 } while(0);
00139 
00140 #define XI_IF_FREE(_ptr)                                \
00141 do {                                                    \
00142     if (_ptr)                                           \
00143         free(_ptr);                                     \
00144     _ptr = NULL;                                        \
00145 } while(0);
00146 
00147 #define XI_GTK_IF_FREE(_gtkWidgetPtr)                   \
00148 do {                                                    \
00149     if (_gtkWidgetPtr && GTK_IS_WIDGET(_gtkWidgetPtr))  \
00150         gtk_widget_destroy(_gtkWidgetPtr);              \
00151     _gtkWidgetPtr = NULL;                               \
00152 } while(0);
00153 
00154 #define XI_ERR_BAIL(_function)                          \
00155 do {                                                    \
00156     err = _function;                                    \
00157     if (err != OK)                                      \
00158     {                                                   \
00159         ErrorHandler(err);                              \
00160         goto BAIL;                                      \
00161     }                                                   \
00162 } while (0); 
00163 
00164 #define XI_VERIFY(_ptr)                                 \
00165 do {                                                    \
00166     if (!_ptr)                                          \
00167         return ErrorHandler(E_INVALID_PTR);             \
00168 } while (0);
00169      
00170 #if defined(DEBUG_sgehani) || defined(DEBUG_druidd) || defined(DEBUG_root)
00171 #define XI_ASSERT(_expr, _msg)                                              \
00172 do {                                                                        \
00173     if (!(_expr))                                                           \
00174         printf("%s %d: ASSERTION FAILED! %s \n", __FILE__, __LINE__, _msg); \
00175 } while(0);
00176 #else
00177 #define XI_ASSERT(_expr, _msg)
00178 #endif
00179 
00180 #define XI_GTK_UPDATE_UI()                              \
00181 do {                                                    \
00182     while (gtk_events_pending())                        \
00183         gtk_main_iteration();                           \
00184 } while (0);
00185 
00186 
00187 #ifndef TRUE
00188 #define TRUE 1
00189 #endif
00190 
00191 #ifndef FALSE
00192 #define FALSE 0
00193 #endif
00194 
00195 #ifndef NULL
00196 #define NULL 0
00197 #endif
00198 
00199 #endif /* _XIDEFINES_H_ */