Skip to content

Commit

Permalink
-Added carbon based uninstaller
Browse files Browse the repository at this point in the history
-Fixed corrupt install path
-Other minor fixes
  • Loading branch information
Zeph committed Apr 19, 2003
1 parent 99b3956 commit 033f1a5
Show file tree
Hide file tree
Showing 11 changed files with 909 additions and 579 deletions.
11 changes: 11 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ COMMON_OBJS = log.o install_log.o
CORE_OBJS = detect.o plugins.o network.o install.o copy.o file.o loki_launchurl.o
OBJS = $(COMMON_OBJS) $(CORE_OBJS) main.o
LOKI_UNINSTALL_OBJS = loki_uninstall.o uninstall_ui.o
CARBON_UNINSTALL_OBJS = carbon_uninstall.o uninstall_carbonui.o
UNINSTALL_OBJS = uninstall.o
CHECK_OBJS = $(COMMON_OBJS) $(CORE_OBJS) check.o
CONSOLE_OBJS = $(OBJS) console_ui.o @CONSOLE_OBJS@
Expand Down Expand Up @@ -67,6 +68,16 @@ loki_uninstall.o: uninstall.c
loki_uninstall: $(LOKI_UNINSTALL_OBJS) $(SETUPDB)/$(arch)/libsetupdb.a
$(CC) $(LDFLAGS) -o $@ $(LOKI_UNINSTALL_OBJS) $(GUI_LIBS)

carbon_uninstall.o: uninstall.c
$(CC) $(LDFLAGS) -c -o $@ $^ $(CFLAGS) -DUNINSTALL_CARBONUI -DUNINSTALL_UI -DVERSION=\"$(UNINSTALL_VERSION)\"

carbon_uninstall: $(CARBON_UNINSTALL_OBJS) $(SETUPDB)/$(arch)/libsetupdb.a
$(CC) $(LDFLAGS) -o $@ $(CARBON_UNINSTALL_OBJS) $(CARBON_LIBS)
rm -f -R ./uninstall.APP
cp -R ./setup.APP ./uninstall.APP
cp ./carbon/Info.plist.uninstall ./uninstall.APP/Contents/Info.plist
rm -f ./uninstall.APP/Contents/MacOS/setup.carbon
cp ./carbon_uninstall ./uninstall.APP/Contents/MacOS
uninstall: $(UNINSTALL_OBJS) $(COMMON_LIBS)
$(CC) $(LDFLAGS) -o $@ $(UNINSTALL_OBJS) $(CONSOLE_LIBS) @STATIC@

Expand Down
22 changes: 22 additions & 0 deletions carbon/Info.plist.uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>carbon_uninstall</string>
<key>CFBundleName</key>
<string>Loki Uninstaller</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.1</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>
241 changes: 137 additions & 104 deletions carbon/carbonres.c

Large diffs are not rendered by default.

76 changes: 55 additions & 21 deletions carbon/carbonres.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
#include <CoreServices/CoreServices.h>

// Constants used to identify Carbon resources
#define OPTION_GROUP_ID 128
#define CLASS_GROUP_ID 129
#define COPY_GROUP_ID 130
#define DONE_GROUP_ID 131
#define ABORT_GROUP_ID 132
#define WARNING_GROUP_ID 133
#define WEBSITE_GROUP_ID 134
#define OPTION_GROUP_ID 128
#define CLASS_GROUP_ID 129
#define COPY_GROUP_ID 130
#define DONE_GROUP_ID 131
#define ABORT_GROUP_ID 132
#define WARNING_GROUP_ID 133
#define WEBSITE_GROUP_ID 134
#define UNINSTALL_GROUP_ID 135
#define UNINSTALL_STATUS_GROUP_ID 136

// OPTION_GROUP_ID controls
#define OPTION_INSTALL_PATH_LABEL_ID 200
Expand Down Expand Up @@ -76,6 +78,19 @@
#define WEBSITE_README_BUTTON_ID 806
#define WEBSITE_CONTINUE_BUTTON_ID 807

// UNINSTALL_GROUP_ID controls
#define UNINSTALL_OPTIONS_GROUP_ID 901
#define UNINSTALL_EXIT_BUTTON_ID 904
#define UNINSTALL_UNINSTALL_BUTTON_ID 905
#define UNINSTALL_SPACE_VALUE_LABEL_ID 903
#define UNINSTALL_SPACE_LABEL_ID 902

// UNINSTALL_STATUS_GROUP_ID controls
#define UNINSTALL_STATUS_OPTION_LABEL_ID 1000
#define UNINSTALL_STATUS_PROGRESS_ID 1001
#define UNINSTALL_STATUS_CANCEL_BUTTON_ID 1002
#define UNINSTALL_STATUS_FINISHED_BUTTON_ID 1003

#define LOKI_SETUP_SIG 'loki'

// Possible command events that are raised
Expand All @@ -91,6 +106,8 @@
#define COMMAND_RECOMMENDED 'recc'
#define COMMAND_EXPERT 'expr'
#define COMMAND_WEBSITE 'webb'
#define COMMAND_FINISHED 'fini'
#define COMMAND_UNINSTALL 'unin'

#define COMMAND_PROMPT_YES 'yes '
#define COMMAND_PROMPT_NO 'no '
Expand Down Expand Up @@ -124,10 +141,19 @@ typedef enum
DONE_PAGE = 3,
ABORT_PAGE = 4,
WARNING_PAGE = 5,
WEBSITE_PAGE = 6
WEBSITE_PAGE = 6,
UNINSTALL_PAGE = 7,
UNINSTALL_STATUS_PAGE = 8,
} InstallPage;
// Number of pages that exist
#define PAGE_COUNT 7
#define PAGE_COUNT 9

typedef enum
{
PromptType_YesNo,
PromptType_OK,
PromptType_OKAbort,
}PromptType;

typedef struct
{
Expand All @@ -151,7 +177,7 @@ typedef struct
} CarbonRes;

// Function declarations
CarbonRes *carbon_LoadCarbonRes(int (*CommandEventCallback)(UInt32), const char *);
CarbonRes *carbon_LoadCarbonRes(int (*CommandEventCallback)(UInt32));
void carbon_UnloadCarbonRes(CarbonRes *);
int carbon_IterateForState(CarbonRes *, int *);
void carbon_ShowInstallScreen(CarbonRes *, InstallPage);
Expand All @@ -170,8 +196,12 @@ void carbon_GetEntryText(CarbonRes *, int, char *, int);
void carbon_SetProgress(CarbonRes *, int, float);
void carbon_SetCheckbox(CarbonRes *, int, int);
int carbon_GetCheckbox(CarbonRes *, int);
int carbon_Prompt(CarbonRes *, int, const char *);
int carbon_Prompt(CarbonRes *, PromptType, const char *);
int carbon_ReadmeOrLicense(CarbonRes *, int, const char *);
int carbon_LaunchURL(const char *);
void carbon_GetAppPath(char *, int);
int carbon_PromptForPath(char *, int);
void carbon_AddDesktopAlias(const char *);

// Options related functions and data types
typedef enum
Expand All @@ -184,10 +214,11 @@ typedef enum

#define MAX_OPTIONS 32
#define MAX_BUTTON_NAME 512
typedef struct
typedef struct OptionsButtonStruct
{
ControlRef Control;
ButtonType Type;
struct OptionsButtonStruct *NextButton;
void *Data;
// This should be cast to an OptionsBox when used. It had
// to be "void *" to avoid a circular reference. This is
Expand All @@ -207,10 +238,10 @@ typedef struct
}RadioGroup;

// Starting ID's for "dynamic" controls
#define START_LABEL_ID 1040
/*#define START_LABEL_ID 1040
#define START_CHECK_ID 1000
#define START_RADIO_ID 1020
#define START_SEP_ID 1060
#define START_SEP_ID 1060*/
typedef struct
{
CarbonRes *Res;
Expand All @@ -223,30 +254,33 @@ typedef struct
// Callback for application to handle command events (buttons)
int (*OptionClickCallback)(OptionsButton *Button);

// Control reference to box that controls are in
ControlRef BoxControlRef;
// Number of buttons that can fit in the box without resizing
int BoxStartCount;
// What display is the box on (used for resizing other controls
int GroupID;
// These variables are used to keep track of the current resource ID
// of controls (since we're not creating controls dynamically right now
// and need to keep track of the next available control in the resource
// file.
int CurLabelID;
/*int CurLabelID;
int CurRadioID;
int CurSepID;
int CurCheckID;
int CurCheckID;*/
}OptionsBox;

OptionsButton *carbon_OptionsNewLabel(OptionsBox *, const char *);
OptionsButton *carbon_OptionsNewCheckButton(OptionsBox *, const char *);
OptionsButton *carbon_OptionsNewSeparator(OptionsBox *);
OptionsButton *carbon_OptionsNewRadioButton(OptionsBox *, const char *, RadioGroup **);
OptionsBox *carbon_OptionsNewBox(CarbonRes *, int (*OptionClickCallback)(OptionsButton *Button));
OptionsBox *carbon_OptionsNewBox(CarbonRes *, int, int (*OptionClickCallback)(OptionsButton *Button));
void carbon_OptionsSetTooltip(OptionsButton *, const char *);
void carbon_OptionsSetValue(OptionsButton *, int);
int carbon_OptionsGetValue(OptionsButton *);
void carbon_OptionsShowBox(OptionsBox *);
void carbon_SetProperWindowSize(OptionsBox *, int);
void carbon_SetUninstallWindowSize(OptionsBox *);
OptionsButton *carbon_GetButtonByName(OptionsBox *, const char *);
int carbon_LaunchURL(const char *);
void carbon_GetAppPath(char *, int);
int carbon_PromptForPath(char *, int);
void carbon_AddDesktopAlias(const char *);

#endif
20 changes: 11 additions & 9 deletions carbon_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,12 @@ int OnOptionClickEvent(OptionsButton *ButtonWithEventClick)
{
if (!strcmp(child->name, "eula"))
{
carbon_debug("EULA not supported yet!\n");
//!!!TODO - Support EULA
const char* name = GetProductEULANode(cur_info, data_node);
if(name)
{
if(!carbon_ReadmeOrLicense(MyRes, false, name))
char buffer[MAX_README_SIZE];
load_file(name, buffer, MAX_README_SIZE);
if(!carbon_ReadmeOrLicense(MyRes, false, buffer))
{
carbon_OptionsSetValue(ButtonWithEventClick, false);
return true;
Expand Down Expand Up @@ -652,15 +652,15 @@ static yesno_answer carbonui_prompt(const char *txt, yesno_answer suggest)
if(suggest != RESPONSE_OK)
{
// YES/NO dialog
if(carbon_Prompt(MyRes, true, txt))
if(carbon_Prompt(MyRes, PromptType_YesNo, txt))
PromptResponse = RESPONSE_YES;
else
PromptResponse = RESPONSE_NO;
}
else
{
// OK dialog
if(carbon_Prompt(MyRes, false, txt))
if(carbon_Prompt(MyRes, PromptType_OK, txt))
PromptResponse = RESPONSE_OK;
else
{
Expand All @@ -679,7 +679,7 @@ static install_state carbonui_init(install_info *info, int argc, char **argv, in
carbon_debug("***carbonui_init()\n");

// Load the resources related to our carbon interface
MyRes = carbon_LoadCarbonRes(OnCommandEvent, GetProductDesc(info));
MyRes = carbon_LoadCarbonRes(OnCommandEvent);
// Couldn't allocate resources...exit setup.
if(MyRes == NULL)
{
Expand Down Expand Up @@ -804,7 +804,9 @@ static install_state carbonui_license(install_info *info)
{
carbon_debug("***carbonui_license()\n");
// If license is accepted
if(carbon_ReadmeOrLicense(MyRes, false, GetProductEULA(info)))
char buffer[MAX_README_SIZE];
load_file(GetProductEULA(info), buffer, MAX_README_SIZE);
if(carbon_ReadmeOrLicense(MyRes, false, buffer))
cur_state = SETUP_README;
else
cur_state = SETUP_EXIT;
Expand Down Expand Up @@ -861,7 +863,7 @@ static install_state carbonui_setup(install_info *info)
// Else, let the user select appropriate options
//options = glade_xml_get_widget(setup_glade, "option_vbox");
//gtk_container_foreach(GTK_CONTAINER(options), empty_container, options);
options = carbon_OptionsNewBox(MyRes, OnOptionClickEvent);
options = carbon_OptionsNewBox(MyRes, true, OnOptionClickEvent);
info->install_size = 0;
node = info->config->root->childs;
radio_list = NULL;
Expand Down Expand Up @@ -939,7 +941,7 @@ static int carbonui_update(install_info *info, const char *path, size_t progress
char LastText[1024] = "";
char LastCurrent[1024] = "";

carbon_debug("***carbonui_update()\n");
//carbon_debug("***carbonui_update()\n");

// Abort immediately if current state is SETUP_ABORT
if(cur_state == SETUP_ABORT)
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ case "$target" in
REENTRANT=""
CFLAGS="$CFLAGS -I/sw/include -Ddarwin"
LDFLAGS="$LDFLAGS -framework Carbon"
COMMON_LIBS="carbon/carbonres.o carbon/carbondebug.o carbon/STUPControl.c"
COMMON_LIBS="carbon/carbonres.o carbon/carbondebug.o carbon/STUPControl.o"
ARCH=ppc ;;
*ppc* | *powerpc*)
ARCH=ppc ;;
Expand Down
3 changes: 1 addition & 2 deletions setup.APP/Contents/Resources/carbon_ui.nib/info.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 033f1a5

Please sign in to comment.